@kohost/api-client 3.7.4 → 3.7.6

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.
@@ -141,6 +141,40 @@ var require_RequestLoginToken = __commonJS({
141
141
  }
142
142
  });
143
143
 
144
+ // dist/useCases/LogoutSelf.js
145
+ var require_LogoutSelf = __commonJS({
146
+ "dist/useCases/LogoutSelf.js"(exports2, module2) {
147
+ module2.exports = /* @__PURE__ */ __name(function LogoutSelf2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
148
+ if (!requestData) requestData = {};
149
+ const pathParams = null;
150
+ const { data, query, headers } = requestData;
151
+ let url = "/auth/user/me/logout";
152
+ if (pathParams && data) {
153
+ for (const param of pathParams) {
154
+ const paramName = param.replace(":", "");
155
+ url = url.replace(param, data[paramName]);
156
+ }
157
+ }
158
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
159
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
160
+ const missing = missingParams.map((param) => param.replace(":", ""));
161
+ return Promise.reject(
162
+ new Error("Missing parameters: " + missing.join(", "))
163
+ );
164
+ }
165
+ const config = {
166
+ method: "post",
167
+ url,
168
+ ...httpConfigOptions
169
+ };
170
+ if (data) config.data = data;
171
+ if (query) config.params = query;
172
+ if (headers) config.headers = headers;
173
+ return this._http.request(config);
174
+ }, "LogoutSelf");
175
+ }
176
+ });
177
+
144
178
  // dist/useCases/LogoutUser.js
