@arcforges/api-client 1.0.0-ci.9.1 → 1.0.0-ci.92.1

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.
@@ -0,0 +1,290 @@
1
+ export function isPartReceipt(value) { return check0(value); }
2
+ /** The schema's declared UTF-8 document bound in bytes. */
3
+ export const partReceiptJsonMaxBytes = 65536;
4
+ /** Parses one strict PartReceipt document; refusal kinds match the C# codec. */
5
+ export function tryParsePartReceiptJson(input) {
6
+ const parsed = strictJson(input, 65536);
7
+ if (!parsed.ok)
8
+ return parsed;
9
+ return isPartReceipt(parsed.value) ? { ok: true, value: parsed.value } : { ok: false, failure: "invalid" };
10
+ }
11
+ /** Parses one strict PartReceipt document or throws an error carrying the refusal kind. */
12
+ export function parsePartReceiptJson(input) {
13
+ const result = tryParsePartReceiptJson(input);
14
+ if (!result.ok)
15
+ throw Object.assign(new Error(`PartReceipt JSON refused: ${result.failure}.`), { failure: result.failure });
16
+ return result.value;
17
+ }
18
+ /** Writes compact UTF-8 in schema property order and refuses output the schema rejects. */
19
+ export function serializePartReceiptJson(value) {
20
+ const bytes = new TextEncoder().encode(JSON.stringify(orderPartReceipt(value)));
21
+ const result = tryParsePartReceiptJson(bytes);
22
+ if (!result.ok)
23
+ throw Object.assign(new Error(`PartReceipt JSON refused: ${result.failure}.`), { failure: result.failure });
24
+ return bytes;
25
+ }
26
+ function orderPartReceipt(value) {
27
+ const out = {};
28
+ out["partNumber"] = value["partNumber"];
29
+ out["size"] = value["size"];
30
+ out["sha256"] = value["sha256"];
31
+ out["etag"] = value["etag"];
32
+ return out;
33
+ }
34
+ function check0(value) {
35
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
36
+ return false;
37
+ const object = value;
38
+ for (const key of Object.keys(object)) {
39
+ switch (key) {
40
+ case "partNumber":
41
+ if (!check1(object[key]))
42
+ return false;
43
+ break;
44
+ case "size":
45
+ if (!check2(object[key]))
46
+ return false;
47
+ break;
48
+ case "sha256":
49
+ if (!check3(object[key]))
50
+ return false;
51
+ break;
52
+ case "etag":
53
+ if (!check4(object[key]))
54
+ return false;
55
+ break;
56
+ default: return false;
57
+ }
58
+ }
59
+ if (!Object.prototype.hasOwnProperty.call(object, "partNumber"))
60
+ return false;
61
+ if (!Object.prototype.hasOwnProperty.call(object, "size"))
62
+ return false;
63
+ if (!Object.prototype.hasOwnProperty.call(object, "sha256"))
64
+ return false;
65
+ if (!Object.prototype.hasOwnProperty.call(object, "etag"))
66
+ return false;
67
+ return true;
68
+ }
69
+ function check1(value) {
70
+ if (typeof value !== 'number' || !Number.isSafeInteger(value))
71
+ return false;
72
+ if (value < 0)
73
+ return false;
74
+ if (value > 4294967295)
75
+ return false;
76
+ return true;
77
+ }
78
+ function check2(value) {
79
+ if (typeof value !== 'string' || !validText(value))
80
+ return false;
81
+ if ([...value].length > 20)
82
+ return false;
83
+ if ((new RegExp("^(0|[1-9][0-9]*)$", 'u')).exec(value)?.[0] !== value)
84
+ return false;
85
+ if (BigInt(value) > 18446744073709551615n)
86
+ return false;
87
+ return true;
88
+ }
89
+ function check3(value) {
90
+ if (typeof value !== 'string' || !validText(value))
91
+ return false;
92
+ if ((new RegExp("^[0-9a-f]{64}$", 'u')).exec(value)?.[0] !== value)
93
+ return false;
94
+ return true;
95
+ }
96
+ function check4(value) {
97
+ if (typeof value !== 'string' || !validText(value))
98
+ return false;
99
+ return true;
100
+ }
101
+ /** Strict UTF-8 JSON: no BOM, comments, trailing commas or duplicate properties; depth <= 32; integer lexemes only. */
102
+ function strictJson(input, maxBytes) {
103
+ let text;
104
+ if (typeof input === "string") {
105
+ if (!validText(input))
106
+ return { ok: false, failure: "malformed" };
107
+ if (new TextEncoder().encode(input).byteLength > maxBytes)
108
+ return { ok: false, failure: "tooLarge" };
109
+ text = input;
110
+ }
111
+ else {
112
+ if (input.byteLength > maxBytes)
113
+ return { ok: false, failure: "tooLarge" };
114
+ try {
115
+ text = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(input);
116
+ }
117
+ catch {
118
+ return { ok: false, failure: "malformed" };
119
+ }
120
+ }
121
+ try {
122
+ return { ok: true, value: new StrictJsonReader(text).document() };
123
+ }
124
+ catch {
125
+ return { ok: false, failure: "malformed" };
126
+ }
127
+ }
128
+ class StrictJsonReader {
129
+ text;
130
+ index = 0;
131
+ constructor(text) {
132
+ this.text = text;
133
+ }
134
+ document() {
135
+ this.space();
136
+ const value = this.value(0);
137
+ this.space();
138
+ if (this.index !== this.text.length)
139
+ throw new SyntaxError("Trailing JSON content");
140
+ return value;
141
+ }
142
+ value(depth) {
143
+ switch (this.text[this.index]) {
144
+ case "{": return this.object(depth + 1);
145
+ case "[": return this.array(depth + 1);
146
+ case '"': return this.string();
147
+ case "t": return this.literal("true", true);
148
+ case "f": return this.literal("false", false);
149
+ case "n": return this.literal("null", null);
150
+ default: return this.number();
151
+ }
152
+ }
153
+ object(depth) {
154
+ if (depth > 32)
155
+ throw new SyntaxError("JSON depth exceeded");
156
+ this.index++;
157
+ const out = {};
158
+ const keys = new Set();
159
+ this.space();
160
+ if (this.text[this.index] === "}") {
161
+ this.index++;
162
+ return out;
163
+ }
164
+ for (;;) {
165
+ this.space();
166
+ if (this.text[this.index] !== '"')
167
+ throw new SyntaxError("Expected property name");
168
+ const key = this.string();
169
+ if (keys.has(key))
170
+ throw new SyntaxError("Duplicate JSON property");
171
+ keys.add(key);
172
+ this.space();
173
+ if (this.text[this.index++] !== ":")
174
+ throw new SyntaxError("Expected colon");
175
+ this.space();
176
+ // defineProperty keeps names such as __proto__ as ordinary own properties.
177
+ Object.defineProperty(out, key, { value: this.value(depth), enumerable: true, writable: true, configurable: true });
178
+ this.space();
179
+ const next = this.text[this.index++];
180
+ if (next === "}")
181
+ return out;
182
+ if (next !== ",")
183
+ throw new SyntaxError("Expected comma");
184
+ }
185
+ }
186
+ array(depth) {
187
+ if (depth > 32)
188
+ throw new SyntaxError("JSON depth exceeded");
189
+ this.index++;
190
+ const out = [];
191
+ this.space();
192
+ if (this.text[this.index] === "]") {
193
+ this.index++;
194
+ return out;
195
+ }
196
+ for (;;) {
197
+ this.space();
198
+ out.push(this.value(depth));
199
+ this.space();
200
+ const next = this.text[this.index++];
201
+ if (next === "]")
202
+ return out;
203
+ if (next !== ",")
204
+ throw new SyntaxError("Expected comma");
205
+ }
206
+ }
207
+ string() {
208
+ this.index++;
209
+ let out = "";
210
+ for (;;) {
211
+ const c = this.text[this.index++];
212
+ if (c === undefined)
213
+ throw new SyntaxError("Unterminated string");
214
+ if (c === '"')
215
+ break;
216
+ if (c < " ")
217
+ throw new SyntaxError("Unescaped control character");
218
+ if (c !== "\\") {
219
+ out += c;
220
+ continue;
221
+ }
222
+ const e = this.text[this.index++];
223
+ const simple = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" };
224
+ if (e !== undefined && e in simple) {
225
+ out += simple[e];
226
+ continue;
227
+ }
228
+ if (e !== "u" || !/^[0-9a-fA-F]{4}$/.test(this.text.slice(this.index, this.index + 4)))
229
+ throw new SyntaxError("Invalid escape");
230
+ out += String.fromCharCode(parseInt(this.text.slice(this.index, this.index + 4), 16));
231
+ this.index += 4;
232
+ }
233
+ if (!validText(out))
234
+ throw new SyntaxError("Lone surrogate escape");
235
+ return out;
236
+ }
237
+ number() {
238
+ const match = /-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y;
239
+ match.lastIndex = this.index;
240
+ const found = match.exec(this.text);
241
+ if (found === null)
242
+ throw new SyntaxError("Invalid JSON value");
243
+ this.index = match.lastIndex;
244
+ // Selected schemas have no fractional numbers; fraction/exponent lexemes never satisfy an integer.
245
+ return found[1] !== undefined || found[2] !== undefined ? Number.NaN : Number(found[0]);
246
+ }
247
+ literal(word, value) {
248
+ if (this.text.slice(this.index, this.index + word.length) !== word)
249
+ throw new SyntaxError("Invalid JSON literal");
250
+ this.index += word.length;
251
+ return value;
252
+ }
253
+ space() {
254
+ while (this.text[this.index] === " " || this.text[this.index] === "\t" || this.text[this.index] === "\n" || this.text[this.index] === "\r")
255
+ this.index++;
256
+ }
257
+ }
258
+ function validText(value) {
259
+ for (const scalar of value) {
260
+ const point = scalar.codePointAt(0);
261
+ if (point >= 0xd800 && point <= 0xdfff)
262
+ return false;
263
+ }
264
+ return true;
265
+ }
266
+ function inventoryRules(value) {
267
+ const files = value.files;
268
+ const seen = new Set();
269
+ let previous;
270
+ let total = 0n;
271
+ for (const file of files) {
272
+ const path = file.path;
273
+ const folded = path.toUpperCase();
274
+ if (path.length === 0 || folded === 'INVENTORY.JSON' || folded === 'SIGNATURE.JSON' || seen.has(folded) || (previous !== undefined && previous >= path))
275
+ return false;
276
+ for (const segment of path.split('/')) {
277
+ if (!/^[A-Za-z0-9_.-]+$/.test(segment) || segment === '.' || segment === '..' || segment.endsWith('.') || /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i.test(segment))
278
+ return false;
279
+ }
280
+ const size = BigInt(file.size);
281
+ if (size > 134217728n)
282
+ return false;
283
+ total += size;
284
+ if (total > 1073741824n)
285
+ return false;
286
+ seen.add(folded);
287
+ previous = path;
288
+ }
289
+ return files.some(file => file.path === 'manifest.json');
290
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforges/api-client",
3
- "version": "1.0.0-ci.9.1",
3
+ "version": "1.0.0-ci.92.1",
4
4
  "description": "ArcForges public gRPC-Web client entry point; initial Hello World example.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -18,24 +18,32 @@
18
18
  ".": {
19
19
  "types": "./dist/index.d.ts",
20
20
  "import": "./dist/index.js"
21
- }
21
+ },
22
+ "./build-identity": "./build-identity.json"
22
23
  },
