@approvio/ts-sdk 0.0.7 → 0.0.9

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 (63) hide show
  1. package/dist/index.cjs +603 -0
  2. package/dist/index.d.cts +145 -0
  3. package/dist/index.d.mts +145 -0
  4. package/dist/index.mjs +571 -0
  5. package/package.json +21 -7
  6. package/dist/auth/agent.authenticator.d.ts +0 -12
  7. package/dist/auth/agent.authenticator.js +0 -96
  8. package/dist/auth/agent.authenticator.js.map +0 -1
  9. package/dist/auth/auth.helpers.d.ts +0 -11
  10. package/dist/auth/auth.helpers.js +0 -114
  11. package/dist/auth/auth.helpers.js.map +0 -1
  12. package/dist/auth/auth.helpers.test.d.ts +0 -1
  13. package/dist/auth/auth.helpers.test.js +0 -44
  14. package/dist/auth/auth.helpers.test.js.map +0 -1
  15. package/dist/auth/bearer.authenticator.d.ts +0 -11
  16. package/dist/auth/bearer.authenticator.js +0 -43
  17. package/dist/auth/bearer.authenticator.js.map +0 -1
  18. package/dist/auth/oauth.helper.d.ts +0 -10
  19. package/dist/auth/oauth.helper.js +0 -83
  20. package/dist/auth/oauth.helper.js.map +0 -1
  21. package/dist/auth/user.authenticator.d.ts +0 -11
  22. package/dist/auth/user.authenticator.js +0 -45
  23. package/dist/auth/user.authenticator.js.map +0 -1
  24. package/dist/auth/utils.d.ts +0 -1
  25. package/dist/auth/utils.js +0 -11
  26. package/dist/auth/utils.js.map +0 -1
  27. package/dist/client/agent.client.d.ts +0 -8
  28. package/dist/client/agent.client.js +0 -16
  29. package/dist/client/agent.client.js.map +0 -1
  30. package/dist/client/agent.client.test.d.ts +0 -1
  31. package/dist/client/agent.client.test.js +0 -82
  32. package/dist/client/agent.client.test.js.map +0 -1
  33. package/dist/client/approvio.client.d.ts +0 -44
  34. package/dist/client/approvio.client.js +0 -68
  35. package/dist/client/approvio.client.js.map +0 -1
  36. package/dist/client/base.client.d.ts +0 -29
  37. package/dist/client/base.client.js +0 -142
  38. package/dist/client/base.client.js.map +0 -1
  39. package/dist/client/base.client.test.d.ts +0 -1
  40. package/dist/client/base.client.test.js +0 -218
  41. package/dist/client/base.client.test.js.map +0 -1
  42. package/dist/client/errors.d.ts +0 -6
  43. package/dist/client/errors.js +0 -16
  44. package/dist/client/errors.js.map +0 -1
  45. package/dist/client/user.client.d.ts +0 -56
  46. package/dist/client/user.client.js +0 -137
  47. package/dist/client/user.client.js.map +0 -1
  48. package/dist/client/utils.d.ts +0 -4
  49. package/dist/client/utils.js +0 -29
  50. package/dist/client/utils.js.map +0 -1
  51. package/dist/client/utils.test.d.ts +0 -1
  52. package/dist/client/utils.test.js +0 -150
  53. package/dist/client/utils.test.js.map +0 -1
  54. package/dist/config.d.ts +0 -7
  55. package/dist/config.js +0 -3
  56. package/dist/config.js.map +0 -1
  57. package/dist/index.d.ts +0 -7
  58. package/dist/index.js +0 -24
  59. package/dist/index.js.map +0 -1
  60. package/dist/interfaces.d.ts +0 -6
  61. package/dist/interfaces.js +0 -3
  62. package/dist/interfaces.js.map +0 -1
  63. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.client.test.js","sourceRoot":"","sources":["../../src/client/agent.client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkD;AAElD,kDAAyB;AACzB,gDAAiC;AAEjC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAClB,MAAM,WAAW,GAAG,eAAkC,CAAA;AAEtD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,iBAAsB,CAAA;IAC1B,IAAI,iBAAgC,CAAA;IACpC,IAAI,MAA2B,CAAA;IAE/B,UAAU,CAAC,GAAG,EAAE;QACd,iBAAiB,GAAG;YAClB,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;YACd,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,GAAG,EA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AAK,CAAC,eAAe,CAAC,CAAC,CAAA;YAGnE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAA;YAGxD,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,44 +0,0 @@
