windmill-client 1.145.2 → 1.146.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/dist/client.d.ts +77 -0
- package/dist/client.js +368 -0
- 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 +20 -0
- package/dist/core/CancelablePromise.js +116 -0
- package/dist/core/OpenAPI.d.ts +16 -0
- package/dist/core/OpenAPI.js +14 -0
- package/dist/core/request.d.ts +30 -0
- package/dist/core/request.js +289 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +98 -0
- package/dist/models/AccountId.d.ts +1 -0
- package/dist/models/AccountId.js +6 -0
- package/dist/models/ActionKind.d.ts +9 -0
- package/dist/models/ActionKind.js +17 -0
- package/dist/models/After.d.ts +4 -0
- package/dist/models/After.js +6 -0
- package/dist/models/AppWithLastVersion.d.ts +21 -0
- package/dist/models/AppWithLastVersion.js +16 -0
- package/dist/models/AppWithLastVersionWDraft.d.ts +5 -0
- package/dist/models/AppWithLastVersionWDraft.js +6 -0
- package/dist/models/ArgsFilter.d.ts +4 -0
- package/dist/models/ArgsFilter.js +6 -0
- package/dist/models/AuditLog.d.ts +102 -0
- package/dist/models/AuditLog.js +103 -0
- package/dist/models/Before.d.ts +4 -0
- package/dist/models/Before.js +6 -0
- package/dist/models/BranchAll.d.ts +10 -0
- package/dist/models/BranchAll.js +6 -0
- package/dist/models/BranchOne.d.ts +10 -0
- package/dist/models/BranchOne.js +6 -0
- package/dist/models/ClientName.d.ts +1 -0
- package/dist/models/ClientName.js +6 -0
- package/dist/models/CompletedJob.d.ts +65 -0
- package/dist/models/CompletedJob.js +35 -0
- package/dist/models/ContextualVariable.d.ts +5 -0
- package/dist/models/ContextualVariable.js +6 -0
- package/dist/models/CreateInput.d.ts +4 -0
- package/dist/models/CreateInput.js +6 -0
- package/dist/models/CreateResource.d.ts +6 -0
- package/dist/models/CreateResource.js +6 -0
- package/dist/models/CreateVariable.d.ts +8 -0
- package/dist/models/CreateVariable.js +6 -0
- package/dist/models/CreateWorkspace.d.ts +5 -0
- package/dist/models/CreateWorkspace.js +6 -0
- package/dist/models/CreatedBy.d.ts +4 -0
- package/dist/models/CreatedBy.js +6 -0
- package/dist/models/EditResource.d.ts +5 -0
- package/dist/models/EditResource.js +6 -0
- package/dist/models/EditResourceType.d.ts +4 -0
- package/dist/models/EditResourceType.js +6 -0
- package/dist/models/EditSchedule.d.ts +7 -0
- package/dist/models/EditSchedule.js +6 -0
- package/dist/models/EditVariable.d.ts +6 -0
- package/dist/models/EditVariable.js +6 -0
- package/dist/models/EditWorkspaceUser.d.ts +5 -0
- package/dist/models/EditWorkspaceUser.js +6 -0
- package/dist/models/Flow.d.ts +3 -0
- package/dist/models/Flow.js +6 -0
- package/dist/models/FlowMetadata.d.ts +12 -0
- package/dist/models/FlowMetadata.js +6 -0
- package/dist/models/FlowModule.d.ts +27 -0
- package/dist/models/FlowModule.js +6 -0
- package/dist/models/FlowModuleValue.d.ts +9 -0
- package/dist/models/FlowModuleValue.js +6 -0
- package/dist/models/FlowPreview.d.ts +8 -0
- package/dist/models/FlowPreview.js +6 -0
- package/dist/models/FlowStatus.d.ts +12 -0
- package/dist/models/FlowStatus.js +6 -0
- package/dist/models/FlowStatusModule.d.ts +34 -0
- package/dist/models/FlowStatusModule.js +19 -0
- package/dist/models/FlowValue.d.ts +6 -0
- package/dist/models/FlowValue.js +6 -0
- package/dist/models/Folder.d.ts +5 -0
- package/dist/models/Folder.js +6 -0
- package/dist/models/ForloopFlow.d.ts +9 -0
- package/dist/models/ForloopFlow.js +6 -0
- package/dist/models/GlobalUserInfo.d.ts +14 -0
- package/dist/models/GlobalUserInfo.js +15 -0
- package/dist/models/Graphql.d.ts +3 -0
- package/dist/models/Graphql.js +6 -0
- package/dist/models/Group.d.ts +6 -0
- package/dist/models/Group.js +6 -0
- package/dist/models/Http.d.ts +8 -0
- package/dist/models/Http.js +14 -0
- package/dist/models/Identity.d.ts +4 -0
- package/dist/models/Identity.js +6 -0
- package/dist/models/IncludeHeader.d.ts +6 -0
- package/dist/models/IncludeHeader.js +6 -0
- package/dist/models/Input.d.ts +9 -0
- package/dist/models/Input.js +6 -0
- package/dist/models/InputId.d.ts +1 -0
- package/dist/models/InputId.js +6 -0
- package/dist/models/InputTransform.d.ts +3 -0
- package/dist/models/InputTransform.js +6 -0
- package/dist/models/InstanceGroup.d.ts +4 -0
- package/dist/models/InstanceGroup.js +6 -0
- package/dist/models/JavascriptTransform.d.ts +4 -0
- package/dist/models/JavascriptTransform.js +6 -0
- package/dist/models/Job.d.ts +11 -0
- package/dist/models/Job.js +15 -0
- package/dist/models/JobId.d.ts +1 -0
- package/dist/models/JobId.js +6 -0
- package/dist/models/JobKinds.d.ts +4 -0
- package/dist/models/JobKinds.js +6 -0
- package/dist/models/ListableApp.d.ts +18 -0
- package/dist/models/ListableApp.js +16 -0
- package/dist/models/ListableRawApp.d.ts +9 -0
- package/dist/models/ListableRawApp.js +6 -0
- package/dist/models/ListableResource.d.ts +14 -0
- package/dist/models/ListableResource.js +6 -0
- package/dist/models/ListableVariable.d.ts +14 -0
- package/dist/models/ListableVariable.js +6 -0
- package/dist/models/Login.d.ts +4 -0
- package/dist/models/Login.js +6 -0
- package/dist/models/MainArgSignature.d.ts +33 -0
- package/dist/models/MainArgSignature.js +15 -0
- package/dist/models/Name.d.ts +1 -0
- package/dist/models/Name.js +6 -0
- package/dist/models/NewJobId.d.ts +4 -0
- package/dist/models/NewJobId.js +6 -0
- package/dist/models/NewSchedule.d.ts +11 -0
- package/dist/models/NewSchedule.js +6 -0
- package/dist/models/NewScript.d.ts +40 -0
- package/dist/models/NewScript.js +33 -0
- package/dist/models/NewScriptWithDraft.d.ts +5 -0
- package/dist/models/NewScriptWithDraft.js +6 -0
- package/dist/models/NewToken.d.ts +5 -0
- package/dist/models/NewToken.js +6 -0
- package/dist/models/NewTokenImpersonate.d.ts +5 -0
- package/dist/models/NewTokenImpersonate.js +6 -0
- package/dist/models/NewUser.d.ts +5 -0
- package/dist/models/NewUser.js +6 -0
- package/dist/models/OpenFlow.d.ts +7 -0
- package/dist/models/OpenFlow.js +6 -0
- package/dist/models/OpenFlowWPath.d.ts +5 -0
- package/dist/models/OpenFlowWPath.js +6 -0
- package/dist/models/Operation.d.ts +4 -0
- package/dist/models/Operation.js +6 -0
- package/dist/models/OrderDesc.d.ts +4 -0
- package/dist/models/OrderDesc.js +6 -0
- package/dist/models/Page.d.ts +4 -0
- package/dist/models/Page.js +6 -0
- package/dist/models/ParentJob.d.ts +4 -0
- package/dist/models/ParentJob.js +6 -0
- package/dist/models/Path.d.ts +1 -0
- package/dist/models/Path.js +6 -0
- package/dist/models/PathFlow.d.ts +6 -0
- package/dist/models/PathFlow.js +6 -0
- package/dist/models/PathId.d.ts +1 -0
- package/dist/models/PathId.js +6 -0
- package/dist/models/PathScript.d.ts +7 -0
- package/dist/models/PathScript.js +6 -0
- package/dist/models/Payload.d.ts +6 -0
- package/dist/models/Payload.js +6 -0
- package/dist/models/PerPage.d.ts +4 -0
- package/dist/models/PerPage.js +6 -0
- package/dist/models/Policy.d.ts +13 -0
- package/dist/models/Policy.js +16 -0
- package/dist/models/Preview.d.ts +30 -0
- package/dist/models/Preview.js +31 -0
- package/dist/models/QueueLimit.d.ts +5 -0
- package/dist/models/QueueLimit.js +6 -0
- package/dist/models/QueuedJob.d.ts +63 -0
- package/dist/models/QueuedJob.js +35 -0
- package/dist/models/RawScript.d.ts +27 -0
- package/dist/models/RawScript.js +24 -0
- package/dist/models/Resource.d.ts +9 -0
- package/dist/models/Resource.js +6 -0
- package/dist/models/ResourceName.d.ts +4 -0
- package/dist/models/ResourceName.js +6 -0
- package/dist/models/ResourceType.d.ts +6 -0
- package/dist/models/ResourceType.js +6 -0
- package/dist/models/ResultFilter.d.ts +4 -0
- package/dist/models/ResultFilter.js +6 -0
- package/dist/models/Retry.d.ts +11 -0
- package/dist/models/Retry.js +6 -0
- package/dist/models/RunnableId.d.ts +1 -0
- package/dist/models/RunnableId.js +6 -0
- package/dist/models/RunnableType.d.ts +5 -0
- package/dist/models/RunnableType.js +13 -0
- package/dist/models/RunnableTypeQuery.d.ts +2 -0
- package/dist/models/RunnableTypeQuery.js +6 -0
- package/dist/models/Running.d.ts +4 -0
- package/dist/models/Running.js +6 -0
- package/dist/models/Schedule.d.ts +16 -0
- package/dist/models/Schedule.js +6 -0
- package/dist/models/SchedulePath.d.ts +4 -0
- package/dist/models/SchedulePath.js +6 -0
- package/dist/models/ScheduleWJobs.d.ts +8 -0
- package/dist/models/ScheduleWJobs.js +6 -0
- package/dist/models/Script.d.ts +54 -0
- package/dist/models/Script.js +33 -0
- package/dist/models/ScriptArgs.d.ts +1 -0
- package/dist/models/ScriptArgs.js +6 -0
- package/dist/models/ScriptExactHash.d.ts +4 -0
- package/dist/models/ScriptExactHash.js +6 -0
- package/dist/models/ScriptExactPath.d.ts +4 -0
- package/dist/models/ScriptExactPath.js +6 -0
- package/dist/models/ScriptHash.d.ts +1 -0
- package/dist/models/ScriptHash.js +6 -0
- package/dist/models/ScriptPath.d.ts +1 -0
- package/dist/models/ScriptPath.js +6 -0
- package/dist/models/ScriptStartPath.d.ts +4 -0
- package/dist/models/ScriptStartPath.js +6 -0
- package/dist/models/SlackToken.d.ts +8 -0
- package/dist/models/SlackToken.js +6 -0
- package/dist/models/StartedAfter.d.ts +4 -0
- package/dist/models/StartedAfter.js +6 -0
- package/dist/models/StartedBefore.d.ts +4 -0
- package/dist/models/StartedBefore.js +6 -0
- package/dist/models/StaticTransform.d.ts +4 -0
- package/dist/models/StaticTransform.js +6 -0
- package/dist/models/Success.d.ts +4 -0
- package/dist/models/Success.js +6 -0
- package/dist/models/Suspended.d.ts +4 -0
- package/dist/models/Suspended.js +6 -0
- package/dist/models/Tag.d.ts +4 -0
- package/dist/models/Tag.js +6 -0
- package/dist/models/Token.d.ts +1 -0
- package/dist/models/Token.js +6 -0
- package/dist/models/TokenResponse.d.ts +6 -0
- package/dist/models/TokenResponse.js +6 -0
- package/dist/models/TruncatedToken.d.ts +8 -0
- package/dist/models/TruncatedToken.js +6 -0
- package/dist/models/UpdateInput.d.ts +5 -0
- package/dist/models/UpdateInput.js +6 -0
- package/dist/models/Usage.d.ts +3 -0
- package/dist/models/Usage.js +6 -0
- package/dist/models/User.d.ts +14 -0
- package/dist/models/User.js +6 -0
- package/dist/models/UserWorkspaceList.d.ts +8 -0
- package/dist/models/UserWorkspaceList.js +6 -0
- package/dist/models/Username.d.ts +4 -0
- package/dist/models/Username.js +6 -0
- package/dist/models/VersionId.d.ts +1 -0
- package/dist/models/VersionId.js +6 -0
- package/dist/models/WorkerPing.d.ts +9 -0
- package/dist/models/WorkerPing.js +6 -0
- package/dist/models/Workspace.d.ts +6 -0
- package/dist/models/Workspace.js +6 -0
- package/dist/models/WorkspaceId.d.ts +1 -0
- package/dist/models/WorkspaceId.js +6 -0
- package/dist/models/WorkspaceInvite.d.ts +6 -0
- package/dist/models/WorkspaceInvite.js +6 -0
- package/dist/services/AdminService.d.ts +39 -0
- package/dist/services/AdminService.js +56 -0
- package/dist/services/AppService.d.ts +195 -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 +26 -0
- package/dist/services/DraftService.js +40 -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 +125 -0
- package/dist/services/GroupService.js +165 -0
- package/dist/services/InputService.d.ts +78 -0
- package/dist/services/InputService.js +99 -0
- package/dist/services/JobService.d.ts +761 -0
- package/dist/services/JobService.js +650 -0
- package/dist/services/OauthService.d.ts +98 -0
- package/dist/services/OauthService.js +124 -0
- package/dist/services/RawAppService.d.ts +103 -0
- package/dist/services/RawAppService.js +110 -0
- package/dist/services/ResourceService.d.ts +178 -0
- package/dist/services/ResourceService.js +247 -0
- package/dist/services/ScheduleService.d.ts +125 -0
- package/dist/services/ScheduleService.js +154 -0
- package/dist/services/ScriptService.d.ts +258 -0
- package/dist/services/ScriptService.js +287 -0
- package/dist/services/SettingsService.d.ts +27 -0
- package/dist/services/SettingsService.js +52 -0
- package/dist/services/UserService.d.ts +312 -0
- package/dist/services/UserService.js +412 -0
- package/dist/services/VariableService.d.ts +95 -0
- package/dist/services/VariableService.js +139 -0
- package/dist/services/WorkerService.d.ts +25 -0
- package/dist/services/WorkerService.js +34 -0
- package/dist/services/WorkspaceService.d.ts +287 -0
- package/dist/services/WorkspaceService.js +351 -0
- package/package.json +1 -1
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export { AdminService, AuditService, FlowService, GranularAclService, GroupService, JobService, ResourceService, VariableService, ScriptService, ScheduleService, SettingsService, UserService, WorkspaceService, } from "./index";
|
|
2
|
+
export type Sql = string;
|
|
3
|
+
export type Email = string;
|
|
4
|
+
export type Base64 = string;
|
|
5
|
+
export type Resource<S extends string> = any;
|
|
6
|
+
export declare const SHARED_FOLDER = "/shared";
|
|
7
|
+
export declare function setClient(token?: string, baseUrl?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Create a client configuration from env variables
|
|
10
|
+
* @returns client configuration
|
|
11
|
+
*/
|
|
12
|
+
export declare function getWorkspace(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Get a resource value by path
|
|
15
|
+
* @param path path of the resource, default to internal state path
|
|
16
|
+
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
17
|
+
* @returns resource value
|
|
18
|
+
*/
|
|
19
|
+
export declare function getResource(path?: string, undefinedIfEmpty?: boolean): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
22
|
+
* @param obj resource value or path of the resource under the format `$res:path`
|
|
23
|
+
* @returns resource value
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveDefaultResource(obj: any): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the full resource value by path
|
|
28
|
+
* @param path path of the resource, default to internal state path
|
|
29
|
+
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
30
|
+
* @returns full resource
|
|
31
|
+
*/
|
|
32
|
+
export declare function getFullResource(path?: string, undefinedIfEmpty?: boolean): Promise<any>;
|
|
33
|
+
export declare function getStatePath(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Set a resource value by path
|
|
36
|
+
* @param path path of the resource to set, default to state path
|
|
37
|
+
* @param value new value of the resource to set
|
|
38
|
+
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
|
|
39
|
+
*/
|
|
40
|
+
export declare function setResource(value: any, path?: string, initializeToTypeIfNotExist?: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Set the state
|
|
43
|
+
* @param state state to set
|
|
44
|
+
* @deprecated use setState instead
|
|
45
|
+
*/
|
|
46
|
+
export declare function setInternalState(state: any): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Set the state
|
|
49
|
+
* @param state state to set
|
|
50
|
+
*/
|
|
51
|
+
export declare function setState(state: any): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the internal state
|
|
54
|
+
* @deprecated use getState instead
|
|
55
|
+
*/
|
|
56
|
+
export declare function getInternalState(): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Get the state shared across executions
|
|
59
|
+
*/
|
|
60
|
+
export declare function getState(): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a variable by path
|
|
63
|
+
* @param path path of the variable
|
|
64
|
+
* @returns variable value
|
|
65
|
+
*/
|
|
66
|
+
export declare function getVariable(path: string): Promise<string | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Set a variable by path, create if not exist
|
|
69
|
+
* @param path path of the variable
|
|
70
|
+
* @param value value of the variable
|
|
71
|
+
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
|
|
72
|
+
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
|
|
73
|
+
*/
|
|
74
|
+
export declare function setVariable(path: string, value: string, isSecretIfNotExist?: boolean, descriptionIfNotExist?: string): Promise<void>;
|
|
75
|
+
export declare function databaseUrlFromResource(path: string): Promise<string>;
|
|
76
|
+
export declare function base64ToUint8Array(data: string): Uint8Array;
|
|
77
|
+
export declare function uint8ArrayToBase64(arrayBuffer: Uint8Array): string;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.databaseUrlFromResource = exports.setVariable = exports.getVariable = exports.getState = exports.getInternalState = exports.setState = exports.setInternalState = exports.setResource = exports.getStatePath = exports.getFullResource = exports.resolveDefaultResource = exports.getResource = exports.getWorkspace = exports.setClient = exports.SHARED_FOLDER = exports.WorkspaceService = exports.UserService = exports.SettingsService = exports.ScheduleService = exports.ScriptService = exports.VariableService = exports.ResourceService = exports.JobService = exports.GroupService = exports.GranularAclService = exports.FlowService = exports.AuditService = exports.AdminService = void 0;
|
|
13
|
+
const index_1 = require("./index");
|
|
14
|
+
const index_2 = require("./index");
|
|
15
|
+
var index_3 = require("./index");
|
|
16
|
+
Object.defineProperty(exports, "AdminService", { enumerable: true, get: function () { return index_3.AdminService; } });
|
|
17
|
+
Object.defineProperty(exports, "AuditService", { enumerable: true, get: function () { return index_3.AuditService; } });
|
|
18
|
+
Object.defineProperty(exports, "FlowService", { enumerable: true, get: function () { return index_3.FlowService; } });
|
|
19
|
+
Object.defineProperty(exports, "GranularAclService", { enumerable: true, get: function () { return index_3.GranularAclService; } });
|
|
20
|
+
Object.defineProperty(exports, "GroupService", { enumerable: true, get: function () { return index_3.GroupService; } });
|
|
21
|
+
Object.defineProperty(exports, "JobService", { enumerable: true, get: function () { return index_3.JobService; } });
|
|
22
|
+
Object.defineProperty(exports, "ResourceService", { enumerable: true, get: function () { return index_3.ResourceService; } });
|
|
23
|
+
Object.defineProperty(exports, "VariableService", { enumerable: true, get: function () { return index_3.VariableService; } });
|
|
24
|
+
Object.defineProperty(exports, "ScriptService", { enumerable: true, get: function () { return index_3.ScriptService; } });
|
|
25
|
+
Object.defineProperty(exports, "ScheduleService", { enumerable: true, get: function () { return index_3.ScheduleService; } });
|
|
26
|
+
Object.defineProperty(exports, "SettingsService", { enumerable: true, get: function () { return index_3.SettingsService; } });
|
|
27
|
+
Object.defineProperty(exports, "UserService", { enumerable: true, get: function () { return index_3.UserService; } });
|
|
28
|
+
Object.defineProperty(exports, "WorkspaceService", { enumerable: true, get: function () { return index_3.WorkspaceService; } });
|
|
29
|
+
exports.SHARED_FOLDER = "/shared";
|
|
30
|
+
function setClient(token, baseUrl) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
if (baseUrl === undefined) {
|
|
33
|
+
baseUrl =
|
|
34
|
+
(_b = (_a = getEnv("BASE_INTERNAL_URL")) !== null && _a !== void 0 ? _a : getEnv("BASE_URL")) !== null && _b !== void 0 ? _b : "http://localhost:8000";
|
|
35
|
+
}
|
|
36
|
+
if (token === undefined) {
|
|
37
|
+
token = (_c = getEnv("WM_TOKEN")) !== null && _c !== void 0 ? _c : "no_token";
|
|
38
|
+
}
|
|
39
|
+
index_2.OpenAPI.WITH_CREDENTIALS = true;
|
|
40
|
+
index_2.OpenAPI.TOKEN = token;
|
|
41
|
+
index_2.OpenAPI.BASE = baseUrl + "/api";
|
|
42
|
+
}
|
|
43
|
+
exports.setClient = setClient;
|
|
44
|
+
const getEnv = (key) => {
|
|
45
|
+
if (typeof window === "undefined") {
|
|
46
|
+
// node
|
|
47
|
+
return process.env[key];
|
|
48
|
+
}
|
|
49
|
+
// browser
|
|
50
|
+
return window.process.env[key];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Create a client configuration from env variables
|
|
54
|
+
* @returns client configuration
|
|
55
|
+
*/
|
|
56
|
+
function getWorkspace() {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = getEnv("WM_WORKSPACE")) !== null && _a !== void 0 ? _a : "no_workspace";
|
|
59
|
+
}
|
|
60
|
+
exports.getWorkspace = getWorkspace;
|
|
61
|
+
/**
|
|
62
|
+
* Get a resource value by path
|
|
63
|
+
* @param path path of the resource, default to internal state path
|
|
64
|
+
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
65
|
+
* @returns resource value
|
|
66
|
+
*/
|
|
67
|
+
function getResource(path, undefinedIfEmpty) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const workspace = getWorkspace();
|
|
70
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
71
|
+
try {
|
|
72
|
+
const resource = yield index_1.ResourceService.getResource({ workspace, path });
|
|
73
|
+
return yield _transformLeaf(resource.value);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
if (undefinedIfEmpty && e.status === 404) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw Error(`Resource not found at ${path} or not visible to you`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exports.getResource = getResource;
|
|
86
|
+
/**
|
|
87
|
+
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
88
|
+
* @param obj resource value or path of the resource under the format `$res:path`
|
|
89
|
+
* @returns resource value
|
|
90
|
+
*/
|
|
91
|
+
function resolveDefaultResource(obj) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
if (typeof obj === "string" && obj.startsWith("$res:")) {
|
|
94
|
+
return yield getResource(obj.substring(5), true);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return obj;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
exports.resolveDefaultResource = resolveDefaultResource;
|
|
102
|
+
/**
|
|
103
|
+
* Get the full resource value by path
|
|
104
|
+
* @param path path of the resource, default to internal state path
|
|
105
|
+
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
106
|
+
* @returns full resource
|
|
107
|
+
*/
|
|
108
|
+
function getFullResource(path, undefinedIfEmpty) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const workspace = getWorkspace();
|
|
111
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
112
|
+
try {
|
|
113
|
+
const resource = yield index_1.ResourceService.getResource({ workspace, path });
|
|
114
|
+
const value = yield _transformLeaf(resource.value);
|
|
115
|
+
return Object.assign(Object.assign({}, resource), { value });
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
if (undefinedIfEmpty && e.status === 404) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw Error(`Resource not found at ${path} or not visible to you`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.getFullResource = getFullResource;
|
|
128
|
+
function getStatePath() {
|
|
129
|
+
const state_path = getEnv("WM_STATE_PATH_NEW");
|
|
130
|
+
if (state_path === undefined) {
|
|
131
|
+
throw Error("State path not set");
|
|
132
|
+
}
|
|
133
|
+
return state_path;
|
|
134
|
+
}
|
|
135
|
+
exports.getStatePath = getStatePath;
|
|
136
|
+
/**
|
|
137
|
+
* Set a resource value by path
|
|
138
|
+
* @param path path of the resource to set, default to state path
|
|
139
|
+
* @param value new value of the resource to set
|
|
140
|
+
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
|
|
141
|
+
*/
|
|
142
|
+
function setResource(value, path, initializeToTypeIfNotExist) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
path = path !== null && path !== void 0 ? path : getStatePath();
|
|
145
|
+
const workspace = getWorkspace();
|
|
146
|
+
if (yield index_1.ResourceService.existsResource({ workspace, path })) {
|
|
147
|
+
yield index_1.ResourceService.updateResourceValue({
|
|
148
|
+
workspace,
|
|
149
|
+
path,
|
|
150
|
+
requestBody: { value },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
else if (initializeToTypeIfNotExist) {
|
|
154
|
+
yield index_1.ResourceService.createResource({
|
|
155
|
+
workspace,
|
|
156
|
+
requestBody: { path, value, resource_type: initializeToTypeIfNotExist },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw Error(`Resource at path ${path} does not exist and no type was provided to initialize it`);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
exports.setResource = setResource;
|
|
165
|
+
/**
|
|
166
|
+
* Set the state
|
|
167
|
+
* @param state state to set
|
|
168
|
+
* @deprecated use setState instead
|
|
169
|
+
*/
|
|
170
|
+
function setInternalState(state) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
yield setResource(state, undefined, "state");
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
exports.setInternalState = setInternalState;
|
|
176
|
+
/**
|
|
177
|
+
* Set the state
|
|
178
|
+
* @param state state to set
|
|
179
|
+
*/
|
|
180
|
+
function setState(state) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
yield setResource(state, undefined, "state");
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
exports.setState = setState;
|
|
186
|
+
// /**
|
|
187
|
+
// * Set the shared state
|
|
188
|
+
// * @param state state to set
|
|
189
|
+
// */
|
|
190
|
+
// export async function setSharedState(
|
|
191
|
+
// state: any,
|
|
192
|
+
// path = "state.json"
|
|
193
|
+
// ): Promise<void> {
|
|
194
|
+
// await Deno.writeTextFile(SHARED_FOLDER + "/" + path, JSON.stringify(state));
|
|
195
|
+
// }
|
|
196
|
+
// /**
|
|
197
|
+
// * Get the shared state
|
|
198
|
+
// * @param state state to set
|
|
199
|
+
// */
|
|
200
|
+
// export async function getSharedState(path = "state.json"): Promise<any> {
|
|
201
|
+
// return JSON.parse(await Deno.readTextFile(SHARED_FOLDER + "/" + path));
|
|
202
|
+
// }
|
|
203
|
+
/**
|
|
204
|
+
* Get the internal state
|
|
205
|
+
* @deprecated use getState instead
|
|
206
|
+
*/
|
|
207
|
+
function getInternalState() {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
return yield getResource(getStatePath(), true);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
exports.getInternalState = getInternalState;
|
|
213
|
+
/**
|
|
214
|
+
* Get the state shared across executions
|
|
215
|
+
*/
|
|
216
|
+
function getState() {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
return yield getResource(getStatePath(), true);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
exports.getState = getState;
|
|
222
|
+
/**
|
|
223
|
+
* Get a variable by path
|
|
224
|
+
* @param path path of the variable
|
|
225
|
+
* @returns variable value
|
|
226
|
+
*/
|
|
227
|
+
function getVariable(path) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
const workspace = getWorkspace();
|
|
230
|
+
try {
|
|
231
|
+
const variable = yield index_1.VariableService.getVariable({ workspace, path });
|
|
232
|
+
return variable.value;
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
throw Error(`Variable not found at ${path} or not visible to you`);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
exports.getVariable = getVariable;
|
|
240
|
+
/**
|
|
241
|
+
* Set a variable by path, create if not exist
|
|
242
|
+
* @param path path of the variable
|
|
243
|
+
* @param value value of the variable
|
|
244
|
+
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
|
|
245
|
+
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
|
|
246
|
+
*/
|
|
247
|
+
function setVariable(path, value, isSecretIfNotExist, descriptionIfNotExist) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
const workspace = getWorkspace();
|
|
250
|
+
if (yield index_1.VariableService.existsVariable({ workspace, path })) {
|
|
251
|
+
yield index_1.VariableService.updateVariable({
|
|
252
|
+
workspace,
|
|
253
|
+
path,
|
|
254
|
+
requestBody: { value },
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
yield index_1.VariableService.createVariable({
|
|
259
|
+
workspace,
|
|
260
|
+
requestBody: {
|
|
261
|
+
path,
|
|
262
|
+
value,
|
|
263
|
+
is_secret: isSecretIfNotExist !== null && isSecretIfNotExist !== void 0 ? isSecretIfNotExist : false,
|
|
264
|
+
description: descriptionIfNotExist !== null && descriptionIfNotExist !== void 0 ? descriptionIfNotExist : "",
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
exports.setVariable = setVariable;
|
|
271
|
+
function transformLeaves(d) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
for (const k in d) {
|
|
274
|
+
d[k] = yield _transformLeaf(d[k]);
|
|
275
|
+
}
|
|
276
|
+
return d;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
const VAR_RESOURCE_PREFIX = "$var:";
|
|
280
|
+
const RES_RESOURCE_PREFIX = "$res:";
|
|
281
|
+
function _transformLeaf(v) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
if (typeof v === "object") {
|
|
284
|
+
return transformLeaves(v);
|
|
285
|
+
}
|
|
286
|
+
else if (typeof v === "string" && v.startsWith(VAR_RESOURCE_PREFIX)) {
|
|
287
|
+
const varName = v.substring(VAR_RESOURCE_PREFIX.length);
|
|
288
|
+
return yield getVariable(varName);
|
|
289
|
+
}
|
|
290
|
+
else if (typeof v === "string" && v.startsWith(RES_RESOURCE_PREFIX)) {
|
|
291
|
+
const resName = v.substring(RES_RESOURCE_PREFIX.length);
|
|
292
|
+
return yield getResource(resName);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
return v;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function databaseUrlFromResource(path) {
|
|
300
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
301
|
+
const resource = yield getResource(path);
|
|
302
|
+
return `postgresql://${resource.user}:${resource.password}@${resource.host}:${resource.port}/${resource.dbname}?sslmode=${resource.sslmode}`;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
exports.databaseUrlFromResource = databaseUrlFromResource;
|
|
306
|
+
// /**
|
|
307
|
+
// * Get URLs needed for resuming a flow after this step
|
|
308
|
+
// * @param approver approver name
|
|
309
|
+
// * @returns approval page UI URL, resume and cancel API URLs for resumeing the flow
|
|
310
|
+
// */
|
|
311
|
+
// export async function getResumeUrls(approver?: string): Promise<{
|
|
312
|
+
// approvalPage: string;
|
|
313
|
+
// resume: string;
|
|
314
|
+
// cancel: string;
|
|
315
|
+
// }> {
|
|
316
|
+
// const nonce = Math.floor(Math.random() * 4294967295);
|
|
317
|
+
// const workspace = getWorkspace();
|
|
318
|
+
// return await JobService.getResumeUrls({
|
|
319
|
+
// workspace,
|
|
320
|
+
// resumeId: nonce,
|
|
321
|
+
// approver,
|
|
322
|
+
// id: process.env.get("WM_JOB_ID") ?? "NO_JOB_ID",
|
|
323
|
+
// });
|
|
324
|
+
// }
|
|
325
|
+
function base64ToUint8Array(data) {
|
|
326
|
+
return Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
|
|
327
|
+
}
|
|
328
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
329
|
+
function uint8ArrayToBase64(arrayBuffer) {
|
|
330
|
+
let base64 = "";
|
|
331
|
+
const encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
332
|
+
const bytes = new Uint8Array(arrayBuffer);
|
|
333
|
+
const byteLength = bytes.byteLength;
|
|
334
|
+
const byteRemainder = byteLength % 3;
|
|
335
|
+
const mainLength = byteLength - byteRemainder;
|
|
336
|
+
let a, b, c, d;
|
|
337
|
+
let chunk;
|
|
338
|
+
// Main loop deals with bytes in chunks of 3
|
|
339
|
+
for (let i = 0; i < mainLength; i = i + 3) {
|
|
340
|
+
// Combine the three bytes into a single integer
|
|
341
|
+
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
|
342
|
+
// Use bitmasks to extract 6-bit segments from the triplet
|
|
343
|
+
a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18
|
|
344
|
+
b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12
|
|
345
|
+
c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6
|
|
346
|
+
d = chunk & 63; // 63 = 2^6 - 1
|
|
347
|
+
// Convert the raw binary segments to the appropriate ASCII encoding
|
|
348
|
+
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];
|
|
349
|
+
}
|
|
350
|
+
// Deal with the remaining bytes and padding
|
|
351
|
+
if (byteRemainder == 1) {
|
|
352
|
+
chunk = bytes[mainLength];
|
|
353
|
+
a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2
|
|
354
|
+
// Set the 4 least significant bits to zero
|
|
355
|
+
b = (chunk & 3) << 4; // 3 = 2^2 - 1
|
|
356
|
+
base64 += encodings[a] + encodings[b] + "==";
|
|
357
|
+
}
|
|
358
|
+
else if (byteRemainder == 2) {
|
|
359
|
+
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];
|
|
360
|
+
a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10
|
|
361
|
+
b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4
|
|
362
|
+
// Set the 2 least significant bits to zero
|
|
363
|
+
c = (chunk & 15) << 2; // 15 = 2^4 - 1
|
|
364
|
+
base64 += encodings[a] + encodings[b] + encodings[c] + "=";
|
|
365
|
+
}
|
|
366
|
+
return base64;
|
|
367
|
+
}
|
|
368
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
@@ -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,20 @@
|
|
|
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
|
+
#private;
|
|
13
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
15
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
16
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
17
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
get isCancelled(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _CancelablePromise_isResolved, _CancelablePromise_isRejected, _CancelablePromise_isCancelled, _CancelablePromise_cancelHandlers, _CancelablePromise_promise, _CancelablePromise_resolve, _CancelablePromise_reject;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CancelablePromise = exports.CancelError = void 0;
|
|
16
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
17
|
+
/* istanbul ignore file */
|
|
18
|
+
/* tslint:disable */
|
|
19
|
+
/* eslint-disable */
|
|
20
|
+
class CancelError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'CancelError';
|
|
24
|
+
}
|
|
25
|
+
get isCancelled() {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CancelError = CancelError;
|
|
30
|
+
class CancelablePromise {
|
|
31
|
+
constructor(executor) {
|
|
32
|
+
_CancelablePromise_isResolved.set(this, void 0);
|
|
33
|
+
_CancelablePromise_isRejected.set(this, void 0);
|
|
34
|
+
_CancelablePromise_isCancelled.set(this, void 0);
|
|
35
|
+
_CancelablePromise_cancelHandlers.set(this, void 0);
|
|
36
|
+
_CancelablePromise_promise.set(this, void 0);
|
|
37
|
+
_CancelablePromise_resolve.set(this, void 0);
|
|
38
|
+
_CancelablePromise_reject.set(this, void 0);
|
|
39
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, false, "f");
|
|
40
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, false, "f");
|
|
41
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, false, "f");
|
|
42
|
+
__classPrivateFieldSet(this, _CancelablePromise_cancelHandlers, [], "f");
|
|
43
|
+
__classPrivateFieldSet(this, _CancelablePromise_promise, new Promise((resolve, reject) => {
|
|
44
|
+
__classPrivateFieldSet(this, _CancelablePromise_resolve, resolve, "f");
|
|
45
|
+
__classPrivateFieldSet(this, _CancelablePromise_reject, reject, "f");
|
|
46
|
+
const onResolve = (value) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, true, "f");
|
|
52
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_resolve, "f")) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
53
|
+
};
|
|
54
|
+
const onReject = (reason) => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, true, "f");
|
|
60
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_reject, "f")) === null || _a === void 0 ? void 0 : _a.call(this, reason);
|
|
61
|
+
};
|
|
62
|
+
const onCancel = (cancelHandler) => {
|
|
63
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").push(cancelHandler);
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
69
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isResolved, "f"),
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
72
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f"),
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
75
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f"),
|
|
76
|
+
});
|
|
77
|
+
return executor(onResolve, onReject, onCancel);
|
|
78
|
+
}), "f");
|
|
79
|
+
}
|
|
80
|
+
get [(_CancelablePromise_isResolved = new WeakMap(), _CancelablePromise_isRejected = new WeakMap(), _CancelablePromise_isCancelled = new WeakMap(), _CancelablePromise_cancelHandlers = new WeakMap(), _CancelablePromise_promise = new WeakMap(), _CancelablePromise_resolve = new WeakMap(), _CancelablePromise_reject = new WeakMap(), Symbol.toStringTag)]() {
|
|
81
|
+
return "Cancellable Promise";
|
|
82
|
+
}
|
|
83
|
+
then(onFulfilled, onRejected) {
|
|
84
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").then(onFulfilled, onRejected);
|
|
85
|
+
}
|
|
86
|
+
catch(onRejected) {
|
|
87
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").catch(onRejected);
|
|
88
|
+
}
|
|
89
|
+
finally(onFinally) {
|
|
90
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").finally(onFinally);
|
|
91
|
+
}
|
|
92
|
+
cancel() {
|
|
93
|
+
var _a;
|
|
94
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, true, "f");
|
|
98
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length) {
|
|
99
|
+
try {
|
|
100
|
+
for (const cancelHandler of __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f")) {
|
|
101
|
+
cancelHandler();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.warn('Cancellation threw an error', error);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length = 0;
|
|
110
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_reject, "f")) === null || _a === void 0 ? void 0 : _a.call(this, new CancelError('Request aborted'));
|
|
111
|
+
}
|
|
112
|
+
get isCancelled() {
|
|
113
|
+
return __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.CancelablePromise = CancelablePromise;
|
|
@@ -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> | undefined;
|
|
10
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
11
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
12
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
13
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
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.146.0',
|
|
7
|
+
WITH_CREDENTIALS: false,
|
|
8
|
+
CREDENTIALS: 'include',
|
|
9
|
+
TOKEN: undefined,
|
|
10
|
+
USERNAME: undefined,
|
|
11
|
+
PASSWORD: undefined,
|
|
12
|
+
HEADERS: undefined,
|
|
13
|
+
ENCODE_PATH: undefined,
|
|
14
|
+
};
|