@voltro/plugin-audit 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `@voltro/*` packages are recorded here. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## Stability contract — read this before you pin a version
7
+
8
+ Voltro is **`0.x` — pre-1.0, and deliberately so.** Under SemVer, `0.y.z` means
9
+ "anything MAY change." We hold to exactly that, stated out loud:
10
+
11
+ - **Pin exact versions.** Depend on `@voltro/runtime@0.4.2`, never `^0.4.2` or
12
+ `~0.4.2`. There is no compatible-range promise below 1.0.
13
+ - **Every MINOR may break.** Breaking changes land on a minor bump (`0.4.x →
14
+ 0.5.0`); patches (`0.4.1 → 0.4.2`) are additive or fixes only. This is the
15
+ standard `0.x` reading of SemVer — the minor slot carries breaking under `0.x`.
16
+ - **Read this changelog before upgrading.** The `⚠ BREAKING` section of each
17
+ release lists every incompatible change with its migration. It is the only
18
+ migration path we provide — there is no deprecation cycle, no compat shim.
19
+ - **All packages release together (lockstep).** One coordinated version across
20
+ the whole framework; the git tag is the source of truth.
21
+
22
+ This is not a placeholder disclaimer — it is the contract. The framework is
23
+ refactored aggressively while it has no external stability obligations, and that
24
+ velocity is the point. A stable-core tier and per-package `1.0` graduation are
25
+ planned, but not yet; until then, treat the whole surface as movable and pin
26
+ exact.
27
+
28
+ The **public API** of each package is its `publishConfig.exports` entry points,
29
+ minus anything marked `@internal` (those are cross-package internals and are
30
+ stripped from the published `.d.ts`). Importing a deep path that isn't an
31
+ exported entry point is unsupported.
32
+
33
+ ---
34
+
35
+ ## [Unreleased]
36
+
37
+ _Changes staged for the next release accumulate here (rolled up from
38
+ `.changes/*.md` at tag time — see `.changes/README.md`)._
39
+
40
+ ---
41
+
42
+ ## [0.1.0]
43
+
44
+ Initial pre-release baseline. This is the starting point the changelog tracks
45
+ from; it is not an exhaustive history of prior development. The framework ships
46
+ as `@voltro/*` packages spanning the runtime, database/query layer, web client
47
+ and router, durable workflows, the CLI, and the plugin ecosystem
48
+ (auth, storage, mail, billing, observability, and more). Not published to a
49
+ public registry yet.
50
+
51
+ Subsequent releases record their deltas from here under dated headings, with
52
+ `⚠ BREAKING` first.
package/LICENSE ADDED
@@ -0,0 +1,57 @@
1
+ Voltro — Proprietary Software License
2
+
3
+ Copyright (c) 2026 Voltro UG. All rights reserved.
4
+
5
+ This software and all associated source code, documentation, and other
6
+ materials (the "Software") are the proprietary property of Voltro UG
7
+ ("Voltro"). This is NOT open-source software.
8
+
9
+ Your access to and use of the Software is governed exclusively by the Voltro
10
+ Terms of Service at:
11
+
12
+ https://voltro.cloud/legal/terms
13
+
14
+ By downloading, installing, or using the Software you agree to those Terms.
15
+ Subject to and conditioned on your continued compliance with them, Voltro
16
+ grants you a limited, non-exclusive, non-transferable, non-sublicensable,
17
+ revocable license to use the Software. All rights not expressly granted in the
18
+ Terms are reserved by Voltro. If you do not agree to the Terms, you have no
19
+ license and may not use the Software.
20
+
21
+ The Terms of Service — including the scope of permitted use, plan
22
+ entitlements, fees, and pricing — may change from time to time. The version in
23
+ force is the one published at the URL above. Commercial terms and pricing are
24
+ NOT part of this notice and are not fixed by, or granted in perpetuity by, the
25
+ version of the Software in which this file appears.
26
+
27
+ Permitted use — your own software. Voltro is a development framework. You may
28
+ use the Software to build, run, and commercially distribute your own
29
+ applications and services, and to charge your own customers for them, without
30
+ owing Voltro any share of that revenue or any further permission beyond the
31
+ Terms. Applications you build with the Software are yours.
32
+
33
+ Prohibited use — reselling Voltro. You may NOT redistribute, resell,
34
+ sublicense, publish, or otherwise provide the Software itself — in whole or in
35
+ part, in source or compiled form — to third parties as a library, framework,
36
+ SDK, template, starter, or development tool for them to build upon, whether
37
+ standalone or repackaged. Shipping the Software as a non-separable, bundled
38
+ dependency inside an application you deliver (for example, compiled into your
39
+ deployed app) is permitted; extracting or re-exposing it as a reusable
40
+ component for others is not.
41
+
42
+ Except as expressly permitted above or by the Terms, you may not copy, modify,
43
+ merge, publish, sublicense, sell, distribute, or create derivative works of the
44
+ Software, in whole or in part.
45
+
46
+ Third-party open-source components distributed alongside the Software are the
47
+ property of their respective owners and are licensed under their own terms; see
48
+ THIRD-PARTY-NOTICES.md where provided. Nothing in this notice limits your
49
+ rights, or extends Voltro's, in those components.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
54
+ VOLTRO BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM,
55
+ OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
56
+
57
+ For licensing inquiries, contact Voltro UG.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ <div align="center">
2
+
3
+ # @voltro/plugin-audit
4
+
5
+ **Audit plugin — ships the `audit()` schema mixin (createdAt/updatedAt/createdBy/updatedBy → Actor) plus an optional mutation interceptor that records every call to a configurable sink (console / memory / custom function).**
6
+
7
+ [📖 Documentation](https://docs.voltro.dev/docs/plugins/audit) · [Changelog](./CHANGELOG.md) · [voltro.dev](https://voltro.dev) · [Voltro Cloud](https://voltro.cloud)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ```sh
14
+ npm install @voltro/plugin-audit
15
+ ```
16
+
17
+ > ### [→ Read the documentation for @voltro/plugin-audit](https://docs.voltro.dev/docs/plugins/audit)
18
+
19
+ Installation, guides, the full API reference, and examples all live in the
20
+ **[Voltro documentation](https://docs.voltro.dev/docs/intro/getting-started)** — the single source of truth. This README is
21
+ deliberately short so there is nothing here to drift out of date.
22
+
23
+ ## License
24
+
25
+ Proprietary. © 2026 Voltro UG. Your use is governed by the
26
+ [Terms of Service](https://voltro.cloud/legal/terms). See the bundled `LICENSE`.
package/SECURITY.md ADDED
@@ -0,0 +1,56 @@
1
+ # Security Policy
2
+
3
+ We take the security of Voltro and the applications built on it seriously. This
4
+ document explains how to report a vulnerability and what to expect in return.
5
+
6
+ ## Reporting a vulnerability
7
+
8
+ **Please do not open public issues or discuss suspected vulnerabilities in
9
+ public channels.** Report them privately by email:
10
+
11
+ **security contact: [support@voltro.dev](mailto:support@voltro.dev)**
12
+ (subject line: `SECURITY`).
13
+
14
+ Include, where you can:
15
+
16
+ - the affected package(s) and version(s) (e.g. `@voltro/runtime@x.y.z`);
17
+ - a description of the issue and its impact;
18
+ - a minimal reproduction or proof of concept;
19
+ - any suggested remediation.
20
+
21
+ If you'd like to encrypt your report, ask in a first plain email and we'll
22
+ arrange a key.
23
+
24
+ ## What to expect
25
+
26
+ - **Acknowledgement** of your report within **3 business days**.
27
+ - An initial assessment (severity, affected surface) and a remediation plan as
28
+ soon as we've reproduced the issue.
29
+ - **Coordinated disclosure:** we'll agree a disclosure timeline with you and
30
+ credit you in the release notes if you wish. Please give us reasonable time to
31
+ ship a fix before any public disclosure.
32
+
33
+ We do not currently run a paid bug-bounty program, but we genuinely appreciate
34
+ responsible disclosure and will credit reporters.
35
+
36
+ ## Software Bill of Materials (SBOM)
37
+
38
+ A CycloneDX SBOM of the third-party runtime dependency graph is generated for the
39
+ published packages (`pnpm gen:sbom` → `sbom.cdx.json`). If your procurement or
40
+ security team needs it, request it at
41
+ [support@voltro.dev](mailto:support@voltro.dev).
42
+
43
+ ## Supported versions
44
+
45
+ Voltro is pre-1.0 and ships in lockstep: **only the latest published minor of
46
+ each `@voltro/*` package receives security fixes.** Please upgrade to the latest
47
+ release before reporting, and pin exact versions in production.
48
+
49
+ ## Scope
50
+
51
+ In scope: the published `@voltro/*` packages and the framework's own code.
52
+
53
+ Out of scope: vulnerabilities in third-party dependencies that are already
54
+ tracked upstream (we monitor these via a production-dependency audit gate in
55
+ CI), and issues that require a non-default, explicitly-unsafe configuration. If
56
+ you're unsure, report it anyway — we'd rather hear about it.
@@ -0,0 +1,347 @@
1
+ # Third-Party Notices — @voltro/plugin-audit
2
+
3
+ This package depends on the open-source software listed below. Each is the
4
+ property of its respective copyright holders and is used under the terms of
5
+ its license. This file is provided for attribution; it grants no rights in
6
+ @voltro/plugin-audit itself, which is proprietary (see LICENSE).
7
+
8
+ Generated from the resolved runtime dependency closure (6 packages).
9
+
10
+ ---
11
+
12
+ ## @effect/sql@0.51.1
13
+
14
+ License: MIT
15
+
16
+ ```
17
+ MIT License
18
+
19
+ Copyright (c) 2023-present The Contributors
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+ ```
39
+
40
+ ## jose@6.2.3
41
+
42
+ License: MIT
43
+
44
+ ```
45
+ The MIT License (MIT)
46
+
47
+ Copyright (c) 2018 Filip Skokan
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining a copy
50
+ of this software and associated documentation files (the "Software"), to deal
51
+ in the Software without restriction, including without limitation the rights
52
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
+ copies of the Software, and to permit persons to whom the Software is
54
+ furnished to do so, subject to the following conditions:
55
+
56
+ The above copyright notice and this permission notice shall be included in all
57
+ copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
+ SOFTWARE.
66
+ ```
67
+
68
+ ## layerr@3.0.0
69
+
70
+ License: MIT
71
+
72
+ ```
73
+ MIT License
74
+
75
+ Copyright (c) 2020 Perry Mitchell
76
+
77
+ Permission is hereby granted, free of charge, to any person obtaining a copy
78
+ of this software and associated documentation files (the "Software"), to deal
79
+ in the Software without restriction, including without limitation the rights
80
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
81
+ copies of the Software, and to permit persons to whom the Software is
82
+ furnished to do so, subject to the following conditions:
83
+
84
+ The above copyright notice and this permission notice shall be included in all
85
+ copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
89
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
90
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
91
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
92
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
93
+ SOFTWARE.
94
+ ```
95
+
96
+ ## typeid-js@1.2.0
97
+
98
+ License: Apache-2.0
99
+
100
+ ```
101
+ Apache License
102
+ Version 2.0, January 2004
103
+ http://www.apache.org/licenses/
104
+
105
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
106
+
107
+ 1. Definitions.
108
+
109
+ "License" shall mean the terms and conditions for use, reproduction,
110
+ and distribution as defined by Sections 1 through 9 of this document.
111
+
112
+ "Licensor" shall mean the copyright owner or entity authorized by
113
+ the copyright owner that is granting the License.
114
+
115
+ "Legal Entity" shall mean the union of the acting entity and all
116
+ other entities that control, are controlled by, or are under common
117
+ control with that entity. For the purposes of this definition,
118
+ "control" means (i) the power, direct or indirect, to cause the
119
+ direction or management of such entity, whether by contract or
120
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
121
+ outstanding shares, or (iii) beneficial ownership of such entity.
122
+
123
+ "You" (or "Your") shall mean an individual or Legal Entity
124
+ exercising permissions granted by this License.
125
+
126
+ "Source" form shall mean the preferred form for making modifications,
127
+ including but not limited to software source code, documentation
128
+ source, and configuration files.
129
+
130
+ "Object" form shall mean any form resulting from mechanical
131
+ transformation or translation of a Source form, including but
132
+ not limited to compiled object code, generated documentation,
133
+ and conversions to other media types.
134
+
135
+ "Work" shall mean the work of authorship, whether in Source or
136
+ Object form, made available under the License, as indicated by a
137
+ copyright notice that is included in or attached to the work
138
+ (an example is provided in the Appendix below).
139
+
140
+ "Derivative Works" shall mean any work, whether in Source or Object
141
+ form, that is based on (or derived from) the Work and for which the
142
+ editorial revisions, annotations, elaborations, or other modifications
143
+ represent, as a whole, an original work of authorship. For the purposes
144
+ of this License, Derivative Works shall not include works that remain
145
+ separable from, or merely link (or bind by name) to the interfaces of,
146
+ the Work and Derivative Works thereof.
147
+
148
+ "Contribution" shall mean any work of authorship, including
149
+ the original version of the Work and any modifications or additions
150
+ to that Work or Derivative Works thereof, that is intentionally
151
+ submitted to Licensor for inclusion in the Work by the copyright owner
152
+ or by an individual or Legal Entity authorized to submit on behalf of
153
+ the copyright owner. For the purposes of this definition, "submitted"
154
+ means any form of electronic, verbal, or written communication sent
155
+ to the Licensor or its representatives, including but not limited to
156
+ communication on electronic mailing lists, source code control systems,
157
+ and issue tracking systems that are managed by, or on behalf of, the
158
+ Licensor for the purpose of discussing and improving the Work, but
159
+ excluding communication that is conspicuously marked or otherwise
160
+ designated in writing by the copyright owner as "Not a Contribution."
161
+
162
+ "Contributor" shall mean Licensor and any individual or Legal Entity
163
+ on behalf of whom a Contribution has been received by Licensor and
164
+ subsequently incorporated within the Work.
165
+
166
+ 2. Grant of Copyright License. Subject to the terms and conditions of
167
+ this License, each Contributor hereby grants to You a perpetual,
168
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
169
+ copyright license to reproduce, prepare Derivative Works of,
170
+ publicly display, publicly perform, sublicense, and distribute the
171
+ Work and such Derivative Works in Source or Object form.
172
+
173
+ 3. Grant of Patent License. Subject to the terms and conditions of
174
+ this License, each Contributor hereby grants to You a perpetual,
175
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
176
+ (except as stated in this section) patent license to make, have made,
177
+ use, offer to sell, sell, import, and otherwise transfer the Work,
178
+ where such license applies only to those patent claims licensable
179
+ by such Contributor that are necessarily infringed by their
180
+ Contribution(s) alone or by combination of their Contribution(s)
181
+ with the Work to which such Contribution(s) was submitted. If You
182
+ institute patent litigation against any entity (including a
183
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
184
+ or a Contribution incorporated within the Work constitutes direct
185
+ or contributory patent infringement, then any patent licenses
186
+ granted to You under this License for that Work shall terminate
187
+ as of the date such litigation is filed.
188
+
189
+ 4. Redistribution. You may reproduce and distribute copies of the
190
+ Work or Derivative Works thereof in any medium, with or without
191
+ modifications, and in Source or Object form, provided that You
192
+ meet the following conditions:
193
+
194
+ (a) You must give any other recipients of the Work or
195
+ Derivative Works a copy of this License; and
196
+
197
+ (b) You must cause any modified files to carry prominent notices
198
+ stating that You changed the files; and
199
+
200
+ (c) You must retain, in the Source form of any Derivative Works
201
+ that You distribute, all copyright, patent, trademark, and
202
+ attribution notices from the Source form of the Work,
203
+ excluding those notices that do not pertain to any part of
204
+ the Derivative Works; and
205
+
206
+ (d) If the Work includes a "NOTICE" text file as part of its
207
+ distribution, then any Derivative Works that You distribute must
208
+ include a readable copy of the attribution notices contained
209
+ within such NOTICE file, excluding those notices that do not
210
+ pertain to any part of the Derivative Works, in at least one
211
+ of the following places: within a NOTICE text file distributed
212
+ as part of the Derivative Works; within the Source form or
213
+ documentation, if provided along with the Derivative Works; or,
214
+ within a display generated by the Derivative Works, if and
215
+ wherever such third-party notices normally appear. The contents
216
+ of the NOTICE file are for informational purposes only and
217
+ do not modify the License. You may add Your own attribution
218
+ notices within Derivative Works that You distribute, alongside
219
+ or as an addendum to the NOTICE text from the Work, provided
220
+ that such additional attribution notices cannot be construed
221
+ as modifying the License.
222
+
223
+ You may add Your own copyright statement to Your modifications and
224
+ may provide additional or different license terms and conditions
225
+ for use, reproduction, or distribution of Your modifications, or
226
+ for any such Derivative Works as a whole, provided Your use,
227
+ reproduction, and distribution of the Work otherwise complies with
228
+ the conditions stated in this License.
229
+
230
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
231
+ any Contribution intentionally submitted for inclusion in the Work
232
+ by You to the Licensor shall be under the terms and conditions of
233
+ this License, without any additional terms or conditions.
234
+ Notwithstanding the above, nothing herein shall supersede or modify
235
+ the terms of any separate license agreement you may have executed
236
+ with Licensor regarding such Contributions.
237
+
238
+ 6. Trademarks. This License does not grant permission to use the trade
239
+ names, trademarks, service marks, or product names of the Licensor,
240
+ except as required for reasonable and customary use in describing the
241
+ origin of the Work and reproducing the content of the NOTICE file.
242
+
243
+ 7. Disclaimer of Warranty. Unless required by applicable law or
244
+ agreed to in writing, Licensor provides the Work (and each
245
+ Contributor provides its Contributions) on an "AS IS" BASIS,
246
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
247
+ implied, including, without limitation, any warranties or conditions
248
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
249
+ PARTICULAR PURPOSE. You are solely responsible for determining the
250
+ appropriateness of using or redistributing the Work and assume any
251
+ risks associated with Your exercise of permissions under this License.
252
+
253
+ 8. Limitation of Liability. In no event and under no legal theory,
254
+ whether in tort (including negligence), contract, or otherwise,
255
+ unless required by applicable law (such as deliberate and grossly
256
+ negligent acts) or agreed to in writing, shall any Contributor be
257
+ liable to You for damages, including any direct, indirect, special,
258
+ incidental, or consequential damages of any character arising as a
259
+ result of this License or out of the use or inability to use the
260
+ Work (including but not limited to damages for loss of goodwill,
261
+ work stoppage, computer failure or malfunction, or any and all
262
+ other commercial damages or losses), even if such Contributor
263
+ has been advised of the possibility of such damages.
264
+
265
+ 9. Accepting Warranty or Additional Liability. While redistributing
266
+ the Work or Derivative Works thereof, You may choose to offer,
267
+ and charge a fee for, acceptance of support, warranty, indemnity,
268
+ or other liability obligations and/or rights consistent with this
269
+ License. However, in accepting such obligations, You may act only
270
+ on Your own behalf and on Your sole responsibility, not on behalf
271
+ of any other Contributor, and only if You agree to indemnify,
272
+ defend, and hold each Contributor harmless for any liability
273
+ incurred by, or claims asserted against, such Contributor by reason
274
+ of your accepting any such warranty or additional liability.
275
+
276
+ END OF TERMS AND CONDITIONS
277
+
278
+ APPENDIX: How to apply the Apache License to your work.
279
+
280
+ To apply the Apache License to your work, attach the following
281
+ boilerplate notice, with the fields enclosed by brackets "[]"
282
+ replaced with your own identifying information. (Don't include
283
+ the brackets!) The text should be enclosed in the appropriate
284
+ comment syntax for the file format. We also recommend that a
285
+ file or class name and description of purpose be included on the
286
+ same "printed page" as the copyright notice for easier
287
+ identification within third-party archives.
288
+
289
+ Copyright [yyyy] [name of copyright owner]
290
+
291
+ Licensed under the Apache License, Version 2.0 (the "License");
292
+ you may not use this file except in compliance with the License.
293
+ You may obtain a copy of the License at
294
+
295
+ http://www.apache.org/licenses/LICENSE-2.0
296
+
297
+ Unless required by applicable law or agreed to in writing, software
298
+ distributed under the License is distributed on an "AS IS" BASIS,
299
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
300
+ See the License for the specific language governing permissions and
301
+ limitations under the License.
302
+ ```
303
+
304
+ ## ulidx@2.4.1
305
+
306
+ License: MIT
307
+
308
+ ```
309
+ MIT License
310
+
311
+ Copyright (c) 2021 Perry Mitchell
312
+
313
+ Permission is hereby granted, free of charge, to any person obtaining a copy
314
+ of this software and associated documentation files (the "Software"), to deal
315
+ in the Software without restriction, including without limitation the rights
316
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
317
+ copies of the Software, and to permit persons to whom the Software is
318
+ furnished to do so, subject to the following conditions:
319
+
320
+ The above copyright notice and this permission notice shall be included in all
321
+ copies or substantial portions of the Software.
322
+
323
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
324
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
325
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
326
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
327
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
328
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
329
+ SOFTWARE.
330
+ ```
331
+
332
+ ## uuid@11.1.1
333
+
334
+ License: MIT
335
+
336
+ ```
337
+ The MIT License (MIT)
338
+
339
+ Copyright (c) 2010-2020 Robert Kieffer and other contributors
340
+
341
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
342
+
343
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
344
+
345
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
346
+ ```
347
+
@@ -0,0 +1,138 @@
1
+ import { ColumnDefinition } from '@voltro/database';
2
+ import { Effect } from 'effect';
3
+ import { MixinDefinition } from '@voltro/database';
4
+ import { Subject } from '@voltro/protocol';
5
+ import { TableIndex } from '@voltro/database';
6
+ import { TableLike } from '@voltro/database';
7
+ import { VoltroPlugin } from '@voltro/protocol';
8
+
9
+ export declare const audit: () => MixinDefinition<{
10
+ readonly createdAt: ColumnDefinition<Date, "timestamp">;
11
+ readonly updatedAt: ColumnDefinition<Date, "timestamp">;
12
+ readonly createdBy: ColumnDefinition<string | null, "reference">;
13
+ readonly updatedBy: ColumnDefinition<string | null, "reference">;
14
+ }>;
15
+
16
+ export declare const AUDIT_LOG_TABLE = "_voltro_audit_log";
17
+
18
+ /** Narrow slice of the framework DataStore the durable sink needs. */
19
+ export declare interface AuditDataStore {
20
+ insert: (table: string, row: Record<string, unknown>) => Promise<unknown>;
21
+ }
22
+
23
+ /**
24
+ * One audit event captured per mutation invocation. The payload is the
25
+ * mutation's resolved input — already validated by the procedure's
26
+ * input schema, so consumers don't need to re-validate. The result
27
+ * lands in `outcome.value` on success or `outcome.error` on failure.
28
+ */
29
+ export declare interface AuditEvent {
30
+ readonly ts: number;
31
+ readonly tag: string;
32
+ readonly subject: Subject;
33
+ readonly traceId: string;
34
+ readonly input: unknown;
35
+ readonly outcome: {
36
+ readonly kind: 'ok';
37
+ readonly value: unknown;
38
+ readonly durationMs: number;
39
+ } | {
40
+ readonly kind: 'error';
41
+ readonly error: unknown;
42
+ readonly durationMs: number;
43
+ };
44
+ }
45
+
46
+ /** Map an {@link AuditEvent} to an audit-log row. */
47
+ export declare const auditEventToRow: (event: AuditEvent) => Record<string, unknown>;
48
+
49
+ /**
50
+ * The slice of a built `Table` this package exposes — annotated explicitly so
51
+ * @voltro/database's private column-builder class doesn't leak across the
52
+ * package boundary (TS4094). Only name + columns + indexes are needed.
53
+ */
54
+ export declare interface AuditLogTable extends TableLike {
55
+ readonly fields: Record<string, ColumnDefinition<unknown>>;
56
+ readonly appliedIndexes: ReadonlyArray<TableIndex>;
57
+ }
58
+
59
+ /**
60
+ * The audit-log table: one append-only row per recorded mutation. `subject`,
61
+ * `input`, and `outcome` are portable `json()` columns (JSONB on pg, JSON on
62
+ * mysql/mariadb, NVARCHAR(MAX) on mssql, TEXT on sqlite) — never a pg-only
63
+ * type. Indexed by `tag` and `traceId` for the common audit queries.
64
+ */
65
+ export declare const auditLogTable: AuditLogTable;
66
+
67
+ /** The audit-log table, ready to spread into `extendSchema.tables`. */
68
+ export declare const auditLogTables: ReadonlyArray<AuditLogTable>;
69
+
70
+ /**
71
+ * Build the audit plugin. Returns the VoltroPlugin you pass into
72
+ * app.config.ts's `plugins: [...]` array. Safe to call multiple times
73
+ * (each call gets its own filter + sink), but pushing several
74
+ * instances of this plugin into one app produces duplicate audit
75
+ * events — use the `include`/`exclude` filters to scope distinct
76
+ * instances instead.
77
+ */
78
+ export declare const auditPlugin: (options?: AuditPluginOptions) => VoltroPlugin;
79
+
80
+ export declare interface AuditPluginOptions {
81
+ /**
82
+ * Where to record audit events:
83
+ * - 'console' (default) — pretty-prints to stdout for local dev.
84
+ * - 'memory' — keeps the last 1000 events in-process;
85
+ * read them with {@link readAuditBuffer}.
86
+ * Useful for tests that need to assert
87
+ * "this mutation emitted that audit event".
88
+ * - 'datastore' — DURABLE, queryable trail. Contributes the
89
+ * `_voltro_audit_log` table (via `extendSchema`,
90
+ * under `store:write`) and appends one row per
91
+ * mutation. Survives restarts, shared across
92
+ * replicas, queryable via
93
+ * `ctx.store.select('_voltro_audit_log')`.
94
+ * The production choice.
95
+ * - a function — custom sink. Receives every event and may
96
+ * return `void` / `Promise<void>` /
97
+ * `Effect<void>`. Persist events wherever you
98
+ * like — e.g. an `Effect<void>` sink that
99
+ * writes rows to your own audit table on top
100
+ * of `@effect/sql`.
101
+ */
102
+ readonly sink?: 'console' | 'memory' | 'datastore' | AuditSink;
103
+ /**
104
+ * If set, only mutations matching this RegExp are recorded. Useful
105
+ * for narrowing audit cost to write-heavy domain tags only. Default:
106
+ * record every mutation.
107
+ */
108
+ readonly include?: RegExp;
109
+ /**
110
+ * Mutations matching this RegExp are SKIPPED — overrides `include`.
111
+ * Typically `/^debug\./` or similar. Default: skip nothing.
112
+ */
113
+ readonly exclude?: RegExp;
114
+ }
115
+
116
+ export declare type AuditSink = (event: AuditEvent) => void | Promise<void> | Effect.Effect<void>;
117
+
118
+ /** Drop everything in the in-process buffer. Useful between smoke phases. */
119
+ export declare const clearAuditBuffer: () => void;
120
+
121
+ /**
122
+ * A DataStore-backed audit sink — appends each event to `_voltro_audit_log`.
123
+ * Returns a `(event) => Promise<void>` so it plugs straight into the plugin's
124
+ * function-sink path (which lifts it into an Effect + swallows failures, so a
125
+ * write hiccup never masks the mutation).
126
+ */
127
+ export declare const dataStoreAuditSink: (store: AuditDataStore) => (event: AuditEvent) => Promise<void>;
128
+
129
+ /**
130
+ * Read the in-process audit buffer. Returns a stable snapshot copy —
131
+ * mutating it has no effect on the running buffer. Empty array when
132
+ * the plugin isn't using the 'memory' sink.
133
+ */
134
+ export declare const readAuditBuffer: () => ReadonlyArray<AuditEvent>;
135
+
136
+ export { VoltroPlugin }
137
+
138
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,122 @@
1
+ import { audit as e } from "./mixin.js";
2
+ import { Effect as t } from "effect";
3
+ import { definePlugin as n } from "@voltro/protocol";
4
+ import { createLogger as r } from "@voltro/logger";
5
+ import { id as i, json as a, table as o, text as s, timestamp as c } from "@voltro/database";
6
+ //#region src/store.ts
7
+ var l = "_voltro_audit_log", u = o(l, {
8
+ id: i({ prefix: "audit" }),
9
+ tag: s(),
10
+ at: c(),
11
+ subjectId: s().nullable(),
12
+ tenantId: s().nullable(),
13
+ traceId: s(),
14
+ status: s(),
15
+ durationMs: s(),
16
+ subject: a(),
17
+ input: a(),
18
+ outcome: a()
19
+ }).index("byAuditTag", ["tag"]).index("byAuditTrace", ["traceId"]), d = [u], f = (e) => ({
20
+ tag: e.tag,
21
+ at: new Date(e.ts),
22
+ subjectId: e.subject.id ?? null,
23
+ tenantId: e.subject.tenantId ?? null,
24
+ traceId: e.traceId,
25
+ status: e.outcome.kind,
26
+ durationMs: String(e.outcome.durationMs),
27
+ subject: e.subject,
28
+ input: e.input,
29
+ outcome: e.outcome
30
+ }), p = (e) => async (t) => {
31
+ await e.insert(l, f(t));
32
+ }, m = r({ scope: "@voltro/plugin-audit" }), h = 1e3, g = [], _ = () => [...g], v = () => {
33
+ g.length = 0;
34
+ }, y = (e) => {
35
+ g.push(e), g.length > h && g.splice(0, g.length - h);
36
+ }, b = (e) => {
37
+ let t = e.subject.id ? `${e.subject.type}:${e.subject.id}` : e.subject.type, n = e.outcome.kind === "ok" ? "ok" : "error", r = {
38
+ subject: t,
39
+ tenant: e.subject.tenantId ?? null,
40
+ status: n,
41
+ durationMs: e.outcome.durationMs,
42
+ traceId: e.traceId
43
+ };
44
+ n === "error" ? m.warn(e.tag, r) : m.info(e.tag, r);
45
+ }, x = (e, n) => typeof e == "function" ? (n) => t.suspend(() => {
46
+ let r = e(n);
47
+ return r === void 0 ? t.void : t.isEffect(r) ? r : t.tryPromise({
48
+ try: () => Promise.resolve(r),
49
+ catch: (e) => e
50
+ });
51
+ }) : e === "datastore" ? (e) => t.suspend(() => {
52
+ let r = n();
53
+ return r ? t.tryPromise({
54
+ try: () => r(e),
55
+ catch: (e) => e
56
+ }) : t.void;
57
+ }) : e === "memory" ? (e) => t.sync(() => y(e)) : (e) => t.sync(() => b(e)), S = (e) => {
58
+ let t = [], n = [], r = (e) => {
59
+ if (e._tag !== "Empty") {
60
+ if (e._tag === "Fail") {
61
+ t.push(e.error);
62
+ return;
63
+ }
64
+ if (e._tag === "Die") {
65
+ n.push(e.defect);
66
+ return;
67
+ }
68
+ if (e._tag !== "Interrupt") {
69
+ if (e._tag === "Sequential") {
70
+ r(e.left), r(e.right);
71
+ return;
72
+ }
73
+ if (e._tag === "Parallel") {
74
+ r(e.left), r(e.right);
75
+ return;
76
+ }
77
+ }
78
+ }
79
+ };
80
+ return r(e), t[0] ?? n[0] ?? e;
81
+ }, C = (e = {}) => {
82
+ let r = e.sink === "datastore", i, a = x(e.sink, () => i), o = (t) => !(e.exclude?.test(t) || e.include && !e.include.test(t)), s = (e, n) => o(n.tag) ? t.suspend(() => {
83
+ let r = Date.now();
84
+ return e.pipe(t.tap((e) => a({
85
+ ts: r,
86
+ tag: n.tag,
87
+ subject: n.subject,
88
+ traceId: n.traceId,
89
+ input: n.input,
90
+ outcome: {
91
+ kind: "ok",
92
+ value: e,
93
+ durationMs: Date.now() - r
94
+ }
95
+ }).pipe(t.catchAllCause(() => t.void))), t.tapErrorCause((e) => a({
96
+ ts: r,
97
+ tag: n.tag,
98
+ subject: n.subject,
99
+ traceId: n.traceId,
100
+ input: n.input,
101
+ outcome: {
102
+ kind: "error",
103
+ error: S(e),
104
+ durationMs: Date.now() - r
105
+ }
106
+ }).pipe(t.catchAllCause(() => t.void))));
107
+ }) : e;
108
+ return n({
109
+ name: "@voltro/plugin-audit",
110
+ description: "Records every mutation invocation; ships an audit() schema mixin for row-level metadata.",
111
+ permissions: r ? ["rpc:intercept:mutation", "store:write"] : ["rpc:intercept:mutation"],
112
+ ...r ? {
113
+ extendSchema: { tables: d },
114
+ bindDataStore: (e) => {
115
+ i = p(e);
116
+ }
117
+ } : {},
118
+ interceptMutation: s
119
+ });
120
+ };
121
+ //#endregion
122
+ export { l as AUDIT_LOG_TABLE, e as audit, f as auditEventToRow, u as auditLogTable, d as auditLogTables, C as auditPlugin, v as clearAuditBuffer, p as dataStoreAuditSink, _ as readAuditBuffer };
@@ -0,0 +1,11 @@
1
+ import { ColumnDefinition } from '@voltro/database';
2
+ import { MixinDefinition } from '@voltro/database';
3
+
4
+ export declare const audit: () => MixinDefinition<{
5
+ readonly createdAt: ColumnDefinition<Date, "timestamp">;
6
+ readonly updatedAt: ColumnDefinition<Date, "timestamp">;
7
+ readonly createdBy: ColumnDefinition<string | null, "reference">;
8
+ readonly updatedBy: ColumnDefinition<string | null, "reference">;
9
+ }>;
10
+
11
+ export { }
package/dist/mixin.js ADDED
@@ -0,0 +1,17 @@
1
+ import { defineMixin as e, reference as t, requireActors as n, timestamp as r } from "@voltro/database";
2
+ //#region src/mixin.ts
3
+ var i = () => e({
4
+ id: "voltro/audit",
5
+ fields: {
6
+ createdAt: r().default("now"),
7
+ updatedAt: r().default("now").onUpdate("now"),
8
+ createdBy: t(n()).nullable(),
9
+ updatedBy: t(n()).nullable()
10
+ },
11
+ behaviors: {
12
+ beforeInsert: () => "audit.beforeInsert: stamp createdAt + createdBy from ctx.actor",
13
+ beforeUpdate: () => "audit.beforeUpdate: stamp updatedAt + updatedBy from ctx.actor"
14
+ }
15
+ });
16
+ //#endregion
17
+ export { i as audit };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@voltro/plugin-audit",
3
+ "version": "0.1.0",
4
+ "description": "Audit plugin — ships the `audit()` schema mixin (createdAt/updatedAt/createdBy/updatedBy → Actor) plus an optional mutation interceptor that records every call to a configurable sink (console / memory / custom function).",
5
+ "keywords": [
6
+ "voltro",
7
+ "typescript",
8
+ "framework"
9
+ ],
10
+ "license": "SEE LICENSE IN LICENSE",
11
+ "homepage": "https://voltro.dev",
12
+ "bugs": {
13
+ "email": "support@voltro.dev"
14
+ },
15
+ "author": {
16
+ "name": "Voltro UG",
17
+ "url": "https://voltro.dev"
18
+ },
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./mixin": {
27
+ "types": "./dist/mixin.d.ts",
28
+ "import": "./dist/mixin.js",
29
+ "default": "./dist/mixin.js"
30
+ }
31
+ },
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "sideEffects": false,
36
+ "engines": {
37
+ "node": ">=24.0.0"
38
+ },
39
+ "dependencies": {
40
+ "@voltro/database": "0.1.0",
41
+ "@voltro/logger": "0.1.0",
42
+ "@voltro/protocol": "0.1.0"
43
+ },
44
+ "peerDependencies": {
45
+ "effect": "^3.21.4"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
+ }