@teamlearners/clawops 0.32.0 → 0.33.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.cjs CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var chunkHKXRJRAW_cjs = require('./chunk-HKXRJRAW.cjs');
5
+ var chunkZCUZCZTF_cjs = require('./chunk-ZCUZCZTF.cjs');
6
+ var chunkTVDUOKJD_cjs = require('./chunk-TVDUOKJD.cjs');
6
7
  var zod = require('zod');
7
8
  var crypto = require('crypto');
8
9
 
@@ -13,11 +14,11 @@ function validateBaseUrl(url) {
13
14
  try {
14
15
  parsed = new URL(url);
15
16
  } catch {
16
- throw new chunkHKXRJRAW_cjs.ClawOpsError(`Invalid base_url: ${url}`);
17
+ throw new chunkTVDUOKJD_cjs.ClawOpsError(`Invalid base_url: ${url}`);
17
18
  }
18
19
  if (parsed.protocol === "https:") return url;
19
20
  if (parsed.protocol === "http:" && LOCALHOST_HOSTS.has(parsed.hostname)) return url;
20
- throw new chunkHKXRJRAW_cjs.ClawOpsError(
21
+ throw new chunkTVDUOKJD_cjs.ClawOpsError(
21
22
  `base_url\uC740 HTTPS\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4 (\uBC1B\uC740 \uAC12: '${url}'). \uB85C\uCEEC \uAC1C\uBC1C \uC2DC\uC5D0\uB294 http://localhost\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`
22
23
  );
23
24
  }
@@ -30,9 +31,9 @@ var APIClient = class {
30
31
  _defaultHeaders;
31
32
  constructor(options) {
32
33
  this._apiKey = options.apiKey;
33
- this._baseURL = validateBaseUrl((options.baseURL ?? chunkHKXRJRAW_cjs.DEFAULT_BASE_URL).replace(/\/+$/, ""));
34
- this._maxRetries = options.maxRetries ?? chunkHKXRJRAW_cjs.DEFAULT_MAX_RETRIES;
35
- this._timeout = options.timeout ?? chunkHKXRJRAW_cjs.DEFAULT_TIMEOUT;
34
+ this._baseURL = validateBaseUrl((options.baseURL ?? chunkZCUZCZTF_cjs.DEFAULT_BASE_URL).replace(/\/+$/, ""));
35
+ this._maxRetries = options.maxRetries ?? chunkZCUZCZTF_cjs.DEFAULT_MAX_RETRIES;
36
+ this._timeout = options.timeout ?? chunkZCUZCZTF_cjs.DEFAULT_TIMEOUT;
36
37
  this._fetch = options.fetch ?? globalThis.fetch;
37
38
  this._defaultHeaders = options.defaultHeaders ?? {};
38
39
  }
@@ -41,7 +42,7 @@ var APIClient = class {
41
42
  Authorization: `Bearer ${this._apiKey}`,
42
43
  "Content-Type": "application/json",
43
44
  Accept: "application/json",
44
- "User-Agent": `claw-ops-node/${chunkHKXRJRAW_cjs.VERSION}`,
45
+ "User-Agent": `claw-ops-node/${chunkZCUZCZTF_cjs.VERSION}`,
45
46
  ...this._defaultHeaders
46
47
  };
47
48
  if (extra) Object.assign(headers, extra);
@@ -77,14 +78,14 @@ var APIClient = class {
77
78
  await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
78
79
  continue;
79
80
  }
80
- throw new chunkHKXRJRAW_cjs.APITimeoutError({ method: method2, url });
81
+ throw new chunkTVDUOKJD_cjs.APITimeoutError({ method: method2, url });
81
82
  }
82
83
  if (retriesLeft > 0) {
83
84
  retriesLeft--;
84
85
  await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
85
86
  continue;
86
87
  }
87
- throw new chunkHKXRJRAW_cjs.APIConnectionError({ method: method2, url });
88
+ throw new chunkTVDUOKJD_cjs.APIConnectionError({ method: method2, url });
88
89
  } finally {
89
90
  clearTimeout(timeoutId);
90
91
  }
@@ -100,7 +101,7 @@ var APIClient = class {
100
101
  } catch {
101
102
  body = null;
102
103
  }
103
- throw chunkHKXRJRAW_cjs.makeStatusError(response.status, body, response.headers, { method: method2, url });
104
+ throw chunkTVDUOKJD_cjs.makeStatusError(response.status, body, response.headers, { method: method2, url });
104
105
  }
105
106
  }
