@bluestep-systems/b6p-core 1.4.0 → 1.6.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/README.md +51 -2
- package/dist/Err.d.ts +69 -2
- package/dist/Err.js +98 -2
- package/dist/Err.js.map +1 -1
- package/dist/constants/Gateway.d.ts +14 -0
- package/dist/constants/Gateway.js +14 -0
- package/dist/constants/Gateway.js.map +1 -1
- package/dist/gateway/GatewayClient.js +10 -1
- package/dist/gateway/GatewayClient.js.map +1 -1
- package/dist/gateway/GatewayMarketplace.d.ts +138 -6
- package/dist/gateway/GatewayMarketplace.js +301 -15
- package/dist/gateway/GatewayMarketplace.js.map +1 -1
- package/dist/gateway/GatewayTokenService.d.ts +39 -5
- package/dist/gateway/GatewayTokenService.js +169 -11
- package/dist/gateway/GatewayTokenService.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/testing/FakeGateway.d.ts +45 -3
- package/dist/testing/FakeGateway.js +307 -9
- package/dist/testing/FakeGateway.js.map +1 -1
- package/dist/types.d.ts +109 -3
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -595,7 +595,7 @@ export type GqlParentNameResp = {
|
|
|
595
595
|
* carry a code outside this list; {@link Err.GatewayError.code} keeps whatever arrived.
|
|
596
596
|
* @lastreviewed null
|
|
597
597
|
*/
|
|
598
|
-
export type GatewayErrorCode = "token-missing" | "token-invalid" | "scope-missing" | "not-permitted" | "not-found" | "non-fast-forward" | "too-large" | "forge-unavailable" | "scope-escalation" | "alias-taken" | "invalid-request" | "token-limit" | "registry-unavailable" | "repo-exists" | "rewrite-in-progress";
|
|
598
|
+
export type GatewayErrorCode = "token-missing" | "token-invalid" | "scope-missing" | "not-permitted" | "not-found" | "non-fast-forward" | "too-large" | "forge-unavailable" | "scope-escalation" | "alias-taken" | "invalid-request" | "token-limit" | "registry-unavailable" | "repo-exists" | "rewrite-in-progress" | "repo-archived" | "not-archived";
|
|
599
599
|
/**
|
|
600
600
|
* The JSON body of a gateway error response. On git routes the body is best-effort, so every
|
|
601
601
|
* member may be absent.
|
|
@@ -826,10 +826,53 @@ export interface GatewayMarketplaceRepo {
|
|
|
826
826
|
* @lastreviewed null
|
|
827
827
|
*/
|
|
828
828
|
gitUrl: string;
|
|
829
|
+
/**
|
|
830
|
+
* The repo's website, `""` when it has none. A gateway that predates the repo lifecycle sends none: `""` then.
|
|
831
|
+
* @lastreviewed null
|
|
832
|
+
*/
|
|
833
|
+
website: string;
|
|
834
|
+
/**
|
|
835
|
+
* The repo's topics in the forge's order, `[]` when it has none (or the gateway predates them).
|
|
836
|
+
* @lastreviewed null
|
|
837
|
+
*/
|
|
838
|
+
topics: string[];
|
|
839
|
+
/**
|
|
840
|
+
* Whether the repo is archived: it can be fetched but not pushed to, edited or renamed (unarchive it first).
|
|
841
|
+
* `false` when the gateway predates the repo lifecycle and sends no flag.
|
|
842
|
+
* @lastreviewed null
|
|
843
|
+
*/
|
|
844
|
+
archived: boolean;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* One deleted marketplace repo, as `GET /api/v1/registry/tombstones` lists it. A delete renames the repo to its
|
|
848
|
+
* tombstone and archives it; nothing is destroyed until a purge.
|
|
849
|
+
* @lastreviewed null
|
|
850
|
+
*/
|
|
851
|
+
export interface GatewayMarketplaceTombstone {
|
|
852
|
+
/**
|
|
853
|
+
* The tombstone's name, `_deleted-<id>-<name>`: what {@link GatewayMarketplace.purge} takes.
|
|
854
|
+
* @lastreviewed null
|
|
855
|
+
*/
|
|
856
|
+
tombstone: string;
|
|
857
|
+
/**
|
|
858
|
+
* The repo's name as the tombstone holds it (cut short when the name was long).
|
|
859
|
+
* @lastreviewed null
|
|
860
|
+
*/
|
|
861
|
+
deletedName: string;
|
|
862
|
+
/**
|
|
863
|
+
* The forge's repo id.
|
|
864
|
+
* @lastreviewed null
|
|
865
|
+
*/
|
|
866
|
+
id: number;
|
|
867
|
+
/**
|
|
868
|
+
* Whether the tombstone is archived (a purge needs it to be).
|
|
869
|
+
* @lastreviewed null
|
|
870
|
+
*/
|
|
871
|
+
archived: boolean;
|
|
829
872
|
}
|
|
830
873
|
/**
|
|
831
874
|
* The editable metadata of a marketplace repo. Each member is optional: absent means "not given" (on create
|
|
832
|
-
* the gateway's default applies;
|
|
875
|
+
* the gateway's default applies; on an edit it is left unchanged). Never send `null`: omit the member.
|
|
833
876
|
* @lastreviewed null
|
|
834
877
|
*/
|
|
835
878
|
export interface GatewayMarketplaceRepoMetadata {
|
|
@@ -920,6 +963,12 @@ export interface GatewayTokenRecord {
|
|
|
920
963
|
* @lastreviewed null
|
|
921
964
|
*/
|
|
922
965
|
current: boolean;
|
|
966
|
+
/**
|
|
967
|
+
* Whether a rotation of this token may set a new expiry. A gateway that predates refreshable
|
|
968
|
+
* tokens leaves it out, which core reads as `false`.
|
|
969
|
+
* @lastreviewed null
|
|
970
|
+
*/
|
|
971
|
+
refreshable: boolean;
|
|
923
972
|
}
|
|
924
973
|
/**
|
|
925
974
|
* Body of `GET /api/v1/tokens`.
|
|
@@ -969,6 +1018,13 @@ export interface GatewayTokenCreateRequest {
|
|
|
969
1018
|
* @lastreviewed null
|
|
970
1019
|
*/
|
|
971
1020
|
expiresAt?: string | null;
|
|
1021
|
+
/**
|
|
1022
|
+
* Mint the token refreshable, so a rotation may later set a new expiry. Sent only when `true`; left
|
|
1023
|
+
* out or `false`, the token is not refreshable. Against a gateway that does not offer refreshable
|
|
1024
|
+
* tokens, `true` is refused before the mint is sent (`Err.GatewayRefreshableUnsupportedError`).
|
|
1025
|
+
* @lastreviewed null
|
|
1026
|
+
*/
|
|
1027
|
+
refreshable?: boolean;
|
|
972
1028
|
}
|
|
973
1029
|
/**
|
|
974
1030
|
* Set on a {@link GatewayCreatedToken} when no expiry was asked for and the default 90 days would
|
|
@@ -1018,12 +1074,23 @@ export interface GatewayMintedTokenBody {
|
|
|
1018
1074
|
* @lastreviewed null
|
|
1019
1075
|
*/
|
|
1020
1076
|
expiresAt: string | null;
|
|
1077
|
+
/**
|
|
1078
|
+
* Whether a rotation of the token may set a new expiry. Left out by a gateway that predates
|
|
1079
|
+
* refreshable tokens.
|
|
1080
|
+
* @lastreviewed null
|
|
1081
|
+
*/
|
|
1082
|
+
refreshable?: boolean;
|
|
1021
1083
|
}
|
|
1022
1084
|
/**
|
|
1023
1085
|
* A freshly minted token, secret included. Core never logs it; showing it is the consumer's job.
|
|
1024
1086
|
* @lastreviewed null
|
|
1025
1087
|
*/
|
|
1026
1088
|
export interface GatewayMintedToken extends GatewayMintedTokenBody {
|
|
1089
|
+
/**
|
|
1090
|
+
* Whether a rotation of the token may set a new expiry; `false` when the gateway left it out.
|
|
1091
|
+
* @lastreviewed null
|
|
1092
|
+
*/
|
|
1093
|
+
refreshable: boolean;
|
|
1027
1094
|
/**
|
|
1028
1095
|
* `true` when {@link GatewayMintedTokenBody.expiresAt} is `null`.
|
|
1029
1096
|
* @lastreviewed null
|
|
@@ -1058,7 +1125,8 @@ export interface GatewayTokenRotateResult {
|
|
|
1058
1125
|
alias: string;
|
|
1059
1126
|
};
|
|
1060
1127
|
/**
|
|
1061
|
-
* Its replacement: same alias
|
|
1128
|
+
* Its replacement: same alias and scopes, with a new secret, and the same absolute end date
|
|
1129
|
+
* (`expiresAt`) unless a refreshable token's rotation asked for new `days`.
|
|
1062
1130
|
* @lastreviewed null
|
|
1063
1131
|
*/
|
|
1064
1132
|
token: GatewayMintedToken;
|
|
@@ -1069,6 +1137,44 @@ export interface GatewayTokenRotateResult {
|
|
|
1069
1137
|
*/
|
|
1070
1138
|
rotatedCurrent: boolean;
|
|
1071
1139
|
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Options for `core.gateway.tokens.rotate()`.
|
|
1142
|
+
* @lastreviewed null
|
|
1143
|
+
*/
|
|
1144
|
+
export interface GatewayTokenRotateOptions {
|
|
1145
|
+
/**
|
|
1146
|
+
* Give the replacement a new expiry this many days from now: a whole number from 1 to
|
|
1147
|
+
* `Gateway.MAX_REFRESH_DAYS` (365). Only for a refreshable token: for any
|
|
1148
|
+
* other, `rotate()` throws `Err.GatewayTokenNotRefreshableError`. Left out, the replacement keeps
|
|
1149
|
+
* the rotated token's absolute end date.
|
|
1150
|
+
* @lastreviewed null
|
|
1151
|
+
*/
|
|
1152
|
+
days?: number;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Result of `core.gateway.tokens.setRefreshable()`.
|
|
1156
|
+
* @lastreviewed null
|
|
1157
|
+
*/
|
|
1158
|
+
export interface GatewayTokenRefreshableResult {
|
|
1159
|
+
id: string;
|
|
1160
|
+
alias: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* The flag as the gateway now holds it.
|
|
1163
|
+
* @lastreviewed null
|
|
1164
|
+
*/
|
|
1165
|
+
refreshable: boolean;
|
|
1166
|
+
/**
|
|
1167
|
+
* The flag as the caller's token list gave it just before the change; equal to
|
|
1168
|
+
* {@link refreshable} when nothing changed.
|
|
1169
|
+
* @lastreviewed null
|
|
1170
|
+
*/
|
|
1171
|
+
was: boolean;
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether this is the token b6p has stored.
|
|
1174
|
+
* @lastreviewed null
|
|
1175
|
+
*/
|
|
1176
|
+
current: boolean;
|
|
1177
|
+
}
|
|
1072
1178
|
/**
|
|
1073
1179
|
* The recipes `core.schema.recipe()` can run.
|
|
1074
1180
|
* @lastreviewed null
|