@extrahorizon/javascript-sdk 8.9.0-dev-135-f1c216a → 8.9.0-dev-137-14a5300
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/CHANGELOG.md +1 -0
- package/build/index.cjs.js +52 -2
- package/build/index.mjs +53 -3
- package/build/types/mockType.d.ts +21 -0
- package/build/types/services/tasks/functions/types.d.ts +145 -1
- package/build/types/version.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [8.9.0]
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
|
+
- Added the `exh.tasks.functions` methods `find`, `getByName`, `update`, `enable`, `disable` and `remove`
|
|
11
12
|
- Added a `exh.users.findByEmail` method to find a user by their email address.
|
|
12
13
|
|
|
13
14
|
### Fixed
|
package/build/index.cjs.js
CHANGED
|
@@ -999,6 +999,16 @@ exports.ApiRequestErrorType = void 0;
|
|
|
999
999
|
ApiRequestErrorType["RESPONSE"] = "response";
|
|
1000
1000
|
})(exports.ApiRequestErrorType || (exports.ApiRequestErrorType = {}));
|
|
1001
1001
|
|
|
1002
|
+
exports.FunctionPermissionMode = void 0;
|
|
1003
|
+
(function (FunctionPermissionMode) {
|
|
1004
|
+
/** To execute this function directly the user needs the EXECUTE_TASK_FUNCTION permission */
|
|
1005
|
+
FunctionPermissionMode["PERMISSION_REQUIRED"] = "permissionRequired";
|
|
1006
|
+
/** Every logged in user can execute this function directly */
|
|
1007
|
+
FunctionPermissionMode["ALL_USERS"] = "allUsers";
|
|
1008
|
+
/** The function can be executed even by unauthenticated requests */
|
|
1009
|
+
FunctionPermissionMode["PUBLIC"] = "public";
|
|
1010
|
+
})(exports.FunctionPermissionMode || (exports.FunctionPermissionMode = {}));
|
|
1011
|
+
|
|
1002
1012
|
exports.TaskStatus = void 0;
|
|
1003
1013
|
(function (TaskStatus) {
|
|
1004
1014
|
TaskStatus["NEW"] = "new";
|
|
@@ -4011,8 +4021,48 @@ var apiRequests = (client, httpAuth) => {
|
|
|
4011
4021
|
};
|
|
4012
4022
|
|
|
4013
4023
|
var functions = (client, httpAuth) => ({
|
|
4024
|
+
async find(options) {
|
|
4025
|
+
const response = await client.get(httpAuth, '/functions/', options);
|
|
4026
|
+
return response.data;
|
|
4027
|
+
},
|
|
4028
|
+
async create(body, options) {
|
|
4029
|
+
const response = await client.post(httpAuth, '/functions/', body, {
|
|
4030
|
+
...options,
|
|
4031
|
+
customKeys: ['environmentVariables'],
|
|
4032
|
+
});
|
|
4033
|
+
return response.data;
|
|
4034
|
+
},
|
|
4035
|
+
async getByName(name, options) {
|
|
4036
|
+
const response = await client.get(httpAuth, `/functions/${name}`, {
|
|
4037
|
+
...options,
|
|
4038
|
+
customResponseKeys: ['environmentVariables'],
|
|
4039
|
+
});
|
|
4040
|
+
return response.data;
|
|
4041
|
+
},
|
|
4042
|
+
async update(name, body, options) {
|
|
4043
|
+
const response = await client.put(httpAuth, `/functions/${name}`, body, {
|
|
4044
|
+
...options,
|
|
4045
|
+
customRequestKeys: ['environmentVariables'],
|
|
4046
|
+
});
|
|
4047
|
+
return response.data;
|
|
4048
|
+
},
|
|
4049
|
+
async remove(name, options) {
|
|
4050
|
+
const response = await client.delete(httpAuth, `/functions/${name}`, options);
|
|
4051
|
+
return response.data;
|
|
4052
|
+
},
|
|
4053
|
+
async enable(name, options) {
|
|
4054
|
+
const response = await client.post(httpAuth, `/functions/${name}/enable`, {}, options);
|
|
4055
|
+
return response.data;
|
|
4056
|
+
},
|
|
4057
|
+
async disable(name, options) {
|
|
4058
|
+
const response = await client.post(httpAuth, `/functions/${name}/disable`, {}, options);
|
|
4059
|
+
return response.data;
|
|
4060
|
+
},
|
|
4014
4061
|
async execute(functionName, data, options) {
|
|
4015
|
-
const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
|
|
4062
|
+
const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
|
|
4063
|
+
...options,
|
|
4064
|
+
customKeys: ['data', 'result'],
|
|
4065
|
+
});
|
|
4016
4066
|
return response.data;
|
|
4017
4067
|
},
|
|
4018
4068
|
});
|
|
@@ -5610,7 +5660,7 @@ const templatesV2Service = (httpWithAuth) => {
|
|
|
5610
5660
|
};
|
|
5611
5661
|
};
|
|
5612
5662
|
|
|
5613
|
-
const version = '8.9.0-dev-
|
|
5663
|
+
const version = '8.9.0-dev-137-14a5300';
|
|
5614
5664
|
|
|
5615
5665
|
/**
|
|
5616
5666
|
* Create ExtraHorizon client.
|
package/build/index.mjs
CHANGED
|
@@ -969,6 +969,16 @@ var ApiRequestErrorType;
|
|
|
969
969
|
ApiRequestErrorType["RESPONSE"] = "response";
|
|
970
970
|
})(ApiRequestErrorType || (ApiRequestErrorType = {}));
|
|
971
971
|
|
|
972
|
+
var FunctionPermissionMode;
|
|
973
|
+
(function (FunctionPermissionMode) {
|
|
974
|
+
/** To execute this function directly the user needs the EXECUTE_TASK_FUNCTION permission */
|
|
975
|
+
FunctionPermissionMode["PERMISSION_REQUIRED"] = "permissionRequired";
|
|
976
|
+
/** Every logged in user can execute this function directly */
|
|
977
|
+
FunctionPermissionMode["ALL_USERS"] = "allUsers";
|
|
978
|
+
/** The function can be executed even by unauthenticated requests */
|
|
979
|
+
FunctionPermissionMode["PUBLIC"] = "public";
|
|
980
|
+
})(FunctionPermissionMode || (FunctionPermissionMode = {}));
|
|
981
|
+
|
|
972
982
|
var TaskStatus;
|
|
973
983
|
(function (TaskStatus) {
|
|
974
984
|
TaskStatus["NEW"] = "new";
|
|
@@ -3981,8 +3991,48 @@ var apiRequests = (client, httpAuth) => {
|
|
|
3981
3991
|
};
|
|
3982
3992
|
|
|
3983
3993
|
var functions = (client, httpAuth) => ({
|
|
3994
|
+
async find(options) {
|
|
3995
|
+
const response = await client.get(httpAuth, '/functions/', options);
|
|
3996
|
+
return response.data;
|
|
3997
|
+
},
|
|
3998
|
+
async create(body, options) {
|
|
3999
|
+
const response = await client.post(httpAuth, '/functions/', body, {
|
|
4000
|
+
...options,
|
|
4001
|
+
customKeys: ['environmentVariables'],
|
|
4002
|
+
});
|
|
4003
|
+
return response.data;
|
|
4004
|
+
},
|
|
4005
|
+
async getByName(name, options) {
|
|
4006
|
+
const response = await client.get(httpAuth, `/functions/${name}`, {
|
|
4007
|
+
...options,
|
|
4008
|
+
customResponseKeys: ['environmentVariables'],
|
|
4009
|
+
});
|
|
4010
|
+
return response.data;
|
|
4011
|
+
},
|
|
4012
|
+
async update(name, body, options) {
|
|
4013
|
+
const response = await client.put(httpAuth, `/functions/${name}`, body, {
|
|
4014
|
+
...options,
|
|
4015
|
+
customRequestKeys: ['environmentVariables'],
|
|
4016
|
+
});
|
|
4017
|
+
return response.data;
|
|
4018
|
+
},
|
|
4019
|
+
async remove(name, options) {
|
|
4020
|
+
const response = await client.delete(httpAuth, `/functions/${name}`, options);
|
|
4021
|
+
return response.data;
|
|
4022
|
+
},
|
|
4023
|
+
async enable(name, options) {
|
|
4024
|
+
const response = await client.post(httpAuth, `/functions/${name}/enable`, {}, options);
|
|
4025
|
+
return response.data;
|
|
4026
|
+
},
|
|
4027
|
+
async disable(name, options) {
|
|
4028
|
+
const response = await client.post(httpAuth, `/functions/${name}/disable`, {}, options);
|
|
4029
|
+
return response.data;
|
|
4030
|
+
},
|
|
3984
4031
|
async execute(functionName, data, options) {
|
|
3985
|
-
const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
|
|
4032
|
+
const response = await client.post(httpAuth, `/functions/${functionName}/execute`, { data }, {
|
|
4033
|
+
...options,
|
|
4034
|
+
customKeys: ['data', 'result'],
|
|
4035
|
+
});
|
|
3986
4036
|
return response.data;
|
|
3987
4037
|
},
|
|
3988
4038
|
});
|
|
@@ -5580,7 +5630,7 @@ const templatesV2Service = (httpWithAuth) => {
|
|
|
5580
5630
|
};
|
|
5581
5631
|
};
|
|
5582
5632
|
|
|
5583
|
-
const version = '8.9.0-dev-
|
|
5633
|
+
const version = '8.9.0-dev-137-14a5300';
|
|
5584
5634
|
|
|
5585
5635
|
/**
|
|
5586
5636
|
* Create ExtraHorizon client.
|
|
@@ -5760,4 +5810,4 @@ const parseStoredCredentials = (fileContent) => exhCredentialsDecoder(fileConten
|
|
|
5760
5810
|
.filter(line => line.length === 2)
|
|
5761
5811
|
.reduce((memo, [key, value]) => ({ ...memo, [key]: value }), {}));
|
|
5762
5812
|
|
|
5763
|
-
export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidTokenError, JSONSchemaType, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceUnavailableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TemplateResolvingError, TemplateSyntaxError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
|
|
5813
|
+
export { AccessTokenExpiredError, AccessTokenUnknownError, ActionType, ActivationRequestLimitError, ActivationRequestTimeoutError, ActivationUnknownError, AlreadyActivatedError, ApiError, ApiFunctionRequestMethod, ApiRequestErrorType, AppStoreTransactionAlreadyLinked, ApplicationNotAuthenticatedError, ApplicationType, ApplicationUnknownError, AuthenticationError, AuthorizationCodeExpiredError, AuthorizationUnknownError, BadGatewayServerError, BadRequestError, BodyFormatError, CallbackNotValidError, Comorbidities, DefaultLocalizationMissingError, DisabledForOidcUsersError, DuplicateRequestError, EmailUnknownError, EmailUsedError, EmptyBodyError, ErrorClassMap, FieldFormatError, FieldType, FileTooLargeError, FirebaseConnectionError, FirebaseInvalidPlatformDataError, ForbiddenError, ForgotPasswordRequestLimitError, ForgotPasswordRequestTimeoutError, FunctionPermissionMode, Gender, GlobalPermissionName, IDFormatError, IllegalArgumentError, IllegalStateError, Impediments, IncorrectPinCodeError, InvalidClientError, InvalidCurrencyForProductPrice, InvalidGrantError, InvalidMfaCodeError, InvalidMfaTokenError, InvalidNonceError, InvalidPKCEError, InvalidPresenceTokenError, InvalidReceiptDataError, InvalidRequestError, InvalidTokenError, JSONSchemaType, LocalizationKeyMissingError, LockedDocumentError, LoginAttemptStatus, LoginFreezeError, LoginTimeoutError, MedicationFrequency, MedicationUnit, MfaReattemptDelayError, MfaRequiredError, MissingPKCEVerifierError, MissingRequiredFieldsError, NewMFARequiredError, NewPasswordHashUnknownError, NewPasswordPinCodeUnknownError, NoConfiguredAppStoreProduct, NoConfiguredPlayStoreProduct, NoMatchingPlayStoreLinkedSubscription, NoPermissionError, NotActivatedError, NotEnoughMfaMethodsError, NotFoundError, OAuth2ClientIdError, OAuth2ClientSecretError, OAuth2ErrorClassMap, OAuth2LoginError, OAuth2MissingClientCredentialsError, OauthKeyError, OauthSignatureError, OauthTokenError, OidcIdTokenError, OidcInvalidAuthorizationCodeError, OidcProviderResponseError, OrderSchemaStatus, PasswordError, PaymentIntentCreationSchemaPaymentMethodType, PaymentIntentCreationSchemaSetupPaymentMethodReuse, PinCodesNotEnabledError, PlayStoreTransactionAlreadyLinked, ProfileActivity, ProfileAlreadyExistsError, QueuedMailStatus, RefreshTokenExpiredError, RefreshTokenUnknownError, RemoveFieldError, RequestAbortedError, ResourceAlreadyExistsError, ResourceUnknownError, Results, ServerError, ServiceUnavailableError, StatusInUseError, StripePaymentMethodError, StripeRequestError, SubscriptionEntitlementSource, SubscriptionEntitlementStatus, SubscriptionEntitlementStatusCategory, SubscriptionEventSource, SubscriptionEventType, SupportedLanguageCodes, TaskStatus, TemplateFillingError, TemplateResolvingError, TemplateSyntaxError, TokenNotDeleteableError, TokenPermission, TooManyFailedAttemptsError, UnauthorizedClientError, UnauthorizedError, UnauthorizedTokenError, UnknownReceiptTransactionError, UnsupportedGrantError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UserNotAuthenticatedError, createClient, createOAuth1Client, createOAuth2Client, createProxyClient, findAllGeneric, findAllIterator, getMockSdkOAuth2 as getMockSdk, getMockSdkOAuth1, getMockSdkOAuth2, getMockSdkProxy, parseGlobalPermissions, parseStoredCredentials, recursiveMap, rqlBuilder, rqlParser };
|
|
@@ -182,6 +182,13 @@ export declare type MockClientOAuth1<MockFn> = {
|
|
|
182
182
|
findFirst: MockFn;
|
|
183
183
|
};
|
|
184
184
|
functions: {
|
|
185
|
+
find: MockFn;
|
|
186
|
+
create: MockFn;
|
|
187
|
+
getByName: MockFn;
|
|
188
|
+
update: MockFn;
|
|
189
|
+
remove: MockFn;
|
|
190
|
+
enable: MockFn;
|
|
191
|
+
disable: MockFn;
|
|
185
192
|
execute: MockFn;
|
|
186
193
|
};
|
|
187
194
|
api: {
|
|
@@ -748,6 +755,13 @@ export declare type MockClientOAuth2<MockFn> = {
|
|
|
748
755
|
findFirst: MockFn;
|
|
749
756
|
};
|
|
750
757
|
functions: {
|
|
758
|
+
find: MockFn;
|
|
759
|
+
create: MockFn;
|
|
760
|
+
getByName: MockFn;
|
|
761
|
+
update: MockFn;
|
|
762
|
+
remove: MockFn;
|
|
763
|
+
enable: MockFn;
|
|
764
|
+
disable: MockFn;
|
|
751
765
|
execute: MockFn;
|
|
752
766
|
};
|
|
753
767
|
api: {
|
|
@@ -1314,6 +1328,13 @@ export declare type MockClientProxy<MockFn> = {
|
|
|
1314
1328
|
findFirst: MockFn;
|
|
1315
1329
|
};
|
|
1316
1330
|
functions: {
|
|
1331
|
+
find: MockFn;
|
|
1332
|
+
create: MockFn;
|
|
1333
|
+
getByName: MockFn;
|
|
1334
|
+
update: MockFn;
|
|
1335
|
+
remove: MockFn;
|
|
1336
|
+
enable: MockFn;
|
|
1337
|
+
disable: MockFn;
|
|
1317
1338
|
execute: MockFn;
|
|
1318
1339
|
};
|
|
1319
1340
|
api: {
|
|
@@ -1,6 +1,82 @@
|
|
|
1
|
-
import { OptionsBase } from '../../types';
|
|
1
|
+
import { OptionsBase, type AffectedRecords, type PagedResult } from '../../types';
|
|
2
2
|
import { Task } from '../types';
|
|
3
3
|
export interface FunctionsService {
|
|
4
|
+
/**
|
|
5
|
+
* View a list of functions.
|
|
6
|
+
*
|
|
7
|
+
* Although this endpoint is a paged-like endpoint, it will return all functions in a single page.
|
|
8
|
+
* RQL is not supported for this endpoint, and any RQL provided will be ignored.
|
|
9
|
+
*
|
|
10
|
+
* Permission | Scope | Effect
|
|
11
|
+
* - | - | -
|
|
12
|
+
* `VIEW_TASK_FUNCTIONS` | `global` | **Required** for this endpoint
|
|
13
|
+
*/
|
|
14
|
+
find(options?: OptionsBase): Promise<PagedResult<FunctionBase>>;
|
|
15
|
+
/**
|
|
16
|
+
* View a list of functions.
|
|
17
|
+
*
|
|
18
|
+
* Although this endpoint is a paged-like endpoint, it will return all functions in a single page.
|
|
19
|
+
* RQL is not supported for this endpoint, and any RQL provided will be ignored.
|
|
20
|
+
*
|
|
21
|
+
* Permission | Scope | Effect
|
|
22
|
+
* - | - | -
|
|
23
|
+
* `VIEW_TASK_FUNCTIONS` | `global` | **Required** for this endpoint
|
|
24
|
+
*/
|
|
25
|
+
create(body: FunctionCreation, options?: OptionsBase): Promise<FunctionDetails>;
|
|
26
|
+
/**
|
|
27
|
+
* View details of a function by its name.
|
|
28
|
+
*
|
|
29
|
+
* Permission | Scope | Effect
|
|
30
|
+
* - | - | -
|
|
31
|
+
* `VIEW_TASK_FUNCTION_DETAILS` | `global` | **Required** for this endpoint
|
|
32
|
+
*
|
|
33
|
+
* @throws {ResourceUnknownError} When no function with the specified name is found
|
|
34
|
+
*/
|
|
35
|
+
getByName(name: string, options?: OptionsBase): Promise<FunctionDetails>;
|
|
36
|
+
/**
|
|
37
|
+
* Update a function by its name.
|
|
38
|
+
*
|
|
39
|
+
* Permission | Scope | Effect
|
|
40
|
+
* - | - | -
|
|
41
|
+
* `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
|
|
42
|
+
*
|
|
43
|
+
* @throws {ResourceUnknownError} When no function with the specified name is found
|
|
44
|
+
*/
|
|
45
|
+
update(name: string, body: Partial<FunctionCreation>, options?: OptionsBase): Promise<AffectedRecords>;
|
|
46
|
+
/**
|
|
47
|
+
* Delete a function by its name.
|
|
48
|
+
*
|
|
49
|
+
* Permission | Scope | Effect
|
|
50
|
+
* - | - | -
|
|
51
|
+
* `DELETE_TASK_FUNCTION` | `global` | **Required** for this endpoint
|
|
52
|
+
*
|
|
53
|
+
* @throws {ResourceUnknownError} When no function with the specified name is found
|
|
54
|
+
*/
|
|
55
|
+
remove(name: string, options?: OptionsBase): Promise<AffectedRecords>;
|
|
56
|
+
/**
|
|
57
|
+
* Enable a function by its name.
|
|
58
|
+
*
|
|
59
|
+
* Does nothing if the function is already enabled.
|
|
60
|
+
*
|
|
61
|
+
* Permission | Scope | Effect
|
|
62
|
+
* - | - | -
|
|
63
|
+
* `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
|
|
64
|
+
*
|
|
65
|
+
* @throws {ResourceUnknownError} When no function with the specified name is found
|
|
66
|
+
*/
|
|
67
|
+
enable(name: string, options?: OptionsBase): Promise<AffectedRecords>;
|
|
68
|
+
/**
|
|
69
|
+
* Disable a function by its name.
|
|
70
|
+
*
|
|
71
|
+
* Does nothing if the function is already disabled.
|
|
72
|
+
*
|
|
73
|
+
* Permission | Scope | Effect
|
|
74
|
+
* - | - | -
|
|
75
|
+
* `UPDATE_TASK_FUNCTION` | `global` | **Required** for this endpoint
|
|
76
|
+
*
|
|
77
|
+
* @throws {ResourceUnknownError} When no function with the specified name is found
|
|
78
|
+
*/
|
|
79
|
+
disable(name: string, options?: OptionsBase): Promise<AffectedRecords>;
|
|
4
80
|
/**
|
|
5
81
|
* ## Execute a Function directly
|
|
6
82
|
*
|
|
@@ -21,6 +97,74 @@ export interface FunctionsService {
|
|
|
21
97
|
*/
|
|
22
98
|
execute<T = any, U = any>(functionName: string, data?: U, options?: OptionsBase): Promise<DirectExecutionResponse<T, U>>;
|
|
23
99
|
}
|
|
100
|
+
export interface FunctionBase {
|
|
101
|
+
/** The name of the Function */
|
|
102
|
+
name: string;
|
|
103
|
+
/** A description of the Function */
|
|
104
|
+
description: string;
|
|
105
|
+
/** The timestamp when the Function was last updated */
|
|
106
|
+
updateTimestamp: Date;
|
|
107
|
+
}
|
|
108
|
+
export interface FunctionCreation {
|
|
109
|
+
/** The name of the Function, this serves as the unique identifier amongst all Functions */
|
|
110
|
+
name: string;
|
|
111
|
+
/** A description of the Function */
|
|
112
|
+
description?: string;
|
|
113
|
+
/** Base64 Encoded binary value of the compressed (.zip) function code */
|
|
114
|
+
code: string;
|
|
115
|
+
/** Entry point for execution of the function, e.g. `index.handler` */
|
|
116
|
+
entryPoint: string;
|
|
117
|
+
/**
|
|
118
|
+
* The runtime environment for the Function, e.g. `nodejs24.x`
|
|
119
|
+
* The supported runtimes can be found in the [task service documentation](https://docs.extrahorizon.com/extrahorizon/services/automation/task-service/functions#runtime)
|
|
120
|
+
*/
|
|
121
|
+
runtime: string;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum execution time (seconds) of the function.
|
|
124
|
+
* Should be between 3 and 300 seconds, defaults to 30 seconds if not provided.
|
|
125
|
+
*/
|
|
126
|
+
timeLimit?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Memory limit (MB) for the function.
|
|
129
|
+
* Should be between 128 and 10240, defaults to 128 if not provided.
|
|
130
|
+
*/
|
|
131
|
+
memoryLimit?: number;
|
|
132
|
+
/** Environment variables to be made available to the function during execution */
|
|
133
|
+
environmentVariables?: {
|
|
134
|
+
[key: string]: {
|
|
135
|
+
value: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
/** Options related to the execution of the function, such as permission an priority */
|
|
139
|
+
executionOptions?: {
|
|
140
|
+
/** Defines access for executing the function directly or for invoking it as an API function. */
|
|
141
|
+
permissionMode?: FunctionPermissionMode;
|
|
142
|
+
/** The default priority assigned to all tasks created for this function, unless a priority is specified for a task explicitly */
|
|
143
|
+
defaultPriority?: number;
|
|
144
|
+
};
|
|
145
|
+
/** The policy that determines system behavior after the execution of a Function fails. */
|
|
146
|
+
retryPolicy?: {
|
|
147
|
+
/**
|
|
148
|
+
* The retry policy is disabled by default, If this field is set to true, the retry policy becomes active.
|
|
149
|
+
* If active the policy will retry a maximum of 3 times, with an increasing timeout of 2, 5 and 10 seconds respectively.
|
|
150
|
+
*/
|
|
151
|
+
enabled: boolean;
|
|
152
|
+
/** A list of error names that should trigger a retry. If not specified, the default is to retry on all errors. */
|
|
153
|
+
errorsToRetry: string[];
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export declare type FunctionDetails = Omit<FunctionCreation, 'code'> & FunctionBase & {
|
|
157
|
+
/** Indicates whether the function is enabled or disabled for execution/invocation. Enabled by default. */
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
};
|
|
160
|
+
export declare enum FunctionPermissionMode {
|
|
161
|
+
/** To execute this function directly the user needs the EXECUTE_TASK_FUNCTION permission */
|
|
162
|
+
PERMISSION_REQUIRED = "permissionRequired",
|
|
163
|
+
/** Every logged in user can execute this function directly */
|
|
164
|
+
ALL_USERS = "allUsers",
|
|
165
|
+
/** The function can be executed even by unauthenticated requests */
|
|
166
|
+
PUBLIC = "public"
|
|
167
|
+
}
|
|
24
168
|
export interface DirectExecutionResponse<T, U> extends Task<U> {
|
|
25
169
|
/** The result of the Function execution, this may be user defined */
|
|
26
170
|
result: T;
|
package/build/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.9.0-dev-
|
|
1
|
+
export declare const version = "8.9.0-dev-137-14a5300";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extrahorizon/javascript-sdk",
|
|
3
|
-
"version": "8.9.0-dev-
|
|
3
|
+
"version": "8.9.0-dev-137-14a5300",
|
|
4
4
|
"description": "This package serves as a JavaScript wrapper around all Extra Horizon cloud services.",
|
|
5
5
|
"main": "build/index.cjs.js",
|
|
6
6
|
"types": "build/types/index.d.ts",
|