@structured-id/proto 0.14.0 → 0.16.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 +17 -0
- package/dist/generated/sid/v1/admin/admin.d.ts +48 -17
- package/dist/generated/sid/v1/admin/admin.js +55 -62
- package/dist/generated/sid/v1/admin/admin.js.map +1 -1
- package/dist/generated/sid/v1/admin/branding.d.ts +54 -26
- package/dist/generated/sid/v1/admin/branding.js +87 -98
- package/dist/generated/sid/v1/admin/branding.js.map +1 -1
- package/dist/generated/sid/v1/admin/enrollment.d.ts +63 -44
- package/dist/generated/sid/v1/admin/enrollment.js +109 -107
- package/dist/generated/sid/v1/admin/enrollment.js.map +1 -1
- package/dist/generated/sid/v1/admin/flow.d.ts +90 -42
- package/dist/generated/sid/v1/admin/flow.js +143 -155
- package/dist/generated/sid/v1/admin/flow.js.map +1 -1
- package/dist/generated/sid/v1/admin/security.d.ts +11 -4
- package/dist/generated/sid/v1/admin/security.js +14 -14
- package/dist/generated/sid/v1/admin/security.js.map +1 -1
- package/dist/generated/sid/v1/admin/sessions.d.ts +18 -8
- package/dist/generated/sid/v1/admin/sessions.js +27 -29
- package/dist/generated/sid/v1/admin/sessions.js.map +1 -1
- package/dist/generated/sid/v1/authn/auth.d.ts +13 -7
- package/dist/generated/sid/v1/authn/auth.js +20 -20
- package/dist/generated/sid/v1/authn/auth.js.map +1 -1
- package/dist/generated/sid/v1/authz/authz.d.ts +203 -111
- package/dist/generated/sid/v1/authz/authz.js +308 -330
- package/dist/generated/sid/v1/authz/authz.js.map +1 -1
- package/dist/generated/sid/v1/authz/governance.d.ts +40 -26
- package/dist/generated/sid/v1/authz/governance.js +65 -71
- package/dist/generated/sid/v1/authz/governance.js.map +1 -1
- package/dist/generated/sid/v1/common/types.d.ts +29 -0
- package/dist/generated/sid/v1/common/types.js +47 -0
- package/dist/generated/sid/v1/common/types.js.map +1 -1
- package/dist/generated/sid/v1/federation/upstream.d.ts +34 -16
- package/dist/generated/sid/v1/federation/upstream.js +53 -59
- package/dist/generated/sid/v1/federation/upstream.js.map +1 -1
- package/dist/generated/sid/v1/ids/ids.d.ts +12 -0
- package/dist/generated/sid/v1/ids/ids.js +6 -0
- package/dist/generated/sid/v1/ids/ids.js.map +1 -1
- package/dist/generated/sid/v1/machine/machine_user.d.ts +100 -48
- package/dist/generated/sid/v1/machine/machine_user.js +228 -179
- package/dist/generated/sid/v1/machine/machine_user.js.map +1 -1
- package/dist/generated/sid/v1/machine/pat.d.ts +16 -12
- package/dist/generated/sid/v1/machine/pat.js +41 -45
- package/dist/generated/sid/v1/machine/pat.js.map +1 -1
- package/dist/generated/sid/v1/projects/projects.d.ts +141 -103
- package/dist/generated/sid/v1/projects/projects.js +293 -271
- package/dist/generated/sid/v1/projects/projects.js.map +1 -1
- package/dist/ip.d.ts +31 -0
- package/dist/ip.js +84 -0
- package/dist/ip.js.map +1 -0
- package/package.json +6 -2
package/dist/ip.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checked reading of `sid.v1.common.IpAddress` and its text for display.
|
|
3
|
+
* The message carries one IP host address as data: 4 bytes for IPv4 or 16
|
|
4
|
+
* for IPv6 in network order, the length giving the family. An absent field
|
|
5
|
+
* means the address is unknown or was not recorded.
|
|
6
|
+
*/
|
|
7
|
+
import type { IpAddress } from "./generated/sid/v1/common/types.js";
|
|
8
|
+
/** An address's family, as the message's length gives it. */
|
|
9
|
+
export type IpFamily = "ipv4" | "ipv6";
|
|
10
|
+
/** An address read from its message: the family and a copy of its octets. */
|
|
11
|
+
export interface CheckedIpAddress {
|
|
12
|
+
readonly family: IpFamily;
|
|
13
|
+
/** 4 octets for IPv4, 16 for IPv6, in network order. */
|
|
14
|
+
readonly octets: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
/** A message whose value is not 4 or 16 bytes. Names the length only. */
|
|
17
|
+
export declare class IpAddressError extends Error {
|
|
18
|
+
readonly length: number;
|
|
19
|
+
constructor(length: number);
|
|
20
|
+
}
|
|
21
|
+
/** The address `message` carries, or `IpAddressError` for another length. */
|
|
22
|
+
export declare function readIpAddress(message: IpAddress): CheckedIpAddress;
|
|
23
|
+
/**
|
|
24
|
+
* The address of an optional field: an absent message stays absent (unknown
|
|
25
|
+
* or unrecorded); a present one is read as `readIpAddress` reads it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function optionalIpAddress(message: IpAddress | undefined): CheckedIpAddress | undefined;
|
|
28
|
+
/** The message carrying `address`. */
|
|
29
|
+
export declare function toIpAddress(address: CheckedIpAddress): IpAddress;
|
|
30
|
+
/** The text an address is shown as: dotted IPv4, or RFC 5952 IPv6. */
|
|
31
|
+
export declare function ipAddressText(address: CheckedIpAddress): string;
|
package/dist/ip.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** A message whose value is not 4 or 16 bytes. Names the length only. */
|
|
2
|
+
export class IpAddressError extends Error {
|
|
3
|
+
length;
|
|
4
|
+
constructor(length) {
|
|
5
|
+
super(`an IP address is 4 or 16 bytes, not ${length}`);
|
|
6
|
+
this.length = length;
|
|
7
|
+
this.name = "IpAddressError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** The address `message` carries, or `IpAddressError` for another length. */
|
|
11
|
+
export function readIpAddress(message) {
|
|
12
|
+
const { length } = message.value;
|
|
13
|
+
// A copy into a plain Uint8Array: a Buffer's own slice would share memory.
|
|
14
|
+
if (length === 4)
|
|
15
|
+
return { family: "ipv4", octets: Uint8Array.from(message.value) };
|
|
16
|
+
if (length === 16)
|
|
17
|
+
return { family: "ipv6", octets: Uint8Array.from(message.value) };
|
|
18
|
+
throw new IpAddressError(length);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The address of an optional field: an absent message stays absent (unknown
|
|
22
|
+
* or unrecorded); a present one is read as `readIpAddress` reads it.
|
|
23
|
+
*/
|
|
24
|
+
export function optionalIpAddress(message) {
|
|
25
|
+
return message === undefined ? undefined : readIpAddress(message);
|
|
26
|
+
}
|
|
27
|
+
/** The message carrying `address`. */
|
|
28
|
+
export function toIpAddress(address) {
|
|
29
|
+
return { value: Uint8Array.from(address.octets) };
|
|
30
|
+
}
|
|
31
|
+
/** Dotted-decimal text of 4 octets. */
|
|
32
|
+
function dotted(octets) {
|
|
33
|
+
return Array.from(octets).join(".");
|
|
34
|
+
}
|
|
35
|
+
/** Whether 16 octets are an IPv4-mapped IPv6 address (RFC 4291 section 2.5.5.2). */
|
|
36
|
+
function isMapped(octets) {
|
|
37
|
+
for (let i = 0; i < 10; i++)
|
|
38
|
+
if (octets[i] !== 0)
|
|
39
|
+
return false;
|
|
40
|
+
return octets[10] === 0xff && octets[11] === 0xff;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* RFC 5952 text of 16 octets: lowercase hexadecimal groups without leading
|
|
44
|
+
* zeros, the longest run of two or more zero groups (the first of equal
|
|
45
|
+
* runs) shortened to `::`. An IPv4-mapped address is written
|
|
46
|
+
* `::ffff:a.b.c.d` (RFC 5952 section 5); it stays IPv6.
|
|
47
|
+
*/
|
|
48
|
+
function ipv6Text(octets) {
|
|
49
|
+
if (isMapped(octets))
|
|
50
|
+
return `::ffff:${dotted(octets.subarray(12))}`;
|
|
51
|
+
const groups = [];
|
|
52
|
+
for (let i = 0; i < 16; i += 2)
|
|
53
|
+
groups.push((octets[i] << 8) | octets[i + 1]);
|
|
54
|
+
let bestStart = -1;
|
|
55
|
+
let bestLength = 1;
|
|
56
|
+
for (let i = 0; i < 8;) {
|
|
57
|
+
if (groups[i] !== 0) {
|
|
58
|
+
i++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
let j = i;
|
|
62
|
+
while (j < 8 && groups[j] === 0)
|
|
63
|
+
j++;
|
|
64
|
+
if (j - i > bestLength) {
|
|
65
|
+
bestStart = i;
|
|
66
|
+
bestLength = j - i;
|
|
67
|
+
}
|
|
68
|
+
i = j;
|
|
69
|
+
}
|
|
70
|
+
const hex = (g) => g.toString(16);
|
|
71
|
+
if (bestStart < 0)
|
|
72
|
+
return groups.map(hex).join(":");
|
|
73
|
+
const head = groups.slice(0, bestStart).map(hex).join(":");
|
|
74
|
+
const tail = groups
|
|
75
|
+
.slice(bestStart + bestLength)
|
|
76
|
+
.map(hex)
|
|
77
|
+
.join(":");
|
|
78
|
+
return `${head}::${tail}`;
|
|
79
|
+
}
|
|
80
|
+
/** The text an address is shown as: dotted IPv4, or RFC 5952 IPv6. */
|
|
81
|
+
export function ipAddressText(address) {
|
|
82
|
+
return address.family === "ipv4" ? dotted(address.octets) : ipv6Text(address.octets);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=ip.js.map
|
package/dist/ip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../src/ip.ts"],"names":[],"mappings":"AAkBA,yEAAyE;AACzE,MAAM,OAAO,cAAe,SAAQ,KAAK;IAClB;IAArB,YAAqB,MAAc;QACjC,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;QADpC,WAAM,GAAN,MAAM,CAAQ;QAEjC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAAC,OAAkB;IAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;IACjC,2EAA2E;IAC3E,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IACpF,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IACrF,MAAM,IAAI,cAAc,CAA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,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACvF,CAAC","sourcesContent":["/**\n * The checked reading of `sid.v1.common.IpAddress` and its text for display.\n * The message carries one IP host address as data: 4 bytes for IPv4 or 16\n * for IPv6 in network order, the length giving the family. An absent field\n * means the address is unknown or was not recorded.\n */\nimport type { IpAddress } from \"./generated/sid/v1/common/types.js\";\n\n/** An address's family, as the message's length gives it. */\nexport type IpFamily = \"ipv4\" | \"ipv6\";\n\n/** An address read from its message: the family and a copy of its octets. */\nexport interface CheckedIpAddress {\n readonly family: IpFamily;\n /** 4 octets for IPv4, 16 for IPv6, in network order. */\n readonly octets: Uint8Array;\n}\n\n/** A message whose value is not 4 or 16 bytes. Names the length only. */\nexport class IpAddressError extends Error {\n constructor(readonly length: number) {\n super(`an IP address is 4 or 16 bytes, not ${length}`);\n this.name = \"IpAddressError\";\n }\n}\n\n/** The address `message` carries, or `IpAddressError` for another length. */\nexport function readIpAddress(message: IpAddress): CheckedIpAddress {\n const { length } = message.value;\n // A copy into a plain Uint8Array: a Buffer's own slice would share memory.\n if (length === 4) return { family: \"ipv4\", octets: Uint8Array.from(message.value) };\n if (length === 16) return { family: \"ipv6\", octets: Uint8Array.from(message.value) };\n throw new IpAddressError(length);\n}\n\n/**\n * The address of an optional field: an absent message stays absent (unknown\n * or unrecorded); a present one is read as `readIpAddress` reads it.\n */\nexport function optionalIpAddress(message: IpAddress | undefined): CheckedIpAddress | undefined {\n return message === undefined ? undefined : readIpAddress(message);\n}\n\n/** The message carrying `address`. */\nexport function toIpAddress(address: CheckedIpAddress): IpAddress {\n return { value: Uint8Array.from(address.octets) };\n}\n\n/** Dotted-decimal text of 4 octets. */\nfunction dotted(octets: Uint8Array): string {\n return Array.from(octets).join(\".\");\n}\n\n/** Whether 16 octets are an IPv4-mapped IPv6 address (RFC 4291 section 2.5.5.2). */\nfunction isMapped(octets: Uint8Array): boolean {\n for (let i = 0; i < 10; i++) if (octets[i] !== 0) return false;\n return octets[10] === 0xff && octets[11] === 0xff;\n}\n\n/**\n * RFC 5952 text of 16 octets: lowercase hexadecimal groups without leading\n * zeros, the longest run of two or more zero groups (the first of equal\n * runs) shortened to `::`. An IPv4-mapped address is written\n * `::ffff:a.b.c.d` (RFC 5952 section 5); it stays IPv6.\n */\nfunction ipv6Text(octets: Uint8Array): string {\n if (isMapped(octets)) return `::ffff:${dotted(octets.subarray(12))}`;\n const groups: number[] = [];\n for (let i = 0; i < 16; i += 2) groups.push((octets[i]! << 8) | octets[i + 1]!);\n let bestStart = -1;\n let bestLength = 1;\n for (let i = 0; i < 8;) {\n if (groups[i] !== 0) {\n i++;\n continue;\n }\n let j = i;\n while (j < 8 && groups[j] === 0) j++;\n if (j - i > bestLength) {\n bestStart = i;\n bestLength = j - i;\n }\n i = j;\n }\n const hex = (g: number) => g.toString(16);\n if (bestStart < 0) return groups.map(hex).join(\":\");\n const head = groups.slice(0, bestStart).map(hex).join(\":\");\n const tail = groups\n .slice(bestStart + bestLength)\n .map(hex)\n .join(\":\");\n return `${head}::${tail}`;\n}\n\n/** The text an address is shown as: dotted IPv4, or RFC 5952 IPv6. */\nexport function ipAddressText(address: CheckedIpAddress): string {\n return address.family === \"ipv4\" ? dotted(address.octets) : ipv6Text(address.octets);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@structured-id/proto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "StructuredID public sid.v1 API for TypeScript: generated messages and clients for gRPC and gRPC-web.",
|
|
6
6
|
"exports": {
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"types": "./dist/totp.d.ts",
|
|
9
9
|
"default": "./dist/totp.js"
|
|
10
10
|
},
|
|
11
|
+
"./ip": {
|
|
12
|
+
"types": "./dist/ip.d.ts",
|
|
13
|
+
"default": "./dist/ip.js"
|
|
14
|
+
},
|
|
11
15
|
"./sid/v1/*": {
|
|
12
16
|
"types": "./dist/generated/sid/v1/*.d.ts",
|
|
13
17
|
"default": "./dist/generated/sid/v1/*.js"
|
|
@@ -57,7 +61,7 @@
|
|
|
57
61
|
"dependencies": {
|
|
58
62
|
"@protobuf-ts/runtime": "^2.11.1",
|
|
59
63
|
"@protobuf-ts/runtime-rpc": "^2.11.1",
|
|
60
|
-
"@structured-id/ids": "^0.
|
|
64
|
+
"@structured-id/ids": "^0.9.0"
|
|
61
65
|
},
|
|
62
66
|
"devDependencies": {
|
|
63
67
|
"@bufbuild/buf": "^1.75.0",
|