@bluestep-systems/b6p-core 1.5.0 → 1.7.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/dist/types.d.ts CHANGED
@@ -711,32 +711,61 @@ export interface GatewayKnowledgeBase {
711
711
  access?: GatewayKnowledgeBaseAccess;
712
712
  }
713
713
  /**
714
- * A knowledge base's access, as the gateway reports it: `{ kind: "public" }` (anyone may read it with no
715
- * sign-in), `{ kind: "private" }`, or a kind this version of core does not know. The kind is matched exactly
716
- * (`"public"` and `"private"`, lower case); anything else, including `"Public"`, is `unknown`, which must be
717
- * treated as private. `rawKind` is the kind as sent (`null` when it was not a string) and `raw` the whole value.
718
- * A kind that carries a permission object may follow, which is why this is a union and not a boolean.
714
+ * A knowledge base's access, as the gateway reports it. Who may read it:
715
+ * - `{ kind: "public" }`: anyone, with no sign-in.
716
+ * - `{ kind: "private" }`: any signed-in user the gateway admits to global knowledge bases.
717
+ * - `{ kind: "fleet-supers" }` (web-global contract 6.26.0): fleet supers only, that is supers who are enabled and
718
+ * not restricted to a reseller.
719
+ * - `{ kind: "supers" }` (web-global contract 6.26.0): fleet supers and reseller supers (enabled supers, restricted
720
+ * to a reseller or not).
721
+ * - `unknown`: a kind this version of core does not know.
722
+ *
723
+ * The kind is matched exactly (`"public"`, `"private"`, `"fleet-supers"`, `"supers"`, lower case, and no member
724
+ * but `kind`); anything else, including `"Public"`, `"Supers"` or `"fleet_supers"`, is `unknown`, which must never
725
+ * be treated as more open than the most closed kind: never public, and not readable by anyone in particular.
726
+ * Only `public` is readable signed out; `fleet-supers` and `supers` are internal and never public. `rawKind` is the
727
+ * kind as sent (`null` when it was not a string) and `raw` the whole value. A kind that carries a permission
728
+ * object may follow, which is why this is a union and not a boolean.
719
729
  * @lastreviewed null
720
730
  */
721
731
  export type GatewayKnowledgeBaseAccess = {
722
732
  kind: "public";
723
733
  } | {
724
734
  kind: "private";
735
+ } | {
736
+ kind: "fleet-supers";
737
+ } | {
738
+ kind: "supers";
725
739
  } | {
726
740
  kind: "unknown";
727
741
  rawKind: string | null;
728
742
  raw: JsonValue;
729
743
  };
730
744
  /**
731
- * An access a caller may set: public or private. An `unknown` access read from the gateway is never accepted
732
- * here, so it can never be sent back.
745
+ * An access a caller may set: `public`, `private`, `fleet-supers` or `supers` (see
746
+ * {@link GatewayKnowledgeBaseAccess} for who may read each). An `unknown` access read from the gateway is never
747
+ * accepted here, so it can never be sent back.
748
+ *
749
+ * Do not set `fleet-supers` or `supers` on any knowledge base until every gateway enforces them (web-global
750
+ * CU-1k5g91btrrn deployed, contract 6.26.0). An older gateway refuses them, or worse, lets any signed-in user read
751
+ * a kind it does not know.
733
752
  * @lastreviewed null
734
753
  */
735
754
  export type GatewayKnowledgeBaseAccessInput = {
736
755
  kind: "public";
737
756
  } | {
738
757
  kind: "private";
758
+ } | {
759
+ kind: "fleet-supers";
760
+ } | {
761
+ kind: "supers";
739
762
  };
763
+ /**
764
+ * The kinds of {@link GatewayKnowledgeBaseAccessInput}: every access kind this version of core knows, exactly as
765
+ * sent on the wire.
766
+ * @lastreviewed null
767
+ */
768
+ export type GatewayKnowledgeBaseAccessKind = GatewayKnowledgeBaseAccessInput["kind"];
740
769
  /**
741
770
  * A global knowledge base as the admin routes (`POST`, `GET /{id}`, `PATCH /{id}`) describe it.
742
771
  * @lastreviewed null
@@ -963,6 +992,12 @@ export interface GatewayTokenRecord {
963
992
  * @lastreviewed null
964
993
  */
965
994
  current: boolean;
995
+ /**
996
+ * Whether a rotation of this token may set a new expiry. A gateway that predates refreshable
997
+ * tokens leaves it out, which core reads as `false`.
998
+ * @lastreviewed null
999
+ */
1000
+ refreshable: boolean;
966
1001
  }