145
179
  var require_LogoutUser = __commonJS({
146
180
  "dist/useCases/LogoutUser.js"(exports2, module2) {
@@ -7009,11 +7043,46 @@ var require_UpdateIssue = __commonJS({
7009
7043
  }
7010
7044
  });
7011
7045
 
7046
+ // dist/useCases/BulkUpdateIssue.js
7047
+ var require_BulkUpdateIssue = __commonJS({
7048
+ "dist/useCases/BulkUpdateIssue.js"(exports2, module2) {
7049
+ module2.exports = /* @__PURE__ */ __name(function BulkUpdateIssue2(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
7050
+ if (!requestData) requestData = {};
7051
+ const pathParams = null;
7052
+ const { data, query, headers } = requestData;
7053
+ let url = "/issues";
7054
+ if (pathParams && data) {
7055
+ for (const param of pathParams) {
7056
+ const paramName = param.replace(":", "");
7057
+ url = url.replace(param, data[paramName]);
7058
+ }
7059
+ }
7060
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
7061
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
7062
+ const missing = missingParams.map((param) => param.replace(":", ""));
7063
+ return Promise.reject(
7064
+ new Error("Missing parameters: " + missing.join(", "))
7065
+ );
7066
+ }
7067
+ const config = {
7068
+ method: "put",
7069
+ url,
7070
+ ...httpConfigOptions
7071
+ };
7072
+ if (data) config.data = data;
7073
+ if (query) config.params = query;
7074
+ if (headers) config.headers = headers;
7075
+ return this._http.request(config);
7076
+ }, "BulkUpdateIssue");
7077
+ }
7078
+ });
7079
+
7012
7080
  // src/Client/index.js
7013
7081
  var LoginStart = require_LoginStart();
7014
7082
  var RefreshToken = require_RefreshToken();
7015
7083
  var LoginFinish = require_LoginFinish();
7016
7084
  var RequestLoginToken = require_RequestLoginToken();
7085
+ var LogoutSelf = require_LogoutSelf();
7017
7086
  var LogoutUser = require_LogoutUser();
7018
7087
  var StartRegisterPasskey = require_StartRegisterPasskey();
7019
7088
  var FinishRegisterPasskey = require_FinishRegisterPasskey();
@@ -7216,6 +7285,7 @@ var ListIssues = require_ListIssues();
7216
7285
  var DeleteIssue = require_DeleteIssue();
7217
7286
  var CreateIssue = require_CreateIssue();
7218
7287
  var UpdateIssue = require_UpdateIssue();
7288
+ var BulkUpdateIssue = require_BulkUpdateIssue();
7219
7289
  var { EventEmitter } = require("events");
7220
7290
  var axios = require("axios");
7221
7291
  var KohostApiClient = class _KohostApiClient extends EventEmitter {
@@ -7285,6 +7355,10 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
7285
7355
  const key = _KohostApiClient.defs.organizationHeader;
7286
7356
  this._http.defaults.headers.common[key] = orgId;
7287
7357
  }
7358
+ get organizationId() {
7359
+ const key = _KohostApiClient.defs.organizationHeader;
7360
+ return this._http.defaults.headers.common[key];
7361
+ }
7288
7362
  /**
7289
7363
  * @param {string} propertyId
7290
7364
  * @returns {void}
@@ -7296,6 +7370,10 @@ var KohostApiClient = class _KohostApiClient extends EventEmitter {
7296
7370
  const key = _KohostApiClient.defs.propertyHeader;
7297
7371
  this._http.defaults.headers.common[key] = propertyId;
7298
7372
  }
7373
+ get propertyId() {
7374
+ const key = _KohostApiClient.defs.propertyHeader;
7375
+ return this._http.defaults.headers.common[key];
7376
+ }
7299
7377
  static get defs() {
7300
7378
  return {
7301
7379
  apiKeyHeader: "X-Api-Key",
@@ -7366,6 +7444,7 @@ KohostApiClient.prototype.LoginStart = LoginStart;
7366
7444
  KohostApiClient.prototype.RefreshToken = RefreshToken;
7367
7445
  KohostApiClient.prototype.LoginFinish = LoginFinish;
7368
7446
  KohostApiClient.prototype.RequestLoginToken = RequestLoginToken;
7447
+ KohostApiClient.prototype.LogoutSelf = LogoutSelf;
7369
7448
  KohostApiClient.prototype.LogoutUser = LogoutUser;
7370
7449
  KohostApiClient.prototype.StartRegisterPasskey = StartRegisterPasskey;
7371
7450
  KohostApiClient.prototype.FinishRegisterPasskey = FinishRegisterPasskey;
@@ -7568,4 +7647,5 @@ KohostApiClient.prototype.ListIssues = ListIssues;
7568
7647
  KohostApiClient.prototype.DeleteIssue = DeleteIssue;
7569
7648
  KohostApiClient.prototype.CreateIssue = CreateIssue;
7570
7649
  KohostApiClient.prototype.UpdateIssue = UpdateIssue;
7650
+ KohostApiClient.prototype.BulkUpdateIssue = BulkUpdateIssue;
7571
7651
  module.exports = KohostApiClient;
@@ -141,6 +141,40 @@ var require_RequestLoginToken = __commonJS({
141
141
  }
142
142
  });
143
143
 
144
+ // dist/useCases/LogoutSelf.js
145
+ var require_LogoutSelf = __commonJS({
146
+ "dist/useCases/LogoutSelf.js"(exports, module) {
147
+ module.exports = /* @__PURE__ */ __name(function LogoutSelf(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
148
+ if (!requestData) requestData = {};
149
+ const pathParams = null;
150
+ const { data, query, headers } = requestData;
151
+ let url = "/auth/user/me/logout";
152
+ if (pathParams && data) {
153
+ for (const param of pathParams) {
154
+ const paramName = param.replace(":", "");
155
+ url = url.replace(param, data[paramName]);
156
+ }
157
+ }
158
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
159
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
160
+ const missing = missingParams.map((param) => param.replace(":", ""));
161
+ return Promise.reject(
162
+ new Error("Missing parameters: " + missing.join(", "))
163
+ );
164
+ }
165
+ const config = {
166
+ method: "post",
167
+ url,
168
+ ...httpConfigOptions
169
+ };
170
+ if (data) config.data = data;
171
+ if (query) config.params = query;
172
+ if (headers) config.headers = headers;
173
+ return this._http.request(config);
174
+ }, "LogoutSelf");
175
+ }
176
+ });
177
+
144
178
  // dist/useCases/LogoutUser.js
