@opensip-cli/datastore 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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/baseline-repo.test.d.ts +2 -0
- package/dist/__tests__/baseline-repo.test.d.ts.map +1 -0
- package/dist/__tests__/baseline-repo.test.js +85 -0
- package/dist/__tests__/baseline-repo.test.js.map +1 -0
- package/dist/__tests__/data-store.test.d.ts +10 -0
- package/dist/__tests__/data-store.test.d.ts.map +1 -0
- package/dist/__tests__/data-store.test.js +68 -0
- package/dist/__tests__/data-store.test.js.map +1 -0
- package/dist/__tests__/factory.test.d.ts +2 -0
- package/dist/__tests__/factory.test.d.ts.map +1 -0
- package/dist/__tests__/factory.test.js +168 -0
- package/dist/__tests__/factory.test.js.map +1 -0
- package/dist/__tests__/migration-integrity.test.d.ts +2 -0
- package/dist/__tests__/migration-integrity.test.d.ts.map +1 -0
- package/dist/__tests__/migration-integrity.test.js +78 -0
- package/dist/__tests__/migration-integrity.test.js.map +1 -0
- package/dist/__tests__/tool-state-repo.test.d.ts +7 -0
- package/dist/__tests__/tool-state-repo.test.d.ts.map +1 -0
- package/dist/__tests__/tool-state-repo.test.js +54 -0
- package/dist/__tests__/tool-state-repo.test.js.map +1 -0
- package/dist/__tests__/version-guard.test.d.ts +2 -0
- package/dist/__tests__/version-guard.test.d.ts.map +1 -0
- package/dist/__tests__/version-guard.test.js +110 -0
- package/dist/__tests__/version-guard.test.js.map +1 -0
- package/dist/backends/memory.d.ts +3 -0
- package/dist/backends/memory.d.ts.map +1 -0
- package/dist/backends/memory.js +5 -0
- package/dist/backends/memory.js.map +1 -0
- package/dist/backends/shared.d.ts +3 -0
- package/dist/backends/shared.d.ts.map +1 -0
- package/dist/backends/shared.js +31 -0
- package/dist/backends/shared.js.map +1 -0
- package/dist/backends/sqlite.d.ts +5 -0
- package/dist/backends/sqlite.d.ts.map +1 -0
- package/dist/backends/sqlite.js +8 -0
- package/dist/backends/sqlite.js.map +1 -0
- package/dist/baseline-repo.d.ts +50 -0
- package/dist/baseline-repo.d.ts.map +1 -0
- package/dist/baseline-repo.js +159 -0
- package/dist/baseline-repo.js.map +1 -0
- package/dist/data-store.d.ts +78 -0
- package/dist/data-store.d.ts.map +1 -0
- package/dist/data-store.js +71 -0
- package/dist/data-store.js.map +1 -0
- package/dist/factory.d.ts +47 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +151 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/baseline.d.ts +178 -0
- package/dist/schema/baseline.d.ts.map +1 -0
- package/dist/schema/baseline.js +31 -0
- package/dist/schema/baseline.js.map +1 -0
- package/dist/schema/tool-state.d.ts +110 -0
- package/dist/schema/tool-state.d.ts.map +1 -0
- package/dist/schema/tool-state.js +20 -0
- package/dist/schema/tool-state.js.map +1 -0
- package/dist/schema-version.d.ts +23 -0
- package/dist/schema-version.d.ts.map +1 -0
- package/dist/schema-version.js +55 -0
- package/dist/schema-version.js.map +1 -0
- package/dist/tool-state-repo.d.ts +51 -0
- package/dist/tool-state-repo.d.ts.map +1 -0
- package/dist/tool-state-repo.js +110 -0
- package/dist/tool-state-repo.js.map +1 -0
- package/migrations/.gitkeep +0 -0
- package/migrations/0000_sticky_white_tiger.sql +39 -0
- package/migrations/0001_easy_harry_osborn.sql +18 -0
- package/migrations/0002_plain_amazoness.sql +5 -0
- package/migrations/0003_mysterious_khan.sql +6 -0
- package/migrations/0004_narrow_bloodscream.sql +3 -0
- package/migrations/0005_lying_luke_cage.sql +7 -0
- package/migrations/0006_mean_photon.sql +12 -0
- package/migrations/0007_parallel_chamber.sql +3 -0
- package/migrations/0008_flaky_victor_mancha.sql +7 -0
- package/migrations/0009_stable_tool_identity.sql +9 -0
- package/migrations/0010_add_timestamp_iso_and_payload_version.sql +11 -0
- package/migrations/0011_payload_version_safety_and_notes.sql +21 -0
- package/migrations/0012_overrated_talon.sql +21 -0
- package/migrations/0013_lovely_zarda.sql +1 -0
- package/migrations/meta/0000_snapshot.json +269 -0
- package/migrations/meta/0001_snapshot.json +369 -0
- package/migrations/meta/0002_snapshot.json +400 -0
- package/migrations/meta/0003_snapshot.json +441 -0
- package/migrations/meta/0004_snapshot.json +270 -0
- package/migrations/meta/0005_snapshot.json +315 -0
- package/migrations/meta/0006_snapshot.json +382 -0
- package/migrations/meta/0007_snapshot.json +303 -0
- package/migrations/meta/0008_snapshot.json +346 -0
- package/migrations/meta/0009_snapshot.json +367 -0
- package/migrations/meta/0010_snapshot.json +382 -0
- package/migrations/meta/0011_snapshot.json +382 -0
- package/migrations/meta/0012_snapshot.json +512 -0
- package/migrations/meta/0013_snapshot.json +458 -0
- package/migrations/meta/_journal.json +104 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
OpenSIP CLI
|
|
2
|
+
Copyright 2026 opensip-ai
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this software except in compliance with the License. A copy of the License is
|
|
6
|
+
included in the LICENSE file and is also available at:
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Generated by scripts/build-package-readmes.mjs — do not edit by hand.
|
|
2
|
+
Change the package's "description" (or the generator template) and run
|
|
3
|
+
`pnpm docs:readmes`. CI enforces sync via `pnpm docs:readmes:check`. -->
|
|
4
|
+
|
|
5
|
+
# @opensip-cli/datastore
|
|
6
|
+
|
|
7
|
+
> SQLite + Drizzle persistence layer for OpenSIP CLI — DataStore interface, backends, factory, schema migrations
|
|
8
|
+
|
|
9
|
+
This is an **internal library** of the opensip-cli toolkit. It is published so the CLI and tools can depend on it; most users will not install it directly.
|
|
10
|
+
|
|
11
|
+
Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase-analysis toolkit: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Most users install the CLI, which bundles the first-party tools:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
curl -fsSL https://opensip.ai/cli/install.sh | bash
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This package is published for the CLI and advanced plugin authors; most users should not install `@opensip-cli/datastore` directly.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- 📚 Project docs: https://opensip.ai/docs/opensip-cli/
|
|
26
|
+
- 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.0/docs/public/70-reference/02-package-catalog.md
|
|
27
|
+
- 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.0/packages/datastore
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
Apache-2.0 © opensip-ai
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-repo.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/baseline-repo.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createSignal } from '@opensip-cli/core';
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { BaselineRepo, DataStoreFactory, requireDrizzleDataStore, } from '../index.js';
|
|
5
|
+
let ds;
|
|
6
|
+
let repo;
|
|
7
|
+
function sig(ruleId, file) {
|
|
8
|
+
return createSignal({ source: 's', severity: 'high', ruleId, message: 'm', code: { file } });
|
|
9
|
+
}
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
ds = DataStoreFactory.open({ backend: 'memory' });
|
|
12
|
+
repo = new BaselineRepo(ds);
|
|
13
|
+
});
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
ds.close();
|
|
16
|
+
});
|
|
17
|
+
describe('BaselineRepo', () => {
|
|
18
|
+
it('migrations dropped the old per-tool baseline tables, kept the generic pair (0006+0007)', () => {
|
|
19
|
+
const rows = requireDrizzleDataStore(ds).db.all(sql `SELECT name FROM sqlite_master WHERE type='table'`);
|
|
20
|
+
const names = new Set(rows.map((r) => r.name));
|
|
21
|
+
expect(names.has('tool_baseline_entries')).toBe(true);
|
|
22
|
+
expect(names.has('tool_baseline_meta')).toBe(true);
|
|
23
|
+
expect(names.has('fit_baseline')).toBe(false);
|
|
24
|
+
expect(names.has('graph_baseline_signals')).toBe(false);
|
|
25
|
+
expect(names.has('graph_baseline_meta')).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
it('round-trips fingerprint + full Signal payload', () => {
|
|
28
|
+
const payload = sig('rule-a', 'src/a.ts');
|
|
29
|
+
repo.save('graph', [{ fingerprint: 'fp-a', payload }]);
|
|
30
|
+
const rows = repo.load('graph');
|
|
31
|
+
expect(rows).toHaveLength(1);
|
|
32
|
+
expect(rows[0].fingerprint).toBe('fp-a');
|
|
33
|
+
expect(rows[0].payload?.ruleId).toBe('rule-a');
|
|
34
|
+
expect(rows[0].payload?.filePath).toBe('src/a.ts');
|
|
35
|
+
});
|
|
36
|
+
it('exists/capturedAt reflect the saved marker', () => {
|
|
37
|
+
expect(repo.exists('graph')).toBe(false);
|
|
38
|
+
expect(repo.capturedAt('graph')).toBeUndefined();
|
|
39
|
+
repo.save('graph', [{ fingerprint: 'fp', payload: sig('r', 'f') }]);
|
|
40
|
+
expect(repo.exists('graph')).toBe(true);
|
|
41
|
+
expect(typeof repo.capturedAt('graph')).toBe('number');
|
|
42
|
+
});
|
|
43
|
+
it('an empty save is a valid saved state (exists, no rows)', () => {
|
|
44
|
+
repo.save('graph', []);
|
|
45
|
+
expect(repo.exists('graph')).toBe(true);
|
|
46
|
+
expect(repo.load('graph')).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
it('save replaces the prior baseline atomically', () => {
|
|
49
|
+
repo.save('graph', [{ fingerprint: 'old', payload: sig('r', 'f') }]);
|
|
50
|
+
repo.save('graph', [{ fingerprint: 'new', payload: sig('r2', 'f2') }]);
|
|
51
|
+
expect(repo.load('graph').map((r) => r.fingerprint)).toEqual(['new']);
|
|
52
|
+
});
|
|
53
|
+
it('dedupes by fingerprint (last wins) and sorts deterministically', () => {
|
|
54
|
+
repo.save('graph', [
|
|
55
|
+
{ fingerprint: 'b', payload: sig('rb', 'fb') },
|
|
56
|
+
{ fingerprint: 'a', payload: sig('ra1', 'fa') },
|
|
57
|
+
{ fingerprint: 'a', payload: sig('ra2', 'fa') }, // duplicate fingerprint
|
|
58
|
+
]);
|
|
59
|
+
const rows = repo.load('graph');
|
|
60
|
+
expect(rows.map((r) => r.fingerprint)).toEqual(['a', 'b']);
|
|
61
|
+
expect(rows.find((r) => r.fingerprint === 'a')?.payload?.ruleId).toBe('ra2'); // last won
|
|
62
|
+
});
|
|
63
|
+
it('scopes rows per tool — tools never see each other', () => {
|
|
64
|
+
repo.save('graph', [{ fingerprint: 'g', payload: sig('rg', 'fg') }]);
|
|
65
|
+
repo.save('fitness', [{ fingerprint: 'f', payload: sig('rf', 'ff') }]);
|
|
66
|
+
expect(repo.load('graph').map((r) => r.fingerprint)).toEqual(['g']);
|
|
67
|
+
expect(repo.load('fitness').map((r) => r.fingerprint)).toEqual(['f']);
|
|
68
|
+
expect(repo.exists('simulation')).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
it('clear removes entries + meta marker (unlike empty save)', () => {
|
|
71
|
+
repo.save('graph', [{ fingerprint: 'g1', payload: sig('r', 'f') }]);
|
|
72
|
+
expect(repo.exists('graph')).toBe(true);
|
|
73
|
+
expect(repo.load('graph')).toHaveLength(1);
|
|
74
|
+
const cleared = repo.clear('graph');
|
|
75
|
+
expect(cleared.entries).toBe(1);
|
|
76
|
+
expect(cleared.meta).toBe(true);
|
|
77
|
+
expect(repo.exists('graph')).toBe(false);
|
|
78
|
+
expect(repo.load('graph')).toEqual([]);
|
|
79
|
+
// clear on never-saved is no-op (0 entries, no meta)
|
|
80
|
+
const cleared2 = repo.clear('never');
|
|
81
|
+
expect(cleared2.entries).toBe(0);
|
|
82
|
+
expect(cleared2.meta).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=baseline-repo.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-repo.test.js","sourceRoot":"","sources":["../../src/__tests__/baseline-repo.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,aAAa,CAAC;AAErB,IAAI,EAAa,CAAC;AAClB,IAAI,IAAkB,CAAC;AAEvB,SAAS,GAAG,CAAC,MAAc,EAAE,IAAY;IACvC,OAAO,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE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— the public persistence handle boundary helpers.
|
|
3
|
+
*
|
|
4
|
+
* Covers the `isDrizzleDataStore` type guard (every shape branch), the
|
|
5
|
+
* `requireDrizzleDataStore` narrow-or-throw, and the `DataStoreMigrationError`
|
|
6
|
+
* carrier. These guard the raw-Drizzle boundary (`restrict-raw-db-access`), so
|
|
7
|
+
* each rejection branch must stay pinned.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=data-store.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-store.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/data-store.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data-store — the public persistence handle boundary helpers.
|
|
3
|
+
*
|
|
4
|
+
* Covers the `isDrizzleDataStore` type guard (every shape branch), the
|
|
5
|
+
* `requireDrizzleDataStore` narrow-or-throw, and the `DataStoreMigrationError`
|
|
6
|
+
* carrier. These guard the raw-Drizzle boundary (`restrict-raw-db-access`), so
|
|
7
|
+
* each rejection branch must stay pinned.
|
|
8
|
+
*/
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { DataStoreMigrationError, isDrizzleDataStore, requireDrizzleDataStore, } from '../data-store.js';
|
|
11
|
+
/** A minimal object that satisfies the Drizzle-backed shape. */
|
|
12
|
+
const drizzleLike = () => ({
|
|
13
|
+
db: {},
|
|
14
|
+
transaction: () => undefined,
|
|
15
|
+
close: () => undefined,
|
|
16
|
+
});
|
|
17
|
+
describe('isDrizzleDataStore', () => {
|
|
18
|
+
it('accepts an object carrying db + transaction() + close()', () => {
|
|
19
|
+
expect(isDrizzleDataStore(drizzleLike())).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
it('rejects non-objects and null', () => {
|
|
22
|
+
expect(isDrizzleDataStore('nope')).toBe(false);
|
|
23
|
+
expect(isDrizzleDataStore(42)).toBe(false);
|
|
24
|
+
expect(isDrizzleDataStore(undefined)).toBe(false);
|
|
25
|
+
expect(isDrizzleDataStore(null)).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
it('rejects when `db` is absent', () => {
|
|
28
|
+
expect(isDrizzleDataStore({ transaction: () => undefined, close: () => undefined })).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
it('rejects when `transaction` is absent or not a function', () => {
|
|
31
|
+
expect(isDrizzleDataStore({ db: {}, close: () => undefined })).toBe(false);
|
|
32
|
+
expect(isDrizzleDataStore({ db: {}, transaction: 'x', close: () => undefined })).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
it('rejects when `close` is absent or not a function', () => {
|
|
35
|
+
expect(isDrizzleDataStore({ db: {}, transaction: () => undefined })).toBe(false);
|
|
36
|
+
expect(isDrizzleDataStore({ db: {}, transaction: () => undefined, close: 'x' })).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('requireDrizzleDataStore', () => {
|
|
40
|
+
it('returns the store unchanged when it is Drizzle-backed', () => {
|
|
41
|
+
const store = drizzleLike();
|
|
42
|
+
expect(requireDrizzleDataStore(store)).toBe(store);
|
|
43
|
+
});
|
|
44
|
+
it('throws when the store is not Drizzle-backed', () => {
|
|
45
|
+
const plain = { transaction: () => undefined, close: () => undefined };
|
|
46
|
+
expect(() => requireDrizzleDataStore(plain)).toThrow(/Drizzle-backed DataStore is required/);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('DataStoreMigrationError', () => {
|
|
50
|
+
it('carries the message, name, migrationFile, and cause', () => {
|
|
51
|
+
const cause = new Error('disk full');
|
|
52
|
+
const err = new DataStoreMigrationError('migration failed', {
|
|
53
|
+
migrationFile: '0007_add_index.sql',
|
|
54
|
+
cause,
|
|
55
|
+
});
|
|
56
|
+
expect(err).toBeInstanceOf(Error);
|
|
57
|
+
expect(err.name).toBe('DataStoreMigrationError');
|
|
58
|
+
expect(err.message).toBe('migration failed');
|
|
59
|
+
expect(err.migrationFile).toBe('0007_add_index.sql');
|
|
60
|
+
expect(err.cause).toBe(cause);
|
|
61
|
+
});
|
|
62
|
+
it('defaults migrationFile and cause to undefined', () => {
|
|
63
|
+
const err = new DataStoreMigrationError('boom');
|
|
64
|
+
expect(err.migrationFile).toBeUndefined();
|
|
65
|
+
expect(err.cause).toBeUndefined();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=data-store.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-store.test.js","sourceRoot":"","sources":["../../src/__tests__/data-store.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAI1B,gEAAgE;AAChE,MAAM,WAAW,GAAG,GAAY,EAAE,CAAC,CAAC;IAClC,EAAE,EAAE,EAAE;IACN,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;IAC5B,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;CACvB,CAAC,CAAC;AAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,C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EH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,GAAG,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/factory.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
+
import { isNativeBindingError, openFailureMessage } from '../factory.js';
|
|
6
|
+
import { DataStoreFactory, DataStoreMigrationError } from '../index.js';
|
|
7
|
+
let tmp;
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
tmp = mkdtempSync(join(tmpdir(), 'ds-factory-'));
|
|
10
|
+
});
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
13
|
+
});
|
|
14
|
+
describe('DataStoreFactory.open — backends', () => {
|
|
15
|
+
it('opens an in-memory store and closes cleanly', () => {
|
|
16
|
+
const ds = DataStoreFactory.open({ backend: 'memory' });
|
|
17
|
+
expect(ds.db).toBeDefined();
|
|
18
|
+
ds.close();
|
|
19
|
+
});
|
|
20
|
+
it('memory backends are isolated from each other', () => {
|
|
21
|
+
const a = DataStoreFactory.open({ backend: 'memory' });
|
|
22
|
+
const b = DataStoreFactory.open({ backend: 'memory' });
|
|
23
|
+
// Can't easily query without a schema; the structural separation
|
|
24
|
+
// (different `db` handles) is sufficient evidence.
|
|
25
|
+
expect(a.db).not.toBe(b.db);
|
|
26
|
+
a.close();
|
|
27
|
+
b.close();
|
|
28
|
+
});
|
|
29
|
+
it('opens a SQLite store at the given path and persists across reopens', () => {
|
|
30
|
+
const path = join(tmp, 'test.sqlite');
|
|
31
|
+
const a = DataStoreFactory.open({ backend: 'sqlite', path });
|
|
32
|
+
a.close();
|
|
33
|
+
const b = DataStoreFactory.open({ backend: 'sqlite', path });
|
|
34
|
+
expect(b.db).toBeDefined();
|
|
35
|
+
b.close();
|
|
36
|
+
});
|
|
37
|
+
it('close() is idempotent', () => {
|
|
38
|
+
const ds = DataStoreFactory.open({ backend: 'memory' });
|
|
39
|
+
ds.close();
|
|
40
|
+
expect(() => ds.close()).not.toThrow();
|
|
41
|
+
});
|
|
42
|
+
it('throws when SQLite backend is opened without a path', () => {
|
|
43
|
+
expect(() => DataStoreFactory.open({ backend: 'sqlite' })).toThrow();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe('DataStoreFactory.open — migration error path', () => {
|
|
47
|
+
it('throws DataStoreMigrationError when the SQLite file is corrupted', () => {
|
|
48
|
+
const path = join(tmp, 'corrupt.sqlite');
|
|
49
|
+
// Write garbage that is not a valid SQLite header.
|
|
50
|
+
writeFileSync(path, 'this is not a sqlite database', 'utf8');
|
|
51
|
+
expect(() => DataStoreFactory.open({ backend: 'sqlite', path })).toThrow(DataStoreMigrationError);
|
|
52
|
+
});
|
|
53
|
+
it('migration error message contains the recovery hint with the path', () => {
|
|
54
|
+
const path = join(tmp, 'corrupt2.sqlite');
|
|
55
|
+
writeFileSync(path, 'garbage', 'utf8');
|
|
56
|
+
try {
|
|
57
|
+
DataStoreFactory.open({ backend: 'sqlite', path });
|
|
58
|
+
throw new Error('expected throw');
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
expect(error).toBeInstanceOf(DataStoreMigrationError);
|
|
62
|
+
expect(error.message).toContain('corrupt2.sqlite');
|
|
63
|
+
expect(error.message).toContain('Delete');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe('DataStoreFactory.open — migrate failure on healthy backend', () => {
|
|
68
|
+
it('closes the backend and throws DataStoreMigrationError when migration folder is invalid', () => {
|
|
69
|
+
expect(() => DataStoreFactory.open({
|
|
70
|
+
backend: 'memory',
|
|
71
|
+
migrationsFolder: '/nonexistent/path/that/does/not/exist',
|
|
72
|
+
})).toThrow(DataStoreMigrationError);
|
|
73
|
+
});
|
|
74
|
+
it('migration failure on SQLite backend includes recovery hint with path', () => {
|
|
75
|
+
const path = join(tmp, 'good.sqlite');
|
|
76
|
+
try {
|
|
77
|
+
DataStoreFactory.open({
|
|
78
|
+
backend: 'sqlite',
|
|
79
|
+
path,
|
|
80
|
+
migrationsFolder: '/nonexistent/migrations',
|
|
81
|
+
});
|
|
82
|
+
throw new Error('expected throw');
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
expect(error).toBeInstanceOf(DataStoreMigrationError);
|
|
86
|
+
expect(error.message).toContain('good.sqlite');
|
|
87
|
+
expect(error.message).toContain('Delete');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
it('migration failure on memory backend returns the in-memory message', () => {
|
|
91
|
+
try {
|
|
92
|
+
DataStoreFactory.open({
|
|
93
|
+
backend: 'memory',
|
|
94
|
+
migrationsFolder: '/no/such/dir',
|
|
95
|
+
});
|
|
96
|
+
throw new Error('expected throw');
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
expect(error).toBeInstanceOf(DataStoreMigrationError);
|
|
100
|
+
expect(error.message).toContain('in-memory backend');
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('native-binding (ABI mismatch) failures are not reported as corruption', () => {
|
|
105
|
+
it('isNativeBindingError detects ERR_DLOPEN_FAILED', () => {
|
|
106
|
+
const e = Object.assign(new Error('dlopen failed'), { code: 'ERR_DLOPEN_FAILED' });
|
|
107
|
+
expect(isNativeBindingError(e)).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
it('isNativeBindingError detects the NODE_MODULE_VERSION mismatch text', () => {
|
|
110
|
+
const e = new Error('The module was compiled against a different Node.js version using NODE_MODULE_VERSION 127. This version of Node.js requires NODE_MODULE_VERSION 137.');
|
|
111
|
+
expect(isNativeBindingError(e)).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
it('isNativeBindingError scans the cause chain', () => {
|
|
114
|
+
const root = Object.assign(new Error('dlopen'), { code: 'ERR_DLOPEN_FAILED' });
|
|
115
|
+
const wrapped = new Error('failed to construct Database', { cause: root });
|
|
116
|
+
expect(isNativeBindingError(wrapped)).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
it('isNativeBindingError is false for a genuine corrupt-file error', () => {
|
|
119
|
+
const e = Object.assign(new Error('file is not a database'), { code: 'SQLITE_NOTADB' });
|
|
120
|
+
expect(isNativeBindingError(e)).toBe(false);
|
|
121
|
+
expect(isNativeBindingError(undefined)).toBe(false);
|
|
122
|
+
});
|
|
123
|
+
it('binding-error message says rebuild, NOT delete the data store', () => {
|
|
124
|
+
const e = Object.assign(new Error('dlopen failed'), { code: 'ERR_DLOPEN_FAILED' });
|
|
125
|
+
const msg = openFailureMessage({ backend: 'sqlite', path: 'project/cache.sqlite' }, e);
|
|
126
|
+
expect(msg).toContain('pnpm rebuild better-sqlite3');
|
|
127
|
+
expect(msg).toContain('NOT corrupt');
|
|
128
|
+
expect(msg).not.toContain('Delete');
|
|
129
|
+
});
|
|
130
|
+
it('a non-binding sqlite open error keeps the delete-to-recover message', () => {
|
|
131
|
+
const e = Object.assign(new Error('disk image is malformed'), { code: 'SQLITE_CORRUPT' });
|
|
132
|
+
const msg = openFailureMessage({ backend: 'sqlite', path: 'project/cache.sqlite' }, e);
|
|
133
|
+
expect(msg).toContain('Delete');
|
|
134
|
+
expect(msg).not.toContain('pnpm rebuild');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe('DataStoreMigrationError', () => {
|
|
138
|
+
it('preserves cause via the standard ES2022 Error.cause slot', () => {
|
|
139
|
+
const root = new Error('underlying');
|
|
140
|
+
const e = new DataStoreMigrationError('outer', { cause: root });
|
|
141
|
+
expect(e.cause).toBe(root);
|
|
142
|
+
expect(e.name).toBe('DataStoreMigrationError');
|
|
143
|
+
});
|
|
144
|
+
it('omits cause when not supplied', () => {
|
|
145
|
+
const e = new DataStoreMigrationError('outer');
|
|
146
|
+
expect(e.cause).toBeUndefined();
|
|
147
|
+
});
|
|
148
|
+
it('stores migrationFile when supplied', () => {
|
|
149
|
+
const e = new DataStoreMigrationError('outer', { migrationFile: '0001_init.sql' });
|
|
150
|
+
expect(e.migrationFile).toBe('0001_init.sql');
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe('DataStore.transaction', () => {
|
|
154
|
+
it('passes a tx handle through and returns its return value', () => {
|
|
155
|
+
const ds = DataStoreFactory.open({ backend: 'memory' });
|
|
156
|
+
const result = ds.transaction(() => 42);
|
|
157
|
+
expect(result).toBe(42);
|
|
158
|
+
ds.close();
|
|
159
|
+
});
|
|
160
|
+
it('rolls back on a thrown error', () => {
|
|
161
|
+
const ds = DataStoreFactory.open({ backend: 'memory' });
|
|
162
|
+
expect(() => ds.transaction(() => {
|
|
163
|
+
throw new Error('boom');
|
|
164
|
+
})).toThrow('boom');
|
|
165
|
+
ds.close();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=factory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.test.js","sourceRoot":"","sources":["../../src/__tests__/factory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,UAAU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