23
24
  "files": [
24
- "dist",
25
25
  "LICENSE",
26
26
  "NOTICE",
27
+ "README.md",
28
+ "build-identity.json",
29
+ "contracts.binpb",
30
+ "dist",
27
31
  "sbom.cdx.json",
28
- "source.json",
29
- "README.md"
32
+ "schemas",
33
+ "source.json"
30
34
  ],
31
35
  "dependencies": {
32
- "@arcforges/proto": "1.0.0-ci.9.1",
33
- "@bufbuild/protobuf": "2.14.1",
36
+ "@arcforges/proto": "1.0.0-ci.92.1",
37
+ "@bufbuild/protobuf": "2.15.0",
34
38
  "@connectrpc/connect": "2.2.0",
35
39
  "@connectrpc/connect-web": "2.2.0"
36
40
  },
37
41
  "publishConfig": {
38
42
  "access": "public",
39
43
  "registry": "https://registry.npmjs.org/"
44
+ },
45
+ "arcforges": {
46
+ "licenceBoundary": "Apache",
47
+ "contractAccess": "public"
40
48
  }
41
49
  }
package/sbom.cdx.json CHANGED
@@ -5,10 +5,10 @@
5
5
  "metadata": {
6
6
  "component": {
7
7
  "type": "library",
8
- "bom-ref": "pkg:npm/%40arcforges/api-client@1.0.0-ci.9.1",
8
+ "bom-ref": "pkg:npm/%40arcforges/api-client@1.0.0-ci.92.1",
9
9
  "name": "@arcforges/api-client",
10
- "version": "1.0.0-ci.9.1",
11
- "purl": "pkg:npm/%40arcforges/api-client@1.0.0-ci.9.1",
10
+ "version": "1.0.0-ci.92.1",
11
+ "purl": "pkg:npm/%40arcforges/api-client@1.0.0-ci.92.1",
12
12
  "licenses": [
13
13
  {
14
14
  "expression": "Apache-2.0"
@@ -19,10 +19,10 @@
19
19
  "components": [
20
20
  {
21
21
  "type": "library",
22
- "bom-ref": "pkg:npm/%40arcforges/proto@1.0.0-ci.9.1",
22
+ "bom-ref": "pkg:npm/%40arcforges/proto@1.0.0-ci.92.1",
23
23
  "name": "@arcforges/proto",
24
- "version": "1.0.0-ci.9.1",
25
- "purl": "pkg:npm/%40arcforges/proto@1.0.0-ci.9.1",
24
+ "version": "1.0.0-ci.92.1",
25
+ "purl": "pkg:npm/%40arcforges/proto@1.0.0-ci.92.1",
26
26
  "licenses": [
27
27
  {
28
28
  "expression": "Apache-2.0"
@@ -31,10 +31,10 @@
31
31
  },
32
32
  {
33
33
  "type": "library",
34
- "bom-ref": "pkg:npm/%40bufbuild/protobuf@2.14.1",
34
+ "bom-ref": "pkg:npm/%40bufbuild/protobuf@2.15.0",
35
35
  "name": "@bufbuild/protobuf",
36
- "version": "2.14.1",
37
- "purl": "pkg:npm/%40bufbuild/protobuf@2.14.1",
36
+ "version": "2.15.0",
37
+ "purl": "pkg:npm/%40bufbuild/protobuf@2.15.0",
38
38
  "licenses": [
39
39
  {
40
40
  "expression": "(Apache-2.0 AND BSD-3-Clause)"
@@ -68,33 +68,33 @@
68
68
  ],
69
69
  "dependencies": [
70
70
  {
71
- "ref": "pkg:npm/%40bufbuild/protobuf@2.14.1",
71
+ "ref": "pkg:npm/%40bufbuild/protobuf@2.15.0",
72
72
  "dependsOn": []
73
73
  },
74
74
  {
75
- "ref": "pkg:npm/%40arcforges/proto@1.0.0-ci.9.1",
75
+ "ref": "pkg:npm/%40arcforges/proto@1.0.0-ci.92.1",
76
76
  "dependsOn": [
77
- "pkg:npm/%40bufbuild/protobuf@2.14.1"
77
+ "pkg:npm/%40bufbuild/protobuf@2.15.0"
78
78
  ]
79
79
  },
80
80
  {
81
81
  "ref": "pkg:npm/%40connectrpc/connect@2.2.0",
82
82
  "dependsOn": [
83
- "pkg:npm/%40bufbuild/protobuf@2.14.1"
83
+ "pkg:npm/%40bufbuild/protobuf@2.15.0"
84
84
  ]
85
85
  },
86
86
  {
87
87
  "ref": "pkg:npm/%40connectrpc/connect-web@2.2.0",
88
88
  "dependsOn": [
89
- "pkg:npm/%40bufbuild/protobuf@2.14.1",
89
+ "pkg:npm/%40bufbuild/protobuf@2.15.0",
90
90
  "pkg:npm/%40connectrpc/connect@2.2.0"
91
91
  ]
92
92
  },
93
93
  {
94
- "ref": "pkg:npm/%40arcforges/api-client@1.0.0-ci.9.1",
94
+ "ref": "pkg:npm/%40arcforges/api-client@1.0.0-ci.92.1",
95
95
  "dependsOn": [
96
- "pkg:npm/%40arcforges/proto@1.0.0-ci.9.1",
97
- "pkg:npm/%40bufbuild/protobuf@2.14.1",
96
+ "pkg:npm/%40arcforges/proto@1.0.0-ci.92.1",
97
+ "pkg:npm/%40bufbuild/protobuf@2.15.0",
98
98
  "pkg:npm/%40connectrpc/connect@2.2.0",
99
99
  "pkg:npm/%40connectrpc/connect-web@2.2.0"
100
100
  ]
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$comment": "SPDX-License-Identifier: Apache-2.0",
4
+ "title": "PackageInventory",
5
+ "type": "object",
6
+ "properties": {
7
+ "schemaVersion": {
8
+ "type": "string",
9
+ "const": "inventory.v1"
10
+ },
11
+ "files": {
12
+ "type": "array",
13
+ "maxItems": 10000,
14
+ "items": {
15
+ "$ref": "#/$defs/InventoryFile"
16
+ },
17
+ "minItems": 1
18
+ }
19
+ },
20
+ "required": ["schemaVersion", "files"],
21
+ "additionalProperties": false,
22
+ "$defs": {
23
+ "InventoryFile": {
24
+ "title": "InventoryFile",
25
+ "type": "object",
26
+ "properties": {
27
+ "path": {
28
+ "type": "string",
29
+ "pattern": "^[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)*$"
30
+ },
31
+ "size": {
32
+ "type": "string",
33
+ "pattern": "^(0|[1-9][0-9]*)$",
34
+ "maxLength": 20,
35
+ "x-arcforges-rules": ["uint64String"]
36
+ },
37
+ "sha256": {
38
+ "type": "string",
39
+ "pattern": "^[0-9a-f]{64}$"
40
+ }
41
+ },
42
+ "required": ["path", "size", "sha256"],
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "x-arcforges-rules": ["inventoryPaths", "inventoryBounds"],
47
+ "x-arcforges-max-bytes": 4194304,
48
+ "x-arcforges-schema-version": "1"
49
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$comment": "SPDX-License-Identifier: Apache-2.0",
4
+ "title": "PartReceipt",
5
+ "type": "object",
6
+ "properties": {
7
+ "partNumber": {
8
+ "type": "integer",
9
+ "minimum": 0,
10
+ "maximum": 4294967295
11
+ },
12
+ "size": {
13
+ "type": "string",
14
+ "pattern": "^(0|[1-9][0-9]*)$",
15
+ "maxLength": 20,
16
+ "x-arcforges-rules": ["uint64String"]
17
+ },
18
+ "sha256": {
19
+ "type": "string",
20
+ "pattern": "^[0-9a-f]{64}$"
21
+ },
22
+ "etag": {
23
+ "type": "string"
24
+ }
25
+ },
26
+ "required": ["partNumber", "size", "sha256", "etag"],
27
+ "additionalProperties": false,
28
+ "x-arcforges-max-bytes": 65536,
29
+ "x-arcforges-schema-version": "1"
30
+ }
@@ -0,0 +1,14 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ syntax = "proto3";
3
+
4
+ package arcforges.events.v1;
5
+
6
+ option csharp_namespace = "ArcForges.Contracts.Events.V1";
7
+ option java_package = "io.github.arcforges.contracts.events.v1";
8
+ option java_multiple_files = true;
9
+ option java_outer_classname = "EventsProto";
10
+
11
+ // The complete entitlement.changed hint payload; not the full Event envelope.
12
+ message EntitlementChanged {
13
+ optional int64 entitlement_version = 1 [json_name = "entitlementVersion"];
14
+ }