@agent-teams/repository-mutation 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/README.md +10 -0
- package/dist/canonical-json.d.ts +12 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +137 -0
- package/dist/canonical-json.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/installed-artifact-identity.d.ts +15 -0
- package/dist/installed-artifact-identity.d.ts.map +1 -0
- package/dist/installed-artifact-identity.js +127 -0
- package/dist/installed-artifact-identity.js.map +1 -0
- package/dist/node.d.ts +29 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +19 -0
- package/dist/node.js.map +1 -0
- package/dist/package-version.d.ts +3 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +11 -0
- package/dist/package-version.js.map +1 -0
- package/dist/qualification/index.d.ts +24 -0
- package/dist/qualification/index.d.ts.map +1 -0
- package/dist/qualification/index.js +11 -0
- package/dist/qualification/index.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.d.ts +19 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.js +74 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.d.ts +35 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.js +181 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts +23 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js +134 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.d.ts +26 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js +172 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.d.ts +14 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.js +23 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.d.ts +17 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.js +47 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.d.ts +37 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.js +244 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-existing-repository-ancestors.d.ts +13 -0
- package/dist/repository-mutation/adapters/node/node-existing-repository-ancestors.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-existing-repository-ancestors.js +67 -0
- package/dist/repository-mutation/adapters/node/node-existing-repository-ancestors.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.d.ts +84 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.js +232 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.js +2 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.d.ts +6 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.js +30 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.d.ts +11 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.js +159 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.js +22 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.js +203 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.d.ts +17 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.js +22 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts +28 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js +213 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.d.ts +15 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.js +51 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.d.ts +29 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.js +72 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.d.ts +31 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.js +254 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.d.ts +13 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.js +210 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.d.ts +15 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.js +181 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.d.ts +12 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.js +18 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts +25 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js +150 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts +12 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js +56 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts +22 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js +246 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-lease-release.d.ts +21 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-lease-release.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-lease-release.js +34 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-lease-release.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts +4 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js +43 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts +14 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js +109 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts +21 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js +215 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts +18 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js +30 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.d.ts +31 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.js +50 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-repository-path.d.ts +2 -0
- package/dist/repository-mutation/adapters/node/node-repository-path.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-repository-path.js +7 -0
- package/dist/repository-mutation/adapters/node/node-repository-path.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.d.ts +21 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.js +59 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.js.map +1 -0
- package/dist/repository-mutation/application/model/directory-materialization.d.ts +35 -0
- package/dist/repository-mutation/application/model/directory-materialization.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/directory-materialization.js +11 -0
- package/dist/repository-mutation/application/model/directory-materialization.js.map +1 -0
- package/dist/repository-mutation/application/model/exact-postimage.d.ts +17 -0
- package/dist/repository-mutation/application/model/exact-postimage.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/exact-postimage.js +11 -0
- package/dist/repository-mutation/application/model/exact-postimage.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts +69 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js +15 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts +64 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js +2 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/application/model/path-identity.d.ts +7 -0
- package/dist/repository-mutation/application/model/path-identity.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/path-identity.js +2 -0
- package/dist/repository-mutation/application/model/path-identity.js.map +1 -0
- package/dist/repository-mutation/application/model/repository-path.d.ts +8 -0
- package/dist/repository-mutation/application/model/repository-path.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/repository-path.js +74 -0
- package/dist/repository-mutation/application/model/repository-path.js.map +1 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.d.ts +33 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.js +21 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts +9 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js +214 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts +7 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js +253 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js.map +1 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.d.ts +7 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.d.ts.map +1 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.js +2 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.js.map +1 -0
- package/dist/repository-mutation-envelope.d.ts +32 -0
- package/dist/repository-mutation-envelope.d.ts.map +1 -0
- package/dist/repository-mutation-envelope.js +292 -0
- package/dist/repository-mutation-envelope.js.map +1 -0
- package/dist/state-contract.d.ts +6 -0
- package/dist/state-contract.d.ts.map +1 -0
- package/dist/state-contract.js +6 -0
- package/dist/state-contract.js.map +1 -0
- package/dist/strict-json.d.ts +7 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +131 -0
- package/dist/strict-json.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-evidence.d.ts +29 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-evidence.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-evidence.js +139 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-evidence.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-profile.d.ts +151 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-profile.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-profile.js +29 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-profile.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-store.d.ts +25 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-store.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-store.js +303 -0
- package/dist/transaction-coordination/adapters/node/node-journal-slot-store.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-operation-lock.d.ts +16 -0
- package/dist/transaction-coordination/adapters/node/node-operation-lock.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-operation-lock.js +359 -0
- package/dist/transaction-coordination/adapters/node/node-operation-lock.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-state-directory.d.ts +11 -0
- package/dist/transaction-coordination/adapters/node/node-state-directory.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-state-directory.js +91 -0
- package/dist/transaction-coordination/adapters/node/node-state-directory.js.map +1 -0
- package/dist/transaction-coordination/mutation-lease.d.ts +38 -0
- package/dist/transaction-coordination/mutation-lease.d.ts.map +1 -0
- package/dist/transaction-coordination/mutation-lease.js +351 -0
- package/dist/transaction-coordination/mutation-lease.js.map +1 -0
- package/package.json +52 -0
- package/schemas/known-file-transaction-plan/v1.schema.json +65 -0
- package/schemas/known-file-transaction-receipt/v1.schema.json +36 -0
- package/schemas/repository-mutation-transaction-envelope/v1.schema.json +46 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
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 [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Repository Mutation
|
|
2
|
+
|
|
3
|
+
`@agent-teams/repository-mutation` is the zero-monorepo-dependency leaf for the
|
|
4
|
+
cooperative repository operation lock, bounded state evidence, closed known-file
|
|
5
|
+
transactions, exact receipts, and exact-artifact recovery.
|
|
6
|
+
|
|
7
|
+
Standalone callers protect the shared lock and common transaction evidence. They
|
|
8
|
+
do not classify an unaccompanied Engineering Foundation local-mode backup; full
|
|
9
|
+
Foundation local-mode admission remains the responsibility of Foundation's
|
|
10
|
+
composition wrapper.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CanonicalJsonPrimitive = boolean | null | number | string;
|
|
2
|
+
export type CanonicalJsonValue = CanonicalJsonPrimitive | readonly CanonicalJsonValue[] | {
|
|
3
|
+
readonly [key: string]: CanonicalJsonValue;
|
|
4
|
+
};
|
|
5
|
+
export declare class CanonicalJsonError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function canonicalJson(value: CanonicalJsonValue): string;
|
|
9
|
+
export declare function sha256Bytes(value: Uint8Array): `sha256:${string}`;
|
|
10
|
+
export declare function sha256Text(value: string): `sha256:${string}`;
|
|
11
|
+
export declare function sha256Json(value: CanonicalJsonValue): `sha256:${string}`;
|
|
12
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAC1B,sBAAsB,GACtB,SAAS,kBAAkB,EAAE,GAC7B;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAEnD,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAmB,OAAO,EAAE,MAAM,EAGjC;CACF;AA8JD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAE/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,MAAM,EAAE,CAEjE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,MAAM,EAAE,CAE5D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,UAAU,MAAM,EAAE,CAExE"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export class CanonicalJsonError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "CanonicalJsonError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function compareStrings(left, right) {
|
|
9
|
+
if (left < right) {
|
|
10
|
+
return -1;
|
|
11
|
+
}
|
|
12
|
+
if (left > right) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
function assertCanonicalString(value) {
|
|
18
|
+
if (value.normalize("NFC") !== value) {
|
|
19
|
+
throw new CanonicalJsonError("Canonical JSON strings must use NFC normalization.");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function invalidContainer(message) {
|
|
23
|
+
throw new CanonicalJsonError(`Canonical JSON ${message}.`);
|
|
24
|
+
}
|
|
25
|
+
function enterContainer(value, ancestors) {
|
|
26
|
+
if (ancestors.has(value)) {
|
|
27
|
+
invalidContainer("must not contain cycles");
|
|
28
|
+
}
|
|
29
|
+
ancestors.add(value);
|
|
30
|
+
return () => ancestors.delete(value);
|
|
31
|
+
}
|
|
32
|
+
function canonicalizeArray(value, ancestors) {
|
|
33
|
+
const leave = enterContainer(value, ancestors);
|
|
34
|
+
try {
|
|
35
|
+
if (Object.getPrototypeOf(value) !== Array.prototype) {
|
|
36
|
+
invalidContainer("arrays must use the intrinsic Array prototype");
|
|
37
|
+
}
|
|
38
|
+
const keys = Reflect.ownKeys(value);
|
|
39
|
+
if (keys.some((key) => typeof key !== "string" ||
|
|
40
|
+
(key !== "length" && !/^(?:0|[1-9][0-9]*)$/u.test(key)))) {
|
|
41
|
+
invalidContainer("arrays must not contain extra or symbolic properties");
|
|
42
|
+
}
|
|
43
|
+
const lengthDescriptor = Object.getOwnPropertyDescriptor(value, "length");
|
|
44
|
+
if (lengthDescriptor === undefined ||
|
|
45
|
+
!("value" in lengthDescriptor) ||
|
|
46
|
+
typeof lengthDescriptor.value !== "number") {
|
|
47
|
+
invalidContainer("arrays must expose an own data length");
|
|
48
|
+
}
|
|
49
|
+
const length = lengthDescriptor.value;
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
if (typeof key === "string" &&
|
|
52
|
+
key !== "length" &&
|
|
53
|
+
BigInt(key) >= BigInt(length)) {
|
|
54
|
+
invalidContainer("array indexes must be within the declared length");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const items = [];
|
|
58
|
+
for (let index = 0; index < length; index += 1) {
|
|
59
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
60
|
+
if (descriptor === undefined ||
|
|
61
|
+
!("value" in descriptor) ||
|
|
62
|
+
descriptor.enumerable !== true) {
|
|
63
|
+
invalidContainer("arrays must be dense own-data sequences");
|
|
64
|
+
}
|
|
65
|
+
items.push(canonicalize(descriptor.value, ancestors));
|
|
66
|
+
}
|
|
67
|
+
return `[${items.join(",")}]`;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
leave();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function canonicalizeObject(candidate, ancestors) {
|
|
74
|
+
const prototype = Object.getPrototypeOf(candidate);
|
|
75
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
76
|
+
invalidContainer("objects must have a plain or null prototype");
|
|
77
|
+
}
|
|
78
|
+
const leave = enterContainer(candidate, ancestors);
|
|
79
|
+
try {
|
|
80
|
+
const entries = Reflect.ownKeys(candidate).map((key) => {
|
|
81
|
+
if (typeof key !== "string") {
|
|
82
|
+
invalidContainer("objects must not contain symbolic properties");
|
|
83
|
+
}
|
|
84
|
+
const descriptor = Object.getOwnPropertyDescriptor(candidate, key);
|
|
85
|
+
if (descriptor === undefined ||
|
|
86
|
+
!("value" in descriptor) ||
|
|
87
|
+
descriptor.enumerable !== true) {
|
|
88
|
+
invalidContainer("objects must contain only enumerable own-data properties");
|
|
89
|
+
}
|
|
90
|
+
assertCanonicalString(key);
|
|
91
|
+
return [key, descriptor.value];
|
|
92
|
+
});
|
|
93
|
+
entries.sort(([left], [right]) => compareStrings(left, right));
|
|
94
|
+
return `{${entries
|
|
95
|
+
.map(([key, item]) => `${JSON.stringify(key)}:${canonicalize(item, ancestors)}`)
|
|
96
|
+
.join(",")}}`;
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
leave();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function canonicalize(value, ancestors) {
|
|
103
|
+
if (value === null || typeof value === "boolean") {
|
|
104
|
+
return JSON.stringify(value);
|
|
105
|
+
}
|
|
106
|
+
if (typeof value === "string") {
|
|
107
|
+
assertCanonicalString(value);
|
|
108
|
+
return JSON.stringify(value);
|
|
109
|
+
}
|
|
110
|
+
if (typeof value === "number") {
|
|
111
|
+
if (!Number.isFinite(value) ||
|
|
112
|
+
!Number.isSafeInteger(value)) {
|
|
113
|
+
throw new CanonicalJsonError("Canonical JSON numbers must be finite safe integers.");
|
|
114
|
+
}
|
|
115
|
+
return JSON.stringify(value);
|
|
116
|
+
}
|
|
117
|
+
if (typeof value !== "object") {
|
|
118
|
+
invalidContainer("values must use the closed JSON data model");
|
|
119
|
+
}
|
|
120
|
+
if (Array.isArray(value)) {
|
|
121
|
+
return canonicalizeArray(value, ancestors);
|
|
122
|
+
}
|
|
123
|
+
return canonicalizeObject(value, ancestors);
|
|
124
|
+
}
|
|
125
|
+
export function canonicalJson(value) {
|
|
126
|
+
return canonicalize(value, new WeakSet());
|
|
127
|
+
}
|
|
128
|
+
export function sha256Bytes(value) {
|
|
129
|
+
return `sha256:${createHash("sha256").update(value).digest("hex")}`;
|
|
130
|
+
}
|
|
131
|
+
export function sha256Text(value) {
|
|
132
|
+
return sha256Bytes(Buffer.from(value, "utf8"));
|
|
133
|
+
}
|
|
134
|
+
export function sha256Json(value) {
|
|
135
|
+
return sha256Text(canonicalJson(value));
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=canonical-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.js","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,KAAa;IACjD,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;QACrC,MAAM,IAAI,kBAAkB,CAC1B,oDAAoD,CACrD,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,IAAI,kBAAkB,CAAC,kBAAkB,OAAO,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,cAAc,CACrB,KAAa,EACb,SAA0B;IAE1B,IA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Code = "MUTATION_CLAIM_INVALID" | "MUTATION_LEASE_INVALID" | "MUTATION_STATE_INVALID";
|
|
2
|
+
export declare class RepositoryMutationError extends Error {
|
|
3
|
+
readonly code: RepositoryMutationErrorCode;
|
|
4
|
+
constructor(code: RepositoryMutationErrorCode, message: string, options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GACnC,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,CAAC;AAE7B,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAE3C,YAAY,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAIrF;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,IAAI,CAA8B;IAE3C,YAAY,IAAiC,EAAE,OAAe,EAAE,OAAsB;QACpF,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { canonicalJson, sha256Bytes, sha256Json, sha256Text, CanonicalJsonError } from "./canonical-json.js";
|
|
2
|
+
export type { CanonicalJsonPrimitive, CanonicalJsonValue } from "./canonical-json.js";
|
|
3
|
+
export { parseStrictJson, StrictJsonError } from "./strict-json.js";
|
|
4
|
+
export type { StrictJsonFailure } from "./strict-json.js";
|
|
5
|
+
export { assertRepositoryMutationArtifactBindings, compileRepositoryMutationEnvelope, parseRepositoryMutationEnvelope, REPOSITORY_MUTATION_ENVELOPE_FORMAT, RepositoryMutationEnvelopeError } from "./repository-mutation-envelope.js";
|
|
6
|
+
export type { CompileRepositoryMutationEnvelopeInput, RepositoryMutationArtifactIdentity, RepositoryMutationEnvelope } from "./repository-mutation-envelope.js";
|
|
7
|
+
export { RepositoryMutationError } from "./errors.js";
|
|
8
|
+
export type { RepositoryMutationErrorCode } from "./errors.js";
|
|
9
|
+
export type { MutationClaim } from "./transaction-coordination/mutation-lease.js";
|
|
10
|
+
export { computeInstalledArtifactBuildIdentity, installedRepositoryMutationBuildIdentity } from "./installed-artifact-identity.js";
|
|
11
|
+
export type { InstalledArtifactClosure, InstalledArtifactDigest } from "./installed-artifact-identity.js";
|
|
12
|
+
export { installedRepositoryMutationVersion, REPOSITORY_MUTATION_PACKAGE_NAME } from "./package-version.js";
|
|
13
|
+
export type { BoundDirectoryCreation, CapturedDirectory, DirectoryCreatePolicy, DirectoryMaterializationProjection, DirectoryMutationErrorCode, ProjectedDirectory, UnboundDirectoryCreationRecovery } from "./repository-mutation/application/model/directory-materialization.js";
|
|
14
|
+
export type { PortablePathIdentity } from "./repository-mutation/application/model/path-identity.js";
|
|
15
|
+
export { assertKnownFileTransactionPlan, compileKnownFileTransactionPlan, KnownFileTransactionPlanError } from "./repository-mutation/application/policies/known-file-transaction-plan.js";
|
|
16
|
+
export { applyKnownFileTransaction, canonicalKnownFileTransactionReceipt, KnownFileTransactionError } from "./repository-mutation/adapters/node/node-known-file-transaction.js";
|
|
17
|
+
export { recoverKnownFileTransaction } from "./repository-mutation/adapters/node/node-known-file-transaction-recovery.js";
|
|
18
|
+
export { inspectKnownFileTransactionBarrier } from "./repository-mutation/adapters/node/node-known-file-transaction-inspection.js";
|
|
19
|
+
export type { KnownFileTransactionBarrierInspection } from "./repository-mutation/adapters/node/node-known-file-transaction-inspection.js";
|
|
20
|
+
export type { CompileKnownFileTransactionPlanInput, KnownFileDigest, KnownFileImageV1, KnownFilePreconditionV1, KnownFileTransactionOperationInput, KnownFileTransactionOperationOutcome, KnownFileTransactionOperationV1, KnownFileTransactionPlanV1, KnownFileTransactionReceiptV1 } from "./repository-mutation/application/model/known-file-transaction.js";
|
|
21
|
+
export type { KnownFileTransactionEnvelopeV1, KnownFileTransactionJournalOperationV1, KnownFileTransactionJournalV1, KnownFileTransactionPortableIdentityV1, KnownFileTransactionRetirementV1, } from "./repository-mutation/application/model/known-file-transaction-journal.js";
|
|
22
|
+
export { portableRepositoryPathIdentity, portableRepositoryPathProblem } from "./repository-mutation/application/model/repository-path.js";
|
|
23
|
+
export type { PortableRepositoryPathProblem } from "./repository-mutation/application/model/repository-path.js";
|
|
24
|
+
export { assertKnownFileTransactionEnvelope } from "./repository-mutation/application/policies/known-file-transaction-envelope.js";
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EACL,wCAAwC,EACxC,iCAAiC,EACjC,+BAA+B,EAC/B,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,sCAAsC,EACtC,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,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AE,kCAAkC,EAAE,MAAM,+EAA+E,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { canonicalJson, sha256Bytes, sha256Json, sha256Text, CanonicalJsonError } from "./canonical-json.js";
|
|
2
|
+
export { parseStrictJson, StrictJsonError } from "./strict-json.js";
|
|
3
|
+
export { assertRepositoryMutationArtifactBindings, compileRepositoryMutationEnvelope, parseRepositoryMutationEnvelope, REPOSITORY_MUTATION_ENVELOPE_FORMAT, RepositoryMutationEnvelopeError } from "./repository-mutation-envelope.js";
|
|
4
|
+
export { RepositoryMutationError } from "./errors.js";
|
|
5
|
+
export { computeInstalledArtifactBuildIdentity, installedRepositoryMutationBuildIdentity } from "./installed-artifact-identity.js";
|
|
6
|
+
export { installedRepositoryMutationVersion, REPOSITORY_MUTATION_PACKAGE_NAME } from "./package-version.js";
|
|
7
|
+
export { assertKnownFileTransactionPlan, compileKnownFileTransactionPlan, KnownFileTransactionPlanError } from "./repository-mutation/application/policies/known-file-transaction-plan.js";
|
|
8
|
+
export { applyKnownFileTransaction, canonicalKnownFileTransactionReceipt, KnownFileTransactionError } from "./repository-mutation/adapters/node/node-known-file-transaction.js";
|
|
9
|
+
export { recoverKnownFileTransaction } from "./repository-mutation/adapters/node/node-known-file-transaction-recovery.js";
|
|
10
|
+
export { inspectKnownFileTransactionBarrier } from "./repository-mutation/adapters/node/node-known-file-transaction-inspection.js";
|
|
11
|
+
export { portableRepositoryPathIdentity, portableRepositoryPathProblem } from "./repository-mutation/application/model/repository-path.js";
|
|
12
|
+
export { assertKnownFileTransactionEnvelope } from "./repository-mutation/application/policies/known-file-transaction-envelope.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EACL,wCAAwC,EACxC,iCAAiC,EACjC,+BAA+B,EAC/B,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,mCAAmC,CAAC;AAM3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,qCAAqC,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAEnI,OAAO,EAAE,kCAAkC,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAO5G,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,2EAA2E,CAAC;AAC3L,OAAO,EAAE,yBAAyB,EAAE,oCAAoC,EAAE,yBAAyB,EAAE,MAAM,oEAAoE,CAAC;AAChL,OAAO,EAAE,2BAA2B,EAAE,MAAM,6EAA6E,CAAC;AAC1H,OAAO,EAAE,kCAAkC,EAAE,MAAM,+EAA+E,CAAC;AAgBnI,OAAO,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAC;AAE3I,OAAO,EAAE,kCAAkC,EAAE,MAAM,+EAA+E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type InstalledArtifactDigest = `sha256:${string}`;
|
|
2
|
+
export interface InstalledArtifactClosure {
|
|
3
|
+
readonly packageRoot: string;
|
|
4
|
+
readonly roots: readonly ("assets" | "contract" | "dist" | "presets" | "schemas")[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Derives an identity from the installed package manifest, executable
|
|
8
|
+
* JavaScript, and every shipped schema/preset contract. Length-prefixed paths and bytes
|
|
9
|
+
* make the digest independent of directory enumeration and installation path.
|
|
10
|
+
*/
|
|
11
|
+
export declare function computeInstalledArtifactBuildIdentity(declaration: InstalledArtifactClosure, limits?: {
|
|
12
|
+
readonly maximumVisitedEntries?: number;
|
|
13
|
+
}): Promise<InstalledArtifactDigest>;
|
|
14
|
+
export declare function installedRepositoryMutationBuildIdentity(): Promise<InstalledArtifactDigest>;
|
|
15
|
+
//# sourceMappingURL=installed-artifact-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-artifact-identity.d.ts","sourceRoot":"","sources":["../src/installed-artifact-identity.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,uBAAuB,GAAG,UAAU,MAAM,EAAE,CAAC;AACzD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;CACrF;AA8GD;;;;GAIG;AACH,wBAAsB,qCAAqC,CACzD,WAAW,EAAE,wBAAwB,EACrC,MAAM,GAAE;IAAE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,OAAO,CAAC,uBAAuB,CAAC,CA4BlC;AAID,wBAAgB,wCAAwC,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAM3F"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
3
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { readBoundedRegularFile } from "./repository-mutation/adapters/node/node-bounded-regular-file.js";
|
|
6
|
+
const maximumBuildFileBytes = 8 * 1024 * 1024;
|
|
7
|
+
const maximumBuildFiles = 4096;
|
|
8
|
+
const maximumBuildBytes = 64 * 1024 * 1024;
|
|
9
|
+
const maximumVisitedBuildEntries = 16_384;
|
|
10
|
+
const maximumBuildTreeDepth = 64;
|
|
11
|
+
const repositoryMutationPackageRoot = dirname(fileURLToPath(new URL("../package.json", import.meta.url)));
|
|
12
|
+
function comparePortablePaths(left, right) {
|
|
13
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
14
|
+
}
|
|
15
|
+
function portableRelativePath(root, path) {
|
|
16
|
+
return relative(root, path).split(sep).join("/");
|
|
17
|
+
}
|
|
18
|
+
async function collectRegularFiles(root, directory, output, budget) {
|
|
19
|
+
if (budget.depth > maximumBuildTreeDepth) {
|
|
20
|
+
throw new Error("Installed artifact tree is too deep.");
|
|
21
|
+
}
|
|
22
|
+
const entries = [];
|
|
23
|
+
const handle = await opendir(directory);
|
|
24
|
+
try {
|
|
25
|
+
for await (const entry of handle) {
|
|
26
|
+
budget.visited += 1;
|
|
27
|
+
if (budget.visited > budget.maximumVisited) {
|
|
28
|
+
throw new Error("Installed artifact contains too many entries.");
|
|
29
|
+
}
|
|
30
|
+
entries.push(entry);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
await handle.close().catch((error) => {
|
|
35
|
+
if (!(error instanceof Error &&
|
|
36
|
+
"code" in error &&
|
|
37
|
+
error.code === "ERR_DIR_CLOSED")) {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
entries.sort((left, right) => comparePortablePaths(left.name, right.name));
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
const path = join(directory, entry.name);
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
budget.depth += 1;
|
|
47
|
+
try {
|
|
48
|
+
await collectRegularFiles(root, path, output, budget);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
budget.depth -= 1;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (!entry.isFile()) {
|
|
56
|
+
throw new Error(`Installed artifact contains a non-regular entry: ${portableRelativePath(root, path)}.`);
|
|
57
|
+
}
|
|
58
|
+
output.push(path);
|
|
59
|
+
if (output.length > maximumBuildFiles) {
|
|
60
|
+
throw new Error("Installed artifact contains too many files.");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function assertRealDirectory(path) {
|
|
65
|
+
const metadata = await lstat(path);
|
|
66
|
+
if (metadata.isSymbolicLink() || !metadata.isDirectory()) {
|
|
67
|
+
throw new Error(`Installed artifact directory is unsafe: ${path}.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function buildIdentityFiles(declaration, maximumVisited) {
|
|
71
|
+
const files = [];
|
|
72
|
+
const budget = { depth: 0, maximumVisited, visited: 0 };
|
|
73
|
+
const root = declaration.packageRoot;
|
|
74
|
+
const manifest = join(root, "package.json");
|
|
75
|
+
for (const name of declaration.roots) {
|
|
76
|
+
const selected = join(root, name);
|
|
77
|
+
await assertRealDirectory(selected);
|
|
78
|
+
await collectRegularFiles(root, selected, files, budget);
|
|
79
|
+
}
|
|
80
|
+
files.push(manifest);
|
|
81
|
+
return files.toSorted((left, right) => comparePortablePaths(portableRelativePath(root, left), portableRelativePath(root, right)));
|
|
82
|
+
}
|
|
83
|
+
function hashLength(hash, length) {
|
|
84
|
+
const encoded = Buffer.allocUnsafe(8);
|
|
85
|
+
encoded.writeBigUInt64BE(BigInt(length));
|
|
86
|
+
hash.update(encoded);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Derives an identity from the installed package manifest, executable
|
|
90
|
+
* JavaScript, and every shipped schema/preset contract. Length-prefixed paths and bytes
|
|
91
|
+
* make the digest independent of directory enumeration and installation path.
|
|
92
|
+
*/
|
|
93
|
+
export async function computeInstalledArtifactBuildIdentity(declaration, limits = {}) {
|
|
94
|
+
const hash = createHash("sha256");
|
|
95
|
+
let totalBytes = 0;
|
|
96
|
+
const maximumVisitedEntries = limits.maximumVisitedEntries ?? maximumVisitedBuildEntries;
|
|
97
|
+
if (!Number.isSafeInteger(maximumVisitedEntries) || maximumVisitedEntries <= 0) {
|
|
98
|
+
throw new TypeError("maximumVisitedEntries must be a positive safe integer.");
|
|
99
|
+
}
|
|
100
|
+
const root = declaration.packageRoot;
|
|
101
|
+
for (const path of await buildIdentityFiles(declaration, maximumVisitedEntries)) {
|
|
102
|
+
const relativePath = portableRelativePath(root, path);
|
|
103
|
+
const record = await readBoundedRegularFile(path, maximumBuildFileBytes);
|
|
104
|
+
if (record.outcome !== "read") {
|
|
105
|
+
throw new Error(`Installed artifact is not a stable bounded regular file: ${relativePath}.`);
|
|
106
|
+
}
|
|
107
|
+
totalBytes += record.bytes.byteLength;
|
|
108
|
+
if (totalBytes > maximumBuildBytes) {
|
|
109
|
+
throw new Error("Installed artifact exceeds the byte limit.");
|
|
110
|
+
}
|
|
111
|
+
const pathBytes = Buffer.from(relativePath, "utf8");
|
|
112
|
+
hashLength(hash, pathBytes.byteLength);
|
|
113
|
+
hash.update(pathBytes);
|
|
114
|
+
hashLength(hash, record.bytes.byteLength);
|
|
115
|
+
hash.update(record.bytes);
|
|
116
|
+
}
|
|
117
|
+
return `sha256:${hash.digest("hex")}`;
|
|
118
|
+
}
|
|
119
|
+
let installedBuildIdentity;
|
|
120
|
+
export function installedRepositoryMutationBuildIdentity() {
|
|
121
|
+
installedBuildIdentity ??= computeInstalledArtifactBuildIdentity({
|
|
122
|
+
packageRoot: repositoryMutationPackageRoot,
|
|
123
|
+
roots: ["dist", "schemas"]
|
|
124
|
+
});
|
|
125
|
+
return installedBuildIdentity;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=installed-artifact-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-artifact-identity.js","sourceRoot":"","sources":["../src/installed-artifact-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACz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