106
107
  async _request(method2, path, options = {}) {
@@ -111,11 +112,11 @@ var APIClient = class {
111
112
  try {
112
113
  json = await response.json();
113
114
  } catch {
114
- throw new chunkHKXRJRAW_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
115
+ throw new chunkTVDUOKJD_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
115
116
  }
116
117
  const parsed = options.castTo.safeParse(json);
117
118
  if (!parsed.success) {
118
- throw new chunkHKXRJRAW_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
119
+ throw new chunkTVDUOKJD_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
119
120
  }
120
121
  return parsed.data;
121
122
  }
@@ -123,7 +124,7 @@ var APIClient = class {
123
124
  return status === 408 || status === 409 || status === 429 || status >= 500;
124
125
  }
125
126
  _retryDelay(retriesTaken) {
126
- const delay = Math.min(chunkHKXRJRAW_cjs.INITIAL_RETRY_DELAY * 2 ** retriesTaken, chunkHKXRJRAW_cjs.MAX_RETRY_DELAY);
127
+ const delay = Math.min(chunkZCUZCZTF_cjs.INITIAL_RETRY_DELAY * 2 ** retriesTaken, chunkZCUZCZTF_cjs.MAX_RETRY_DELAY);
127
128
  return delay * (1 + Math.random());
128
129
  }
129
130
  _sleep(ms) {
@@ -648,7 +649,8 @@ var Messages = class extends APIResource {
648
649
  Body: params.body,
649
650
  Type: params.type,
650
651
  Subject: params.subject,
651
- MediaUrl: params.mediaUrl
652
+ MediaUrl: params.mediaUrl,
653
+ IdempotencyKey: params.idempotencyKey
652
654
  });
653
655
  return this._client._post(`${this._basePath}/messages`, {
654
656
  body,
@@ -957,7 +959,7 @@ var AccountContext = class {
957
959
  return new BlockedRecipients(this._client, this._accountId);
958
960
  }
959
961
  };
960
- var WebhookVerificationError = class extends chunkHKXRJRAW_cjs.ClawOpsError {
962
+ var WebhookVerificationError = class extends chunkTVDUOKJD_cjs.ClawOpsError {
961
963
  constructor(message = "Webhook \uC11C\uBA85\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.") {
962
964
  super(message);
963
965
  this.name = "WebhookVerificationError";
@@ -987,13 +989,13 @@ var ClawOps = class extends APIClient {
987
989
  constructor(options = {}) {
988
990
  let apiKey = options.apiKey ?? process.env.CLAWOPS_API_KEY;
989
991
  if (!apiKey) {
990
- throw new chunkHKXRJRAW_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
992
+ throw new chunkTVDUOKJD_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
991
993
  }
992
994
  let accountId = options.accountId ?? process.env.CLAWOPS_ACCOUNT_ID;
993
995
  if (!accountId) {
994
- throw new chunkHKXRJRAW_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
996
+ throw new chunkTVDUOKJD_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
995
997
  }
996
- const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ?? chunkHKXRJRAW_cjs.DEFAULT_BASE_URL;
998
+ const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ?? chunkZCUZCZTF_cjs.DEFAULT_BASE_URL;
997
999
  super({
998
1000
  apiKey,
999
1001
  baseURL,
@@ -1042,77 +1044,81 @@ var ClawOps = class extends APIClient {
1042
1044
  // src/client-default.ts
1043
1045
  var client_default_default = ClawOps;
1044
1046
 
1047
+ Object.defineProperty(exports, "VERSION", {
1048
+ enumerable: true,
1049
+ get: function () { return chunkZCUZCZTF_cjs.VERSION; }
1050
+ });
1045
1051
  Object.defineProperty(exports, "APIConnectionError", {
1046
1052
  enumerable: true,
1047
- get: function () { return chunkHKXRJRAW_cjs.APIConnectionError; }
1053
+ get: function () { return chunkTVDUOKJD_cjs.APIConnectionError; }
1048
1054
  });
1049
1055
  Object.defineProperty(exports, "APIError", {
1050
1056
  enumerable: true,
1051
- get: function () { return chunkHKXRJRAW_cjs.APIError; }
1057
+ get: function () { return chunkTVDUOKJD_cjs.APIError; }
1052
1058
  });
1053
1059
  Object.defineProperty(exports, "APIResponseValidationError", {
1054
1060
  enumerable: true,
1055
- get: function () { return chunkHKXRJRAW_cjs.APIResponseValidationError; }
1061
+ get: function () { return chunkTVDUOKJD_cjs.APIResponseValidationError; }
1056
1062
  });
1057
1063
  Object.defineProperty(exports, "APIStatusError", {
1058
1064
  enumerable: true,
1059
- get: function () { return chunkHKXRJRAW_cjs.APIStatusError; }
1065
+ get: function () { return chunkTVDUOKJD_cjs.APIStatusError; }
1060
1066
  });
1061
1067
  Object.defineProperty(exports, "APITimeoutError", {
1062
1068
  enumerable: true,
1063
- get: function () { return chunkHKXRJRAW_cjs.APITimeoutError; }
1069
+ get: function () { return chunkTVDUOKJD_cjs.APITimeoutError; }
1064
1070
  });
1065
1071
  Object.defineProperty(exports, "AgentConnectionError", {
1066
1072
  enumerable: true,
1067
- get: function () { return chunkHKXRJRAW_cjs.AgentConnectionError; }
1073
+ get: function () { return chunkTVDUOKJD_cjs.AgentConnectionError; }
1068
1074
  });
1069
1075
  Object.defineProperty(exports, "AgentError", {
1070
1076
  enumerable: true,
1071
- get: function () { return chunkHKXRJRAW_cjs.AgentError; }
1077
+ get: function () { return chunkTVDUOKJD_cjs.AgentError; }
1072
1078
  });
1073
1079
  Object.defineProperty(exports, "AuthenticationError", {
1074
1080
  enumerable: true,
1075
- get: function () { return chunkHKXRJRAW_cjs.AuthenticationError; }
1081
+ get: function () { return chunkTVDUOKJD_cjs.AuthenticationError; }
1076
1082
  });
1077
1083
  Object.defineProperty(exports, "BadRequestError", {
1078
1084
  enumerable: true,
1079
- get: function () { return chunkHKXRJRAW_cjs.BadRequestError; }
1085
+ get: function () { return chunkTVDUOKJD_cjs.BadRequestError; }
1080
1086
  });
1081
1087
  Object.defineProperty(exports, "ClawOpsError", {
1082
1088
  enumerable: true,
1083
- get: function () { return chunkHKXRJRAW_cjs.ClawOpsError; }
1089
+ get: function () { return chunkTVDUOKJD_cjs.ClawOpsError; }
1084
1090
  });
1085
1091
  Object.defineProperty(exports, "ConflictError", {
1086
1092
  enumerable: true,
1087
- get: function () { return chunkHKXRJRAW_cjs.ConflictError; }
1093
+ get: function () { return chunkTVDUOKJD_cjs.ConflictError; }
1088
1094
  });
1089
1095
  Object.defineProperty(exports, "InternalServerError", {
1090
1096
  enumerable: true,
1091
- get: function () { return chunkHKXRJRAW_cjs.InternalServerError; }
1097
+ get: function () { return chunkTVDUOKJD_cjs.InternalServerError; }
1092
1098
  });
1093
1099
  Object.defineProperty(exports, "NotFoundError", {
1094
1100
  enumerable: true,
1095
- get: function () { return chunkHKXRJRAW_cjs.NotFoundError; }
1101
+ get: function () { return chunkTVDUOKJD_cjs.NotFoundError; }
1096
1102
  });
1097
1103
  Object.defineProperty(exports, "PermissionDeniedError", {
1098
1104
  enumerable: true,
1099
- get: function () { return chunkHKXRJRAW_cjs.PermissionDeniedError; }
1105
+ get: function () { return chunkTVDUOKJD_cjs.PermissionDeniedError; }
1100
1106
  });
1101
1107
  Object.defineProperty(exports, "RateLimitError", {
1102
1108
  enumerable: true,
1103
- get: function () { return chunkHKXRJRAW_cjs.RateLimitError; }
1109
+ get: function () { return chunkTVDUOKJD_cjs.RateLimitError; }
1104
1110
  });
1105
1111
  Object.defineProperty(exports, "ServiceUnavailableError", {
1106
1112
  enumerable: true,
1107
- get: function () { return chunkHKXRJRAW_cjs.ServiceUnavailableError; }
1113
+ get: function () { return chunkTVDUOKJD_cjs.ServiceUnavailableError; }
1108
1114
  });
1109
- Object.defineProperty(exports, "UnprocessableEntityError", {
1115
+ Object.defineProperty(exports, "SolapiBridgeError", {
1110
1116
  enumerable: true,
1111
- get: function () { return chunkHKXRJRAW_cjs.UnprocessableEntityError; }
1117
+ get: function () { return chunkTVDUOKJD_cjs.SolapiBridgeError; }
1112
1118
  });
1113
- Object.defineProperty(exports, "VERSION", {
1119
+ Object.defineProperty(exports, "UnprocessableEntityError", {
1114
1120
  enumerable: true,
1115
- get: function () { return chunkHKXRJRAW_cjs.VERSION; }
1121
+ get: function () { return chunkTVDUOKJD_cjs.UnprocessableEntityError; }
1116
1122
  });
1117
1123
  exports.APIClient = APIClient;
1118
1124
  exports.AccountContext = AccountContext;