@peac/kernel 0.9.18 → 0.9.31
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 +190 -0
- package/dist/__tests__/http.test.d.ts +2 -0
- package/dist/__tests__/http.test.d.ts.map +1 -0
- package/dist/__tests__/http.test.js +121 -0
- package/dist/__tests__/http.test.js.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/errors.d.ts +4 -37
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.generated.d.ts +166 -0
- package/dist/errors.generated.d.ts.map +1 -0
- package/dist/errors.generated.js +965 -0
- package/dist/errors.generated.js.map +1 -0
- package/dist/errors.js +11 -172
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +46 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +74 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +34 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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
|
+
Copyright 2025 PEAC Protocol Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/http.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const http_js_1 = require("../http.js");
|
|
5
|
+
(0, vitest_1.describe)('VARY_HEADERS', () => {
|
|
6
|
+
(0, vitest_1.it)('includes PEAC-Purpose and PEAC-Receipt', () => {
|
|
7
|
+
(0, vitest_1.expect)(http_js_1.VARY_HEADERS).toContain('PEAC-Purpose');
|
|
8
|
+
(0, vitest_1.expect)(http_js_1.VARY_HEADERS).toContain('PEAC-Receipt');
|
|
9
|
+
(0, vitest_1.expect)(http_js_1.VARY_HEADERS).toHaveLength(2);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.describe)('applyPurposeVary', () => {
|
|
13
|
+
(0, vitest_1.describe)('with Web API Headers', () => {
|
|
14
|
+
(0, vitest_1.it)('sets Vary when no existing header', () => {
|
|
15
|
+
const headers = new Headers();
|
|
16
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
17
|
+
(0, vitest_1.expect)(headers.get('Vary')).toBe('PEAC-Purpose');
|
|
18
|
+
});
|
|
19
|
+
(0, vitest_1.it)('appends to existing Vary header', () => {
|
|
20
|
+
const headers = new Headers();
|
|
21
|
+
headers.set('Vary', 'Accept-Encoding');
|
|
22
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
23
|
+
// Headers.append behavior
|
|
24
|
+
(0, vitest_1.expect)(headers.get('Vary')).toContain('Accept-Encoding');
|
|
25
|
+
(0, vitest_1.expect)(headers.get('Vary')).toContain('PEAC-Purpose');
|
|
26
|
+
});
|
|
27
|
+
(0, vitest_1.it)('does not duplicate when PEAC-Purpose already present', () => {
|
|
28
|
+
const headers = new Headers();
|
|
29
|
+
headers.set('Vary', 'PEAC-Purpose');
|
|
30
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
31
|
+
(0, vitest_1.expect)(headers.get('Vary')).toBe('PEAC-Purpose');
|
|
32
|
+
});
|
|
33
|
+
(0, vitest_1.it)('handles case-insensitive match', () => {
|
|
34
|
+
const headers = new Headers();
|
|
35
|
+
headers.set('Vary', 'peac-purpose');
|
|
36
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
37
|
+
// Should not duplicate
|
|
38
|
+
(0, vitest_1.expect)(headers.get('Vary')).toBe('peac-purpose');
|
|
39
|
+
});
|
|
40
|
+
(0, vitest_1.it)('handles Vary: * (wildcard)', () => {
|
|
41
|
+
const headers = new Headers();
|
|
42
|
+
headers.set('Vary', '*');
|
|
43
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
44
|
+
// Wildcard means vary on everything, no need to append
|
|
45
|
+
(0, vitest_1.expect)(headers.get('Vary')).toContain('*');
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)('is idempotent when called twice', () => {
|
|
48
|
+
const headers = new Headers();
|
|
49
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
50
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
51
|
+
(0, vitest_1.expect)(headers.get('Vary')).toBe('PEAC-Purpose');
|
|
52
|
+
});
|
|
53
|
+
(0, vitest_1.it)('works for deny responses (vary must apply to denials too)', () => {
|
|
54
|
+
// Deny responses must also vary to prevent caching denial across purposes
|
|
55
|
+
const headers = new Headers();
|
|
56
|
+
headers.set('PEAC-Decision', 'deny');
|
|
57
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
58
|
+
(0, vitest_1.expect)(headers.get('Vary')).toBe('PEAC-Purpose');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
(0, vitest_1.describe)('with Node.js-like response object', () => {
|
|
62
|
+
(0, vitest_1.it)('sets Vary via setHeader', () => {
|
|
63
|
+
const headers = {};
|
|
64
|
+
const res = {
|
|
65
|
+
getHeader: (name) => headers[name.toLowerCase()],
|
|
66
|
+
setHeader: (name, value) => {
|
|
67
|
+
headers[name.toLowerCase()] = value;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
(0, http_js_1.applyPurposeVary)(res);
|
|
71
|
+
(0, vitest_1.expect)(headers['vary']).toBe('PEAC-Purpose');
|
|
72
|
+
});
|
|
73
|
+
(0, vitest_1.it)('appends to existing Vary via setHeader', () => {
|
|
74
|
+
const headers = { vary: 'Accept-Encoding' };
|
|
75
|
+
const res = {
|
|
76
|
+
getHeader: (name) => headers[name.toLowerCase()],
|
|
77
|
+
setHeader: (name, value) => {
|
|
78
|
+
headers[name.toLowerCase()] = value;
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
(0, http_js_1.applyPurposeVary)(res);
|
|
82
|
+
(0, vitest_1.expect)(headers['vary']).toBe('Accept-Encoding, PEAC-Purpose');
|
|
83
|
+
});
|
|
84
|
+
(0, vitest_1.it)('does not duplicate when already present', () => {
|
|
85
|
+
const headers = { vary: 'PEAC-Purpose' };
|
|
86
|
+
const res = {
|
|
87
|
+
getHeader: (name) => headers[name.toLowerCase()],
|
|
88
|
+
setHeader: (name, value) => {
|
|
89
|
+
headers[name.toLowerCase()] = value;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
(0, http_js_1.applyPurposeVary)(res);
|
|
93
|
+
(0, vitest_1.expect)(headers['vary']).toBe('PEAC-Purpose');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
(0, vitest_1.describe)('with Map-like headers (Hono, etc.)', () => {
|
|
97
|
+
(0, vitest_1.it)('sets Vary via set method', () => {
|
|
98
|
+
const map = new Map();
|
|
99
|
+
const headers = {
|
|
100
|
+
set: (name, value) => map.set(name, value),
|
|
101
|
+
};
|
|
102
|
+
(0, http_js_1.applyPurposeVary)(headers);
|
|
103
|
+
(0, vitest_1.expect)(map.get('Vary')).toBe('PEAC-Purpose');
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
(0, vitest_1.describe)('getPeacVaryHeaders', () => {
|
|
108
|
+
(0, vitest_1.it)('returns comma-separated list of PEAC headers', () => {
|
|
109
|
+
const result = (0, http_js_1.getPeacVaryHeaders)();
|
|
110
|
+
(0, vitest_1.expect)(result).toBe('PEAC-Purpose, PEAC-Receipt');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
(0, vitest_1.describe)('needsPurposeVary', () => {
|
|
114
|
+
(0, vitest_1.it)('returns true when purpose was enforced', () => {
|
|
115
|
+
(0, vitest_1.expect)((0, http_js_1.needsPurposeVary)(true)).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
(0, vitest_1.it)('returns false when purpose was not enforced', () => {
|
|
118
|
+
(0, vitest_1.expect)((0, http_js_1.needsPurposeVary)(false)).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=http.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.js","sourceRoot":"","sources":["../../src/__tests__/http.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,wCAAkG;AAElG,IAAA,iBAAQ,EAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAA,WAAE,EAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,IAAA,eAAM,EAAC,sBAAY,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC/C,IAAA,eAAM,EAAC,sBAAY,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC/C,IAAA,eAAM,EAAC,sBAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,WAAE,EAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;YAC9B,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;YAC1B,IAAA,eAAM,EAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,iCAAiC,EAAE,GAAG,EAAE;YACzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACvC,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;YAC1B,0BAA0B;YAC1B,IAAA,eAAM,EA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|
30
30
|
readonly dpop: "DPoP";
|
|
31
|
+
readonly purpose: "PEAC-Purpose";
|
|
32
|
+
readonly purposeApplied: "PEAC-Purpose-Applied";
|
|
33
|
+
readonly purposeReason: "PEAC-Purpose-Reason";
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* Discovery manifest settings
|
|
@@ -73,6 +76,9 @@ export declare const CONSTANTS: {
|
|
|
73
76
|
readonly HEADERS: {
|
|
74
77
|
readonly receipt: "PEAC-Receipt";
|
|
75
78
|
readonly dpop: "DPoP";
|
|
79
|
+
readonly purpose: "PEAC-Purpose";
|
|
80
|
+
readonly purposeApplied: "PEAC-Purpose-Applied";
|
|
81
|
+
readonly purposeReason: "PEAC-Purpose-Reason";
|
|
76
82
|
};
|
|
77
83
|
readonly DISCOVERY: {
|
|
78
84
|
readonly manifestPath: "/.well-known/peac.txt";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;CAOV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,IAAI;;;;CAIP,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;CAIV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASZ,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -31,6 +31,10 @@ exports.ALGORITHMS = {
|
|
|
31
31
|
exports.HEADERS = {
|
|
32
32
|
receipt: 'PEAC-Receipt',
|
|
33
33
|
dpop: 'DPoP',
|
|
34
|
+
// Purpose headers (v0.9.24+)
|
|
35
|
+
purpose: 'PEAC-Purpose',
|
|
36
|
+
purposeApplied: 'PEAC-Purpose-Applied',
|
|
37
|
+
purposeReason: 'PEAC-Purpose-Reason',
|
|
34
38
|
};
|
|
35
39
|
/**
|
|
36
40
|
* Discovery manifest settings
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACU,QAAA,SAAS,GAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACU,QAAA,YAAY,GAAG,KAAc,CAAC;AAE3C;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,CAAC,OAAO,CAAU;IAC7B,OAAO,EAAE,OAAgB;CACjB,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,OAAO,EAAE,cAAuB;IAChC,IAAI,EAAE,MAAe;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACU,QAAA,SAAS,GAAG,kBAA2B,CAAC;AAErD;;;GAGG;AACU,QAAA,YAAY,GAAG,KAAc,CAAC;AAE3C;;GAEG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,CAAC,OAAO,CAAU;IAC7B,OAAO,EAAE,OAAgB;CACjB,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,OAAO,EAAE,cAAuB;IAChC,IAAI,EAAE,MAAe;IACrB,6BAA6B;IAC7B,OAAO,EAAE,cAAuB;IAChC,cAAc,EAAE,sBAA+B;IAC/C,aAAa,EAAE,qBAA8B;CACrC,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY,EAAE,uBAAgC;IAC9C,eAAe,EAAE,UAAmB;IACpC,eAAe,EAAE,IAAI;CACb,CAAC;AAEX;;GAEG;AACU,QAAA,IAAI,GAAG;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,CAAC;IACd,wBAAwB,EAAE,EAAE;CACpB,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACrB,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,EAAE;IACtB,iBAAiB,EAAE,KAAK,EAAE,WAAW;CAC7B,CAAC;AAEX;;GAEG;AACU,QAAA,MAAM,GAAG;IACpB,cAAc,EAAE,YAAY;IAC5B,cAAc,EAAE,CAAC;CACT,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,SAAS,EAAT,iBAAS;IACT,YAAY,EAAZ,oBAAY;IACZ,UAAU,EAAV,kBAAU;IACV,OAAO,EAAP,eAAO;IACP,SAAS,EAAT,iBAAS;IACT,IAAI,EAAJ,YAAI;IACJ,OAAO,EAAP,eAAO;IACP,MAAM,EAAN,cAAM;CACE,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PEAC Protocol Error Codes
|
|
3
|
-
* Derived from specs/kernel/errors.json
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Re-exports from auto-generated errors.generated.ts
|
|
5
|
+
* Source of truth: specs/kernel/errors.json
|
|
6
|
+
* Regenerate with: npx tsx scripts/codegen-errors.ts
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Error code constants
|
|
11
|
-
*/
|
|
12
|
-
export declare const ERROR_CODES: {
|
|
13
|
-
readonly E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE";
|
|
14
|
-
readonly E_INVALID_FORMAT: "E_INVALID_FORMAT";
|
|
15
|
-
readonly E_EXPIRED: "E_EXPIRED";
|
|
16
|
-
readonly E_NOT_YET_VALID: "E_NOT_YET_VALID";
|
|
17
|
-
readonly E_INVALID_ISSUER: "E_INVALID_ISSUER";
|
|
18
|
-
readonly E_INVALID_AUDIENCE: "E_INVALID_AUDIENCE";
|
|
19
|
-
readonly E_JWKS_FETCH_FAILED: "E_JWKS_FETCH_FAILED";
|
|
20
|
-
readonly E_KEY_NOT_FOUND: "E_KEY_NOT_FOUND";
|
|
21
|
-
readonly E_INVALID_AMOUNT: "E_INVALID_AMOUNT";
|
|
22
|
-
readonly E_INVALID_CURRENCY: "E_INVALID_CURRENCY";
|
|
23
|
-
readonly E_INVALID_RAIL: "E_INVALID_RAIL";
|
|
24
|
-
readonly E_MISSING_REQUIRED_CLAIM: "E_MISSING_REQUIRED_CLAIM";
|
|
25
|
-
readonly E_RATE_LIMITED: "E_RATE_LIMITED";
|
|
26
|
-
readonly E_CIRCUIT_BREAKER_OPEN: "E_CIRCUIT_BREAKER_OPEN";
|
|
27
|
-
readonly E_CONTROL_DENIED: "E_CONTROL_DENIED";
|
|
28
|
-
readonly E_CONTROL_REVIEW_REQUIRED: "E_CONTROL_REVIEW_REQUIRED";
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Error definitions map
|
|
32
|
-
*/
|
|
33
|
-
export declare const ERRORS: Record<string, ErrorDefinition>;
|
|
34
|
-
/**
|
|
35
|
-
* Get error definition by code
|
|
36
|
-
*/
|
|
37
|
-
export declare function getError(code: string): ErrorDefinition | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Check if error is retriable
|
|
40
|
-
*/
|
|
41
|
-
export declare function isRetriable(code: string): boolean;
|
|
8
|
+
export { ERROR_CODES, ERRORS, BUNDLE_ERRORS, DISPUTE_ERRORS, getError, isRetriable, type ErrorCode, } from './errors.generated.js';
|
|
42
9
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,WAAW,EACX,MAAM,EACN,aAAa,EACb,cAAc,EACd,QAAQ,EACR,WAAW,EACX,KAAK,SAAS,GACf,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PEAC Protocol Error Codes
|
|
3
|
+
*
|
|
4
|
+
* AUTO-GENERATED from specs/kernel/errors.json
|
|
5
|
+
* DO NOT EDIT MANUALLY - run: npx tsx scripts/codegen-errors.ts
|
|
6
|
+
* Spec version: 0.9.30
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorDefinition } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Error code string constants
|
|
11
|
+
*/
|
|
12
|
+
export declare const ERROR_CODES: {
|
|
13
|
+
readonly E_ATTRIBUTION_CHAIN_TOO_DEEP: "E_ATTRIBUTION_CHAIN_TOO_DEEP";
|
|
14
|
+
readonly E_ATTRIBUTION_CIRCULAR_CHAIN: "E_ATTRIBUTION_CIRCULAR_CHAIN";
|
|
15
|
+
readonly E_ATTRIBUTION_EXPIRED: "E_ATTRIBUTION_EXPIRED";
|
|
16
|
+
readonly E_ATTRIBUTION_HASH_INVALID: "E_ATTRIBUTION_HASH_INVALID";
|
|
17
|
+
readonly E_ATTRIBUTION_INVALID_FORMAT: "E_ATTRIBUTION_INVALID_FORMAT";
|
|
18
|
+
readonly E_ATTRIBUTION_INVALID_REF: "E_ATTRIBUTION_INVALID_REF";
|
|
19
|
+
readonly E_ATTRIBUTION_INVALID_WEIGHT: "E_ATTRIBUTION_INVALID_WEIGHT";
|
|
20
|
+
readonly E_ATTRIBUTION_MISSING_SOURCES: "E_ATTRIBUTION_MISSING_SOURCES";
|
|
21
|
+
readonly E_ATTRIBUTION_NOT_YET_VALID: "E_ATTRIBUTION_NOT_YET_VALID";
|
|
22
|
+
readonly E_ATTRIBUTION_RESOLUTION_FAILED: "E_ATTRIBUTION_RESOLUTION_FAILED";
|
|
23
|
+
readonly E_ATTRIBUTION_RESOLUTION_TIMEOUT: "E_ATTRIBUTION_RESOLUTION_TIMEOUT";
|
|
24
|
+
readonly E_ATTRIBUTION_SIZE_EXCEEDED: "E_ATTRIBUTION_SIZE_EXCEEDED";
|
|
25
|
+
readonly E_ATTRIBUTION_TOO_MANY_SOURCES: "E_ATTRIBUTION_TOO_MANY_SOURCES";
|
|
26
|
+
readonly E_ATTRIBUTION_UNKNOWN_USAGE: "E_ATTRIBUTION_UNKNOWN_USAGE";
|
|
27
|
+
readonly E_BUNDLE_DUPLICATE_RECEIPT: "E_BUNDLE_DUPLICATE_RECEIPT";
|
|
28
|
+
readonly E_BUNDLE_HASH_MISMATCH: "E_BUNDLE_HASH_MISMATCH";
|
|
29
|
+
readonly E_BUNDLE_INVALID_FORMAT: "E_BUNDLE_INVALID_FORMAT";
|
|
30
|
+
readonly E_BUNDLE_KEY_MISSING: "E_BUNDLE_KEY_MISSING";
|
|
31
|
+
readonly E_BUNDLE_MANIFEST_INVALID: "E_BUNDLE_MANIFEST_INVALID";
|
|
32
|
+
readonly E_BUNDLE_MANIFEST_MISSING: "E_BUNDLE_MANIFEST_MISSING";
|
|
33
|
+
readonly E_BUNDLE_MISSING_KEYS: "E_BUNDLE_MISSING_KEYS";
|
|
34
|
+
readonly E_BUNDLE_MISSING_RECEIPTS: "E_BUNDLE_MISSING_RECEIPTS";
|
|
35
|
+
readonly E_BUNDLE_PATH_TRAVERSAL: "E_BUNDLE_PATH_TRAVERSAL";
|
|
36
|
+
readonly E_BUNDLE_POLICY_HASH_MISMATCH: "E_BUNDLE_POLICY_HASH_MISMATCH";
|
|
37
|
+
readonly E_BUNDLE_RECEIPT_INVALID: "E_BUNDLE_RECEIPT_INVALID";
|
|
38
|
+
readonly E_BUNDLE_RECEIPTS_UNORDERED: "E_BUNDLE_RECEIPTS_UNORDERED";
|
|
39
|
+
readonly E_BUNDLE_SIGNATURE_INVALID: "E_BUNDLE_SIGNATURE_INVALID";
|
|
40
|
+
readonly E_BUNDLE_SIZE_EXCEEDED: "E_BUNDLE_SIZE_EXCEEDED";
|
|
41
|
+
readonly E_BUNDLE_TIME_RANGE_INVALID: "E_BUNDLE_TIME_RANGE_INVALID";
|
|
42
|
+
readonly E_CONTROL_DENIED: "E_CONTROL_DENIED";
|
|
43
|
+
readonly E_CONTROL_REVIEW_REQUIRED: "E_CONTROL_REVIEW_REQUIRED";
|
|
44
|
+
readonly E_DISPUTE_DUPLICATE: "E_DISPUTE_DUPLICATE";
|
|
45
|
+
readonly E_DISPUTE_EXPIRED: "E_DISPUTE_EXPIRED";
|
|
46
|
+
readonly E_DISPUTE_INVALID_FORMAT: "E_DISPUTE_INVALID_FORMAT";
|
|
47
|
+
readonly E_DISPUTE_INVALID_GROUNDS: "E_DISPUTE_INVALID_GROUNDS";
|
|
48
|
+
readonly E_DISPUTE_INVALID_ID: "E_DISPUTE_INVALID_ID";
|
|
49
|
+
readonly E_DISPUTE_INVALID_STATE: "E_DISPUTE_INVALID_STATE";
|
|
50
|
+
readonly E_DISPUTE_INVALID_TARGET_TYPE: "E_DISPUTE_INVALID_TARGET_TYPE";
|
|
51
|
+
readonly E_DISPUTE_INVALID_TRANSITION: "E_DISPUTE_INVALID_TRANSITION";
|
|
52
|
+
readonly E_DISPUTE_INVALID_TYPE: "E_DISPUTE_INVALID_TYPE";
|
|
53
|
+
readonly E_DISPUTE_MISSING_RESOLUTION: "E_DISPUTE_MISSING_RESOLUTION";
|
|
54
|
+
readonly E_DISPUTE_NOT_YET_VALID: "E_DISPUTE_NOT_YET_VALID";
|
|
55
|
+
readonly E_DISPUTE_OTHER_REQUIRES_DESCRIPTION: "E_DISPUTE_OTHER_REQUIRES_DESCRIPTION";
|
|
56
|
+
readonly E_DISPUTE_RESOLUTION_NOT_ALLOWED: "E_DISPUTE_RESOLUTION_NOT_ALLOWED";
|
|
57
|
+
readonly E_DISPUTE_TARGET_NOT_FOUND: "E_DISPUTE_TARGET_NOT_FOUND";
|
|
58
|
+
readonly E_IDENTITY_BINDING_FUTURE: "E_IDENTITY_BINDING_FUTURE";
|
|
59
|
+
readonly E_IDENTITY_BINDING_MISMATCH: "E_IDENTITY_BINDING_MISMATCH";
|
|
60
|
+
readonly E_IDENTITY_BINDING_STALE: "E_IDENTITY_BINDING_STALE";
|
|
61
|
+
readonly E_IDENTITY_DIRECTORY_UNAVAILABLE: "E_IDENTITY_DIRECTORY_UNAVAILABLE";
|
|
62
|
+
readonly E_IDENTITY_EXPIRED: "E_IDENTITY_EXPIRED";
|
|
63
|
+
readonly E_IDENTITY_INVALID_FORMAT: "E_IDENTITY_INVALID_FORMAT";
|
|
64
|
+
readonly E_IDENTITY_KEY_EXPIRED: "E_IDENTITY_KEY_EXPIRED";
|
|
65
|
+
readonly E_IDENTITY_KEY_REVOKED: "E_IDENTITY_KEY_REVOKED";
|
|
66
|
+
readonly E_IDENTITY_KEY_UNKNOWN: "E_IDENTITY_KEY_UNKNOWN";
|
|
67
|
+
readonly E_IDENTITY_MISSING: "E_IDENTITY_MISSING";
|
|
68
|
+
readonly E_IDENTITY_NOT_YET_VALID: "E_IDENTITY_NOT_YET_VALID";
|
|
69
|
+
readonly E_IDENTITY_PROOF_UNSUPPORTED: "E_IDENTITY_PROOF_UNSUPPORTED";
|
|
70
|
+
readonly E_IDENTITY_SIG_INVALID: "E_IDENTITY_SIG_INVALID";
|
|
71
|
+
readonly E_CIRCUIT_BREAKER_OPEN: "E_CIRCUIT_BREAKER_OPEN";
|
|
72
|
+
readonly E_INTERNAL: "E_INTERNAL";
|
|
73
|
+
readonly E_JWKS_FETCH_FAILED: "E_JWKS_FETCH_FAILED";
|
|
74
|
+
readonly E_RATE_LIMITED: "E_RATE_LIMITED";
|
|
75
|
+
readonly E_UCP_EVIDENCE_SERIALIZATION_FAILED: "E_UCP_EVIDENCE_SERIALIZATION_FAILED";
|
|
76
|
+
readonly E_UCP_KEY_ALGORITHM_MISMATCH: "E_UCP_KEY_ALGORITHM_MISMATCH";
|
|
77
|
+
readonly E_UCP_KEY_CURVE_MISMATCH: "E_UCP_KEY_CURVE_MISMATCH";
|
|
78
|
+
readonly E_UCP_KEY_NOT_FOUND: "E_UCP_KEY_NOT_FOUND";
|
|
79
|
+
readonly E_UCP_ORDER_INVALID: "E_UCP_ORDER_INVALID";
|
|
80
|
+
readonly E_UCP_ORDER_MISSING_ID: "E_UCP_ORDER_MISSING_ID";
|
|
81
|
+
readonly E_UCP_ORDER_MISSING_LINE_ITEMS: "E_UCP_ORDER_MISSING_LINE_ITEMS";
|
|
82
|
+
readonly E_UCP_ORDER_MISSING_TOTALS: "E_UCP_ORDER_MISSING_TOTALS";
|
|
83
|
+
readonly E_UCP_PAYLOAD_EMPTY: "E_UCP_PAYLOAD_EMPTY";
|
|
84
|
+
readonly E_UCP_PAYLOAD_NOT_JSON: "E_UCP_PAYLOAD_NOT_JSON";
|
|
85
|
+
readonly E_UCP_PAYLOAD_TOO_LARGE: "E_UCP_PAYLOAD_TOO_LARGE";
|
|
86
|
+
readonly E_UCP_PROFILE_FETCH_FAILED: "E_UCP_PROFILE_FETCH_FAILED";
|
|
87
|
+
readonly E_UCP_PROFILE_INVALID: "E_UCP_PROFILE_INVALID";
|
|
88
|
+
readonly E_UCP_PROFILE_NO_SIGNING_KEYS: "E_UCP_PROFILE_NO_SIGNING_KEYS";
|
|
89
|
+
readonly E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED: "E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED";
|
|
90
|
+
readonly E_UCP_SIGNATURE_B64_INVALID: "E_UCP_SIGNATURE_B64_INVALID";
|
|
91
|
+
readonly E_UCP_SIGNATURE_INVALID: "E_UCP_SIGNATURE_INVALID";
|
|
92
|
+
readonly E_UCP_SIGNATURE_MALFORMED: "E_UCP_SIGNATURE_MALFORMED";
|
|
93
|
+
readonly E_UCP_SIGNATURE_MISSING: "E_UCP_SIGNATURE_MISSING";
|
|
94
|
+
readonly E_UCP_VERIFICATION_FAILED: "E_UCP_VERIFICATION_FAILED";
|
|
95
|
+
readonly E_EVIDENCE_NOT_JSON: "E_EVIDENCE_NOT_JSON";
|
|
96
|
+
readonly E_EXPIRED: "E_EXPIRED";
|
|
97
|
+
readonly E_INVALID_AMOUNT: "E_INVALID_AMOUNT";
|
|
98
|
+
readonly E_INVALID_AUDIENCE: "E_INVALID_AUDIENCE";
|
|
99
|
+
readonly E_INVALID_CURRENCY: "E_INVALID_CURRENCY";
|
|
100
|
+
readonly E_INVALID_FORMAT: "E_INVALID_FORMAT";
|
|
101
|
+
readonly E_INVALID_ISSUER: "E_INVALID_ISSUER";
|
|
102
|
+
readonly E_INVALID_RAIL: "E_INVALID_RAIL";
|
|
103
|
+
readonly E_INVALID_RECEIPT_ID: "E_INVALID_RECEIPT_ID";
|
|
104
|
+
readonly E_INVALID_SUBJECT: "E_INVALID_SUBJECT";
|
|
105
|
+
readonly E_MISSING_EXP: "E_MISSING_EXP";
|
|
106
|
+
readonly E_MISSING_REQUIRED_CLAIM: "E_MISSING_REQUIRED_CLAIM";
|
|
107
|
+
readonly E_NOT_YET_VALID: "E_NOT_YET_VALID";
|
|
108
|
+
readonly E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE";
|
|
109
|
+
readonly E_KEY_NOT_FOUND: "E_KEY_NOT_FOUND";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Union type of all error codes
|
|
113
|
+
*/
|
|
114
|
+
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
115
|
+
/**
|
|
116
|
+
* Error definitions map with full metadata
|
|
117
|
+
*/
|
|
118
|
+
export declare const ERRORS: Record<string, ErrorDefinition>;
|
|
119
|
+
/**
|
|
120
|
+
* Get error definition by code
|
|
121
|
+
*/
|
|
122
|
+
export declare function getError(code: string): ErrorDefinition | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Check if error is retriable
|
|
125
|
+
*/
|
|
126
|
+
export declare function isRetriable(code: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Bundle error codes (for @peac/audit)
|
|
129
|
+
*/
|
|
130
|
+
export declare const BUNDLE_ERRORS: {
|
|
131
|
+
readonly DUPLICATE_RECEIPT: "E_BUNDLE_DUPLICATE_RECEIPT";
|
|
132
|
+
readonly HASH_MISMATCH: "E_BUNDLE_HASH_MISMATCH";
|
|
133
|
+
readonly INVALID_FORMAT: "E_BUNDLE_INVALID_FORMAT";
|
|
134
|
+
readonly KEY_MISSING: "E_BUNDLE_KEY_MISSING";
|
|
135
|
+
readonly MANIFEST_INVALID: "E_BUNDLE_MANIFEST_INVALID";
|
|
136
|
+
readonly MANIFEST_MISSING: "E_BUNDLE_MANIFEST_MISSING";
|
|
137
|
+
readonly MISSING_KEYS: "E_BUNDLE_MISSING_KEYS";
|
|
138
|
+
readonly MISSING_RECEIPTS: "E_BUNDLE_MISSING_RECEIPTS";
|
|
139
|
+
readonly PATH_TRAVERSAL: "E_BUNDLE_PATH_TRAVERSAL";
|
|
140
|
+
readonly POLICY_HASH_MISMATCH: "E_BUNDLE_POLICY_HASH_MISMATCH";
|
|
141
|
+
readonly RECEIPT_INVALID: "E_BUNDLE_RECEIPT_INVALID";
|
|
142
|
+
readonly RECEIPTS_UNORDERED: "E_BUNDLE_RECEIPTS_UNORDERED";
|
|
143
|
+
readonly SIGNATURE_INVALID: "E_BUNDLE_SIGNATURE_INVALID";
|
|
144
|
+
readonly SIZE_EXCEEDED: "E_BUNDLE_SIZE_EXCEEDED";
|
|
145
|
+
readonly TIME_RANGE_INVALID: "E_BUNDLE_TIME_RANGE_INVALID";
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Dispute error codes
|
|
149
|
+
*/
|
|
150
|
+
export declare const DISPUTE_ERRORS: {
|
|
151
|
+
readonly DUPLICATE: "E_DISPUTE_DUPLICATE";
|
|
152
|
+
readonly EXPIRED: "E_DISPUTE_EXPIRED";
|
|
153
|
+
readonly INVALID_FORMAT: "E_DISPUTE_INVALID_FORMAT";
|
|
154
|
+
readonly INVALID_GROUNDS: "E_DISPUTE_INVALID_GROUNDS";
|
|
155
|
+
readonly INVALID_ID: "E_DISPUTE_INVALID_ID";
|
|
156
|
+
readonly INVALID_STATE: "E_DISPUTE_INVALID_STATE";
|
|
157
|
+
readonly INVALID_TARGET_TYPE: "E_DISPUTE_INVALID_TARGET_TYPE";
|
|
158
|
+
readonly INVALID_TRANSITION: "E_DISPUTE_INVALID_TRANSITION";
|
|
159
|
+
readonly INVALID_TYPE: "E_DISPUTE_INVALID_TYPE";
|
|
160
|
+
readonly MISSING_RESOLUTION: "E_DISPUTE_MISSING_RESOLUTION";
|
|
161
|
+
readonly NOT_YET_VALID: "E_DISPUTE_NOT_YET_VALID";
|
|
162
|
+
readonly OTHER_REQUIRES_DESCRIPTION: "E_DISPUTE_OTHER_REQUIRES_DESCRIPTION";
|
|
163
|
+
readonly RESOLUTION_NOT_ALLOWED: "E_DISPUTE_RESOLUTION_NOT_ALLOWED";
|
|
164
|
+
readonly TARGET_NOT_FOUND: "E_DISPUTE_TARGET_NOT_FOUND";
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=errors.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.generated.d.ts","sourceRoot":"","sources":["../src/errors.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CA8xBlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAElE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAgBhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;CAejB,CAAC"}
|