umf-codegen 0.10.8__py3-none-any.whl

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.
umf_codegen/_writer.py ADDED
@@ -0,0 +1,194 @@
1
+ # SPDX-License-Identifier: MIT OR Apache-2.0
2
+ """Inventory-checked filesystem publication; independent of schema semantics."""
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import json
7
+ import os
8
+ import shutil
9
+ import tempfile
10
+ from collections.abc import Callable, Mapping
11
+ from pathlib import Path
12
+
13
+ from . import PythonClientResult
14
+
15
+
16
+ class OutputError(ValueError):
17
+ def __init__(self, code: str, message: str, *, written: bool = False, recovery: str | None = None):
18
+ self.code, self.written, self.recovery = code, written, recovery
19
+ super().__init__(message)
20
+
21
+
22
+ def _digest(raw: bytes) -> str:
23
+ return hashlib.sha256(raw).hexdigest()
24
+
25
+
26
+ def _safe(path: object) -> bool:
27
+ return (type(path) is str and bool(path) and not path.startswith("/")
28
+ and "\\" not in path and "\x00" not in path and ":" not in path
29
+ and all(part not in ("", ".", "..") for part in path.split("/")))
30
+
31
+
32
+ def _inventory(raw: bytes | None, package: str, reserved: set[str]) -> dict[str, str]:
33
+ manifest = package + "/_umf/manifest.json"
34
+ if raw is None:
35
+ raise OutputError("OUTPUT_CHANGED", "Missing original inventory")
36
+ try:
37
+ entries = json.loads(raw)["inventory"]
38
+ if type(entries) is not list:
39
+ raise ValueError
40
+ result = {}
41
+ for entry in entries:
42
+ path, digest = entry["path"], entry["sha256"]
43
+ if (not _safe(path) or not path.startswith(package + "/") or path == manifest
44
+ or path in reserved or path in result or type(digest) is not str
45
+ or len(digest) != 64 or any(c not in "0123456789abcdef" for c in digest)):
46
+ raise ValueError
47
+ result[path] = digest
48
+ return result
49
+ except (ValueError, TypeError, KeyError):
50
+ raise OutputError("OUTPUT_CHANGED", "Missing or invalid original inventory") from None
51
+
52
+
53
+ def _candidate(result: PythonClientResult) -> tuple[dict[str, bytes], str, set[str]]:
54
+ files = {}
55
+ package = None
56
+ for item in result["files"]:
57
+ path, text = item["path"], item["text"]
58
+ if not _safe(path) or "/" not in path or path in files or type(text) is not str:
59
+ raise OutputError("INVALID_CANDIDATE", "Unsafe or duplicate generated path")
60
+ prefix = path.split("/")[0]
61
+ if package is None:
62
+ package = prefix
63
+ if prefix != package:
64
+ raise OutputError("INVALID_CANDIDATE", "Expected one generated package")
65
+ raw = text.encode("utf-8")
66
+ if _digest(raw) != item["sha256"]:
67
+ raise OutputError("INVALID_CANDIDATE", "Generated content digest differs")
68
+ files[path] = raw
69
+ if not package:
70
+ raise OutputError("INVALID_CANDIDATE", "Nonempty generated package required")
71
+ reserved = {package + path for path in ("/queries.py", "/_umf/catalog.json", "/_umf/catalog-manifest.json", "/_umf/privileges.json")}
72
+ manifest = package + "/_umf/manifest.json"
73
+ if set(files) & reserved:
74
+ raise OutputError("INVALID_CANDIDATE", "Compiler-owned output cannot be generated here")
75
+ inventory = _inventory(files.get(manifest), package, reserved)
76
+ if len(inventory) != len(files) - 1 or any(inventory.get(path) != _digest(raw) for path, raw in files.items() if path != manifest):
77
+ raise OutputError("INVALID_CANDIDATE", "Generated inventory differs")
78
+ return files, package, reserved
79
+
80
+
81
+ def _path(destination: str | Path) -> Path:
82
+ path = Path(os.path.abspath(destination))
83
+ if path == path.parent:
84
+ raise OutputError("OUTPUT_CHANGED", "Filesystem root cannot be an output directory")
85
+ for parent in (path, *path.parents):
86
+ if parent.is_symlink() or parent.exists() and not parent.is_dir():
87
+ raise OutputError("OUTPUT_CHANGED", "Output ancestors must be ordinary directories")
88
+ return path
89
+
90
+
91
+ def _tree(root: Path) -> dict[str, bytes]:
92
+ if not root.exists():
93
+ return {}
94
+ if root.is_symlink() or not root.is_dir():
95
+ raise OutputError("OUTPUT_CHANGED", "Output must be an ordinary directory")
96
+ result = {}
97
+ pending = [root]
98
+ while pending:
99
+ for path in pending.pop().iterdir():
100
+ if path.is_symlink():
101
+ raise OutputError("OUTPUT_CHANGED", "Output symlinks are not permitted")
102
+ if path.is_dir():
103
+ pending.append(path)
104
+ elif path.is_file():
105
+ result[path.relative_to(root).as_posix()] = path.read_bytes()
106
+ else:
107
+ raise OutputError("OUTPUT_CHANGED", "Output must contain ordinary files")
108
+ return result
109
+
110
+
111
+ def check_package(destination: str | Path, result: PythonClientResult) -> list[str]:
112
+ """Read-only comparison; no output, parent, staging or lock creation."""
113
+ candidate, _, reserved = _candidate(result)
114
+ current = _tree(_path(destination))
115
+ return sorted(path for path in current.keys() | candidate.keys()
116
+ if path not in reserved and current.get(path) != candidate.get(path))
117
+
118
+
119
+ def write_package(destination: str | Path, result: PythonClientResult,
120
+ *, fault: Callable[[str], None] | None = None) -> None:
121
+ """Publish one complete package, refusing original-output changes."""
122
+ candidate, package, reserved = _candidate(result)
123
+ path = _path(destination)
124
+ path.parent.mkdir(parents=True, exist_ok=True)
125
+ _path(path)
126
+ lock = path.parent / (".umf-codegen-" + _digest(str(path).encode())[:24] + ".lock")
127
+ try:
128
+ lock.mkdir()
129
+ except FileExistsError:
130
+ raise OutputError("OUTPUT_BUSY", "Another generator holds the output lock") from None
131
+ completed = False
132
+ try:
133
+ _write_locked(path, candidate, package, reserved, fault)
134
+ completed = True
135
+ finally:
136
+ try:
137
+ lock.rmdir()
138
+ except OSError:
139
+ if completed:
140
+ raise OutputError("WRITE_FAILED", "Output installed but lock cleanup failed", written=True) from None
141
+
142
+
143
+ def _write_locked(path: Path, candidate: Mapping[str, bytes], package: str,
144
+ reserved: set[str], fault: Callable[[str], None] | None) -> None:
145
+ exists = path.exists()
146
+ original = _tree(path)
147
+ if exists:
148
+ manifest = package + "/_umf/manifest.json"
149
+ inventory = _inventory(original.get(manifest), package, reserved)
150
+ owned = {name: raw for name, raw in original.items() if name != manifest and name not in reserved}
151
+ if len(owned) != len(inventory) or any(inventory.get(name) != _digest(raw) for name, raw in owned.items()):
152
+ raise OutputError("OUTPUT_CHANGED", "Existing output differs from its original inventory")
153
+ staging = Path(tempfile.mkdtemp(prefix=".umf-codegen-stage-", dir=path.parent))
154
+ next_path, backup = staging / "next", staging / "previous"
155
+ moved = written = False
156
+ def step(name: str) -> None:
157
+ if fault is not None:
158
+ fault(name)
159
+ try:
160
+ next_path.mkdir()
161
+ for name, raw in {**candidate, **{n: b for n, b in original.items() if n in reserved}}.items():
162
+ target = next_path / name
163
+ target.parent.mkdir(parents=True, exist_ok=True)
164
+ target.write_bytes(raw)
165
+ step("before-swap")
166
+ _path(path)
167
+ if path.exists() != exists or _tree(path) != original:
168
+ raise OutputError("OUTPUT_CHANGED", "Output changed while staging")
169
+ if exists:
170
+ step("before-backup-rename")
171
+ os.replace(path, backup)
172
+ moved = True
173
+ try:
174
+ step("before-install-rename")
175
+ os.replace(next_path, path)
176
+ written = True
177
+ except BaseException:
178
+ if moved:
179
+ try:
180
+ step("before-restore-rename")
181
+ os.replace(backup, path)
182
+ moved = False
183
+ except BaseException: # noqa: BLE001 -- retain recovery state even after interruption
184
+ raise OutputError("WRITE_UNRESOLVED", "Installation and restoration failed; original backup retained",
185
+ recovery=str(staging)) from None
186
+ raise
187
+ step("after-swap")
188
+ except OutputError:
189
+ raise
190
+ except Exception as error:
191
+ raise OutputError("WRITE_FAILED", "Output publication failed", written=written) from error
192
+ finally:
193
+ if not moved or written:
194
+ shutil.rmtree(staging, ignore_errors=True)
umf_codegen/py.typed ADDED
File without changes
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: umf-codegen
3
+ Version: 0.10.8
4
+ Summary: UMF typed Python client generation backed by the native Rust compiler
5
+ License-Expression: MIT OR Apache-2.0
6
+ License-File: LICENSE-APACHE
7
+ License-File: LICENSE-MIT
8
+ License-File: LICENSE.md
9
+ Requires-Python: <3.15,>=3.11
10
+ Requires-Dist: umf-core==0.10.8
11
+ Description-Content-Type: text/markdown
12
+
13
+ # UMF Python client generator
14
+
15
+ `umf-codegen` exposes Python client and pack generation, deployment, migration,
16
+ verification, change discovery, and row-scope operations through the native
17
+ Rust compiler in `umf-core==0.10.7`. The package requires that exact core
18
+ release and checks its native ABI and codegen protocol before use. It has no
19
+ JavaScript or V8 runtime dependency.
20
+
21
+ ```sh
22
+ python -m umf_codegen generate --schema plugin.json --package plugin_client --output generated
23
+ python -m umf_codegen check --schema plugin.json --package plugin_client --output generated
24
+ ```
25
+
26
+ `check` is read-only and exits nonzero for drift or refusal. `generate` refuses
27
+ hand-edited output and unsafe paths. At build and runtime, the package checks a
28
+ pinned manifest covering exactly ten compiler resources. Five shared core
29
+ resources are also byte-compared with the installed `umf-core` wheel; an
30
+ incoherent package pair fails with `ENGINE_UNAVAILABLE` and has no fallback.
31
+
32
+ Each public compiler call uses the `umf` CLI binary packaged inside the pinned
33
+ `umf-core` wheel. The package resolves that exact resource and checks the CLI
34
+ capability protocol, input and output wire protocols, and all ten resource
35
+ hashes before compiling. Missing binaries and mismatched identities fail with
36
+ `ENGINE_UNAVAILABLE`; it never searches `PATH` or the current directory.
37
+
38
+ The parent enforces one monotonic deadline across request validation and
39
+ serialization, CLI startup, compilation, and result decoding. It bounds JSON
40
+ stdin to 32 MiB and stdout to 64 MiB, kills and reaps a timed-out process, and
41
+ returns no partial result. The native CLI caps its live Rust-managed
42
+ allocations at 512 MiB. That allocator budget does not cap Python memory or
43
+ total process RSS. The 64 MiB wire response limit is a serialized-byte bound;
44
+ Python's JSON parser and result objects may use more memory while decoding it.
45
+ JSON parsing cannot be interrupted, so an expired deadline is reported
46
+ immediately after parsing and throughout result conversion.
47
+ Calls accept timeouts greater than zero and up to 60 seconds. The native
48
+ binary must be present and pass the installed-wheel qualification before the
49
+ platform is considered supported.
50
+
51
+ The same package exposes inert deployment, migration, verification, and
52
+ reviewed change discovery APIs:
53
+
54
+ ```python
55
+ from umf_codegen import (
56
+ compile_table_migration,
57
+ discover_table_migration_changes,
58
+ verify_table_migration,
59
+ )
60
+
61
+ result = compile_table_migration(
62
+ migration_id="001", predecessor=None,
63
+ previous_bundle=None, next_bundle=deployment_bundle,
64
+ )
65
+ if result["status"] == "compiled":
66
+ plan = verify_table_migration(result["plan"])
67
+
68
+ candidates = discover_table_migration_changes(previous_bundle, next_bundle)
69
+ # G03 default-change discovery is opt-in; omitting options preserves the
70
+ # historical candidate set and request shape.
71
+ default_candidates = discover_table_migration_changes(
72
+ previous_bundle, next_bundle,
73
+ options={"version": "umf.table-migration-discovery/0.2"},
74
+ )
75
+ reviewed_changes = [
76
+ {key: candidate[key] for key in ("id", "kind", "path", "oldDigest", "newDigest")}
77
+ for candidate in default_candidates
78
+ ]
79
+ ```
80
+
81
+ Discovery recompiles and verifies both complete deployment bundles. Candidate
82
+ `oldValue` and `newValue` fields explain the change; submit only the five marker
83
+ fields shown above. A supported type conversion additionally requires the
84
+ explicit `conversion: "pg-cast-v1"` choice. Candidates identify source changes,
85
+ but do not grant execution authority or make unsupported changes executable.
86
+
87
+ Migration plan 0.1 remains the historical bootstrap/additive profile. Migration
88
+ plan 0.2 is a bounded existing-table evolution profile requiring an installed
89
+ predecessor and stable table inventory. It uses explicit backfill, concurrent
90
+ index, validation, and reviewed-change selections. Plans retain complete before
91
+ and after source bundles and require digest-bound host approval. Verification
92
+ checks source/plan consistency; it cannot authenticate a supplied predecessor,
93
+ apply DDL, or establish installed ledger authority. Native application belongs
94
+ to the separately installed host runtime.
95
+
96
+ First-party files use MIT OR Apache-2.0. The native core wheel retains its own
97
+ license and third-party notices.
98
+
99
+ ## Pack tools
100
+
101
+ Install the `umf-codegen==0.10.7` wheel from the matching UMF GitHub release
102
+ alongside `umf-core==0.10.7`. Call `generate_pack_tools(request)` with a complete
103
+ `umf.pack-tools/1` request to generate PostgreSQL schema DDL, SQLAlchemy models and
104
+ caller-session Python CRUD. Original schema text and unsupported declarations
105
+ remain in source companions and diagnostics; the package never executes JavaScript.
@@ -0,0 +1,25 @@
1
+ umf_codegen/__init__.py,sha256=VhytIDhXCWbA8UkqRgdsbMa5sUY855K_UsoDF-rfdF8,7225
2
+ umf_codegen/__main__.py,sha256=qDnBjMKPvOVJjoihAFfGQi5MKT63GfOaF_-gOXaeM6Y,2078
3
+ umf_codegen/_embedded.py,sha256=ETfEeGAGYeN8IwJ0DDxWwbUEySn2E9B1ioi7dZ4WfFc,121
4
+ umf_codegen/_native.py,sha256=v4jIi21zvPGYvHhj1hfAjQDj5y840DJAP9xl-s3q4rY,20734
5
+ umf_codegen/_release.py,sha256=uduSYsxifdb4kdFJDNRelWNTPT_8JINOb24doksDClM,399
6
+ umf_codegen/_writer.py,sha256=YaMO9JulMv3_CfT4bemFtSfct-D2x3e8PzhtVFx5III,8411
7
+ umf_codegen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ umf_codegen/_resources/actions.package.json,sha256=WnhzY993uT0ip4X7O-xxHivx7NJeF-IVXCzm6ArE4YE,11497
9
+ umf_codegen/_resources/binding.package.json,sha256=8zJlM9zz0iJ5VbriJhqwBer4aS4onHRh8gFf1AVlp48,8840
10
+ umf_codegen/_resources/core.constraints.json,sha256=GASX2gmnbLvvUzLSNCWJNmaOBvcVLxGdS-eu6_prOcw,190431
11
+ umf_codegen/_resources/core.domain-policy.json,sha256=TXQlBeSD0j9-9gzJBLRapE23NHPHGpjgGpGfKJxBSpw,14827
12
+ umf_codegen/_resources/core.package-schema.json,sha256=_KJKhxq_g-iYN7-IG8UlGxpxq5hBH6UFWvEuG90A_aU,45001
13
+ umf_codegen/_resources/core.reference-schema.json,sha256=SpkIgQUxzO1iCCifid_LwulAbDA4NKJ0lZHL6CPKP2U,45463
14
+ umf_codegen/_resources/core.schema.json,sha256=9ffwkOakYYgDw-D9uwviCtYq4JLJnw1-DxWmcz1nqr8,45342
15
+ umf_codegen/_resources/manifest.json,sha256=Xr1R8QlnuhqS7YJ4TO8Bfs4GYzqxWBVcJiR3MvZBg34,961
16
+ umf_codegen/_resources/saga.package.json,sha256=T0LXPv4VBBgH90Ax4SATxt-EPRJVYQWnr_NXoJVqiUA,14864
17
+ umf_codegen/_resources/stable-binding.package.json,sha256=BVCuhtDPB_nmH7eLuzou6zcIOGgaFIOxCIQJ3a6wYx4,8885
18
+ umf_codegen/_resources/tables.package.json,sha256=vuuHSSFrINmCEXAMCoHN0hCx6upAYPeugbipHwYdoY0,23817
19
+ umf_codegen-0.10.8.dist-info/METADATA,sha256=1lvMlPQyMxQIVyIFniHf-pKXkQhZ5IYmKtT1wrEt9-4,5027
20
+ umf_codegen-0.10.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
21
+ umf_codegen-0.10.8.dist-info/entry_points.txt,sha256=5S_vzgEm0Gsj1kqIrIsaYILFKK2LjZ_vuyp_IuNWYII,58
22
+ umf_codegen-0.10.8.dist-info/licenses/LICENSE-APACHE,sha256=p_CX8otHF21J3dwIZXXSTZQUlJP1uOm7gpoO7j66dO4,11359
23
+ umf_codegen-0.10.8.dist-info/licenses/LICENSE-MIT,sha256=8UCf_Q3_Rx-fUHjI8swsBwFH2q4xl4EiNLWRnB-CBwI,1086
24
+ umf_codegen-0.10.8.dist-info/licenses/LICENSE.md,sha256=dt-4eu0iGAVizuYYAJYRfmWeZtEwKFxWpn1fCaeI4OU,13013
25
+ umf_codegen-0.10.8.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ umf-codegen = umf_codegen.__main__:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
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 DocumentDrivenDX contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DocumentDrivenDX contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.