967
1002
  /**
968
1003
  * Body of `GET /api/v1/tokens`.
@@ -1012,6 +1047,13 @@ export interface GatewayTokenCreateRequest {
1012
1047
  * @lastreviewed null
1013
1048
  */
1014
1049
  expiresAt?: string | null;
1050
+ /**
1051
+ * Mint the token refreshable, so a rotation may later set a new expiry. Sent only when `true`; left
1052
+ * out or `false`, the token is not refreshable. Against a gateway that does not offer refreshable
1053
+ * tokens, `true` is refused before the mint is sent (`Err.GatewayRefreshableUnsupportedError`).
1054
+ * @lastreviewed null
1055
+ */
1056
+ refreshable?: boolean;
1015
1057
  }
1016
1058
  /**
1017
1059
  * Set on a {@link GatewayCreatedToken} when no expiry was asked for and the default 90 days would
@@ -1061,12 +1103,23 @@ export interface GatewayMintedTokenBody {
1061
1103
  * @lastreviewed null
1062
1104
  */
1063
1105
  expiresAt: string | null;
1106
+ /**
1107
+ * Whether a rotation of the token may set a new expiry. Left out by a gateway that predates
1108
+ * refreshable tokens.
1109
+ * @lastreviewed null
1110
+ */
1111
+ refreshable?: boolean;
1064
1112
  }
1065
1113
  /**
1066
1114
  * A freshly minted token, secret included. Core never logs it; showing it is the consumer's job.
1067
1115
  * @lastreviewed null
1068
1116
  */
1069
1117
  export interface GatewayMintedToken extends GatewayMintedTokenBody {
1118
+ /**
1119
+ * Whether a rotation of the token may set a new expiry; `false` when the gateway left it out.
1120
+ * @lastreviewed null
1121
+ */
1122
+ refreshable: boolean;
1070
1123
  /**
1071
1124
  * `true` when {@link GatewayMintedTokenBody.expiresAt} is `null`.
1072
1125
  * @lastreviewed null
@@ -1101,7 +1154,8 @@ export interface GatewayTokenRotateResult {
1101
1154
  alias: string;
1102
1155
  };
1103
1156
  /**
1104
- * Its replacement: same alias, scopes and absolute end date (`expiresAt`), with a new secret.
1157
+ * Its replacement: same alias and scopes, with a new secret, and the same absolute end date
1158
+ * (`expiresAt`) unless a refreshable token's rotation asked for new `days`.
1105
1159
  * @lastreviewed null
1106
1160
  */
1107
1161
  token: GatewayMintedToken;
@@ -1112,6 +1166,44 @@ export interface GatewayTokenRotateResult {
1112
1166
  */
1113
1167
  rotatedCurrent: boolean;
1114
1168
  }
1169
+ /**
1170
+ * Options for `core.gateway.tokens.rotate()`.
1171
+ * @lastreviewed null
1172
+ */
1173
+ export interface GatewayTokenRotateOptions {
1174
+ /**
1175
+ * Give the replacement a new expiry this many days from now: a whole number from 1 to
1176
+ * `Gateway.MAX_REFRESH_DAYS` (365). Only for a refreshable token: for any
1177
+ * other, `rotate()` throws `Err.GatewayTokenNotRefreshableError`. Left out, the replacement keeps
1178
+ * the rotated token's absolute end date.
1179
+ * @lastreviewed null
1180
+ */
1181
+ days?: number;
1182
+ }
1183
+ /**
1184
+ * Result of `core.gateway.tokens.setRefreshable()`.
1185
+ * @lastreviewed null
1186
+ */
1187
+ export interface GatewayTokenRefreshableResult {
1188
+ id: string;
1189
+ alias: string;
1190
+ /**
1191
+ * The flag as the gateway now holds it.
1192
+ * @lastreviewed null
1193
+ */
1194
+ refreshable: boolean;
1195
+ /**
1196
+ * The flag as the caller's token list gave it just before the change; equal to
1197
+ * {@link refreshable} when nothing changed.
1198
+ * @lastreviewed null
1199
+ */
1200
+ was: boolean;
1201
+ /**
1202
+ * Whether this is the token b6p has stored.
1203
+ * @lastreviewed null
1204
+ */
1205
+ current: boolean;
1206
+ }
1115
1207
  /**
1116
1208
  * The recipes `core.schema.recipe()` can run.
1117
1209
  * @lastreviewed null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluestep-systems/b6p-core",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Core (vscode-free) library for BlueStep B6P script management",
5
5
  "license": "MIT",
6
6
  "repository": {