145
179
  var require_LogoutUser = __commonJS({
146
180
  "dist/useCases/LogoutUser.js"(exports, module) {
@@ -7009,6 +7043,40 @@ var require_UpdateIssue = __commonJS({
7009
7043
  }
7010
7044
  });
7011
7045
 
7046
+ // dist/useCases/BulkUpdateIssue.js
7047
+ var require_BulkUpdateIssue = __commonJS({
7048
+ "dist/useCases/BulkUpdateIssue.js"(exports, module) {
7049
+ module.exports = /* @__PURE__ */ __name(function BulkUpdateIssue(requestData = { data: null, query: null, headers: null }, httpConfigOptions = {}) {
7050
+ if (!requestData) requestData = {};
7051
+ const pathParams = null;
7052
+ const { data, query, headers } = requestData;
7053
+ let url = "/issues";
7054
+ if (pathParams && data) {
7055
+ for (const param of pathParams) {
7056
+ const paramName = param.replace(":", "");
7057
+ url = url.replace(param, data[paramName]);
7058
+ }
7059
+ }
7060
+ if (url.match(/:[a-zA-Z0-9]+/g)) {
7061
+ const missingParams = url.match(/:[a-zA-Z0-9]+/g);
7062
+ const missing = missingParams.map((param) => param.replace(":", ""));
7063
+ return Promise.reject(
7064
+ new Error("Missing parameters: " + missing.join(", "))
7065
+ );
7066
+ }
7067
+ const config = {
7068
+ method: "put",
7069
+ url,
7070
+ ...httpConfigOptions
7071
+ };
7072
+ if (data) config.data = data;
7073
+ if (query) config.params = query;
7074
+ if (headers) config.headers = headers;
7075
+ return this._http.request(config);
7076
+ }, "BulkUpdateIssue");
7077
+ }
7078
+ });
7079
+
7012
7080
  // node_modules/events/events.js
7013
7081
  var require_events = __commonJS({
7014
7082
  "node_modules/events/events.js"(exports, module) {
@@ -9060,36 +9128,37 @@ var require_axios = __commonJS({
9060
9128
  }, "dispatchXhrRequest"));
9061
9129
  };
9062
9130
  var composeSignals = /* @__PURE__ */ __name((signals, timeout) => {
9063
- let controller = new AbortController();
9064
- let aborted;
9065
- const onabort = /* @__PURE__ */ __name(function(cancel) {
9066
- if (!aborted) {
9067
- aborted = true;
9068
- unsubscribe();
9069
- const err = cancel instanceof Error ? cancel : this.reason;
9070
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
9071
- }
9072
- }, "onabort");
9073
- let timer = timeout && setTimeout(() => {
9074
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
9075
- }, timeout);
9076
- const unsubscribe = /* @__PURE__ */ __name(() => {
9077
- if (signals) {
9078
- timer && clearTimeout(timer);
9131
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
9132
+ if (timeout || length) {
9133
+ let controller = new AbortController();
9134
+ let aborted;
9135
+ const onabort = /* @__PURE__ */ __name(function(reason) {
9136
+ if (!aborted) {
9137
+ aborted = true;
9138
+ unsubscribe();
9139
+ const err = reason instanceof Error ? reason : this.reason;
9140
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
9141
+ }
9142
+ }, "onabort");
9143
+ let timer = timeout && setTimeout(() => {
9079
9144
  timer = null;
9080
- signals.forEach((signal2) => {
9081
- signal2 && (signal2.removeEventListener ? signal2.removeEventListener("abort", onabort) : signal2.unsubscribe(onabort));
9082
- });
9083
- signals = null;
9084
- }
9085
- }, "unsubscribe");
9086
- signals.forEach((signal2) => signal2 && signal2.addEventListener && signal2.addEventListener("abort", onabort));
9087
- const { signal } = controller;
9088
- signal.unsubscribe = unsubscribe;
9089
- return [signal, () => {
9090
- timer && clearTimeout(timer);
9091
- timer = null;
9092
- }];
9145
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
9146
+ }, timeout);
9147
+ const unsubscribe = /* @__PURE__ */ __name(() => {
9148
+ if (signals) {
9149
+ timer && clearTimeout(timer);
9150
+ timer = null;
9151
+ signals.forEach((signal2) => {
9152
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
9153
+ });
9154
+ signals = null;
9155
+ }
9156
+ }, "unsubscribe");
9157
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
9158
+ const { signal } = controller;
9159
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
9160
+ return signal;
9161
+ }
9093
9162
  }, "composeSignals");
9094
9163
  var composeSignals$1 = composeSignals;
9095
9164
  var streamChunk = /* @__PURE__ */ __name(function* (chunk, chunkSize) {
@@ -9106,13 +9175,31 @@ var require_axios = __commonJS({
9106
9175
  pos = end;
9107
9176
  }
9108
9177
  }, "streamChunk");
9109
- var readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize, encode2) {
9110
- for await (const chunk of iterable) {
9111
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : await encode2(String(chunk)), chunkSize);
9178
+ var readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize) {
9179
+ for await (const chunk of readStream(iterable)) {
9180
+ yield* streamChunk(chunk, chunkSize);
9112
9181
  }
9113
9182
  }, "readBytes");
9114
- var trackStream = /* @__PURE__ */ __name((stream, chunkSize, onProgress, onFinish, encode2) => {
9115
- const iterator = readBytes(stream, chunkSize, encode2);
9183
+ var readStream = /* @__PURE__ */ __name(async function* (stream) {
9184
+ if (stream[Symbol.asyncIterator]) {
9185
+ yield* stream;
9186
+ return;
9187
+ }
9188
+ const reader = stream.getReader();
9189
+ try {
9190
+ for (; ; ) {
9191
+ const { done, value } = await reader.read();
9192
+ if (done) {
9193
+ break;
9194
+ }
9195
+ yield value;
9196
+ }
9197
+ } finally {
9198
+ await reader.cancel();
9199
+ }
9200
+ }, "readStream");
9201
+ var trackStream = /* @__PURE__ */ __name((stream, chunkSize, onProgress, onFinish) => {
9202
+ const iterator = readBytes(stream, chunkSize);
9116
9203
  let bytes = 0;
9117
9204
  let done;
9118
9205
  let _onFinish = /* @__PURE__ */ __name((e) => {
@@ -9191,7 +9278,11 @@ var require_axios = __commonJS({
9191
9278
  return body.size;
9192
9279
  }
9193
9280
  if (utils$1.isSpecCompliantForm(body)) {
9194
- return (await new Request(body).arrayBuffer()).byteLength;
9281
+ const _request = new Request(platform.origin, {
9282
+ method: "POST",
9283
+ body
9284
+ });
9285
+ return (await _request.arrayBuffer()).byteLength;
9195
9286
  }
9196
9287
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
9197
9288
  return body.byteLength;
@@ -9223,14 +9314,11 @@ var require_axios = __commonJS({
9223
9314
  fetchOptions
9224
9315
  } = resolveConfig(config);
9225
9316
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
9226
- let [composedSignal, stopTimeout] = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [];
9227
- let finished, request;
9228
- const onFinish = /* @__PURE__ */ __name(() => {
9229
- !finished && setTimeout(() => {
9230
- composedSignal && composedSignal.unsubscribe();
9231
- });
9232
- finished = true;
9233
- }, "onFinish");
9317
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
9318
+ let request;
9319
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
9320
+ composedSignal.unsubscribe();
9321
+ });
9234
9322
  let requestContentLength;
9235
9323
  try {
9236
9324
  if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
@@ -9248,7 +9336,7 @@ var require_axios = __commonJS({
9248
9336
  requestContentLength,
9249
9337
  progressEventReducer(asyncDecorator(onUploadProgress))
9250
9338
  );
9251
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
9339
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
9252
9340
  }
9253
9341
  }
9254
9342
  if (!utils$1.isString(withCredentials)) {
@@ -9266,7 +9354,7 @@ var require_axios = __commonJS({
9266
9354
  });
9267
9355
  let response = await fetch(request);
9268
9356
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
9269
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
9357
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
9270
9358
  const options = {};
9271
9359
  ["status", "statusText", "headers"].forEach((prop) => {
9272
9360
  options[prop] = response[prop];
@@ -9279,15 +9367,14 @@ var require_axios = __commonJS({
9279
9367
  response = new Response(
9280
9368
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
9281
9369
  flush && flush();
9282
- isStreamResponse && onFinish();
9283
- }, encodeText),
9370
+ unsubscribe && unsubscribe();
9371
+ }),
9284
9372
  options
9285
9373
  );
9286
9374
  }
9287
9375
  responseType = responseType || "text";
9288
9376
  let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
9289
- !isStreamResponse && onFinish();
9290
- stopTimeout && stopTimeout();
9377
+ !isStreamResponse && unsubscribe && unsubscribe();
9291
9378
  return await new Promise((resolve, reject) => {
9292
9379
  settle(resolve, reject, {
9293
9380
  data: responseData,
@@ -9299,7 +9386,7 @@ var require_axios = __commonJS({
9299
9386
  });
9300
9387
  });
9301
9388
  } catch (err) {
9302
- onFinish();
9389
+ unsubscribe && unsubscribe();
9303
9390
  if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
9304
9391
  throw Object.assign(
9305
9392
  new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
@@ -9408,7 +9495,7 @@ var require_axios = __commonJS({
9408
9495
  }, "onAdapterRejection"));
9409
9496
  }
9410
9497
  __name(dispatchRequest, "dispatchRequest");
9411
- var VERSION = "1.7.5";
9498
+ var VERSION = "1.7.7";
9412
9499
  var validators$1 = {};
9413
9500
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
9414
9501
  validators$1[type] = /* @__PURE__ */ __name(function validator2(thing) {
@@ -9706,6 +9793,15 @@ var require_axios = __commonJS({
9706
9793
  this._listeners.splice(index, 1);
9707
9794
  }
9708
9795
  }
9796
+ toAbortSignal() {
9797
+ const controller = new AbortController();
9798
+ const abort = /* @__PURE__ */ __name((err) => {
9799
+ controller.abort(err);
9800
+ }, "abort");
9801
+ this.subscribe(abort);
9802
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
9803
+ return controller.signal;
9804
+ }
9709
9805
  /**
9710
9806
  * Returns an object that contains a new `CancelToken` and a function that, when called,
9711
9807
  * cancels the `CancelToken`.
@@ -9843,6 +9939,7 @@ var require_Client = __commonJS({
9843
9939
  var RefreshToken = require_RefreshToken();
9844
9940
  var LoginFinish = require_LoginFinish();
9845
9941
  var RequestLoginToken = require_RequestLoginToken();
9942
+ var LogoutSelf = require_LogoutSelf();
9846
9943
  var LogoutUser = require_LogoutUser();
9847
9944
  var StartRegisterPasskey = require_StartRegisterPasskey();
9848
9945
  var FinishRegisterPasskey = require_FinishRegisterPasskey();
@@ -10045,6 +10142,7 @@ var require_Client = __commonJS({
10045
10142
  var DeleteIssue = require_DeleteIssue();
10046
10143
  var CreateIssue = require_CreateIssue();
10047
10144
  var UpdateIssue = require_UpdateIssue();
10145
+ var BulkUpdateIssue = require_BulkUpdateIssue();
10048
10146
  var { EventEmitter } = require_events();
10049
10147
  var axios = require_axios();
10050
10148
  var KohostApiClient = class _KohostApiClient extends EventEmitter {
@@ -10114,6 +10212,10 @@ var require_Client = __commonJS({
10114
10212
  const key = _KohostApiClient.defs.organizationHeader;
10115
10213
  this._http.defaults.headers.common[key] = orgId;
10116
10214
  }
10215
+ get organizationId() {
10216
+ const key = _KohostApiClient.defs.organizationHeader;
10217
+ return this._http.defaults.headers.common[key];
10218
+ }
10117
10219
  /**
10118
10220
  * @param {string} propertyId
10119
10221
  * @returns {void}
@@ -10125,6 +10227,10 @@ var require_Client = __commonJS({
10125
10227
  const key = _KohostApiClient.defs.propertyHeader;
10126
10228
  this._http.defaults.headers.common[key] = propertyId;
10127
10229
  }
10230
+ get propertyId() {
10231
+ const key = _KohostApiClient.defs.propertyHeader;
10232
+ return this._http.defaults.headers.common[key];
10233
+ }
10128
10234
  static get defs() {
10129
10235
  return {
10130
10236
  apiKeyHeader: "X-Api-Key",
@@ -10195,6 +10301,7 @@ var require_Client = __commonJS({
10195
10301
  KohostApiClient.prototype.RefreshToken = RefreshToken;
10196
10302
  KohostApiClient.prototype.LoginFinish = LoginFinish;
10197
10303
  KohostApiClient.prototype.RequestLoginToken = RequestLoginToken;
10304
+ KohostApiClient.prototype.LogoutSelf = LogoutSelf;
10198
10305
  KohostApiClient.prototype.LogoutUser = LogoutUser;
10199
10306
  KohostApiClient.prototype.StartRegisterPasskey = StartRegisterPasskey;
10200
10307
  KohostApiClient.prototype.FinishRegisterPasskey = FinishRegisterPasskey;
@@ -10397,6 +10504,7 @@ var require_Client = __commonJS({
10397
10504
  KohostApiClient.prototype.DeleteIssue = DeleteIssue;
10398
10505
  KohostApiClient.prototype.CreateIssue = CreateIssue;
10399
10506
  KohostApiClient.prototype.UpdateIssue = UpdateIssue;
10507
+ KohostApiClient.prototype.BulkUpdateIssue = BulkUpdateIssue;
10400
10508
  module.exports = KohostApiClient;
10401
10509
  }
10402
10510
  });