1
- import * as TE from "fp-ts/TaskEither";
2
- import { Workflow, WorkflowCreate, WorkflowVoteRequest, ListWorkflows200Response, ListUsers200Response, User, UserCreate, RoleAssignmentRequest, Group, GroupCreate, ListGroups200Response, AddGroupEntitiesRequest, Space, SpaceCreate, ListSpaces200Response, WorkflowTemplate, WorkflowTemplateCreate, ListWorkflowTemplates200Response, OrganizationAdminCreate } from "@approvio/api";
3
- import { BaseApprovioClient, ApprovioError } from "./base.client";
4
- export declare class ApprovioClient extends BaseApprovioClient {
5
- listWorkflows(params?: {
6
- page?: number;
7
- limit?: number;
8
- include?: string[];
9
- }): TE.TaskEither<ApprovioError, ListWorkflows200Response>;
10
- createWorkflow(data: WorkflowCreate): TE.TaskEither<ApprovioError, void>;
11
- getWorkflow(workflowId: string, params?: {
12
- include?: string[];
13
- }): TE.TaskEither<ApprovioError, Workflow>;
14
- vote(workflowId: string, data: WorkflowVoteRequest): TE.TaskEither<ApprovioError, void>;
15
- listUsers(params?: {
16
- search?: string;
17
- page?: number;
18
- limit?: number;
19
- }): TE.TaskEither<ApprovioError, ListUsers200Response>;
20
- createUser(data: UserCreate): TE.TaskEither<ApprovioError, void>;
21
- getUser(userId: string): TE.TaskEither<ApprovioError, User>;
22
- assignUserRoles(userId: string, data: RoleAssignmentRequest): TE.TaskEither<ApprovioError, void>;
23
- listGroups(params?: {
24
- page?: number;
25
- limit?: number;
26
- }): TE.TaskEither<ApprovioError, ListGroups200Response>;
27
- createGroup(data: GroupCreate): TE.TaskEither<ApprovioError, void>;
28
- getGroup(groupIdentifier: string): TE.TaskEither<ApprovioError, Group>;
29
- addGroupEntities(groupId: string, data: AddGroupEntitiesRequest): TE.TaskEither<ApprovioError, void>;
30
- listSpaces(params?: {
31
- page?: number;
32
- limit?: number;
33
- }): TE.TaskEither<ApprovioError, ListSpaces200Response>;
34
- createSpace(data: SpaceCreate): TE.TaskEither<ApprovioError, void>;
35
- getSpace(spaceId: string): TE.TaskEither<ApprovioError, Space>;
36
- deleteSpace(spaceId: string): TE.TaskEither<ApprovioError, void>;
37
- listWorkflowTemplates(params?: {
38
- page?: number;
39
- limit?: number;
40
- }): TE.TaskEither<ApprovioError, ListWorkflowTemplates200Response>;
41
- createWorkflowTemplate(data: WorkflowTemplateCreate): TE.TaskEither<ApprovioError, WorkflowTemplate>;
42
- getWorkflowTemplate(templateId: string): TE.TaskEither<ApprovioError, WorkflowTemplate>;
43
- addOrganizationAdmin(orgName: string, data: OrganizationAdminCreate): TE.TaskEither<ApprovioError, void>;
44
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApprovioClient = void 0;
4
- const base_client_1 = require("./base.client");
5
- class ApprovioClient extends base_client_1.BaseApprovioClient {
6
- listWorkflows(params) {
7
- return this.get("/workflows", params);
8
- }
9
- createWorkflow(data) {
10
- return this.post("/workflows", data);
11
- }
12
- getWorkflow(workflowId, params) {
13
- return this.get(`/workflows/${workflowId}`, params);
14
- }
15
- vote(workflowId, data) {
16
- return this.post(`/workflows/${workflowId}/vote`, data);
17
- }
18
- listUsers(params) {
19
- return this.get("/users", params);
20
- }
21
- createUser(data) {
22
- return this.post("/users", data);
23
- }
24
- getUser(userId) {
25
- return this.get(`/users/${userId}`);
26
- }
27
- assignUserRoles(userId, data) {
28
- return this.put(`/users/${userId}/roles`, data);
29
- }
30
- listGroups(params) {
31
- return this.get("/groups", params);
32
- }
33
- createGroup(data) {
34
- return this.post("/groups", data);
35
- }
36
- getGroup(groupIdentifier) {
37
- return this.get(`/groups/${groupIdentifier}`);
38
- }
39
- addGroupEntities(groupId, data) {
40
- return this.post(`/groups/${groupId}/entities`, data);
41
- }
42
- listSpaces(params) {
43
- return this.get("/spaces", params);
44
- }
45
- createSpace(data) {
46
- return this.post("/spaces", data);
47
- }
48
- getSpace(spaceId) {
49
- return this.get(`/spaces/${spaceId}`);
50
- }
51
- deleteSpace(spaceId) {
52
- return this.delete(`/spaces/${spaceId}`);
53
- }
54
- listWorkflowTemplates(params) {
55
- return this.get("/workflow-templates", params);
56
- }
57
- createWorkflowTemplate(data) {
58
- return this.post("/workflow-templates", data);
59
- }
60
- getWorkflowTemplate(templateId) {
61
- return this.get(`/workflow-templates/${templateId}`);
62
- }
63
- addOrganizationAdmin(orgName, data) {
64
- return this.post(`/organization/${orgName}/admins`, data);
65
- }
66
- }
67
- exports.ApprovioClient = ApprovioClient;
68
- //# sourceMappingURL=approvio.client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approvio.client.js","sourceRoot":"","sources":["../../src/client/approvio.client.ts"],"names":[],"mappings":";;;AAsBA,+CAA+D;AAK/D,MAAa,cAAe,SAAQ,gCAAkB;IAIpD,aAAa,CAAC,MAIb;QACC,OAAO,IAAI,CAAC,GAAG,CAA2B,YAAY,EAAE,MAAiC,CAAC,CAAA;IAC5F,CAAC;IAKD,cAAc,CAAC,IAAoB;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IAKD,WAAW,CAAC,UAAkB,EAAE,MAA6B;QAC3D,OAAO,IAAI,CAAC,GAAG,CAAW,cAAc,UAAU,EAAE,EAAE,MAAiC,CAAC,CAAA;IAC1F,CAAC;IAKD,IAAI,CAAC,UAAkB,EAAE,IAAyB;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,UAAU,OAAO,EAAE,IAAI,CAAC,CAAA;IACzD,CAAC;IAKD,SAAS,CAAC,MAIT;QACC,OAAO,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WAAW,OAAO,EAAE,CAAC,CAAA;IAC1C,CAAC;IAKD,qBAAqB,CAAC,MAGrB;QACC,OAAO,IAAI,CAAC,GAAG,CAAmC,qBAAqB,EAAE,MAAiC,CAAC,CAAA;IAC7G,CAAC;IAKD,sBAAsB,CAAC,IAA4B;QACjD,OAAO,IAAI,CAAC,IAAI,CAAmB,qBAAqB,EAAE,IAAI,CAAC,CAAA;IACjE,CAAC;IAKD,mBAAmB,CAAC,UAAkB;QACpC,OAAO,IAAI,CAAC,GAAG,CAAmB,uBAAuB,UAAU,EAAE,CAAC,CAAA;IACxE,CAAC;IAKD,oBAAoB,CAAC,OAAe,EAAE,IAA6B;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,OAAO,SAAS,EAAE,IAAI,CAAC,CAAA;IAC3D,CAAC;CACF;AAvJD,wCAuJC"}
@@ -1,29 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import * as TE from "fp-ts/TaskEither";
3
- import { APIError, Workflow, ListWorkflows200Response, WorkflowCreate, WorkflowVoteRequest, CanVoteResponse, ListRoleTemplates200Response, ListWorkflowsParams, GetWorkflowParams, GetEntityInfo200Response } from "@approvio/api";
4
- import { ApprovioServerConfig, Authenticator } from "../interfaces";
5
- export type ApprovioError = (APIError & {
6
- status: number;
7
- }) | Error;
8
- export declare abstract class BaseApprovioClient {
9
- protected readonly config: ApprovioServerConfig;
10
- protected readonly axios: AxiosInstance;
11
- constructor(config: ApprovioServerConfig);
12
- abstract getAuthenticator(): Authenticator;
13
- protected handleError(error: unknown): ApprovioError;
14
- protected get<T>(url: string, params?: Record<string, unknown>): TE.TaskEither<ApprovioError, T>;
15
- protected post<T>(url: string, data?: unknown): TE.TaskEither<ApprovioError, T>;
16
- protected postWithLocation<T>(url: string, data?: unknown): TE.TaskEither<ApprovioError, {
17
- data: T;
18
- location: string;
19
- }>;
20
- protected put<T>(url: string, data?: unknown): TE.TaskEither<ApprovioError, T>;
21
- protected delete<T>(url: string, data?: unknown): TE.TaskEither<ApprovioError, T>;
22
- getWorkflow(workflowId: string, params?: GetWorkflowParams): TE.TaskEither<ApprovioError, Workflow>;
23
- listWorkflows(params?: ListWorkflowsParams): TE.TaskEither<ApprovioError, ListWorkflows200Response>;
24
- createWorkflow(data: WorkflowCreate): TE.TaskEither<ApprovioError, void>;
25
- voteOnWorkflow(workflowId: string, data: WorkflowVoteRequest): TE.TaskEither<ApprovioError, unknown>;
26
- canVoteOnWorkflow(workflowId: string): TE.TaskEither<ApprovioError, CanVoteResponse>;
27
- listRoleTemplates(): TE.TaskEither<ApprovioError, ListRoleTemplates200Response>;
28
- getEntityInfo(): TE.TaskEither<ApprovioError, GetEntityInfo200Response>;
29
- }
@@ -1,142 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.BaseApprovioClient = void 0;
40
- const axios_1 = __importDefault(require("axios"));
41
- const TE = __importStar(require("fp-ts/TaskEither"));
42
- const utils_1 = require("./utils");
43
- const errors_1 = require("./errors");
44
- const networkCodes = ["ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND", "ECONNRESET"];
45
- class BaseApprovioClient {
46
- config;
47
- axios;
48
- constructor(config) {
49
- this.config = config;
50
- (0, utils_1.validateURL)(config.endpoint);
51
- this.axios = axios_1.default.create({
52
- baseURL: (0, utils_1.removeTrailingSlash)(config.endpoint)
53
- });
54
- this.axios.interceptors.request.use(async (axiosConfig) => {
55
- const accessToken = await this.getAuthenticator().getAccessToken();
56
- axiosConfig.headers.set("Authorization", `Bearer ${accessToken}`);
57
- return axiosConfig;
58
- });
59
- }
60
- handleError(error) {
61
- if (axios_1.default.isAxiosError(error)) {
62
- if (networkCodes.includes(error.code ?? ""))
63
- return new errors_1.NetworkError(`Network error ${error.code}`);
64
- const status = error.response?.status;
65
- const data = error.response?.data;
66
- if (status && (0, utils_1.isApprovioError)(data)) {
67
- return {
68
- ...data,
69
- status
70
- };
71
- }
72
- }
73
- if (error instanceof Error)
74
- return error;
75
- return new Error(String(error));
76
- }
77
- get(url, params) {
78
- return TE.tryCatch(async () => {
79
- const response = await this.axios.get(url, { params });
80
- return response.data;
81
- }, error => this.handleError(error));
82
- }
83
- post(url, data) {
84
- return TE.tryCatch(async () => {
85
- const response = await this.axios.post(url, data);
86
- return response.data;
87
- }, error => this.handleError(error));
88
- }
89
- postWithLocation(url, data) {
90
- return TE.tryCatch(async () => {
91
- const response = await this.axios.post(url, data);
92
- const location = response.headers["location"];
93
- if (!location)
94
- throw new errors_1.LocationNotFoundError();
95
- return {
96
- data: response.data,
97
- location
98
- };
99
- }, error => this.handleError(error));
100
- }
101
- put(url, data) {
102
- return TE.tryCatch(async () => {
103
- const response = await this.axios.put(url, data);
104
- return response.data;
105
- }, error => this.handleError(error));
106
- }
107
- delete(url, data) {
108
- return TE.tryCatch(async () => {
109
- const response = await this.axios.delete(url, { data });
110
- return response.data;
111
- }, error => this.handleError(error));
112
- }
113
- getWorkflow(workflowId, params) {
114
- return this.get(`/workflows/${workflowId}`, params);
115
- }
116
- listWorkflows(params) {
117
- const queryParams = {
118
- page: params?.page,
119
- limit: params?.limit,
120
- "include-only-non-terminal-state": params?.includeOnlyNonTerminalState,
121
- include: params?.include
122
- };
123
- return this.get("/workflows", queryParams);
124
- }
125
- createWorkflow(data) {
126
- return this.post("/workflows", data);
127
- }
128
- voteOnWorkflow(workflowId, data) {
129
- return this.post(`/workflows/${workflowId}/vote`, data);
130
- }
131
- canVoteOnWorkflow(workflowId) {
132
- return this.get(`/workflows/${workflowId}/canVote`);
133
- }
134
- listRoleTemplates() {
135
- return this.get("/roles");
136
- }
137
- getEntityInfo() {
138
- return this.get("/auth/info");
139
- }
140
- }
141
- exports.BaseApprovioClient = BaseApprovioClient;
142
- //# sourceMappingURL=base.client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.client.js","sourceRoot":"","sources":["../../src/client/base.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAsE;AACtE,qDAAsC;AAetC,mCAAyE;AACzE,qCAA4D;AAI5D,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAK7E,MAAsB,kBAAkB;IAGP;IAFZ,KAAK,CAAe;IAEvC,YAA+B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;QACzD,IAAA,mBAAW,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAE5B,IAAI,CAAC,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,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AKD,aAAa;QACX,OAAO,IAAI,CAAC,GAAG,CAA2B,YAAY,CAAC,CAAA;IACzD,CAAC;CACF;AA1KD,gDA0KC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,218 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const base_client_1 = require("./base.client");
40
- const axios_1 = __importDefault(require("axios"));
41
- const E = __importStar(require("fp-ts/Either"));
42
- jest.mock("axios");
43
- const mockedAxios = axios_1.default;
44
- class TestClient extends base_client_1.BaseApprovioClient {
45
- mockAuthenticator;
46
- constructor(endpoint) {
47
- super({ endpoint });
48
- this.mockAuthenticator = {
49
- getAccessToken: jest.fn().mockResolvedValue("test-access-token")
50
- };
51
- }
52
- getAuthenticator() {
53
- return this.mockAuthenticator;
54
- }
55
- testGet(url, params) {
56
- return this.get(url, params);
57
- }
58
- testPost(url, data) {
59
- return this.post(url, data);
60
- }
61
- testPut(url, data) {
62
- return this.put(url, data);
63
- }
64
- testDelete(url) {
65
- return this.delete(url);
66
- }
67
- testHandleError(error) {
68
- return this.handleError(error);
69
- }
70
- }
71
- describe("BaseApprovioClient", () => {
72
- let mockAxiosInstance;
73
- beforeEach(() => {
74
- mockAxiosInstance = {
75
- get: jest.fn(),
76
- post: jest.fn(),
77
- put: jest.fn(),
78
- delete: jest.fn(),
79
- interceptors: {
80
- request: {
81
- use: jest.fn()
82
- }
83
- }
84
- };
85
- mockedAxios.create = jest.fn().mockReturnValue(mockAxiosInstance);
86
- jest.clearAllMocks();
87
- });
88
- describe("constructor", () => {
89
- describe("bad cases", () => {
90
- it("should throw error for invalid endpoint URL", () => {
91
- const invalidEndpoint = "not-a-url";
92
- expect(() => new TestClient(invalidEndpoint)).toThrow("Invalid URL");
93
- });
94
- it("should throw error for empty endpoint", () => {
95
- const emptyEndpoint = "";
96
- expect(() => new TestClient(emptyEndpoint)).toThrow("Invalid URL");
97
- });
98
- });
99
- describe("good cases", () => {
100
- it("should create axios instance with correct baseURL", () => {
101
- const endpoint = "https://api.example.com";
102
- new TestClient(endpoint);
103
- expect(mockedAxios.create).toHaveBeenCalledWith({
104
- baseURL: "https://api.example.com"
105
- });
106
- });
107
- it("should remove trailing slash from endpoint", () => {
108
- const endpoint = "https://api.example.com/";
109
- new TestClient(endpoint);
110
- expect(mockedAxios.create).toHaveBeenCalledWith({
111
- baseURL: "https://api.example.com"
112
- });
113
- });
114
- });
115
- });
116
- describe("HTTP methods", () => {
117
- let client;
118
- beforeEach(() => {
119
- client = new TestClient("https://api.example.com");
120
- });
121
- describe("get", () => {
122
- describe("bad cases", () => {
123
- it("should return Left on error", async () => {
124
- const error = new Error("Network error");
125
- mockAxiosInstance.get.mockRejectedValue(error);
126
- const result = await client.testGet("/endpoint")();
127
- expect(E.isLeft(result)).toBe(true);
128
- });
129
- });
130
- describe("good cases", () => {
131
- it("should return Right with data on success", async () => {
132
- const responseData = { id: 1, name: "Test" };
133
- mockAxiosInstance.get.mockResolvedValue({ data: responseData });
134
- const result = await client.testGet("/endpoint")();
135
- expect(E.isRight(result)).toBe(true);
136
- });
137
- it("should pass params to axios", async () => {
138
- mockAxiosInstance.get.mockResolvedValue({ data: {} });
139
- const params = { page: 1, limit: 10 };
140
- await client.testGet("/endpoint", params)();
141
- expect(mockAxiosInstance.get).toHaveBeenCalledWith("/endpoint", { params });
142
- });
143
- });
144
- });
145
- describe("post", () => {
146
- describe("bad cases", () => {
147
- it("should return Left on error", async () => {
148
- const error = new Error("Network error");
149
- mockAxiosInstance.post.mockRejectedValue(error);
150
- const result = await client.testPost("/endpoint", { data: "test" })();
151
- expect(E.isLeft(result)).toBe(true);
152
- });
153
- });
154
- describe("good cases", () => {
155
- it("should return Right with data on success", async () => {
156
- const responseData = { id: 1, created: true };
157
- mockAxiosInstance.post.mockResolvedValue({ data: responseData });
158
- const result = await client.testPost("/endpoint", { name: "Test" })();
159
- expect(E.isRight(result)).toBe(true);
160
- });
161
- it("should pass data to axios", async () => {
162
- mockAxiosInstance.post.mockResolvedValue({ data: {} });
163
- const postData = { name: "Test", value: 123 };
164
- await client.testPost("/endpoint", postData)();
165
- expect(mockAxiosInstance.post).toHaveBeenCalledWith("/endpoint", postData);
166
- });
167
- });
168
- });
169
- describe("put", () => {
170
- describe("bad cases", () => {
171
- it("should return Left on error", async () => {
172
- const error = new Error("Network error");
173
- mockAxiosInstance.put.mockRejectedValue(error);
174
- const result = await client.testPut("/endpoint", { data: "test" })();
175
- expect(E.isLeft(result)).toBe(true);
176
- });
177
- });
178
- describe("good cases", () => {
179
- it("should return Right with data on success", async () => {
180
- const responseData = { id: 1, updated: true };
181
- mockAxiosInstance.put.mockResolvedValue({ data: responseData });
182
- const result = await client.testPut("/endpoint", { name: "Updated" })();
183
- expect(E.isRight(result)).toBe(true);
184
- });
185
- it("should pass data to axios", async () => {
186
- mockAxiosInstance.put.mockResolvedValue({ data: {} });
187
- const putData = { name: "Updated", value: 456 };
188
- await client.testPut("/endpoint", putData)();
189
- expect(mockAxiosInstance.put).toHaveBeenCalledWith("/endpoint", putData);
190
- });
191
- });
192
- });
193
- describe("delete", () => {
194
- describe("bad cases", () => {
195
- it("should return Left on error", async () => {
196
- const error = new Error("Network error");
197
- mockAxiosInstance.delete.mockRejectedValue(error);
198
- const result = await client.testDelete("/endpoint")();
199
- expect(E.isLeft(result)).toBe(true);
200
- });
201
- });
202
- describe("good cases", () => {
203
- it("should return Right with data on success", async () => {
204
- const responseData = { id: 1, deleted: true };
205
- mockAxiosInstance.delete.mockResolvedValue({ data: responseData });
206
- const result = await client.testDelete("/endpoint")();
207
- expect(E.isRight(result)).toBe(true);
208
- });
209
- it("should call axios delete with correct URL", async () => {
210
- mockAxiosInstance.delete.mockResolvedValue({ data: {} });
211
- await client.testDelete("/endpoint/123")();
212
- expect(mockAxiosInstance.delete).toHaveBeenCalledWith("/endpoint/123");
213
- });
214
- });
215
- });
216
- });
217
- });
218
- //# sourceMappingURL=base.client.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.client.test.js","sourceRoot":"","sources":["../../src/client/base.client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgD;AAEhD,kDAAyB;AACzB,gDAAiC;AAEjC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAClB,MAAM,WAAW,GAAG,eAAkC,CAAA;AAEtD,MAAM,UAAW,SAAQ,gCAAkB;IACjC,iBAAiB,CAAe;IAExC,YAAY,QAAgB;QAC1B,KAAK,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;QACjB,IAAI,CAAC,iB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,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAA;oBAGrD,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACrC,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YAEF,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;gBAC1B,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;oBAExD,MAAM,YAAY,GAAG,EAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC,CAAA;oBAC3C,iBAAiB,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAC,IAAI,EAAE,YAAY,EAAC,CAAC,CAAA;oBAGhE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAA;oBAGrD,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACtC,CAAC,CAAC,CAAA;gBAEF,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;oBAEzD,iBAAiB,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC,CAAA;oBAGtD,MAAM,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAA;oBAG1C,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAA;gBACxE,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- export declare class LocationNotFoundError extends Error {
2
- constructor();
3
- }
4
- export declare class NetworkError extends Error {
5
- constructor(message: string);
6
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkError = exports.LocationNotFoundError = void 0;
4
- class LocationNotFoundError extends Error {
5
- constructor() {
6
- super("Location header was expected but not found");
7
- }
8
- }
9
- exports.LocationNotFoundError = LocationNotFoundError;
10
- class NetworkError extends Error {
11
- constructor(message) {
12
- super(message);
13
- }
14
- }
15
- exports.NetworkError = NetworkError;
16
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/client/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,CAAC,4CAA4C,CAAC,CAAA;IACrD,CAAC;CACF;AAJD,sDAIC;AAED,MAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;CACF;AAJD,oCAIC"}
@@ -1,56 +0,0 @@
1
- import * as TE from "fp-ts/TaskEither";
2
- import { AgentGet200Response, AgentRegistrationRequest, AgentRegistrationResponse, ListUsers200Response, UserCreate, User, RoleAssignmentRequest, RoleRemovalRequest, WorkflowTemplateCreate, WorkflowTemplate, ListWorkflowTemplates200Response, WorkflowTemplateUpdate, WorkflowTemplateDeprecate, GroupCreate, Group, ListGroups200Response, ListGroupEntities200Response, AddGroupEntitiesRequest, RemoveGroupEntitiesRequest, SpaceCreate, Space, ListSpaces200Response, OrganizationAdminCreate, ListOrganizationAdminsForOrg200Response, OrganizationAdminRemove } from "@approvio/api";
3
- import { BaseApprovioClient, ApprovioError } from "./base.client";
4
- import { UserAuthenticator } from "../auth/user.authenticator";
5
- import { ApprovioServerConfig, Authenticator } from "../interfaces";
6
- export declare class ApprovioUserClient extends BaseApprovioClient {
7
- private readonly authenticator;
8
- constructor(config: ApprovioServerConfig, authenticator: UserAuthenticator);
9
- getAuthenticator(): Authenticator;
10
- listUsers(params?: {
11
- search?: string;
12
- page?: number;
13
- limit?: number;
14
- }): TE.TaskEither<ApprovioError, ListUsers200Response>;
15
- registerAgent(data: AgentRegistrationRequest): TE.TaskEither<ApprovioError, AgentRegistrationResponse>;
16
- assignAgentRoles(agentId: string, data: RoleAssignmentRequest): TE.TaskEither<ApprovioError, void>;
17
- removeAgentRoles(agentId: string, data: RoleRemovalRequest): TE.TaskEither<ApprovioError, void>;
18
- createUser(data: UserCreate): TE.TaskEither<ApprovioError, string>;
19
- getUser(userId: string): TE.TaskEither<ApprovioError, User>;
20
- assignUserRoles(userId: string, data: RoleAssignmentRequest): TE.TaskEither<ApprovioError, void>;
21
- removeUserRoles(userId: string, data: RoleRemovalRequest): TE.TaskEither<ApprovioError, void>;
22
- createWorkflowTemplate(data: WorkflowTemplateCreate): TE.TaskEither<ApprovioError, WorkflowTemplate>;
23
- listWorkflowTemplates(params?: {
24
- page?: number;
25
- limit?: number;
26
- }): TE.TaskEither<ApprovioError, ListWorkflowTemplates200Response>;
27
- getWorkflowTemplate(templateIdentifier: string): TE.TaskEither<ApprovioError, WorkflowTemplate>;
28
- updateWorkflowTemplate(templateIdentifier: string, data: WorkflowTemplateUpdate): TE.TaskEither<ApprovioError, WorkflowTemplate>;
29
- deprecateWorkflowTemplate(templateName: string, data?: WorkflowTemplateDeprecate): TE.TaskEither<ApprovioError, WorkflowTemplate>;
30
- createGroup(data: GroupCreate): TE.TaskEither<ApprovioError, void>;
31
- listGroups(params?: {
32
- page?: number;
33
- limit?: number;
34
- }): TE.TaskEither<ApprovioError, ListGroups200Response>;
35
- getGroup(groupIdentifier: string): TE.TaskEither<ApprovioError, Group>;
36
- listGroupEntities(groupId: string, params?: {
37
- page?: number;
38
- limit?: number;
39
- }): TE.TaskEither<ApprovioError, ListGroupEntities200Response>;
40
- addGroupEntities(groupId: string, data: AddGroupEntitiesRequest): TE.TaskEither<ApprovioError, Group>;
41
- removeGroupEntities(groupId: string, data: RemoveGroupEntitiesRequest): TE.TaskEither<ApprovioError, Group>;
42
- createSpace(data: SpaceCreate): TE.TaskEither<ApprovioError, void>;
43
- listSpaces(params?: {
44
- page?: number;
45
- limit?: number;
46
- }): TE.TaskEither<ApprovioError, ListSpaces200Response>;
47
- getSpace(spaceId: string): TE.TaskEither<ApprovioError, Space>;
48
- deleteSpace(spaceId: string): TE.TaskEither<ApprovioError, void>;
49
- addOrganizationAdminToOrg(organizationName: string, data: OrganizationAdminCreate): TE.TaskEither<ApprovioError, void>;
50
- listOrganizationAdminsForOrg(organizationName: string, params?: {
51
- page?: number;
52
- limit?: number;
53
- }): TE.TaskEither<ApprovioError, ListOrganizationAdminsForOrg200Response>;
54
- removeOrganizationAdminFromOrg(organizationName: string, data: OrganizationAdminRemove): TE.TaskEither<ApprovioError, void>;
55
- getAgent(agentId: string): TE.TaskEither<ApprovioError, AgentGet200Response>;
56
- }