apacuana-sdk-core 0.9.0 → 0.10.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/index.mjs CHANGED
@@ -33083,6 +33083,209 @@ var getCertStatus = function getCertStatus() {
33083
33083
  };
33084
33084
  };
33085
33085
 
33086
+ /**
33087
+ * @typedef {object} CertType
33088
+ * @property {string} id - The ID of the certificate type.
33089
+ * @property {string} name - The name of the certificate type.
33090
+ */
33091
+
33092
+ /**
33093
+ * @typedef {object} GetCertTypesResponse
33094
+ * @property {Array<CertType>} types - A list of available certificate types.
33095
+ * @property {boolean} success - Indicates if the operation was successful.
33096
+ */
33097
+
33098
+ var getCertTypesOnBoarding = /*#__PURE__*/function () {
33099
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
33100
+ var response, _t2;
33101
+ return _regenerator().w(function (_context4) {
33102
+ while (1) switch (_context4.p = _context4.n) {
33103
+ case 0:
33104
+ _context4.p = 0;
33105
+ _context4.n = 1;
33106
+ return httpRequest("services/api/customer/typeusers", {}, "GET");
33107
+ case 1:
33108
+ response = _context4.v;
33109
+ return _context4.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
33110
+ success: true
33111
+ }));
33112
+ case 2:
33113
+ _context4.p = 2;
33114
+ _t2 = _context4.v;
33115
+ if (!(_t2 instanceof ApacuanaAPIError)) {
33116
+ _context4.n = 3;
33117
+ break;
33118
+ }
33119
+ throw _t2;
33120
+ case 3:
33121
+ throw new Error("Failed to get certificate types: ".concat(_t2.message));
33122
+ case 4:
33123
+ return _context4.a(2);
33124
+ }
33125
+ }, _callee4, null, [[0, 2]]);
33126
+ }));
33127
+ return function getCertTypesOnBoarding() {
33128
+ return _ref4.apply(this, arguments);
33129
+ };
33130
+ }();
33131
+ var getCertTypesOnPremise = /*#__PURE__*/function () {
33132
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
33133
+ return _regenerator().w(function (_context5) {
33134
+ while (1) switch (_context5.n) {
33135
+ case 0:
33136
+ throw new ApacuanaAPIError("Getting certificate types is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33137
+ case 1:
33138
+ return _context5.a(2);
33139
+ }
33140
+ }, _callee5);
33141
+ }));
33142
+ return function getCertTypesOnPremise() {
33143
+ return _ref5.apply(this, arguments);
33144
+ };
33145
+ }();
33146
+
33147
+ /**
33148
+ * Gets the available certificate types.
33149
+ * @returns {Promise<GetCertTypesResponse>} Object with the list of certificate types and a success indicator.
33150
+ * @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
33151
+ * @throws {Error} If the request fails for another reason.
33152
+ */
33153
+ var getCertTypes = /*#__PURE__*/function () {
33154
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
33155
+ var _getConfig2, integrationType;
33156
+ return _regenerator().w(function (_context6) {
33157
+ while (1) switch (_context6.n) {
33158
+ case 0:
33159
+ _getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
33160
+ if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33161
+ _context6.n = 1;
33162
+ break;
33163
+ }
33164
+ return _context6.a(2, getCertTypesOnBoarding());
33165
+ case 1:
33166
+ if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33167
+ _context6.n = 2;
33168
+ break;
33169
+ }
33170
+ return _context6.a(2, getCertTypesOnPremise());
33171
+ case 2:
33172
+ throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
33173
+ case 3:
33174
+ return _context6.a(2);
33175
+ }
33176
+ }, _callee6);
33177
+ }));
33178
+ return function getCertTypes() {
33179
+ return _ref6.apply(this, arguments);
33180
+ };
33181
+ }();
33182
+
33183
+ /**
33184
+ * @typedef {object} Requirement
33185
+ * @property {string} id - The ID of the requirement.
33186
+ * @property {string} description - The description of the requirement.
33187
+ */
33188
+
33189
+ /**
33190
+ * @typedef {object} GetRequirementsResponse
33191
+ * @property {Array<Requirement>} requirements - A list of requirements for the user type.
33192
+ * @property {boolean} success - Indicates if the operation was successful.
33193
+ */
33194
+
33195
+ var getRequerimentsByTypeUserOnBoarding = /*#__PURE__*/function () {
33196
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(type) {
33197
+ var response, _t3;
33198
+ return _regenerator().w(function (_context7) {
33199
+ while (1) switch (_context7.p = _context7.n) {
33200
+ case 0:
33201
+ _context7.p = 0;
33202
+ _context7.n = 1;
33203
+ return httpRequest("services/api/customer/documentspref?typeuser=".concat(type), {}, "GET");
33204
+ case 1:
33205
+ response = _context7.v;
33206
+ return _context7.a(2, _objectSpread2(_objectSpread2({}, response), {}, {
33207
+ success: true
33208
+ }));
33209
+ case 2:
33210
+ _context7.p = 2;
33211
+ _t3 = _context7.v;
33212
+ if (!(_t3 instanceof ApacuanaAPIError)) {
33213
+ _context7.n = 3;
33214
+ break;
33215
+ }
33216
+ throw _t3;
33217
+ case 3:
33218
+ throw new Error("Failed to get requirements: ".concat(_t3.message));
33219
+ case 4:
33220
+ return _context7.a(2);
33221
+ }
33222
+ }, _callee7, null, [[0, 2]]);
33223
+ }));
33224
+ return function getRequerimentsByTypeUserOnBoarding(_x3) {
33225
+ return _ref7.apply(this, arguments);
33226
+ };
33227
+ }();
33228
+ var getRequerimentsByTypeUserOnPremise = /*#__PURE__*/function () {
33229
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
33230
+ return _regenerator().w(function (_context8) {
33231
+ while (1) switch (_context8.n) {
33232
+ case 0:
33233
+ throw new ApacuanaAPIError("Getting requirements by user type is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33234
+ case 1:
33235
+ return _context8.a(2);
33236
+ }
33237
+ }, _callee8);
33238
+ }));
33239
+ return function getRequerimentsByTypeUserOnPremise() {
33240
+ return _ref8.apply(this, arguments);
33241
+ };
33242
+ }();
33243
+
33244
+ /**
33245
+ * Gets the requirements for a given user type.
33246
+ * @param {object} params - The parameters.
33247
+ * @param {number} params.type - The user type to get requirements for.
33248
+ * @returns {Promise<GetRequirementsResponse>} Object with the list of requirements and a success indicator.
33249
+ * @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
33250
+ * @throws {Error} If the request fails for another reason or the type is invalid.
33251
+ */
33252
+ var getRequerimentsByTypeUser = /*#__PURE__*/function () {
33253
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(params) {
33254
+ var type, _getConfig3, integrationType;
33255
+ return _regenerator().w(function (_context9) {
33256
+ while (1) switch (_context9.n) {
33257
+ case 0:
33258
+ if (!(!params || typeof params.type !== "number")) {
33259
+ _context9.n = 1;
33260
+ break;
33261
+ }
33262
+ throw new Error('The "params" object with a numeric "type" property is required.');
33263
+ case 1:
33264
+ type = params.type;
33265
+ _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
33266
+ if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33267
+ _context9.n = 2;
33268
+ break;
33269
+ }
33270
+ return _context9.a(2, getRequerimentsByTypeUserOnBoarding(type));
33271
+ case 2:
33272
+ if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33273
+ _context9.n = 3;
33274
+ break;
33275
+ }
33276
+ return _context9.a(2, getRequerimentsByTypeUserOnPremise());
33277
+ case 3:
33278
+ throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
33279
+ case 4:
33280
+ return _context9.a(2);
33281
+ }
33282
+ }, _callee9);
33283
+ }));
33284
+ return function getRequerimentsByTypeUser(_x4) {
33285
+ return _ref9.apply(this, arguments);
33286
+ };
33287
+ }();
33288
+
33086
33289
  // =================================================================
33087
33290
  // Type Definitions
33088
33291
  // =================================================================
@@ -33912,7 +34115,9 @@ var apacuana = {
33912
34115
  getRevocationReasons: getRevocationReasons,
33913
34116
  uploadSignatureVariant: uploadSignatureVariant,
33914
34117
  getSignatureVariant: getSignatureVariant,
33915
- deleteSignatureVariant: deleteSignatureVariant
34118
+ deleteSignatureVariant: deleteSignatureVariant,
34119
+ getCertTypes: getCertTypes,
34120
+ getRequerimentsByTypeUser: getRequerimentsByTypeUser
33916
34121
  };
33917
34122
 
33918
34123
  export { apacuana as default };