@r146023/omniturbo 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 +201 -0
- package/README.md +320 -0
- package/dist/Omni.d.ts +82 -0
- package/dist/Omni.d.ts.map +1 -0
- package/dist/Omni.js +477 -0
- package/dist/Omni.js.map +1 -0
- package/dist/aliases/AliasRegistry.d.ts +8 -0
- package/dist/aliases/AliasRegistry.d.ts.map +1 -0
- package/dist/aliases/AliasRegistry.js +29 -0
- package/dist/aliases/AliasRegistry.js.map +1 -0
- package/dist/batch/batch.d.ts +4 -0
- package/dist/batch/batch.d.ts.map +1 -0
- package/dist/batch/batch.js +17 -0
- package/dist/batch/batch.js.map +1 -0
- package/dist/core/equality.d.ts +6 -0
- package/dist/core/equality.d.ts.map +1 -0
- package/dist/core/equality.js +43 -0
- package/dist/core/equality.js.map +1 -0
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/ids.d.ts.map +1 -0
- package/dist/core/ids.js +6 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/object.d.ts +49 -0
- package/dist/core/object.d.ts.map +1 -0
- package/dist/core/object.js +134 -0
- package/dist/core/object.js.map +1 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +46 -0
- package/dist/core/path.js.map +1 -0
- package/dist/datatypes/DataTypeRegistry.d.ts +10 -0
- package/dist/datatypes/DataTypeRegistry.d.ts.map +1 -0
- package/dist/datatypes/DataTypeRegistry.js +27 -0
- package/dist/datatypes/DataTypeRegistry.js.map +1 -0
- package/dist/datatypes/builtins.d.ts +3 -0
- package/dist/datatypes/builtins.d.ts.map +1 -0
- package/dist/datatypes/builtins.js +41 -0
- package/dist/datatypes/builtins.js.map +1 -0
- package/dist/history/history.d.ts +4 -0
- package/dist/history/history.d.ts.map +1 -0
- package/dist/history/history.js +22 -0
- package/dist/history/history.js.map +1 -0
- package/dist/history/timeline.d.ts +11 -0
- package/dist/history/timeline.d.ts.map +1 -0
- package/dist/history/timeline.js +22 -0
- package/dist/history/timeline.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/privacy/PrivacyRegistry.d.ts +22 -0
- package/dist/privacy/PrivacyRegistry.d.ts.map +1 -0
- package/dist/privacy/PrivacyRegistry.js +84 -0
- package/dist/privacy/PrivacyRegistry.js.map +1 -0
- package/dist/privacy/writeTokens.d.ts +15 -0
- package/dist/privacy/writeTokens.d.ts.map +1 -0
- package/dist/privacy/writeTokens.js +23 -0
- package/dist/privacy/writeTokens.js.map +1 -0
- package/dist/result/resultFactories.d.ts +28 -0
- package/dist/result/resultFactories.d.ts.map +1 -0
- package/dist/result/resultFactories.js +30 -0
- package/dist/result/resultFactories.js.map +1 -0
- package/dist/schema/SchemaRegistry.d.ts +33 -0
- package/dist/schema/SchemaRegistry.d.ts.map +1 -0
- package/dist/schema/SchemaRegistry.js +90 -0
- package/dist/schema/SchemaRegistry.js.map +1 -0
- package/dist/schema/schemaDefaults.d.ts +3 -0
- package/dist/schema/schemaDefaults.d.ts.map +1 -0
- package/dist/schema/schemaDefaults.js +6 -0
- package/dist/schema/schemaDefaults.js.map +1 -0
- package/dist/schema/schemaValidation.d.ts +20 -0
- package/dist/schema/schemaValidation.d.ts.map +1 -0
- package/dist/schema/schemaValidation.js +80 -0
- package/dist/schema/schemaValidation.js.map +1 -0
- package/dist/subscriptions/subscriptions.d.ts +341 -0
- package/dist/subscriptions/subscriptions.d.ts.map +1 -0
- package/dist/subscriptions/subscriptions.js +373 -0
- package/dist/subscriptions/subscriptions.js.map +1 -0
- package/dist/types/datatype_types.d.ts +25 -0
- package/dist/types/datatype_types.d.ts.map +1 -0
- package/dist/types/datatype_types.js +3 -0
- package/dist/types/datatype_types.js.map +1 -0
- package/dist/types/issue_types.d.ts +14 -0
- package/dist/types/issue_types.d.ts.map +1 -0
- package/dist/types/issue_types.js +2 -0
- package/dist/types/issue_types.js.map +1 -0
- package/dist/types/options_types.d.ts +48 -0
- package/dist/types/options_types.d.ts.map +1 -0
- package/dist/types/options_types.js +2 -0
- package/dist/types/options_types.js.map +1 -0
- package/dist/types/privacy_types.d.ts +22 -0
- package/dist/types/privacy_types.d.ts.map +1 -0
- package/dist/types/privacy_types.js +2 -0
- package/dist/types/privacy_types.js.map +1 -0
- package/dist/types/result_types.d.ts +20 -0
- package/dist/types/result_types.d.ts.map +1 -0
- package/dist/types/result_types.js +2 -0
- package/dist/types/result_types.js.map +1 -0
- package/dist/types/schema_types.d.ts +35 -0
- package/dist/types/schema_types.d.ts.map +1 -0
- package/dist/types/schema_types.js +2 -0
- package/dist/types/schema_types.js.map +1 -0
- package/dist/types/store_types.d.ts +37 -0
- package/dist/types/store_types.d.ts.map +1 -0
- package/dist/types/store_types.js +2 -0
- package/dist/types/store_types.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://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 exercising
|
|
24
|
+
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 Derivative
|
|
95
|
+
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
|
|
141
|
+
the 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
|
|
171
|
+
of 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 2026 Colemen Atwood
|
|
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
|
+
https://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,320 @@
|
|
|
1
|
+
# OmniTurbo
|
|
2
|
+
|
|
3
|
+
**Governed path-state for TypeScript apps.**
|
|
4
|
+
|
|
5
|
+
OmniTurbo is a path-first state store that can be used in two ways:
|
|
6
|
+
|
|
7
|
+
1. as a loose in-memory value bag, or
|
|
8
|
+
2. as a governed in-memory path database with schemas, datatypes, privacy, structured results, subscriptions, alerts, coercers, batch initialization, and history.
|
|
9
|
+
|
|
10
|
+
The core design goal is:
|
|
11
|
+
|
|
12
|
+
> **Freedom by default. Guarantees by request.**
|
|
13
|
+
|
|
14
|
+
Use OmniTurbo when state is more than temporary UI state — when paths represent metadata, plugin settings, schema definitions, form values, editor entities, or other application-critical data that should be validated before it becomes observable state.
|
|
15
|
+
|
|
16
|
+
## Why OmniTurbo?
|
|
17
|
+
|
|
18
|
+
Most state stores let anything write anything:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
store.set("entities.node_1.meta.width", "banana");
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
That is fine for loose state, but it is dangerous when the value represents governed application metadata.
|
|
25
|
+
|
|
26
|
+
OmniTurbo lets important paths define rules:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
omni.schema("entities.*.meta.width", {
|
|
30
|
+
type: "number",
|
|
31
|
+
min: 1,
|
|
32
|
+
max: 5000,
|
|
33
|
+
coerce: true,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
omni.set("entities.node_1.meta.width", "250"); // accepted, stores 250
|
|
37
|
+
omni.set("entities.node_1.meta.width", "banana"); // rejected, old value remains
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If validation fails, the value is not committed and side effects do not fire.
|
|
41
|
+
|
|
42
|
+
## Core guarantee
|
|
43
|
+
|
|
44
|
+
When a path is governed by schema or privacy and a write fails, OmniTurbo should not:
|
|
45
|
+
|
|
46
|
+
- update the stored value,
|
|
47
|
+
- trigger subscriptions,
|
|
48
|
+
- trigger alerts,
|
|
49
|
+
- resolve waiters,
|
|
50
|
+
- add false successful state to the timeline.
|
|
51
|
+
|
|
52
|
+
Invalid state should not become observable state.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install @r146023/omniturbo
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Quick start
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { Omni } from "omniturbo";
|
|
65
|
+
|
|
66
|
+
const omni = new Omni();
|
|
67
|
+
|
|
68
|
+
const result = omni.set("settings.theme", "dark");
|
|
69
|
+
|
|
70
|
+
if (result.success) {
|
|
71
|
+
console.log(omni.get("settings.theme")); // "dark"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`set()` and `setObj()` return `OmniResult` objects instead of booleans. This is deliberate: once a write can be coerced, rejected, privacy-blocked, or partially applied, a boolean is not enough information.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
const result = omni.set("settings.zoom", "1.25", {
|
|
79
|
+
schema: { type: "number", min: 0.1, max: 4 },
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
console.log(result.success); // true
|
|
83
|
+
console.log(result.value); // 1.25
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Governed paths
|
|
87
|
+
|
|
88
|
+
Schemas can be registered by exact path or wildcard path.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
omni.schema("entities.*.meta", {
|
|
92
|
+
type: "object",
|
|
93
|
+
children: {
|
|
94
|
+
width: {
|
|
95
|
+
type: "number",
|
|
96
|
+
min: 1,
|
|
97
|
+
max: 5000,
|
|
98
|
+
coerce: true,
|
|
99
|
+
},
|
|
100
|
+
height: {
|
|
101
|
+
type: "number",
|
|
102
|
+
min: 1,
|
|
103
|
+
max: 5000,
|
|
104
|
+
coerce: true,
|
|
105
|
+
},
|
|
106
|
+
label: {
|
|
107
|
+
type: "string",
|
|
108
|
+
maxLength: 120,
|
|
109
|
+
coerce: true,
|
|
110
|
+
},
|
|
111
|
+
locked: {
|
|
112
|
+
type: "boolean",
|
|
113
|
+
coerce: true,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
omni.set("entities.node_1.meta.width", "250"); // accepted
|
|
119
|
+
omni.set("entities.node_1.meta.width", "bad"); // rejected
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Private paths
|
|
123
|
+
|
|
124
|
+
Private paths can only be updated through the setter returned when the private path is created.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
const created = omni.set("entities.node_1.meta.locked", false, {
|
|
128
|
+
privateSet: true,
|
|
129
|
+
owner: "AmberNode:node_1",
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
omni.set("entities.node_1.meta.locked", true); // rejected
|
|
133
|
+
|
|
134
|
+
created.setter?.(true); // accepted
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Private setters can also write child paths:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
const meta = omni.setObj(
|
|
141
|
+
{ width: 100, height: 80, label: "Node" },
|
|
142
|
+
"entities.node_1.meta",
|
|
143
|
+
{ privateSet: true, owner: "AmberNode:node_1" }
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
meta.setter?.("width", 250); // accepted
|
|
147
|
+
omni.set("entities.node_1.meta.width", 300); // rejected
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Batch initialization
|
|
151
|
+
|
|
152
|
+
Batching is intended for initialization and bulk loading. It lets an app load a large state tree without firing thousands of startup-time subscriptions.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
omni.batch(() => {
|
|
156
|
+
omni.set("settings.theme", "dark");
|
|
157
|
+
omni.set("settings.zoom", 1);
|
|
158
|
+
omni.set("session.ready", true);
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
By default, batch commits values but suppresses per-path subscriptions and alerts during initialization.
|
|
163
|
+
|
|
164
|
+
## Subscriptions
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
const unsubscribe = omni.subscribe("settings.theme", (path, value, oldValue) => {
|
|
168
|
+
console.log(path, value, oldValue);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
omni.set("settings.theme", "light");
|
|
172
|
+
|
|
173
|
+
unsubscribe();
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Tree subscriptions can watch descendants:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
omni.subscribeTree("entities.node_1.meta", (root, changedPath, value) => {
|
|
180
|
+
console.log(`${changedPath} changed under ${root}`);
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Useful for
|
|
185
|
+
|
|
186
|
+
OmniTurbo is most useful for applications where state needs structure and guarantees:
|
|
187
|
+
|
|
188
|
+
- visual editors
|
|
189
|
+
- plugin-driven apps
|
|
190
|
+
- form engines
|
|
191
|
+
- schema-driven UIs
|
|
192
|
+
- internal tool builders
|
|
193
|
+
- metadata-heavy apps
|
|
194
|
+
- local-first apps
|
|
195
|
+
- desktop apps
|
|
196
|
+
- diagram/canvas editors
|
|
197
|
+
- generated app systems
|
|
198
|
+
|
|
199
|
+
It is probably overkill for simple UI flags like `isDropdownOpen`.
|
|
200
|
+
|
|
201
|
+
## What changed in the modular Omni
|
|
202
|
+
|
|
203
|
+
The old single-file OmniTurbo was refactored into a modular project structure:
|
|
204
|
+
|
|
205
|
+
```txt
|
|
206
|
+
omniturbo/
|
|
207
|
+
src/
|
|
208
|
+
index.ts
|
|
209
|
+
Omni.ts
|
|
210
|
+
core/
|
|
211
|
+
types/
|
|
212
|
+
result/
|
|
213
|
+
datatypes/
|
|
214
|
+
schema/
|
|
215
|
+
privacy/
|
|
216
|
+
aliases/
|
|
217
|
+
subscriptions/
|
|
218
|
+
history/
|
|
219
|
+
batch/
|
|
220
|
+
tests/
|
|
221
|
+
docs/
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The most important API change is that `set()` and `setObj()` now return `OmniResult` objects instead of booleans.
|
|
225
|
+
|
|
226
|
+
## Documentation map
|
|
227
|
+
|
|
228
|
+
### Getting started
|
|
229
|
+
|
|
230
|
+
- [Installation](docs/getting-started/installation.md)
|
|
231
|
+
- [Quick start](docs/getting-started/quick-start.md)
|
|
232
|
+
- [Mental model](docs/getting-started/mental-model.md)
|
|
233
|
+
- [Project structure](docs/getting-started/project-structure.md)
|
|
234
|
+
- [Migration guide](docs/getting-started/migration-guide.md)
|
|
235
|
+
|
|
236
|
+
### Concepts
|
|
237
|
+
|
|
238
|
+
- [Paths and values](docs/concepts/paths-and-values.md)
|
|
239
|
+
- [Atomic values vs object trees](docs/concepts/atomic-values-vs-object-trees.md)
|
|
240
|
+
- [Results and issues](docs/concepts/results-and-issues.md)
|
|
241
|
+
- [Governed vs loose mode](docs/concepts/governed-vs-loose-mode.md)
|
|
242
|
+
- [Side-effect lifecycle](docs/concepts/side-effect-lifecycle.md)
|
|
243
|
+
|
|
244
|
+
### API
|
|
245
|
+
|
|
246
|
+
- [Omni class](docs/api/omni-class.md)
|
|
247
|
+
- [Set and setObj](docs/api/set-and-setobj.md)
|
|
248
|
+
- [Get and getObj](docs/api/get-and-getobj.md)
|
|
249
|
+
- [Delete and clear](docs/api/delete-and-clear.md)
|
|
250
|
+
- [Utility methods](docs/api/utility-methods.md)
|
|
251
|
+
- [Explain and export](docs/api/explain-and-export.md)
|
|
252
|
+
|
|
253
|
+
### Schemas and datatypes
|
|
254
|
+
|
|
255
|
+
- [Schema basics](docs/schemas/schema-basics.md)
|
|
256
|
+
- [Schema resolution and wildcards](docs/schemas/schema-resolution-and-wildcards.md)
|
|
257
|
+
- [Object and array schemas](docs/schemas/object-and-array-schemas.md)
|
|
258
|
+
- [Validation and coercion pipeline](docs/schemas/validation-and-coercion-pipeline.md)
|
|
259
|
+
- [Built-in datatypes](docs/datatypes/built-in-datatypes.md)
|
|
260
|
+
- [Custom datatypes](docs/datatypes/custom-datatypes.md)
|
|
261
|
+
|
|
262
|
+
### Privacy
|
|
263
|
+
|
|
264
|
+
- [Private paths](docs/privacy/private-paths.md)
|
|
265
|
+
- [Write tokens and private setters](docs/privacy/write-tokens-and-private-setters.md)
|
|
266
|
+
- [Delete policies](docs/privacy/delete-policies.md)
|
|
267
|
+
- [Ownership patterns](docs/privacy/ownership-patterns.md)
|
|
268
|
+
|
|
269
|
+
### Side effects, batch, and history
|
|
270
|
+
|
|
271
|
+
- [Subscriptions](docs/subscriptions/subscriptions.md)
|
|
272
|
+
- [Alerts](docs/subscriptions/alerts.md)
|
|
273
|
+
- [Coercers](docs/subscriptions/coercers.md)
|
|
274
|
+
- [Waiters](docs/subscriptions/waiters.md)
|
|
275
|
+
- [Batch initialization](docs/batch-history/batch-initialization.md)
|
|
276
|
+
- [History and undo](docs/batch-history/history-and-undo.md)
|
|
277
|
+
- [Timeline](docs/batch-history/timeline.md)
|
|
278
|
+
|
|
279
|
+
### Recipes
|
|
280
|
+
|
|
281
|
+
- [Large app initialization](docs/recipes/large-app-initialization.md)
|
|
282
|
+
- [Form state](docs/recipes/form-state.md)
|
|
283
|
+
- [Settings and preferences](docs/recipes/settings-and-preferences.md)
|
|
284
|
+
- [Metadata enforcement](docs/recipes/metadata-enforcement.md)
|
|
285
|
+
- [Plugin-safe state](docs/recipes/plugin-safe-state.md)
|
|
286
|
+
- [Debugging invalid writes](docs/recipes/debugging-invalid-writes.md)
|
|
287
|
+
|
|
288
|
+
### Amber integration
|
|
289
|
+
|
|
290
|
+
- [Amber metadata integration](docs/amber/amber-metadata-integration.md)
|
|
291
|
+
- [Replacing MetaProps enforcement](docs/amber/replacing-metaprops-enforcement.md)
|
|
292
|
+
- [Entity-owned private metadata](docs/amber/entity-owned-private-metadata.md)
|
|
293
|
+
|
|
294
|
+
### Testing and internals
|
|
295
|
+
|
|
296
|
+
- [Testing Omni](docs/testing/testing-omni.md)
|
|
297
|
+
- [Writing tests for governed paths](docs/testing/writing-governed-path-tests.md)
|
|
298
|
+
- [Internal architecture](docs/internals/internal-architecture.md)
|
|
299
|
+
- [Extension points](docs/internals/extension-points.md)
|
|
300
|
+
- [Gotchas](docs/reference/gotchas.md)
|
|
301
|
+
- [Glossary](docs/reference/glossary.md)
|
|
302
|
+
|
|
303
|
+
## Status
|
|
304
|
+
|
|
305
|
+
OmniTurbo is currently pre-1.0.
|
|
306
|
+
|
|
307
|
+
The core direction is stable, but schema, privacy, datatype, and result APIs may evolve as the library is battle-tested in real applications.
|
|
308
|
+
|
|
309
|
+
Recommended versioning:
|
|
310
|
+
|
|
311
|
+
```txt
|
|
312
|
+
0.1.x = experimental / early adopters
|
|
313
|
+
0.2.x = API cleanup and adapters
|
|
314
|
+
0.3.x = Amber integration proof
|
|
315
|
+
1.0.0 = stable public API
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## License
|
|
319
|
+
|
|
320
|
+
Apache-2.0 © 2026 Colemen Atwood
|
package/dist/Omni.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { AliasRegistry } from "./aliases/AliasRegistry";
|
|
2
|
+
import { DataTypeRegistry } from "./datatypes/DataTypeRegistry";
|
|
3
|
+
import { PrivacyRegistry } from "./privacy/PrivacyRegistry";
|
|
4
|
+
import { SchemaRegistry } from "./schema/SchemaRegistry";
|
|
5
|
+
import { Timeline } from "./history/timeline";
|
|
6
|
+
import { SubscriptionRegistry } from "./subscriptions/subscriptions";
|
|
7
|
+
import type { BatchOptions, GetOptions, SetOptions, SubscriberTiming } from "./types/options_types";
|
|
8
|
+
import type { OmniResult } from "./types/result_types";
|
|
9
|
+
import type { OmniSchema } from "./types/schema_types";
|
|
10
|
+
/**
|
|
11
|
+
* Omni is a path-first state store that can act as either:
|
|
12
|
+
* - a loose value bag, or
|
|
13
|
+
* - a governed in-memory path database with schemas, datatypes, privacy, history, and subscriptions.
|
|
14
|
+
*
|
|
15
|
+
* Freedom remains the default. Enforcement only exists when a schema/privacy rule is provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Omni {
|
|
18
|
+
private store;
|
|
19
|
+
private batchMode;
|
|
20
|
+
private batchQueue;
|
|
21
|
+
private parentNotifications;
|
|
22
|
+
private getObjCache;
|
|
23
|
+
private waiters;
|
|
24
|
+
readonly dataTypes: DataTypeRegistry;
|
|
25
|
+
readonly schemas: SchemaRegistry;
|
|
26
|
+
readonly privacy: PrivacyRegistry;
|
|
27
|
+
readonly aliases: AliasRegistry;
|
|
28
|
+
readonly subscriptions: SubscriptionRegistry;
|
|
29
|
+
readonly timeline: Timeline;
|
|
30
|
+
verbose: boolean;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* Enables or disables notifying parent paths when a child path changes.
|
|
34
|
+
* This is not an efficiency mode; it is a semantic choice for tree subscriptions.
|
|
35
|
+
*/
|
|
36
|
+
setParentNotifications(enabled: boolean): void;
|
|
37
|
+
define(pathPattern: string, schema: OmniSchema): OmniResult;
|
|
38
|
+
schema(pathPattern: string, schema: OmniSchema): OmniResult;
|
|
39
|
+
getSchema(path: string): OmniSchema | undefined;
|
|
40
|
+
explain(path: string): Record<string, unknown>;
|
|
41
|
+
set(path: string, value: unknown, options?: SetOptions): OmniResult;
|
|
42
|
+
setObj(obj: Record<string, unknown>, pathPrefix?: string, options?: SetOptions): OmniResult;
|
|
43
|
+
canSet(path: string, value: unknown, options?: SetOptions): OmniResult;
|
|
44
|
+
private _setInternal;
|
|
45
|
+
get(path: string, options?: GetOptions): unknown;
|
|
46
|
+
getObj(path: string, options?: GetOptions): Record<string, unknown> | undefined;
|
|
47
|
+
getMany(paths: string[]): Record<string, unknown>;
|
|
48
|
+
has(path: string, types?: string[] | string): boolean;
|
|
49
|
+
exists(path: string): boolean;
|
|
50
|
+
isType(path: string, types: string[] | string): boolean;
|
|
51
|
+
isPlainObject(path: string): boolean;
|
|
52
|
+
delete(path: string, options?: SetOptions): OmniResult;
|
|
53
|
+
private deleteChildren;
|
|
54
|
+
batch(operationsOrObject: (() => void) | Record<string, unknown>, pathPrefix?: string, options?: BatchOptions): OmniResult;
|
|
55
|
+
subscribe(path: string, callback: Function, type?: SubscriberTiming): () => void;
|
|
56
|
+
subscribeTree(prefix: string, callback: Function, type?: SubscriberTiming): () => void;
|
|
57
|
+
subscribeGlobal(callback: (path: string, newValue: unknown, oldValue: unknown) => void, options?: {
|
|
58
|
+
throttle?: number;
|
|
59
|
+
once?: boolean;
|
|
60
|
+
}): () => void;
|
|
61
|
+
alert(path: string, callback: Function, options?: {
|
|
62
|
+
condition?: Function;
|
|
63
|
+
throttle?: number;
|
|
64
|
+
once?: boolean;
|
|
65
|
+
}): () => void;
|
|
66
|
+
coercer(path: string, callback: (path: string, value: unknown, oldValue?: unknown) => unknown, options?: {
|
|
67
|
+
condition?: Function;
|
|
68
|
+
throttle?: number;
|
|
69
|
+
once?: boolean;
|
|
70
|
+
}): () => void;
|
|
71
|
+
waitFor(keys: string | string[], exclude?: unknown[]): Promise<Record<string, unknown>>;
|
|
72
|
+
private checkWaiters;
|
|
73
|
+
toggle(path: string): boolean;
|
|
74
|
+
increment(path: string, amount?: number): number;
|
|
75
|
+
decrement(path: string, amount?: number): number;
|
|
76
|
+
undo(path: string): OmniResult;
|
|
77
|
+
clear(): void;
|
|
78
|
+
export(): Record<string, unknown>;
|
|
79
|
+
private invalidateObjCache;
|
|
80
|
+
}
|
|
81
|
+
export default Omni;
|
|
82
|
+
//# sourceMappingURL=Omni.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Omni.d.ts","sourceRoot":"","sources":["../src/Omni.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAsB,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACxH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAA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