windmill-client 0.1.0 → 0.2.1
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/core/ApiError.d.ts +10 -0
- package/dist/core/ApiError.js +15 -0
- package/dist/core/ApiRequestOptions.d.ts +13 -0
- package/dist/core/ApiRequestOptions.js +2 -0
- package/dist/core/ApiResult.d.ts +7 -0
- package/dist/core/ApiResult.js +2 -0
- package/dist/core/CancelablePromise.d.ts +26 -0
- package/dist/core/CancelablePromise.js +94 -0
- package/dist/core/OpenAPI.d.ts +16 -0
- package/dist/core/OpenAPI.js +14 -0
- package/dist/core/request.d.ts +13 -0
- package/dist/core/request.js +269 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +85 -0
- package/dist/models/AppWithLastVersion.d.ts +21 -0
- package/dist/models/AppWithLastVersion.js +15 -0
- package/dist/models/AppWithLastVersionWDraft.d.ts +5 -0
- package/dist/models/AppWithLastVersionWDraft.js +5 -0
- package/dist/models/AuditLog.d.ts +32 -0
- package/dist/models/AuditLog.js +32 -0
- package/dist/models/BranchAll.d.ts +10 -0
- package/dist/models/BranchAll.js +5 -0
- package/dist/models/BranchOne.d.ts +10 -0
- package/dist/models/BranchOne.js +5 -0
- package/dist/models/CompletedJob.d.ts +57 -0
- package/dist/models/CompletedJob.js +26 -0
- package/dist/models/ContextualVariable.d.ts +5 -0
- package/dist/models/ContextualVariable.js +5 -0
- package/dist/models/CreateInput.d.ts +4 -0
- package/dist/models/CreateInput.js +5 -0
- package/dist/models/CreateResource.d.ts +6 -0
- package/dist/models/CreateResource.js +5 -0
- package/dist/models/CreateVariable.d.ts +8 -0
- package/dist/models/CreateVariable.js +5 -0
- package/dist/models/CreateWorkspace.d.ts +5 -0
- package/dist/models/CreateWorkspace.js +5 -0
- package/dist/models/EditResource.d.ts +5 -0
- package/dist/models/EditResource.js +5 -0
- package/dist/models/EditResourceType.d.ts +4 -0
- package/dist/models/EditResourceType.js +5 -0
- package/dist/models/EditSchedule.d.ts +6 -0
- package/dist/models/EditSchedule.js +5 -0
- package/dist/models/EditVariable.d.ts +6 -0
- package/dist/models/EditVariable.js +5 -0
- package/dist/models/EditWorkspaceUser.d.ts +5 -0
- package/dist/models/EditWorkspaceUser.js +5 -0
- package/dist/models/Flow.d.ts +3 -0
- package/dist/models/Flow.js +5 -0
- package/dist/models/FlowMetadata.d.ts +11 -0
- package/dist/models/FlowMetadata.js +5 -0
- package/dist/models/FlowModule.d.ts +18 -0
- package/dist/models/FlowModule.js +5 -0
- package/dist/models/FlowModuleValue.d.ts +8 -0
- package/dist/models/FlowModuleValue.js +5 -0
- package/dist/models/FlowPreview.d.ts +7 -0
- package/dist/models/FlowPreview.js +5 -0
- package/dist/models/FlowStatus.d.ts +12 -0
- package/dist/models/FlowStatus.js +5 -0
- package/dist/models/FlowStatusModule.d.ts +34 -0
- package/dist/models/FlowStatusModule.js +18 -0
- package/dist/models/FlowValue.d.ts +6 -0
- package/dist/models/FlowValue.js +5 -0
- package/dist/models/Folder.d.ts +5 -0
- package/dist/models/Folder.js +5 -0
- package/dist/models/ForloopFlow.d.ts +9 -0
- package/dist/models/ForloopFlow.js +5 -0
- package/dist/models/GlobalUserInfo.d.ts +14 -0
- package/dist/models/GlobalUserInfo.js +14 -0
- package/dist/models/Group.d.ts +6 -0
- package/dist/models/Group.js +5 -0
- package/dist/models/Identity.d.ts +4 -0
- package/dist/models/Identity.js +5 -0
- package/dist/models/Input.d.ts +8 -0
- package/dist/models/Input.js +5 -0
- package/dist/models/InputTransform.d.ts +3 -0
- package/dist/models/InputTransform.js +5 -0
- package/dist/models/JavascriptTransform.d.ts +4 -0
- package/dist/models/JavascriptTransform.js +5 -0
- package/dist/models/Job.d.ts +11 -0
- package/dist/models/Job.js +14 -0
- package/dist/models/ListableApp.d.ts +18 -0
- package/dist/models/ListableApp.js +15 -0
- package/dist/models/ListableResource.d.ts +14 -0
- package/dist/models/ListableResource.js +5 -0
- package/dist/models/ListableVariable.d.ts +14 -0
- package/dist/models/ListableVariable.js +5 -0
- package/dist/models/Login.d.ts +4 -0
- package/dist/models/Login.js +5 -0
- package/dist/models/MainArgSignature.d.ts +33 -0
- package/dist/models/MainArgSignature.js +14 -0
- package/dist/models/NewSchedule.d.ts +10 -0
- package/dist/models/NewSchedule.js +5 -0
- package/dist/models/NewScript.d.ts +29 -0
- package/dist/models/NewScript.js +24 -0
- package/dist/models/NewScriptWithDraft.d.ts +5 -0
- package/dist/models/NewScriptWithDraft.js +5 -0
- package/dist/models/NewToken.d.ts +4 -0
- package/dist/models/NewToken.js +5 -0
- package/dist/models/NewTokenImpersonate.d.ts +5 -0
- package/dist/models/NewTokenImpersonate.js +5 -0
- package/dist/models/NewUser.d.ts +5 -0
- package/dist/models/NewUser.js +5 -0
- package/dist/models/OpenFlow.d.ts +7 -0
- package/dist/models/OpenFlow.js +5 -0
- package/dist/models/OpenFlowWPath.d.ts +4 -0
- package/dist/models/OpenFlowWPath.js +5 -0
- package/dist/models/PathFlow.d.ts +6 -0
- package/dist/models/PathFlow.js +5 -0
- package/dist/models/PathScript.d.ts +7 -0
- package/dist/models/PathScript.js +5 -0
- package/dist/models/Policy.d.ts +13 -0
- package/dist/models/Policy.js +15 -0
- package/dist/models/Preview.d.ts +16 -0
- package/dist/models/Preview.js +16 -0
- package/dist/models/QueuedJob.d.ts +55 -0
- package/dist/models/QueuedJob.js +26 -0
- package/dist/models/RawScript.d.ts +18 -0
- package/dist/models/RawScript.js +16 -0
- package/dist/models/Resource.d.ts +9 -0
- package/dist/models/Resource.js +5 -0
- package/dist/models/ResourceType.d.ts +6 -0
- package/dist/models/ResourceType.js +5 -0
- package/dist/models/Retry.d.ts +11 -0
- package/dist/models/Retry.js +5 -0
- package/dist/models/RunnableType.d.ts +5 -0
- package/dist/models/RunnableType.js +12 -0
- package/dist/models/Schedule.d.ts +15 -0
- package/dist/models/Schedule.js +5 -0
- package/dist/models/Script.d.ts +43 -0
- package/dist/models/Script.js +24 -0
- package/dist/models/ScriptArgs.d.ts +1 -0
- package/dist/models/ScriptArgs.js +5 -0
- package/dist/models/SlackToken.d.ts +8 -0
- package/dist/models/SlackToken.js +5 -0
- package/dist/models/StaticTransform.d.ts +4 -0
- package/dist/models/StaticTransform.js +5 -0
- package/dist/models/TokenResponse.d.ts +6 -0
- package/dist/models/TokenResponse.js +5 -0
- package/dist/models/TruncatedToken.d.ts +7 -0
- package/dist/models/TruncatedToken.js +5 -0
- package/dist/models/UpdateInput.d.ts +5 -0
- package/dist/models/UpdateInput.js +5 -0
- package/dist/models/Usage.d.ts +3 -0
- package/dist/models/Usage.js +5 -0
- package/dist/models/User.d.ts +14 -0
- package/dist/models/User.js +5 -0
- package/dist/models/UserWorkspaceList.d.ts +8 -0
- package/dist/models/UserWorkspaceList.js +5 -0
- package/dist/models/WorkerPing.d.ts +8 -0
- package/dist/models/WorkerPing.js +5 -0
- package/dist/models/Workspace.d.ts +6 -0
- package/dist/models/Workspace.js +5 -0
- package/dist/models/WorkspaceInvite.d.ts +6 -0
- package/dist/models/WorkspaceInvite.js +5 -0
- package/dist/services/AdminService.d.ts +39 -0
- package/dist/services/AdminService.js +56 -0
- package/dist/services/AppService.d.ts +194 -0
- package/dist/services/AppService.js +211 -0
- package/dist/services/AuditService.d.ts +53 -0
- package/dist/services/AuditService.js +47 -0
- package/dist/services/CaptureService.d.ts +30 -0
- package/dist/services/CaptureService.js +56 -0
- package/dist/services/DraftService.d.ts +16 -0
- package/dist/services/DraftService.js +24 -0
- package/dist/services/FavoriteService.d.ts +27 -0
- package/dist/services/FavoriteService.js +40 -0
- package/dist/services/FlowService.d.ts +186 -0
- package/dist/services/FlowService.js +200 -0
- package/dist/services/FolderService.d.ts +128 -0
- package/dist/services/FolderService.js +155 -0
- package/dist/services/GranularAclService.d.ts +46 -0
- package/dist/services/GranularAclService.js +60 -0
- package/dist/services/GroupService.d.ts +110 -0
- package/dist/services/GroupService.js +140 -0
- package/dist/services/InputService.d.ts +78 -0
- package/dist/services/InputService.js +99 -0
- package/dist/services/JobService.d.ts +636 -0
- package/dist/services/JobService.js +564 -0
- package/dist/services/OauthService.d.ts +95 -0
- package/dist/services/OauthService.js +124 -0
- package/dist/services/ResourceService.d.ts +177 -0
- package/dist/services/ResourceService.js +244 -0
- package/dist/services/ScheduleService.d.ts +103 -0
- package/dist/services/ScheduleService.js +134 -0
- package/dist/services/ScriptService.d.ts +303 -0
- package/dist/services/ScriptService.js +339 -0
- package/dist/services/SettingsService.d.ts +15 -0
- package/dist/services/SettingsService.js +30 -0
- package/dist/services/UserService.d.ts +284 -0
- package/dist/services/UserService.js +376 -0
- package/dist/services/VariableService.d.ts +83 -0
- package/dist/services/VariableService.js +123 -0
- package/dist/services/WorkerService.d.ts +25 -0
- package/dist/services/WorkerService.js +34 -0
- package/dist/services/WorkspaceService.d.ts +227 -0
- package/dist/services/WorkspaceService.js +275 -0
- package/package.json +7 -2
- package/src/core/ApiError.d.ts +10 -0
- package/src/core/ApiRequestOptions.d.ts +13 -0
- package/src/core/ApiResult.d.ts +7 -0
- package/src/core/CancelablePromise.d.ts +26 -0
- package/src/core/OpenAPI.d.ts +16 -0
- package/src/core/request.d.ts +13 -0
- package/src/index.d.ts +95 -0
- package/src/models/AppWithLastVersion.d.ts +21 -0
- package/src/models/AppWithLastVersionWDraft.d.ts +5 -0
- package/src/models/AuditLog.d.ts +32 -0
- package/src/models/BranchAll.d.ts +10 -0
- package/src/models/BranchOne.d.ts +10 -0
- package/src/models/CompletedJob.d.ts +57 -0
- package/src/models/ContextualVariable.d.ts +5 -0
- package/src/models/CreateInput.d.ts +4 -0
- package/src/models/CreateResource.d.ts +6 -0
- package/src/models/CreateVariable.d.ts +8 -0
- package/src/models/CreateWorkspace.d.ts +5 -0
- package/src/models/EditResource.d.ts +5 -0
- package/src/models/EditResourceType.d.ts +4 -0
- package/src/models/EditSchedule.d.ts +6 -0
- package/src/models/EditVariable.d.ts +6 -0
- package/src/models/EditWorkspaceUser.d.ts +5 -0
- package/src/models/Flow.d.ts +3 -0
- package/src/models/FlowMetadata.d.ts +11 -0
- package/src/models/FlowModule.d.ts +18 -0
- package/src/models/FlowModuleValue.d.ts +8 -0
- package/src/models/FlowPreview.d.ts +7 -0
- package/src/models/FlowStatus.d.ts +12 -0
- package/src/models/FlowStatusModule.d.ts +34 -0
- package/src/models/FlowValue.d.ts +6 -0
- package/src/models/Folder.d.ts +5 -0
- package/src/models/ForloopFlow.d.ts +9 -0
- package/src/models/GlobalUserInfo.d.ts +14 -0
- package/src/models/Group.d.ts +6 -0
- package/src/models/Identity.d.ts +4 -0
- package/src/models/Input.d.ts +8 -0
- package/src/models/InputTransform.d.ts +3 -0
- package/src/models/JavascriptTransform.d.ts +4 -0
- package/src/models/Job.d.ts +11 -0
- package/src/models/ListableApp.d.ts +18 -0
- package/src/models/ListableResource.d.ts +14 -0
- package/src/models/ListableVariable.d.ts +14 -0
- package/src/models/Login.d.ts +4 -0
- package/src/models/MainArgSignature.d.ts +33 -0
- package/src/models/NewSchedule.d.ts +10 -0
- package/src/models/NewScript.d.ts +29 -0
- package/src/models/NewScriptWithDraft.d.ts +5 -0
- package/src/models/NewToken.d.ts +4 -0
- package/src/models/NewTokenImpersonate.d.ts +5 -0
- package/src/models/NewUser.d.ts +5 -0
- package/src/models/OpenFlow.d.ts +7 -0
- package/src/models/OpenFlowWPath.d.ts +4 -0
- package/src/models/PathFlow.d.ts +6 -0
- package/src/models/PathScript.d.ts +7 -0
- package/src/models/Policy.d.ts +13 -0
- package/src/models/Preview.d.ts +16 -0
- package/src/models/QueuedJob.d.ts +55 -0
- package/src/models/RawScript.d.ts +18 -0
- package/src/models/Resource.d.ts +9 -0
- package/src/models/ResourceType.d.ts +6 -0
- package/src/models/Retry.d.ts +11 -0
- package/src/models/RunnableType.d.ts +5 -0
- package/src/models/Schedule.d.ts +15 -0
- package/src/models/Script.d.ts +43 -0
- package/src/models/ScriptArgs.d.ts +1 -0
- package/src/models/SlackToken.d.ts +8 -0
- package/src/models/StaticTransform.d.ts +4 -0
- package/src/models/TokenResponse.d.ts +6 -0
- package/src/models/TruncatedToken.d.ts +7 -0
- package/src/models/UpdateInput.d.ts +5 -0
- package/src/models/Usage.d.ts +3 -0
- package/src/models/User.d.ts +14 -0
- package/src/models/UserWorkspaceList.d.ts +8 -0
- package/src/models/WorkerPing.d.ts +8 -0
- package/src/models/Workspace.d.ts +6 -0
- package/src/models/WorkspaceInvite.d.ts +6 -0
- package/src/services/AdminService.d.ts +39 -0
- package/src/services/AppService.d.ts +194 -0
- package/src/services/AuditService.d.ts +53 -0
- package/src/services/CaptureService.d.ts +30 -0
- package/src/services/DraftService.d.ts +16 -0
- package/src/services/FavoriteService.d.ts +27 -0
- package/src/services/FlowService.d.ts +186 -0
- package/src/services/FolderService.d.ts +128 -0
- package/src/services/GranularAclService.d.ts +46 -0
- package/src/services/GroupService.d.ts +110 -0
- package/src/services/InputService.d.ts +78 -0
- package/src/services/JobService.d.ts +636 -0
- package/src/services/OauthService.d.ts +95 -0
- package/src/services/ResourceService.d.ts +177 -0
- package/src/services/ScheduleService.d.ts +103 -0
- package/src/services/ScriptService.d.ts +303 -0
- package/src/services/SettingsService.d.ts +15 -0
- package/src/services/UserService.d.ts +284 -0
- package/src/services/VariableService.d.ts +83 -0
- package/src/services/WorkerService.d.ts +25 -0
- package/src/services/WorkspaceService.d.ts +227 -0
- package/tsconfig.json +111 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly body: any;
|
|
8
|
+
readonly request: ApiRequestOptions;
|
|
9
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor(request, response, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ApiError';
|
|
8
|
+
this.url = response.url;
|
|
9
|
+
this.status = response.status;
|
|
10
|
+
this.statusText = response.statusText;
|
|
11
|
+
this.body = response.body;
|
|
12
|
+
this.request = request;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiRequestOptions = {
|
|
2
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly path?: Record<string, any>;
|
|
5
|
+
readonly cookies?: Record<string, any>;
|
|
6
|
+
readonly headers?: Record<string, any>;
|
|
7
|
+
readonly query?: Record<string, any>;
|
|
8
|
+
readonly formData?: Record<string, any>;
|
|
9
|
+
readonly body?: any;
|
|
10
|
+
readonly mediaType?: string;
|
|
11
|
+
readonly responseHeader?: string;
|
|
12
|
+
readonly errors?: Record<number, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class CancelError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
get isCancelled(): boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface OnCancel {
|
|
6
|
+
readonly isResolved: boolean;
|
|
7
|
+
readonly isRejected: boolean;
|
|
8
|
+
readonly isCancelled: boolean;
|
|
9
|
+
(cancelHandler: () => void): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
+
readonly [Symbol.toStringTag]: string;
|
|
13
|
+
private _isResolved;
|
|
14
|
+
private _isRejected;
|
|
15
|
+
private _isCancelled;
|
|
16
|
+
private readonly _cancelHandlers;
|
|
17
|
+
private readonly _promise;
|
|
18
|
+
private _resolve?;
|
|
19
|
+
private _reject?;
|
|
20
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
21
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
22
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
23
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
24
|
+
cancel(): void;
|
|
25
|
+
get isCancelled(): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancelablePromise = exports.CancelError = void 0;
|
|
4
|
+
/* istanbul ignore file */
|
|
5
|
+
/* tslint:disable */
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
class CancelError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'CancelError';
|
|
11
|
+
}
|
|
12
|
+
get isCancelled() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CancelError = CancelError;
|
|
17
|
+
class CancelablePromise {
|
|
18
|
+
constructor(executor) {
|
|
19
|
+
this._isResolved = false;
|
|
20
|
+
this._isRejected = false;
|
|
21
|
+
this._isCancelled = false;
|
|
22
|
+
this._cancelHandlers = [];
|
|
23
|
+
this._promise = new Promise((resolve, reject) => {
|
|
24
|
+
this._resolve = resolve;
|
|
25
|
+
this._reject = reject;
|
|
26
|
+
const onResolve = (value) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this._isResolved = true;
|
|
32
|
+
(_a = this._resolve) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
33
|
+
};
|
|
34
|
+
const onReject = (reason) => {
|
|
35
|
+
var _a;
|
|
36
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this._isRejected = true;
|
|
40
|
+
(_a = this._reject) === null || _a === void 0 ? void 0 : _a.call(this, reason);
|
|
41
|
+
};
|
|
42
|
+
const onCancel = (cancelHandler) => {
|
|
43
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this._cancelHandlers.push(cancelHandler);
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
49
|
+
get: () => this._isResolved,
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
52
|
+
get: () => this._isRejected,
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
55
|
+
get: () => this._isCancelled,
|
|
56
|
+
});
|
|
57
|
+
return executor(onResolve, onReject, onCancel);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
then(onFulfilled, onRejected) {
|
|
61
|
+
return this._promise.then(onFulfilled, onRejected);
|
|
62
|
+
}
|
|
63
|
+
catch(onRejected) {
|
|
64
|
+
return this._promise.catch(onRejected);
|
|
65
|
+
}
|
|
66
|
+
finally(onFinally) {
|
|
67
|
+
return this._promise.finally(onFinally);
|
|
68
|
+
}
|
|
69
|
+
cancel() {
|
|
70
|
+
var _a;
|
|
71
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this._isCancelled = true;
|
|
75
|
+
if (this._cancelHandlers.length) {
|
|
76
|
+
try {
|
|
77
|
+
for (const cancelHandler of this._cancelHandlers) {
|
|
78
|
+
cancelHandler();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.warn('Cancellation threw an error', error);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this._cancelHandlers.length = 0;
|
|
87
|
+
(_a = this._reject) === null || _a === void 0 ? void 0 : _a.call(this, new CancelError('Request aborted'));
|
|
88
|
+
}
|
|
89
|
+
get isCancelled() {
|
|
90
|
+
return this._isCancelled;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.CancelablePromise = CancelablePromise;
|
|
94
|
+
Symbol.toStringTag;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
3
|
+
type Headers = Record<string, string>;
|
|
4
|
+
export type OpenAPIConfig = {
|
|
5
|
+
BASE: string;
|
|
6
|
+
VERSION: string;
|
|
7
|
+
WITH_CREDENTIALS: boolean;
|
|
8
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
9
|
+
TOKEN?: string | Resolver<string>;
|
|
10
|
+
USERNAME?: string | Resolver<string>;
|
|
11
|
+
PASSWORD?: string | Resolver<string>;
|
|
12
|
+
HEADERS?: Headers | Resolver<Headers>;
|
|
13
|
+
ENCODE_PATH?: (path: string) => string;
|
|
14
|
+
};
|
|
15
|
+
export declare const OpenAPI: OpenAPIConfig;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAPI = void 0;
|
|
4
|
+
exports.OpenAPI = {
|
|
5
|
+
BASE: '/api',
|
|
6
|
+
VERSION: '1.95.1',
|
|
7
|
+
WITH_CREDENTIALS: false,
|
|
8
|
+
CREDENTIALS: 'include',
|
|
9
|
+
TOKEN: undefined,
|
|
10
|
+
USERNAME: undefined,
|
|
11
|
+
PASSWORD: undefined,
|
|
12
|
+
HEADERS: undefined,
|
|
13
|
+
ENCODE_PATH: undefined,
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
3
|
+
import type { OnCancel } from './CancelablePromise';
|
|
4
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
5
|
+
export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<Response>;
|
|
6
|
+
/**
|
|
7
|
+
* Request method
|
|
8
|
+
* @param config The OpenAPI configuration object
|
|
9
|
+
* @param options The request options from the service
|
|
10
|
+
* @returns CancelablePromise<T>
|
|
11
|
+
* @throws ApiError
|
|
12
|
+
*/
|
|
13
|
+
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = exports.sendRequest = void 0;
|
|
4
|
+
/* istanbul ignore file */
|
|
5
|
+
/* tslint:disable */
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
const ApiError_1 = require("./ApiError");
|
|
8
|
+
const CancelablePromise_1 = require("./CancelablePromise");
|
|
9
|
+
const isDefined = (value) => {
|
|
10
|
+
return value !== undefined && value !== null;
|
|
11
|
+
};
|
|
12
|
+
const isString = (value) => {
|
|
13
|
+
return typeof value === 'string';
|
|
14
|
+
};
|
|
15
|
+
const isStringWithValue = (value) => {
|
|
16
|
+
return isString(value) && value !== '';
|
|
17
|
+
};
|
|
18
|
+
const isBlob = (value) => {
|
|
19
|
+
return (typeof value === 'object' &&
|
|
20
|
+
typeof value.type === 'string' &&
|
|
21
|
+
typeof value.stream === 'function' &&
|
|
22
|
+
typeof value.arrayBuffer === 'function' &&
|
|
23
|
+
typeof value.constructor === 'function' &&
|
|
24
|
+
typeof value.constructor.name === 'string' &&
|
|
25
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
26
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
27
|
+
};
|
|
28
|
+
const isFormData = (value) => {
|
|
29
|
+
return value instanceof FormData;
|
|
30
|
+
};
|
|
31
|
+
const base64 = (str) => {
|
|
32
|
+
try {
|
|
33
|
+
return btoa(str);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
return Buffer.from(str).toString('base64');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getQueryString = (params) => {
|
|
41
|
+
const qs = [];
|
|
42
|
+
const append = (key, value) => {
|
|
43
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
44
|
+
};
|
|
45
|
+
const process = (key, value) => {
|
|
46
|
+
if (isDefined(value)) {
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
value.forEach(v => {
|
|
49
|
+
process(key, v);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else if (typeof value === 'object') {
|
|
53
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
54
|
+
process(`${key}[${k}]`, v);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
append(key, value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
63
|
+
process(key, value);
|
|
64
|
+
});
|
|
65
|
+
if (qs.length > 0) {
|
|
66
|
+
return `?${qs.join('&')}`;
|
|
67
|
+
}
|
|
68
|
+
return '';
|
|
69
|
+
};
|
|
70
|
+
const getUrl = (config, options) => {
|
|
71
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
72
|
+
const path = options.url
|
|
73
|
+
.replace('{api-version}', config.VERSION)
|
|
74
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
75
|
+
var _a;
|
|
76
|
+
if ((_a = options.path) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(group)) {
|
|
77
|
+
return encoder(String(options.path[group]));
|
|
78
|
+
}
|
|
79
|
+
return substring;
|
|
80
|
+
});
|
|
81
|
+
const url = `${config.BASE}${path}`;
|
|
82
|
+
if (options.query) {
|
|
83
|
+
return `${url}${getQueryString(options.query)}`;
|
|
84
|
+
}
|
|
85
|
+
return url;
|
|
86
|
+
};
|
|
87
|
+
const getFormData = (options) => {
|
|
88
|
+
if (options.formData) {
|
|
89
|
+
const formData = new FormData();
|
|
90
|
+
const process = (key, value) => {
|
|
91
|
+
if (isString(value) || isBlob(value)) {
|
|
92
|
+
formData.append(key, value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
formData.append(key, JSON.stringify(value));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
Object.entries(options.formData)
|
|
99
|
+
.filter(([_, value]) => isDefined(value))
|
|
100
|
+
.forEach(([key, value]) => {
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
value.forEach(v => process(key, v));
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
process(key, value);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return formData;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
};
|
|
112
|
+
const resolve = async (options, resolver) => {
|
|
113
|
+
if (typeof resolver === 'function') {
|
|
114
|
+
return resolver(options);
|
|
115
|
+
}
|
|
116
|
+
return resolver;
|
|
117
|
+
};
|
|
118
|
+
const getHeaders = async (config, options) => {
|
|
119
|
+
const token = await resolve(options, config.TOKEN);
|
|
120
|
+
const username = await resolve(options, config.USERNAME);
|
|
121
|
+
const password = await resolve(options, config.PASSWORD);
|
|
122
|
+
const additionalHeaders = await resolve(options, config.HEADERS);
|
|
123
|
+
const headers = Object.entries({
|
|
124
|
+
Accept: 'application/json',
|
|
125
|
+
...additionalHeaders,
|
|
126
|
+
...options.headers,
|
|
127
|
+
})
|
|
128
|
+
.filter(([_, value]) => isDefined(value))
|
|
129
|
+
.reduce((headers, [key, value]) => ({
|
|
130
|
+
...headers,
|
|
131
|
+
[key]: String(value),
|
|
132
|
+
}), {});
|
|
133
|
+
if (isStringWithValue(token)) {
|
|
134
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
135
|
+
}
|
|
136
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
137
|
+
const credentials = base64(`${username}:${password}`);
|
|
138
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
139
|
+
}
|
|
140
|
+
if (options.body) {
|
|
141
|
+
if (options.mediaType) {
|
|
142
|
+
headers['Content-Type'] = options.mediaType;
|
|
143
|
+
}
|
|
144
|
+
else if (isBlob(options.body)) {
|
|
145
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
146
|
+
}
|
|
147
|
+
else if (isString(options.body)) {
|
|
148
|
+
headers['Content-Type'] = 'text/plain';
|
|
149
|
+
}
|
|
150
|
+
else if (!isFormData(options.body)) {
|
|
151
|
+
headers['Content-Type'] = 'application/json';
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return new Headers(headers);
|
|
155
|
+
};
|
|
156
|
+
const getRequestBody = (options) => {
|
|
157
|
+
var _a;
|
|
158
|
+
if (options.body) {
|
|
159
|
+
if ((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes('/json')) {
|
|
160
|
+
return JSON.stringify(options.body);
|
|
161
|
+
}
|
|
162
|
+
else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
163
|
+
return options.body;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return JSON.stringify(options.body);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return undefined;
|
|
170
|
+
};
|
|
171
|
+
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
172
|
+
const controller = new AbortController();
|
|
173
|
+
const request = {
|
|
174
|
+
headers,
|
|
175
|
+
body: body !== null && body !== void 0 ? body : formData,
|
|
176
|
+
method: options.method,
|
|
177
|
+
signal: controller.signal,
|
|
178
|
+
};
|
|
179
|
+
if (config.WITH_CREDENTIALS) {
|
|
180
|
+
request.credentials = config.CREDENTIALS;
|
|
181
|
+
}
|
|
182
|
+
request.referrerPolicy = "no-referrer";
|
|
183
|
+
onCancel(() => controller.abort());
|
|
184
|
+
return await fetch(url, request);
|
|
185
|
+
};
|
|
186
|
+
exports.sendRequest = sendRequest;
|
|
187
|
+
const getResponseHeader = (response, responseHeader) => {
|
|
188
|
+
if (responseHeader) {
|
|
189
|
+
const content = response.headers.get(responseHeader);
|
|
190
|
+
if (isString(content)) {
|
|
191
|
+
return content;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return undefined;
|
|
195
|
+
};
|
|
196
|
+
const getResponseBody = async (response) => {
|
|
197
|
+
if (response.status !== 204) {
|
|
198
|
+
try {
|
|
199
|
+
const contentType = response.headers.get('Content-Type');
|
|
200
|
+
if (contentType) {
|
|
201
|
+
const isJSON = contentType.toLowerCase().startsWith('application/json');
|
|
202
|
+
if (isJSON) {
|
|
203
|
+
return await response.json();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return await response.text();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
console.error(error);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return undefined;
|
|
215
|
+
};
|
|
216
|
+
const catchErrorCodes = (options, result) => {
|
|
217
|
+
const errors = {
|
|
218
|
+
400: 'Bad Request',
|
|
219
|
+
401: 'Unauthorized',
|
|
220
|
+
403: 'Forbidden',
|
|
221
|
+
404: 'Not Found',
|
|
222
|
+
500: 'Internal Server Error',
|
|
223
|
+
502: 'Bad Gateway',
|
|
224
|
+
503: 'Service Unavailable',
|
|
225
|
+
...options.errors,
|
|
226
|
+
};
|
|
227
|
+
const error = errors[result.status];
|
|
228
|
+
if (error) {
|
|
229
|
+
throw new ApiError_1.ApiError(options, result, error);
|
|
230
|
+
}
|
|
231
|
+
if (!result.ok) {
|
|
232
|
+
throw new ApiError_1.ApiError(options, result, 'Generic Error');
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Request method
|
|
237
|
+
* @param config The OpenAPI configuration object
|
|
238
|
+
* @param options The request options from the service
|
|
239
|
+
* @returns CancelablePromise<T>
|
|
240
|
+
* @throws ApiError
|
|
241
|
+
*/
|
|
242
|
+
const request = (config, options) => {
|
|
243
|
+
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
244
|
+
try {
|
|
245
|
+
const url = getUrl(config, options);
|
|
246
|
+
const formData = getFormData(options);
|
|
247
|
+
const body = getRequestBody(options);
|
|
248
|
+
const headers = await getHeaders(config, options);
|
|
249
|
+
if (!onCancel.isCancelled) {
|
|
250
|
+
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
251
|
+
const responseBody = await getResponseBody(response);
|
|
252
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
253
|
+
const result = {
|
|
254
|
+
url,
|
|
255
|
+
ok: response.ok,
|
|
256
|
+
status: response.status,
|
|
257
|
+
statusText: response.statusText,
|
|
258
|
+
body: responseHeader !== null && responseHeader !== void 0 ? responseHeader : responseBody,
|
|
259
|
+
};
|
|
260
|
+
catchErrorCodes(options, result);
|
|
261
|
+
resolve(result.body);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
reject(error);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
exports.request = request;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export { ApiError } from './core/ApiError';
|
|
2
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
+
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
+
export { AppWithLastVersion } from './models/AppWithLastVersion';
|
|
6
|
+
export type { AppWithLastVersionWDraft } from './models/AppWithLastVersionWDraft';
|
|
7
|
+
export { AuditLog } from './models/AuditLog';
|
|
8
|
+
export type { BranchAll } from './models/BranchAll';
|
|
9
|
+
export type { BranchOne } from './models/BranchOne';
|
|
10
|
+
export { CompletedJob } from './models/CompletedJob';
|
|
11
|
+
export type { ContextualVariable } from './models/ContextualVariable';
|
|
12
|
+
export type { CreateInput } from './models/CreateInput';
|
|
13
|
+
export type { CreateResource } from './models/CreateResource';
|
|
14
|
+
export type { CreateVariable } from './models/CreateVariable';
|
|
15
|
+
export type { CreateWorkspace } from './models/CreateWorkspace';
|
|
16
|
+
export type { EditResource } from './models/EditResource';
|
|
17
|
+
export type { EditResourceType } from './models/EditResourceType';
|
|
18
|
+
export type { EditSchedule } from './models/EditSchedule';
|
|
19
|
+
export type { EditVariable } from './models/EditVariable';
|
|
20
|
+
export type { EditWorkspaceUser } from './models/EditWorkspaceUser';
|
|
21
|
+
export type { Flow } from './models/Flow';
|
|
22
|
+
export type { FlowMetadata } from './models/FlowMetadata';
|
|
23
|
+
export type { FlowModule } from './models/FlowModule';
|
|
24
|
+
export type { FlowModuleValue } from './models/FlowModuleValue';
|
|
25
|
+
export type { FlowPreview } from './models/FlowPreview';
|
|
26
|
+
export type { FlowStatus } from './models/FlowStatus';
|
|
27
|
+
export { FlowStatusModule } from './models/FlowStatusModule';
|
|
28
|
+
export type { FlowValue } from './models/FlowValue';
|
|
29
|
+
export type { Folder } from './models/Folder';
|
|
30
|
+
export type { ForloopFlow } from './models/ForloopFlow';
|
|
31
|
+
export { GlobalUserInfo } from './models/GlobalUserInfo';
|
|
32
|
+
export type { Group } from './models/Group';
|
|
33
|
+
export type { Identity } from './models/Identity';
|
|
34
|
+
export type { Input } from './models/Input';
|
|
35
|
+
export type { InputTransform } from './models/InputTransform';
|
|
36
|
+
export type { JavascriptTransform } from './models/JavascriptTransform';
|
|
37
|
+
export { Job } from './models/Job';
|
|
38
|
+
export { ListableApp } from './models/ListableApp';
|
|
39
|
+
export type { ListableResource } from './models/ListableResource';
|
|
40
|
+
export type { ListableVariable } from './models/ListableVariable';
|
|
41
|
+
export type { Login } from './models/Login';
|
|
42
|
+
export { MainArgSignature } from './models/MainArgSignature';
|
|
43
|
+
export type { NewSchedule } from './models/NewSchedule';
|
|
44
|
+
export { NewScript } from './models/NewScript';
|
|
45
|
+
export type { NewScriptWithDraft } from './models/NewScriptWithDraft';
|
|
46
|
+
export type { NewToken } from './models/NewToken';
|
|
47
|
+
export type { NewTokenImpersonate } from './models/NewTokenImpersonate';
|
|
48
|
+
export type { NewUser } from './models/NewUser';
|
|
49
|
+
export type { OpenFlow } from './models/OpenFlow';
|
|
50
|
+
export type { OpenFlowWPath } from './models/OpenFlowWPath';
|
|
51
|
+
export type { PathFlow } from './models/PathFlow';
|
|
52
|
+
export type { PathScript } from './models/PathScript';
|
|
53
|
+
export { Policy } from './models/Policy';
|
|
54
|
+
export { Preview } from './models/Preview';
|
|
55
|
+
export { QueuedJob } from './models/QueuedJob';
|
|
56
|
+
export { RawScript } from './models/RawScript';
|
|
57
|
+
export type { Resource } from './models/Resource';
|
|
58
|
+
export type { ResourceType } from './models/ResourceType';
|
|
59
|
+
export type { Retry } from './models/Retry';
|
|
60
|
+
export { RunnableType } from './models/RunnableType';
|
|
61
|
+
export type { Schedule } from './models/Schedule';
|
|
62
|
+
export { Script } from './models/Script';
|
|
63
|
+
export type { ScriptArgs } from './models/ScriptArgs';
|
|
64
|
+
export type { SlackToken } from './models/SlackToken';
|
|
65
|
+
export type { StaticTransform } from './models/StaticTransform';
|
|
66
|
+
export type { TokenResponse } from './models/TokenResponse';
|
|
67
|
+
export type { TruncatedToken } from './models/TruncatedToken';
|
|
68
|
+
export type { UpdateInput } from './models/UpdateInput';
|
|
69
|
+
export type { Usage } from './models/Usage';
|
|
70
|
+
export type { User } from './models/User';
|
|
71
|
+
export type { UserWorkspaceList } from './models/UserWorkspaceList';
|
|
72
|
+
export type { WorkerPing } from './models/WorkerPing';
|
|
73
|
+
export type { Workspace } from './models/Workspace';
|
|
74
|
+
export type { WorkspaceInvite } from './models/WorkspaceInvite';
|
|
75
|
+
export { AdminService } from './services/AdminService';
|
|
76
|
+
export { AppService } from './services/AppService';
|
|
77
|
+
export { AuditService } from './services/AuditService';
|
|
78
|
+
export { CaptureService } from './services/CaptureService';
|
|
79
|
+
export { DraftService } from './services/DraftService';
|
|
80
|
+
export { FavoriteService } from './services/FavoriteService';
|
|
81
|
+
export { FlowService } from './services/FlowService';
|
|
82
|
+
export { FolderService } from './services/FolderService';
|
|
83
|
+
export { GranularAclService } from './services/GranularAclService';
|
|
84
|
+
export { GroupService } from './services/GroupService';
|
|
85
|
+
export { InputService } from './services/InputService';
|
|
86
|
+
export { JobService } from './services/JobService';
|
|
87
|
+
export { OauthService } from './services/OauthService';
|
|
88
|
+
export { ResourceService } from './services/ResourceService';
|
|
89
|
+
export { ScheduleService } from './services/ScheduleService';
|
|
90
|
+
export { ScriptService } from './services/ScriptService';
|
|
91
|
+
export { SettingsService } from './services/SettingsService';
|
|
92
|
+
export { UserService } from './services/UserService';
|
|
93
|
+
export { VariableService } from './services/VariableService';
|
|
94
|
+
export { WorkerService } from './services/WorkerService';
|
|
95
|
+
export { WorkspaceService } from './services/WorkspaceService';
|