@fern-api/venus-api-sdk 0.0.20-2-gc6b8e16 → 0.0.20-4-gc5bc779
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/api/resources/organization/types/LightweightUser.d.ts +8 -0
- package/api/resources/organization/types/LightweightUser.js +5 -0
- package/api/resources/organization/types/Organization.d.ts +1 -0
- package/api/resources/organization/types/index.d.ts +1 -0
- package/api/resources/organization/types/index.js +1 -0
- package/core/auth/BasicAuth.js +7 -5
- package/package.json +1 -4
- package/serialization/resources/organization/types/LightweightUser.d.ts +14 -0
- package/serialization/resources/organization/types/LightweightUser.js +35 -0
- package/serialization/resources/organization/types/Organization.d.ts +1 -0
- package/serialization/resources/organization/types/Organization.js +1 -0
- package/serialization/resources/organization/types/index.d.ts +1 -0
- package/serialization/resources/organization/types/index.js +1 -0
package/core/auth/BasicAuth.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BasicAuth = void 0;
|
|
4
|
-
const basic_auth_1 = require("basic-auth");
|
|
5
4
|
const js_base64_1 = require("js-base64");
|
|
5
|
+
const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
|
|
6
6
|
exports.BasicAuth = {
|
|
7
7
|
toAuthorizationHeader: (basicAuth) => {
|
|
8
8
|
if (basicAuth == null) {
|
|
@@ -12,13 +12,15 @@ exports.BasicAuth = {
|
|
|
12
12
|
return `Basic ${token}`;
|
|
13
13
|
},
|
|
14
14
|
fromAuthorizationHeader: (header) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
|
|
16
|
+
const decoded = js_base64_1.Base64.decode(credentials);
|
|
17
|
+
const [username, password] = decoded.split(":", 2);
|
|
18
|
+
if (username == null || password == null) {
|
|
17
19
|
throw new Error("Invalid basic auth");
|
|
18
20
|
}
|
|
19
21
|
return {
|
|
20
|
-
username
|
|
21
|
-
password
|
|
22
|
+
username,
|
|
23
|
+
password,
|
|
22
24
|
};
|
|
23
25
|
},
|
|
24
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/venus-api-sdk",
|
|
3
|
-
"version": "0.0.20-
|
|
3
|
+
"version": "0.0.20-4-gc5bc779",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"Client.d.ts",
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"url-join": "4.0.1",
|
|
23
23
|
"@types/url-join": "4.0.1",
|
|
24
|
-
"basic-auth": "2.0.1",
|
|
25
|
-
"@types/basic-auth": "1.1.3",
|
|
26
24
|
"js-base64": "3.7.2",
|
|
27
|
-
"buffer": "6.0.3",
|
|
28
25
|
"axios": "0.27.2"
|
|
29
26
|
},
|
|
30
27
|
"devDependencies": {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../..";
|
|
5
|
+
import { FernVenusApi } from "../../../..";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const LightweightUser: core.serialization.ObjectSchema<serializers.LightweightUser.Raw, FernVenusApi.LightweightUser>;
|
|
8
|
+
export declare namespace LightweightUser {
|
|
9
|
+
interface Raw {
|
|
10
|
+
userId: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
picture_url?: string | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LightweightUser = void 0;
|
|
30
|
+
const core = __importStar(require("../../../../core"));
|
|
31
|
+
exports.LightweightUser = core.serialization.object({
|
|
32
|
+
userId: core.serialization.string(),
|
|
33
|
+
displayName: core.serialization.string(),
|
|
34
|
+
pictureUrl: core.serialization.property("picture_url", core.serialization.string().optional()),
|
|
35
|
+
});
|
|
@@ -31,4 +31,5 @@ const core = __importStar(require("../../../../core"));
|
|
|
31
31
|
exports.Organization = core.serialization.object({
|
|
32
32
|
organizationId: core.serialization.lazy(async () => (await Promise.resolve().then(() => __importStar(require("../../..")))).OrganizationId),
|
|
33
33
|
artifactReadRequiresToken: core.serialization.boolean(),
|
|
34
|
+
users: core.serialization.list(core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("../../..")))).LightweightUser)),
|
|
34
35
|
});
|