@fern-api/venus-api-sdk 1.3.0 → 2.0.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.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/BaseClient.d.ts +2 -8
  3. package/dist/cjs/BaseClient.js +2 -14
  4. package/dist/cjs/Client.d.ts +2 -2
  5. package/dist/cjs/Client.js +1 -1
  6. package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +2 -2
  7. package/dist/cjs/api/resources/apiKeys/client/Client.js +6 -11
  8. package/dist/cjs/api/resources/auth/client/Client.d.ts +2 -2
  9. package/dist/cjs/api/resources/auth/client/Client.js +3 -5
  10. package/dist/cjs/api/resources/organization/client/Client.d.ts +2 -2
  11. package/dist/cjs/api/resources/organization/client/Client.js +13 -25
  12. package/dist/cjs/api/resources/registry/client/Client.d.ts +2 -2
  13. package/dist/cjs/api/resources/registry/client/Client.js +3 -5
  14. package/dist/cjs/api/resources/user/client/Client.d.ts +2 -2
  15. package/dist/cjs/api/resources/user/client/Client.js +4 -7
  16. package/dist/cjs/core/index.d.ts +0 -2
  17. package/dist/cjs/core/index.js +0 -2
  18. package/dist/cjs/version.d.ts +1 -1
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/esm/BaseClient.d.mts +2 -8
  21. package/dist/esm/BaseClient.mjs +2 -13
  22. package/dist/esm/Client.d.mts +2 -2
  23. package/dist/esm/Client.mjs +2 -2
  24. package/dist/esm/api/resources/apiKeys/client/Client.d.mts +2 -2
  25. package/dist/esm/api/resources/apiKeys/client/Client.mjs +7 -12
  26. package/dist/esm/api/resources/auth/client/Client.d.mts +2 -2
  27. package/dist/esm/api/resources/auth/client/Client.mjs +4 -6
  28. package/dist/esm/api/resources/organization/client/Client.d.mts +2 -2
  29. package/dist/esm/api/resources/organization/client/Client.mjs +14 -26
  30. package/dist/esm/api/resources/registry/client/Client.d.mts +2 -2
  31. package/dist/esm/api/resources/registry/client/Client.mjs +4 -6
  32. package/dist/esm/api/resources/user/client/Client.d.mts +2 -2
  33. package/dist/esm/api/resources/user/client/Client.mjs +5 -8
  34. package/dist/esm/core/index.d.mts +0 -2
  35. package/dist/esm/core/index.mjs +0 -2
  36. package/dist/esm/version.d.mts +1 -1
  37. package/dist/esm/version.mjs +1 -1
  38. package/package.json +1 -1
  39. package/dist/cjs/auth/BearerAuthProvider.d.ts +0 -20
  40. package/dist/cjs/auth/BearerAuthProvider.js +0 -76
  41. package/dist/cjs/auth/index.d.ts +0 -1
  42. package/dist/cjs/auth/index.js +0 -5
  43. package/dist/cjs/core/auth/AuthProvider.d.ts +0 -7
  44. package/dist/cjs/core/auth/AuthProvider.js +0 -2
  45. package/dist/cjs/core/auth/AuthRequest.d.ts +0 -9
  46. package/dist/cjs/core/auth/AuthRequest.js +0 -2
  47. package/dist/cjs/core/auth/BasicAuth.d.ts +0 -8
  48. package/dist/cjs/core/auth/BasicAuth.js +0 -27
  49. package/dist/cjs/core/auth/BearerToken.d.ts +0 -7
  50. package/dist/cjs/core/auth/BearerToken.js +0 -16
  51. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +0 -5
  52. package/dist/cjs/core/auth/NoOpAuthProvider.js +0 -9
  53. package/dist/cjs/core/auth/index.d.ts +0 -5
  54. package/dist/cjs/core/auth/index.js +0 -9
  55. package/dist/cjs/core/base64.d.ts +0 -2
  56. package/dist/cjs/core/base64.js +0 -26
  57. package/dist/esm/auth/BearerAuthProvider.d.mts +0 -20
  58. package/dist/esm/auth/BearerAuthProvider.mjs +0 -39
  59. package/dist/esm/auth/index.d.mts +0 -1
  60. package/dist/esm/auth/index.mjs +0 -1
  61. package/dist/esm/core/auth/AuthProvider.d.mts +0 -7
  62. package/dist/esm/core/auth/AuthProvider.mjs +0 -1
  63. package/dist/esm/core/auth/AuthRequest.d.mts +0 -9
  64. package/dist/esm/core/auth/AuthRequest.mjs +0 -1
  65. package/dist/esm/core/auth/BasicAuth.d.mts +0 -8
  66. package/dist/esm/core/auth/BasicAuth.mjs +0 -24
  67. package/dist/esm/core/auth/BearerToken.d.mts +0 -7
  68. package/dist/esm/core/auth/BearerToken.mjs +0 -13
  69. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +0 -5
  70. package/dist/esm/core/auth/NoOpAuthProvider.mjs +0 -5
  71. package/dist/esm/core/auth/index.d.mts +0 -5
  72. package/dist/esm/core/auth/index.mjs +0 -3
  73. package/dist/esm/core/base64.d.mts +0 -2
  74. package/dist/esm/core/base64.mjs +0 -22
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BearerToken = void 0;
4
- const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
5
- function toAuthorizationHeader(token) {
6
- if (token == null) {
7
- return undefined;
8
- }
9
- return `Bearer ${token}`;
10
- }
11
- exports.BearerToken = {
12
- toAuthorizationHeader: toAuthorizationHeader,
13
- fromAuthorizationHeader: (header) => {
14
- return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
15
- },
16
- };
@@ -1,5 +0,0 @@
1
- import type { AuthProvider } from "./AuthProvider.js";
2
- import type { AuthRequest } from "./AuthRequest.js";
3
- export declare class NoOpAuthProvider implements AuthProvider {
4
- getAuthRequest(): Promise<AuthRequest>;
5
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoOpAuthProvider = void 0;
4
- class NoOpAuthProvider {
5
- getAuthRequest() {
6
- return Promise.resolve({ headers: {} });
7
- }
8
- }
9
- exports.NoOpAuthProvider = NoOpAuthProvider;
@@ -1,5 +0,0 @@
1
- export type { AuthProvider } from "./AuthProvider.js";
2
- export type { AuthRequest } from "./AuthRequest.js";
3
- export { BasicAuth } from "./BasicAuth.js";
4
- export { BearerToken } from "./BearerToken.js";
5
- export { NoOpAuthProvider } from "./NoOpAuthProvider.js";
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
4
- var BasicAuth_js_1 = require("./BasicAuth.js");
5
- Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
6
- var BearerToken_js_1 = require("./BearerToken.js");
7
- Object.defineProperty(exports, "BearerToken", { enumerable: true, get: function () { return BearerToken_js_1.BearerToken; } });
8
- var NoOpAuthProvider_js_1 = require("./NoOpAuthProvider.js");
9
- Object.defineProperty(exports, "NoOpAuthProvider", { enumerable: true, get: function () { return NoOpAuthProvider_js_1.NoOpAuthProvider; } });
@@ -1,2 +0,0 @@
1
- export declare function base64Encode(input: string): string;
2
- export declare function base64Decode(input: string): string;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.base64Encode = base64Encode;
4
- exports.base64Decode = base64Decode;
5
- function base64ToBytes(base64) {
6
- const binString = atob(base64);
7
- return Uint8Array.from(binString, (m) => m.codePointAt(0));
8
- }
9
- function bytesToBase64(bytes) {
10
- const binString = String.fromCodePoint(...bytes);
11
- return btoa(binString);
12
- }
13
- function base64Encode(input) {
14
- if (typeof Buffer !== "undefined") {
15
- return Buffer.from(input, "utf8").toString("base64");
16
- }
17
- const bytes = new TextEncoder().encode(input);
18
- return bytesToBase64(bytes);
19
- }
20
- function base64Decode(input) {
21
- if (typeof Buffer !== "undefined") {
22
- return Buffer.from(input, "base64").toString("utf8");
23
- }
24
- const bytes = base64ToBytes(input);
25
- return new TextDecoder().decode(bytes);
26
- }
@@ -1,20 +0,0 @@
1
- import * as core from "../core/index.mjs";
2
- declare const TOKEN_PARAM: "token";
3
- export declare class BearerAuthProvider implements core.AuthProvider {
4
- private readonly options;
5
- constructor(options: BearerAuthProvider.Options);
6
- static canCreate(options: Partial<BearerAuthProvider.Options>): boolean;
7
- getAuthRequest({ endpointMetadata, }?: {
8
- endpointMetadata?: core.EndpointMetadata;
9
- }): Promise<core.AuthRequest>;
10
- }
11
- export declare namespace BearerAuthProvider {
12
- const AUTH_SCHEME: "HTTPBearer";
13
- const AUTH_CONFIG_ERROR_MESSAGE: string;
14
- type Options = AuthOptions;
15
- type AuthOptions = {
16
- [TOKEN_PARAM]?: core.Supplier<core.BearerToken>;
17
- };
18
- function createInstance(options: Options): core.AuthProvider;
19
- }
20
- export {};
@@ -1,39 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import * as core from "../core/index.mjs";
12
- const TOKEN_PARAM = "token";
13
- export class BearerAuthProvider {
14
- constructor(options) {
15
- this.options = options;
16
- }
17
- static canCreate(options) {
18
- return (options === null || options === void 0 ? void 0 : options[TOKEN_PARAM]) != null;
19
- }
20
- getAuthRequest() {
21
- return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
22
- const token = yield core.Supplier.get(this.options[TOKEN_PARAM]);
23
- if (token == null) {
24
- return { headers: {} };
25
- }
26
- return {
27
- headers: { Authorization: `Bearer ${token}` },
28
- };
29
- });
30
- }
31
- }
32
- (function (BearerAuthProvider) {
33
- BearerAuthProvider.AUTH_SCHEME = "HTTPBearer";
34
- BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${TOKEN_PARAM}' when initializing the client`;
35
- function createInstance(options) {
36
- return new BearerAuthProvider(options);
37
- }
38
- BearerAuthProvider.createInstance = createInstance;
39
- })(BearerAuthProvider || (BearerAuthProvider = {}));
@@ -1 +0,0 @@
1
- export { BearerAuthProvider } from "./BearerAuthProvider.mjs";
@@ -1 +0,0 @@
1
- export { BearerAuthProvider } from "./BearerAuthProvider.mjs";
@@ -1,7 +0,0 @@
1
- import type { EndpointMetadata } from "../fetcher/EndpointMetadata.mjs";
2
- import type { AuthRequest } from "./AuthRequest.mjs";
3
- export interface AuthProvider {
4
- getAuthRequest(arg?: {
5
- endpointMetadata?: EndpointMetadata;
6
- }): Promise<AuthRequest>;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Request parameters for authentication requests.
3
- */
4
- export interface AuthRequest {
5
- /**
6
- * The headers to be included in the request.
7
- */
8
- headers: Record<string, string>;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface BasicAuth {
2
- username: string;
3
- password: string;
4
- }
5
- export declare const BasicAuth: {
6
- toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
- fromAuthorizationHeader: (header: string) => BasicAuth;
8
- };
@@ -1,24 +0,0 @@
1
- import { base64Decode, base64Encode } from "../base64.mjs";
2
- const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
3
- export const BasicAuth = {
4
- toAuthorizationHeader: (basicAuth) => {
5
- if (basicAuth == null) {
6
- return undefined;
7
- }
8
- const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
9
- return `Basic ${token}`;
10
- },
11
- fromAuthorizationHeader: (header) => {
12
- const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
13
- const decoded = base64Decode(credentials);
14
- const [username, ...passwordParts] = decoded.split(":");
15
- const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
16
- if (username == null || password == null) {
17
- throw new Error("Invalid basic auth");
18
- }
19
- return {
20
- username,
21
- password,
22
- };
23
- },
24
- };
@@ -1,7 +0,0 @@
1
- export type BearerToken = string;
2
- declare function toAuthorizationHeader(token: string | undefined): string | undefined;
3
- export declare const BearerToken: {
4
- toAuthorizationHeader: typeof toAuthorizationHeader;
5
- fromAuthorizationHeader: (header: string) => BearerToken;
6
- };
7
- export {};
@@ -1,13 +0,0 @@
1
- const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
2
- function toAuthorizationHeader(token) {
3
- if (token == null) {
4
- return undefined;
5
- }
6
- return `Bearer ${token}`;
7
- }
8
- export const BearerToken = {
9
- toAuthorizationHeader: toAuthorizationHeader,
10
- fromAuthorizationHeader: (header) => {
11
- return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
12
- },
13
- };
@@ -1,5 +0,0 @@
1
- import type { AuthProvider } from "./AuthProvider.mjs";
2
- import type { AuthRequest } from "./AuthRequest.mjs";
3
- export declare class NoOpAuthProvider implements AuthProvider {
4
- getAuthRequest(): Promise<AuthRequest>;
5
- }
@@ -1,5 +0,0 @@
1
- export class NoOpAuthProvider {
2
- getAuthRequest() {
3
- return Promise.resolve({ headers: {} });
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- export type { AuthProvider } from "./AuthProvider.mjs";
2
- export type { AuthRequest } from "./AuthRequest.mjs";
3
- export { BasicAuth } from "./BasicAuth.mjs";
4
- export { BearerToken } from "./BearerToken.mjs";
5
- export { NoOpAuthProvider } from "./NoOpAuthProvider.mjs";
@@ -1,3 +0,0 @@
1
- export { BasicAuth } from "./BasicAuth.mjs";
2
- export { BearerToken } from "./BearerToken.mjs";
3
- export { NoOpAuthProvider } from "./NoOpAuthProvider.mjs";
@@ -1,2 +0,0 @@
1
- export declare function base64Encode(input: string): string;
2
- export declare function base64Decode(input: string): string;
@@ -1,22 +0,0 @@
1
- function base64ToBytes(base64) {
2
- const binString = atob(base64);
3
- return Uint8Array.from(binString, (m) => m.codePointAt(0));
4
- }
5
- function bytesToBase64(bytes) {
6
- const binString = String.fromCodePoint(...bytes);
7
- return btoa(binString);
8
- }
9
- export function base64Encode(input) {
10
- if (typeof Buffer !== "undefined") {
11
- return Buffer.from(input, "utf8").toString("base64");
12
- }
13
- const bytes = new TextEncoder().encode(input);
14
- return bytesToBase64(bytes);
15
- }
16
- export function base64Decode(input) {
17
- if (typeof Buffer !== "undefined") {
18
- return Buffer.from(input, "base64").toString("utf8");
19
- }
20
- const bytes = base64ToBytes(input);
21
- return new TextDecoder().decode(bytes);
22
- }