oneentry 1.0.142 → 1.0.143
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/admins/adminsApi.d.ts +50 -0
- package/dist/admins/adminsApi.js +65 -0
- package/dist/admins/adminsInterfaces.d.ts +98 -0
- package/dist/admins/adminsInterfaces.js +2 -0
- package/dist/admins/adminsSchemas.d.ts +30 -0
- package/dist/admins/adminsSchemas.js +27 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
- package/dist/attribute-sets/attributeSetsApi.js +98 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +185 -0
- package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
- package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
- package/dist/auth-provider/authProviderApi.d.ts +249 -0
- package/dist/auth-provider/authProviderApi.js +354 -0
- package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
- package/dist/auth-provider/authProviderSchemas.js +82 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +412 -0
- package/dist/auth-provider/authProvidersInterfaces.js +2 -0
- package/dist/base/asyncModules.d.ts +80 -0
- package/dist/base/asyncModules.js +448 -0
- package/dist/base/result.d.ts +39 -0
- package/dist/base/result.js +154 -0
- package/dist/base/stateModule.d.ts +41 -0
- package/dist/base/stateModule.js +128 -0
- package/dist/base/syncModules.d.ts +286 -0
- package/dist/base/syncModules.js +716 -0
- package/dist/base/utils.d.ts +197 -0
- package/dist/base/utils.js +2 -0
- package/dist/base/validation.d.ts +118 -0
- package/dist/base/validation.js +132 -0
- package/dist/blocks/blocksApi.d.ts +76 -0
- package/dist/blocks/blocksApi.js +188 -0
- package/dist/blocks/blocksInterfaces.d.ts +168 -0
- package/dist/blocks/blocksInterfaces.js +2 -0
- package/dist/blocks/blocksSchemas.d.ts +195 -0
- package/dist/blocks/blocksSchemas.js +43 -0
- package/dist/discounts/discountsApi.d.ts +56 -0
- package/dist/discounts/discountsApi.js +82 -0
- package/dist/discounts/discountsInterfaces.d.ts +145 -0
- package/dist/discounts/discountsInterfaces.js +2 -0
- package/dist/events/eventsApi.d.ts +60 -0
- package/dist/events/eventsApi.js +97 -0
- package/dist/events/eventsInterfaces.d.ts +87 -0
- package/dist/events/eventsInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
- package/dist/file-uploading/fileUploadingApi.js +129 -0
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +114 -0
- package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
- package/dist/file-uploading/fileUploadingSchemas.js +21 -0
- package/dist/forms/formsApi.d.ts +42 -0
- package/dist/forms/formsApi.js +57 -0
- package/dist/forms/formsInterfaces.d.ts +134 -0
- package/dist/forms/formsInterfaces.js +2 -0
- package/dist/forms/formsSchemas.d.ts +50 -0
- package/dist/forms/formsSchemas.js +31 -0
- package/dist/forms-data/formsDataApi.d.ts +106 -0
- package/dist/forms-data/formsDataApi.js +189 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +522 -0
- package/dist/forms-data/formsDataInterfaces.js +2 -0
- package/dist/forms-data/formsDataSchemas.d.ts +115 -0
- package/dist/forms-data/formsDataSchemas.js +86 -0
- package/dist/general-types/generalTypesApi.d.ts +28 -0
- package/dist/general-types/generalTypesApi.js +38 -0
- package/dist/general-types/generalTypesInterfaces.d.ts +29 -0
- package/dist/general-types/generalTypesInterfaces.js +2 -0
- package/dist/general-types/generalTypesSchemas.d.ts +50 -0
- package/dist/general-types/generalTypesSchemas.js +35 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +103 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +163 -0
- package/dist/integration-collections/integrationCollectionsApi.js +220 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
- package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
- package/dist/locales/localesApi.d.ts +27 -0
- package/dist/locales/localesApi.js +37 -0
- package/dist/locales/localesInterfaces.d.ts +40 -0
- package/dist/locales/localesInterfaces.js +2 -0
- package/dist/locales/localesSchemas.d.ts +32 -0
- package/dist/locales/localesSchemas.js +26 -0
- package/dist/menus/menusApi.d.ts +29 -0
- package/dist/menus/menusApi.js +39 -0
- package/dist/menus/menusInterfaces.d.ts +87 -0
- package/dist/menus/menusInterfaces.js +3 -0
- package/dist/menus/menusSchemas.d.ts +16 -0
- package/dist/menus/menusSchemas.js +28 -0
- package/dist/orders/ordersApi.d.ts +149 -0
- package/dist/orders/ordersApi.js +203 -0
- package/dist/orders/ordersInterfaces.d.ts +520 -0
- package/dist/orders/ordersInterfaces.js +2 -0
- package/dist/orders/ordersSchemas.d.ts +120 -0
- package/dist/orders/ordersSchemas.js +101 -0
- package/dist/pages/pagesApi.d.ts +151 -0
- package/dist/pages/pagesApi.js +390 -0
- package/dist/pages/pagesInterfaces.d.ts +284 -0
- package/dist/pages/pagesInterfaces.js +2 -0
- package/dist/pages/pagesSchemas.d.ts +85 -0
- package/dist/pages/pagesSchemas.js +46 -0
- package/dist/payments/paymentsApi.d.ts +82 -0
- package/dist/payments/paymentsApi.js +121 -0
- package/dist/payments/paymentsInterfaces.d.ts +200 -0
- package/dist/payments/paymentsInterfaces.js +2 -0
- package/dist/payments/paymentsSchemas.d.ts +100 -0
- package/dist/payments/paymentsSchemas.js +65 -0
- package/dist/product-statuses/productStatusesApi.d.ts +47 -0
- package/dist/product-statuses/productStatusesApi.js +70 -0
- package/dist/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/dist/product-statuses/productStatusesInterfaces.js +2 -0
- package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/dist/product-statuses/productStatusesSchemas.js +30 -0
- package/dist/products/productsApi.d.ts +365 -0
- package/dist/products/productsApi.js +459 -0
- package/dist/products/productsInterfaces.d.ts +577 -0
- package/dist/products/productsInterfaces.js +2 -0
- package/dist/products/productsSchemas.d.ts +200 -0
- package/dist/products/productsSchemas.js +98 -0
- package/dist/sitemap/sitemapApi.d.ts +35 -0
- package/dist/sitemap/sitemapApi.js +45 -0
- package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
- package/dist/sitemap/sitemapInterfaces.js +2 -0
- package/dist/system/systemApi.d.ts +43 -0
- package/dist/system/systemApi.js +56 -0
- package/dist/system/systemInterfaces.d.ts +29 -0
- package/dist/system/systemInterfaces.js +2 -0
- package/dist/templates/templatesApi.d.ts +49 -0
- package/dist/templates/templatesApi.js +75 -0
- package/dist/templates/templatesInterfaces.d.ts +67 -0
- package/dist/templates/templatesInterfaces.js +2 -0
- package/dist/templates/templatesSchemas.d.ts +48 -0
- package/dist/templates/templatesSchemas.js +31 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
- package/dist/templates-preview/templatesPreviewApi.js +53 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +119 -0
- package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
- package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
- package/dist/users/usersApi.d.ts +143 -0
- package/dist/users/usersApi.js +171 -0
- package/dist/users/usersInterfaces.d.ts +229 -0
- package/dist/users/usersInterfaces.js +2 -0
- package/dist/users/usersSchemas.d.ts +38 -0
- package/dist/users/usersSchemas.js +28 -0
- package/dist/web-socket/wsApi.d.ts +25 -0
- package/dist/web-socket/wsApi.js +45 -0
- package/dist/web-socket/wsInterfaces.d.ts +16 -0
- package/dist/web-socket/wsInterfaces.js +2 -0
- package/package.json +3 -81
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IUserBody, IUserEntity, IUsersApi } from './usersInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with users
|
|
7
|
+
* @handle /api/content/users
|
|
8
|
+
* @description This module provides various methods to manage users, including creating, retrieving, updating, and deleting user data. It requires proper authorization to access these endpoints.
|
|
9
|
+
*/
|
|
10
|
+
export default class UsersApi extends AsyncModules implements IUsersApi {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for UsersApi class.
|
|
15
|
+
* @param {StateModule} state - The state module containing necessary information for API calls.
|
|
16
|
+
* @description Initializes the UsersApi class with the provided state module.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
19
|
+
/**
|
|
20
|
+
* Getting the data of an authorized user.
|
|
21
|
+
* @handleName getUser
|
|
22
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
23
|
+
* @returns {Promise<IUserEntity | IError>} Returns a promise that resolves to the user entity object if successful; otherwise, returns an error object.
|
|
24
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
25
|
+
* @description This method requires user authorization.
|
|
26
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
27
|
+
*/
|
|
28
|
+
getUser(langCode?: string): Promise<IUserEntity | IError>;
|
|
29
|
+
/**
|
|
30
|
+
* Updating a single user object.
|
|
31
|
+
* @handleName updateUser
|
|
32
|
+
* @param {IUserBody} body - Request body.
|
|
33
|
+
* @example
|
|
34
|
+
{
|
|
35
|
+
"formIdentifier": "reg",
|
|
36
|
+
"authData": [
|
|
37
|
+
{
|
|
38
|
+
"marker": "email_reg",
|
|
39
|
+
"value": "your-email@oneentery.cloud"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"marker": "password_reg",
|
|
43
|
+
"value": "12345"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"formData": [
|
|
47
|
+
{
|
|
48
|
+
"marker": "last_name",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"value": "Username"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"notificationData": {
|
|
54
|
+
"email": "example@oneentry.cloud",
|
|
55
|
+
"phonePush": ["+99999999999"],
|
|
56
|
+
"phoneSMS": "+99999999999"
|
|
57
|
+
},
|
|
58
|
+
"state": {}
|
|
59
|
+
}
|
|
60
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
|
|
61
|
+
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
62
|
+
* @example
|
|
63
|
+
[
|
|
64
|
+
{
|
|
65
|
+
"marker": "email_reg",
|
|
66
|
+
"value": "example@oneentry.cloud"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"marker": "password_reg",
|
|
70
|
+
"value": "password"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
* @param {string} body.authData[].marker - Identifies the field being used. Example: "email_reg".
|
|
74
|
+
* @param {string} body.authData[].value - Contains the value of the field. Example: "example@oneentry.cloud".
|
|
75
|
+
* @param {string} body.formData - Contains additional data for the user.
|
|
76
|
+
* @example
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
"marker": "last_name",
|
|
80
|
+
"type": "string",
|
|
81
|
+
"value": "Username"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
* @param {string} body.formData[].marker - The marker of the field. Example: "last_name".
|
|
85
|
+
* @param {string} body.formData[].type - The type of the field. Example: "string".
|
|
86
|
+
* @param {string} body.formData[].value - The value of the field. Example: "Username".
|
|
87
|
+
* @param {string} body.notificationData - The notification data.
|
|
88
|
+
* @example
|
|
89
|
+
{
|
|
90
|
+
"email": "example@oneentry.cloud",
|
|
91
|
+
"phonePush": ["+99999999999"],
|
|
92
|
+
"phoneSMS": "+99999999999"
|
|
93
|
+
}
|
|
94
|
+
* @param {string} body.notificationData.email - The email address of the user. Example: "example@oneentry.cloud".
|
|
95
|
+
* @param {string} body.notificationData.phonePush - An array of phone numbers for push notifications. Example: ["+99999999999"].
|
|
96
|
+
* @param {string} body.notificationData.phoneSMS - The phone number for SMS notifications. Example: "+99999999999".
|
|
97
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
98
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
|
|
99
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
100
|
+
* @description This method updates the user's data. This method requires user authorization.
|
|
101
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
102
|
+
* @see For more information about {@link https://doc.oneentry.cloud/docs/forms/create-form registration forms}, see the documentation in the {@link https://doc.oneentry.cloud/docs/forms/create-form forms configuration section}.
|
|
103
|
+
*/
|
|
104
|
+
updateUser(body: IUserBody, langCode?: string): Promise<boolean | IError>;
|
|
105
|
+
/**
|
|
106
|
+
* Archiving one user object (marked for deletion).
|
|
107
|
+
* @handleName archiveUser
|
|
108
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
109
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
110
|
+
* @description This method archives a user object (marks it for deletion). This method requires user authorization.
|
|
111
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/auth-provider/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
112
|
+
*/
|
|
113
|
+
archiveUser(): Promise<boolean | IError>;
|
|
114
|
+
/**
|
|
115
|
+
* Delete a single user.
|
|
116
|
+
* @handleName deleteUser
|
|
117
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
118
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
119
|
+
* @description This method deletes the user from the system. This method requires user authorization.
|
|
120
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
121
|
+
*/
|
|
122
|
+
deleteUser(): Promise<boolean | IError>;
|
|
123
|
+
/**
|
|
124
|
+
* Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
125
|
+
* @handleName addFCMToken
|
|
126
|
+
* @param {string} token - The cloud messaging token to be added. This token is used to identify the user's device for push notifications. Example: "fcm_token_1234567890abcdefg".
|
|
127
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the token was successfully added; otherwise, returns an error object.
|
|
128
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
129
|
+
* @description This method adds an FCM token for sending push notifications. This method requires user authorization.
|
|
130
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
131
|
+
*/
|
|
132
|
+
addFCMToken(token: string): Promise<boolean | IError>;
|
|
133
|
+
/**
|
|
134
|
+
* Deletes an FCM (Firebase Cloud Messaging) token.
|
|
135
|
+
* @handleName deleteFCMToken
|
|
136
|
+
* @param {string} token - The cloud messaging token to be deleted. This token is used to identify the user's device for push notifications and will be removed. Example: "fcm_token_1234567890abcdefg".
|
|
137
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the token was successfully deleted; otherwise, returns an error object.
|
|
138
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
139
|
+
* @description This method deletes an existing FCM token. This method requires user authorization.
|
|
140
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
141
|
+
*/
|
|
142
|
+
deleteFCMToken(token: string): Promise<boolean | IError>;
|
|
143
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
const usersSchemas_1 = require("./usersSchemas");
|
|
8
|
+
/**
|
|
9
|
+
* Controllers for working with users
|
|
10
|
+
* @handle /api/content/users
|
|
11
|
+
* @description This module provides various methods to manage users, including creating, retrieving, updating, and deleting user data. It requires proper authorization to access these endpoints.
|
|
12
|
+
*/
|
|
13
|
+
class UsersApi extends asyncModules_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for UsersApi class.
|
|
16
|
+
* @param {StateModule} state - The state module containing necessary information for API calls.
|
|
17
|
+
* @description Initializes the UsersApi class with the provided state module.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
this._url = state.url + '/api/content/users';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Getting the data of an authorized user.
|
|
25
|
+
* @handleName getUser
|
|
26
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
27
|
+
* @returns {Promise<IUserEntity | IError>} Returns a promise that resolves to the user entity object if successful; otherwise, returns an error object.
|
|
28
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
29
|
+
* @description This method requires user authorization.
|
|
30
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
31
|
+
*/
|
|
32
|
+
async getUser(langCode = this.state.lang) {
|
|
33
|
+
const result = await this._fetchGet(`/me?langCode=${langCode}`);
|
|
34
|
+
// Validate response if validation is enabled
|
|
35
|
+
const validated = this._validateResponse(result, usersSchemas_1.UserResponseSchema);
|
|
36
|
+
return this._normalizeData(validated);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Updating a single user object.
|
|
40
|
+
* @handleName updateUser
|
|
41
|
+
* @param {IUserBody} body - Request body.
|
|
42
|
+
* @example
|
|
43
|
+
{
|
|
44
|
+
"formIdentifier": "reg",
|
|
45
|
+
"authData": [
|
|
46
|
+
{
|
|
47
|
+
"marker": "email_reg",
|
|
48
|
+
"value": "your-email@oneentery.cloud"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"marker": "password_reg",
|
|
52
|
+
"value": "12345"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"formData": [
|
|
56
|
+
{
|
|
57
|
+
"marker": "last_name",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"value": "Username"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"notificationData": {
|
|
63
|
+
"email": "example@oneentry.cloud",
|
|
64
|
+
"phonePush": ["+99999999999"],
|
|
65
|
+
"phoneSMS": "+99999999999"
|
|
66
|
+
},
|
|
67
|
+
"state": {}
|
|
68
|
+
}
|
|
69
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
|
|
70
|
+
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
71
|
+
* @example
|
|
72
|
+
[
|
|
73
|
+
{
|
|
74
|
+
"marker": "email_reg",
|
|
75
|
+
"value": "example@oneentry.cloud"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"marker": "password_reg",
|
|
79
|
+
"value": "password"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
* @param {string} body.authData[].marker - Identifies the field being used. Example: "email_reg".
|
|
83
|
+
* @param {string} body.authData[].value - Contains the value of the field. Example: "example@oneentry.cloud".
|
|
84
|
+
* @param {string} body.formData - Contains additional data for the user.
|
|
85
|
+
* @example
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
|
+
"marker": "last_name",
|
|
89
|
+
"type": "string",
|
|
90
|
+
"value": "Username"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
* @param {string} body.formData[].marker - The marker of the field. Example: "last_name".
|
|
94
|
+
* @param {string} body.formData[].type - The type of the field. Example: "string".
|
|
95
|
+
* @param {string} body.formData[].value - The value of the field. Example: "Username".
|
|
96
|
+
* @param {string} body.notificationData - The notification data.
|
|
97
|
+
* @example
|
|
98
|
+
{
|
|
99
|
+
"email": "example@oneentry.cloud",
|
|
100
|
+
"phonePush": ["+99999999999"],
|
|
101
|
+
"phoneSMS": "+99999999999"
|
|
102
|
+
}
|
|
103
|
+
* @param {string} body.notificationData.email - The email address of the user. Example: "example@oneentry.cloud".
|
|
104
|
+
* @param {string} body.notificationData.phonePush - An array of phone numbers for push notifications. Example: ["+99999999999"].
|
|
105
|
+
* @param {string} body.notificationData.phoneSMS - The phone number for SMS notifications. Example: "+99999999999".
|
|
106
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
107
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
|
|
108
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
109
|
+
* @description This method updates the user's data. This method requires user authorization.
|
|
110
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
111
|
+
* @see For more information about {@link https://doc.oneentry.cloud/docs/forms/create-form registration forms}, see the documentation in the {@link https://doc.oneentry.cloud/docs/forms/create-form forms configuration section}.
|
|
112
|
+
*/
|
|
113
|
+
async updateUser(body, langCode = this.state.lang) {
|
|
114
|
+
if (!('langCode' in body))
|
|
115
|
+
body['langCode'] = langCode;
|
|
116
|
+
const result = await this._fetchPut('/me', this._normalizePostBody(body, langCode));
|
|
117
|
+
const validated = this._validateResponse(result, usersSchemas_1.UpdateUserResponseSchema);
|
|
118
|
+
return validated;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Archiving one user object (marked for deletion).
|
|
122
|
+
* @handleName archiveUser
|
|
123
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
124
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
125
|
+
* @description This method archives a user object (marks it for deletion). This method requires user authorization.
|
|
126
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/auth-provider/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
127
|
+
*/
|
|
128
|
+
async archiveUser() {
|
|
129
|
+
const result = await this._fetchDelete('/me');
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Delete a single user.
|
|
134
|
+
* @handleName deleteUser
|
|
135
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
136
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
137
|
+
* @description This method deletes the user from the system. This method requires user authorization.
|
|
138
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
139
|
+
*/
|
|
140
|
+
async deleteUser() {
|
|
141
|
+
const result = await this._fetchDelete('/me/account');
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
146
|
+
* @handleName addFCMToken
|
|
147
|
+
* @param {string} token - The cloud messaging token to be added. This token is used to identify the user's device for push notifications. Example: "fcm_token_1234567890abcdefg".
|
|
148
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the token was successfully added; otherwise, returns an error object.
|
|
149
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
150
|
+
* @description This method adds an FCM token for sending push notifications. This method requires user authorization.
|
|
151
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
152
|
+
*/
|
|
153
|
+
async addFCMToken(token) {
|
|
154
|
+
const result = await this._fetchPost(`/me/fcm-token/${token}`);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Deletes an FCM (Firebase Cloud Messaging) token.
|
|
159
|
+
* @handleName deleteFCMToken
|
|
160
|
+
* @param {string} token - The cloud messaging token to be deleted. This token is used to identify the user's device for push notifications and will be removed. Example: "fcm_token_1234567890abcdefg".
|
|
161
|
+
* @returns {Promise<boolean | IError>} Returns `true` if the token was successfully deleted; otherwise, returns an error object.
|
|
162
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
163
|
+
* @description This method deletes an existing FCM token. This method requires user authorization.
|
|
164
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
165
|
+
*/
|
|
166
|
+
async deleteFCMToken(token) {
|
|
167
|
+
const result = await this._fetchDelete(`/me/fcm-token/${token}`);
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.default = UsersApi;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { IAuthData, IAuthFormData } from '../auth-provider/authProvidersInterfaces';
|
|
2
|
+
import type { IError } from '../base/utils';
|
|
3
|
+
import type { IFormConfig } from '../forms/formsInterfaces';
|
|
4
|
+
import type { FormDataType } from '../forms-data/formsDataInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing user-related operations.
|
|
7
|
+
* @interface IUsersApi
|
|
8
|
+
* @description This interface defines methods for managing user data and handling Firebase Cloud Messaging tokens.
|
|
9
|
+
*/
|
|
10
|
+
interface IUsersApi {
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the data of an authorized user.
|
|
13
|
+
* @handleName getUser
|
|
14
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
15
|
+
* @returns {IUserEntity} A promise resolving to the user entity or an error.
|
|
16
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
17
|
+
* @description This method requires user authorization.
|
|
18
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
19
|
+
*/
|
|
20
|
+
getUser(langCode?: string): Promise<IUserEntity | IError>;
|
|
21
|
+
/**
|
|
22
|
+
* Updating a single user object.
|
|
23
|
+
* @handleName updateUser
|
|
24
|
+
* @param {IUserBody} body - Request body.
|
|
25
|
+
* @example
|
|
26
|
+
{
|
|
27
|
+
"formIdentifier": "reg",
|
|
28
|
+
"authData": [
|
|
29
|
+
{
|
|
30
|
+
"marker": "email_reg",
|
|
31
|
+
"value": "your-email@oneentery.cloud"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"marker": "password_reg",
|
|
35
|
+
"value": "12345"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"formData": [
|
|
39
|
+
{
|
|
40
|
+
"marker": "last_name",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"value": "Username"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"notificationData": {
|
|
46
|
+
"email": "example@oneentry.cloud",
|
|
47
|
+
"phonePush": ["+99999999999"],
|
|
48
|
+
"phoneSMS": "+99999999999"
|
|
49
|
+
},
|
|
50
|
+
"state": {}
|
|
51
|
+
}
|
|
52
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg_form".
|
|
53
|
+
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
54
|
+
* @example
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"marker": "email_reg",
|
|
58
|
+
"value": "example@oneentry.cloud"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"marker": "password_reg",
|
|
62
|
+
"value": "password"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
* @param {string} body.authData[index].marker - Identifies the field being used. Example: "email_reg".
|
|
66
|
+
* @param {string} body.authData[index].value - Contains the value of the field. Example: "example@oneentry.cloud".
|
|
67
|
+
* @param {string} body.formData - Contains additional data for the user.
|
|
68
|
+
* @example
|
|
69
|
+
[
|
|
70
|
+
{
|
|
71
|
+
"marker": "last_name",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"value": "Username"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
* @param {string} body.formData[index].marker - The marker of the field. Example: "last_name".
|
|
77
|
+
* @param {string} body.formData[index].type - The type of the field. Example: "string".
|
|
78
|
+
* @param {string} body.formData[index].value - The value of the field. Example: "Username".
|
|
79
|
+
* @param {string} body.notificationData - The notification data.
|
|
80
|
+
* @example
|
|
81
|
+
{
|
|
82
|
+
"email": "example@oneentry.cloud",
|
|
83
|
+
"phonePush": ["+99999999999"],
|
|
84
|
+
"phoneSMS": "+99999999999"
|
|
85
|
+
}
|
|
86
|
+
* @param {string} body.notificationData.email - The email address of the user. Example: "example@oneentry.cloud".
|
|
87
|
+
* @param {string} body.notificationData.phonePush - An array of phone numbers for push notifications. Example: ["+99999999999"].
|
|
88
|
+
* @param {string} body.notificationData.phoneSMS - The phone number for SMS notifications. Example: "+99999999999".
|
|
89
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
90
|
+
* @returns {boolean} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
|
|
91
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
92
|
+
* @description This method updates the user's data. This method requires user authorization.
|
|
93
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
94
|
+
* @see For more information about {@link https://doc.oneentry.cloud/docs/forms/create-form registration forms}, see the documentation in the {@link https://doc.oneentry.cloud/docs/forms/create-form forms configuration section}.
|
|
95
|
+
*/
|
|
96
|
+
updateUser(body: IUserBody, langCode?: string): Promise<boolean | IError>;
|
|
97
|
+
/**
|
|
98
|
+
* Archiving one user object (marked for deletion).
|
|
99
|
+
* @handleName archiveUser
|
|
100
|
+
* @returns {boolean} A promise resolving to true if successful, or an error.
|
|
101
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
102
|
+
* @description This method archives a user object (marks it for deletion). This method requires user authorization.
|
|
103
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
104
|
+
*/
|
|
105
|
+
archiveUser(): Promise<boolean | IError>;
|
|
106
|
+
/**
|
|
107
|
+
* Deletes the user from the system.
|
|
108
|
+
* @handleName deleteUser
|
|
109
|
+
* @returns {boolean} A promise resolving to true if successful, or an error.
|
|
110
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
111
|
+
* @description This method deletes the user from the system. This method requires user authorization.
|
|
112
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
113
|
+
*/
|
|
114
|
+
deleteUser(): Promise<boolean | IError>;
|
|
115
|
+
/**
|
|
116
|
+
* Adds an FCM token for sending push notifications.
|
|
117
|
+
* @handleName addFCMToken
|
|
118
|
+
* @param {string} token - The FCM token to be added. Example: "fcm_token_1234567890abcdefg".
|
|
119
|
+
* @returns {boolean} A promise resolving to true if successful, or an error.
|
|
120
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
121
|
+
* @description This method adds an FCM token for sending push notifications. This method requires user authorization.
|
|
122
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
123
|
+
*/
|
|
124
|
+
addFCMToken(token: string): Promise<boolean | IError>;
|
|
125
|
+
/**
|
|
126
|
+
* Deletes an existing FCM token.
|
|
127
|
+
* @handleName deleteFCMToken
|
|
128
|
+
* @param {string} token - The FCM token to be deleted. Example: "fcm_token_1234567890abcdefg".
|
|
129
|
+
* @returns {boolean} A promise resolving to true if successful, or an error.
|
|
130
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
131
|
+
* @description This method deletes an existing FCM token. This method requires user authorization.
|
|
132
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
133
|
+
*/
|
|
134
|
+
deleteFCMToken(token: string): Promise<boolean | IError>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @interface IUserEntity
|
|
138
|
+
* @property {number} id - Object identifier. Example: 12345.
|
|
139
|
+
* @property {string} identifier - Text identifier for record field. Example: "user_12345".
|
|
140
|
+
* @property {string} authProviderIdentifier - Text identifier of the authentication provider. Example: "auth_provider_12345".
|
|
141
|
+
* @property {FormDataType[]} formData - Array of data form objects with the following values.
|
|
142
|
+
* @example
|
|
143
|
+
[
|
|
144
|
+
{
|
|
145
|
+
"marker": "last_name",
|
|
146
|
+
"type": "string",
|
|
147
|
+
"value": "Username"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
* @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
|
|
151
|
+
* @property {string} total - Total value. Example: "0".
|
|
152
|
+
* @property {Array<string | number>} groups - Array of user groups.
|
|
153
|
+
* @example
|
|
154
|
+
[
|
|
155
|
+
"group_1",
|
|
156
|
+
"group_2"
|
|
157
|
+
]
|
|
158
|
+
* @property {object} state - Object containing additional user state information.
|
|
159
|
+
* @example
|
|
160
|
+
{
|
|
161
|
+
"key": "value"
|
|
162
|
+
}
|
|
163
|
+
* @property {Array<IFormConfig>} [moduleFormConfigs] - Optional array of form configuration objects associated with the user.
|
|
164
|
+
* @description Represents a user entity with various properties, including identifiers, form data, and user groups.
|
|
165
|
+
*/
|
|
166
|
+
interface IUserEntity {
|
|
167
|
+
id: number;
|
|
168
|
+
identifier: string;
|
|
169
|
+
authProviderIdentifier: string;
|
|
170
|
+
formData: FormDataType[];
|
|
171
|
+
formIdentifier: string;
|
|
172
|
+
total: string;
|
|
173
|
+
groups: Array<string | number>;
|
|
174
|
+
state: Record<string, any>;
|
|
175
|
+
moduleFormConfigs?: Array<IFormConfig>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @interface IUserBody
|
|
179
|
+
* @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
|
|
180
|
+
* @property {string} [langCode] - Language code for localization. Default: "en_US".
|
|
181
|
+
* @property {IAuthData[]} [authData] - Array of authentication data objects with markers and values.
|
|
182
|
+
* @example
|
|
183
|
+
[
|
|
184
|
+
{
|
|
185
|
+
"marker": "password",
|
|
186
|
+
"value": "12345"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
* @property {IAuthFormData | IAuthFormData[]} [formData] - Form data object or array of form data objects.
|
|
190
|
+
* @example
|
|
191
|
+
[
|
|
192
|
+
{
|
|
193
|
+
"marker": "first_name",
|
|
194
|
+
"type": "string",
|
|
195
|
+
"value": "John"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"marker": "last_name",
|
|
199
|
+
"type": "string",
|
|
200
|
+
"value": "Doe"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
* @property {object} [notificationData] - Object containing notification data, including email and phone information.
|
|
204
|
+
* @example
|
|
205
|
+
{
|
|
206
|
+
"email": "example@oneentry.cloud",
|
|
207
|
+
"phonePush": ["+99999999999"],
|
|
208
|
+
"phoneSMS": "+99999999999"
|
|
209
|
+
}
|
|
210
|
+
* @property {object} [state] - Object containing additional state information.
|
|
211
|
+
* @example
|
|
212
|
+
{
|
|
213
|
+
"key": "value"
|
|
214
|
+
}
|
|
215
|
+
* @description Represents the body of a user request, including form identifiers, authentication data, form data, notification data, and state information.
|
|
216
|
+
*/
|
|
217
|
+
interface IUserBody {
|
|
218
|
+
formIdentifier: string;
|
|
219
|
+
langCode?: string;
|
|
220
|
+
authData?: IAuthData[];
|
|
221
|
+
formData?: IAuthFormData | IAuthFormData[];
|
|
222
|
+
notificationData?: {
|
|
223
|
+
email: string;
|
|
224
|
+
phonePush: string[];
|
|
225
|
+
phoneSMS?: string;
|
|
226
|
+
};
|
|
227
|
+
state?: Record<string, any>;
|
|
228
|
+
}
|
|
229
|
+
export type { IUserBody, IUserEntity, IUsersApi };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Users module
|
|
3
|
+
* @description Zod schemas for validating users-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* User response schema (extends base UserEntitySchema)
|
|
8
|
+
* formData can be array or object (inherited from UserEntitySchema)
|
|
9
|
+
*/
|
|
10
|
+
export declare const UserResponseSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
13
|
+
email: z.ZodOptional<z.ZodString>;
|
|
14
|
+
phoneMask: z.ZodOptional<z.ZodString>;
|
|
15
|
+
phoneCode: z.ZodOptional<z.ZodString>;
|
|
16
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
17
|
+
statusMarker: z.ZodOptional<z.ZodString>;
|
|
18
|
+
formData: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
19
|
+
total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
20
|
+
authProviderIdentifier: z.ZodOptional<z.ZodString>;
|
|
21
|
+
formIdentifier: z.ZodOptional<z.ZodString>;
|
|
22
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
23
|
+
state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
24
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
25
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
26
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/**
|
|
29
|
+
* Update user response schema (returns true on success)
|
|
30
|
+
*/
|
|
31
|
+
export declare const UpdateUserResponseSchema: z.ZodBoolean;
|
|
32
|
+
/**
|
|
33
|
+
* Delete user response schema
|
|
34
|
+
*/
|
|
35
|
+
export declare const DeleteUserResponseSchema: z.ZodObject<{
|
|
36
|
+
success: z.ZodBoolean;
|
|
37
|
+
message: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteUserResponseSchema = exports.UpdateUserResponseSchema = exports.UserResponseSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validation schemas for Users module
|
|
6
|
+
* @description Zod schemas for validating users-related API responses
|
|
7
|
+
*/
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const validation_1 = require("../base/validation");
|
|
10
|
+
/**
|
|
11
|
+
* User response schema (extends base UserEntitySchema)
|
|
12
|
+
* formData can be array or object (inherited from UserEntitySchema)
|
|
13
|
+
*/
|
|
14
|
+
exports.UserResponseSchema = validation_1.UserEntitySchema.extend({
|
|
15
|
+
createdAt: zod_1.z.string().optional(),
|
|
16
|
+
updatedAt: zod_1.z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Update user response schema (returns true on success)
|
|
20
|
+
*/
|
|
21
|
+
exports.UpdateUserResponseSchema = zod_1.z.boolean();
|
|
22
|
+
/**
|
|
23
|
+
* Delete user response schema
|
|
24
|
+
*/
|
|
25
|
+
exports.DeleteUserResponseSchema = zod_1.z.object({
|
|
26
|
+
success: zod_1.z.boolean(),
|
|
27
|
+
message: zod_1.z.string().optional(),
|
|
28
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Socket } from 'socket.io-client';
|
|
2
|
+
import AsyncModules from '../base/asyncModules';
|
|
3
|
+
import type StateModule from '../base/stateModule';
|
|
4
|
+
import type { IWS } from './wsInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with users
|
|
7
|
+
* @handle /api/content/ws
|
|
8
|
+
*/
|
|
9
|
+
export default class WsApi extends AsyncModules implements IWS {
|
|
10
|
+
protected state: StateModule;
|
|
11
|
+
protected _url: string;
|
|
12
|
+
/**
|
|
13
|
+
* Constructor
|
|
14
|
+
* @param {StateModule} state - StateModule
|
|
15
|
+
*/
|
|
16
|
+
constructor(state: StateModule);
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of an object Socket.io with a connection.
|
|
19
|
+
* @handleName connect
|
|
20
|
+
* @returns {Socket} Returns a Socket instance.
|
|
21
|
+
* @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
22
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
23
|
+
*/
|
|
24
|
+
connect(): Socket;
|
|
25
|
+
}
|