@proteos/sdk 0.49.0 → 0.50.1
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 +111 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -2
- package/dist/index.d.ts +327 -2
- package/dist/index.js +111 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +6 -0
- package/src/conversation/index.ts +177 -9
- package/src/conversation/types.ts +290 -0
- package/src/errors.ts +20 -3
- package/src/index.ts +49 -17
- package/src/workflow/types.ts +2 -0
package/dist/index.cjs
CHANGED
|
@@ -532,11 +532,18 @@ var ProteosError = class extends Error {
|
|
|
532
532
|
httpStatus;
|
|
533
533
|
/** API error code (e.g., 'not_found', 'unauthorized') */
|
|
534
534
|
code;
|
|
535
|
-
|
|
535
|
+
/**
|
|
536
|
+
* Optional machine-readable payload beside the message — e.g. a denied send's
|
|
537
|
+
* `earliest_allowed_at` / `rule_id`, the offending `contact_id`. Absent on
|
|
538
|
+
* most errors.
|
|
539
|
+
*/
|
|
540
|
+
details;
|
|
541
|
+
constructor(message, httpStatus, code, details) {
|
|
536
542
|
super(message);
|
|
537
543
|
this.name = "ProteosError";
|
|
538
544
|
this.httpStatus = httpStatus;
|
|
539
545
|
this.code = code;
|
|
546
|
+
this.details = details;
|
|
540
547
|
const v8Capture = Error.captureStackTrace;
|
|
541
548
|
if (v8Capture) v8Capture(this, this.constructor);
|
|
542
549
|
}
|
|
@@ -585,6 +592,7 @@ async function parseErrorResponse(response) {
|
|
|
585
592
|
const httpStatus = response.status;
|
|
586
593
|
let code = getDefaultErrorCode(httpStatus);
|
|
587
594
|
let message = "Unknown error";
|
|
595
|
+
let details;
|
|
588
596
|
try {
|
|
589
597
|
const body = await response.text();
|
|
590
598
|
try {
|
|
@@ -597,13 +605,16 @@ async function parseErrorResponse(response) {
|
|
|
597
605
|
} else {
|
|
598
606
|
message = body || `HTTP ${httpStatus}`;
|
|
599
607
|
}
|
|
608
|
+
if (json.details && typeof json.details === "object") {
|
|
609
|
+
details = json.details;
|
|
610
|
+
}
|
|
600
611
|
} catch {
|
|
601
612
|
message = body.trim() || `HTTP ${httpStatus}`;
|
|
602
613
|
}
|
|
603
614
|
} catch {
|
|
604
615
|
message = `HTTP ${httpStatus}`;
|
|
605
616
|
}
|
|
606
|
-
return new ProteosError(message, httpStatus, code);
|
|
617
|
+
return new ProteosError(message, httpStatus, code, details);
|
|
607
618
|
}
|
|
608
619
|
|
|
609
620
|
// src/auth/shares.ts
|
|
@@ -867,6 +878,12 @@ var PLATFORM_ENTITIES = [
|
|
|
867
878
|
{ slug: "contact-groups", name: "Contact Groups" },
|
|
868
879
|
// Tone-of-voice synthesis: per-user setups + generated instruction profiles.
|
|
869
880
|
{ slug: "tone-profiles", name: "Tone Profiles" },
|
|
881
|
+
// Outbound send constraints (windows, connection limits, frequency caps) +
|
|
882
|
+
// their preset catalog.
|
|
883
|
+
{ slug: "sending-rules", name: "Sending Rules" },
|
|
884
|
+
// The channel_action ledger: acts through a connection that are neither a
|
|
885
|
+
// message nor a reaction (LinkedIn invitations, profile visits, InMail).
|
|
886
|
+
{ slug: "channel-actions", name: "Channel Actions" },
|
|
870
887
|
// Connectors (connector-service). `connections` above is shared; this is the
|
|
871
888
|
// manifest catalog.
|
|
872
889
|
{ slug: "connectors", name: "Connectors" }
|
|
@@ -1501,6 +1518,13 @@ var ConversationClient = class {
|
|
|
1501
1518
|
agentListeners;
|
|
1502
1519
|
/** Ingest-time filter rules (drop-with-audit) + their event trail. */
|
|
1503
1520
|
conversationFilters;
|
|
1521
|
+
/** Outbound send constraints: windows, connection limits, frequency caps + presets. */
|
|
1522
|
+
sendingRules;
|
|
1523
|
+
/**
|
|
1524
|
+
* Channel actions: acts performed through a connection that are neither a
|
|
1525
|
+
* message nor a reaction — LinkedIn invitations, profile visits, InMail.
|
|
1526
|
+
*/
|
|
1527
|
+
channelActions;
|
|
1504
1528
|
/** Per-org glossary: custom vocabulary that boosts transcription accuracy. */
|
|
1505
1529
|
glossaryTerms;
|
|
1506
1530
|
/** Conversation taxonomy: the types the pre-summary classifier assigns. */
|
|
@@ -1524,6 +1548,8 @@ var ConversationClient = class {
|
|
|
1524
1548
|
this.messages = new MessageServiceImpl(client);
|
|
1525
1549
|
this.agentListeners = new AgentListenerServiceImpl(client);
|
|
1526
1550
|
this.conversationFilters = new ConversationFilterServiceImpl(client);
|
|
1551
|
+
this.sendingRules = new SendingRuleServiceImpl(client);
|
|
1552
|
+
this.channelActions = new ChannelActionServiceImpl(client);
|
|
1527
1553
|
this.glossaryTerms = new GlossaryTermServiceImpl(client);
|
|
1528
1554
|
this.conversationTypes = new ConversationTypeServiceImpl(client);
|
|
1529
1555
|
this.contactGroups = new ContactGroupServiceImpl(client);
|
|
@@ -1805,6 +1831,13 @@ var MessageServiceImpl = class {
|
|
|
1805
1831
|
send(request) {
|
|
1806
1832
|
return this.client.request("POST", `${CONVERSATION_BASE_PATH}/messages/send`, request);
|
|
1807
1833
|
}
|
|
1834
|
+
checkSendEligibility(request) {
|
|
1835
|
+
return this.client.request(
|
|
1836
|
+
"POST",
|
|
1837
|
+
`${CONVERSATION_BASE_PATH}/messages/send-eligibility`,
|
|
1838
|
+
request
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1808
1841
|
draft(request) {
|
|
1809
1842
|
return this.client.request("POST", `${CONVERSATION_BASE_PATH}/messages/draft`, request);
|
|
1810
1843
|
}
|
|
@@ -2184,6 +2217,82 @@ var CallServiceImpl = class {
|
|
|
2184
2217
|
);
|
|
2185
2218
|
}
|
|
2186
2219
|
};
|
|
2220
|
+
var SendingRuleServiceImpl = class {
|
|
2221
|
+
constructor(client) {
|
|
2222
|
+
this.client = client;
|
|
2223
|
+
}
|
|
2224
|
+
client;
|
|
2225
|
+
list(query = {}) {
|
|
2226
|
+
return this.client.requestWithQuery("GET", `${CONVERSATION_BASE_PATH}/sending-rules`, query);
|
|
2227
|
+
}
|
|
2228
|
+
get(id) {
|
|
2229
|
+
return this.client.request(
|
|
2230
|
+
"GET",
|
|
2231
|
+
`${CONVERSATION_BASE_PATH}/sending-rules/${encodeURIComponent(id)}`
|
|
2232
|
+
);
|
|
2233
|
+
}
|
|
2234
|
+
create(request) {
|
|
2235
|
+
return this.client.request("POST", `${CONVERSATION_BASE_PATH}/sending-rules`, request);
|
|
2236
|
+
}
|
|
2237
|
+
update(id, request) {
|
|
2238
|
+
return this.client.request(
|
|
2239
|
+
"PATCH",
|
|
2240
|
+
`${CONVERSATION_BASE_PATH}/sending-rules/${encodeURIComponent(id)}`,
|
|
2241
|
+
request
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
async delete(id) {
|
|
2245
|
+
await this.client.request(
|
|
2246
|
+
"DELETE",
|
|
2247
|
+
`${CONVERSATION_BASE_PATH}/sending-rules/${encodeURIComponent(id)}`
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
listPresets(query = {}) {
|
|
2251
|
+
return this.client.requestWithQuery(
|
|
2252
|
+
"GET",
|
|
2253
|
+
`${CONVERSATION_BASE_PATH}/sending-rules/presets`,
|
|
2254
|
+
query
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
applyPreset(request) {
|
|
2258
|
+
return this.client.request(
|
|
2259
|
+
"POST",
|
|
2260
|
+
`${CONVERSATION_BASE_PATH}/sending-rules/apply-preset`,
|
|
2261
|
+
request
|
|
2262
|
+
);
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
var ChannelActionServiceImpl = class {
|
|
2266
|
+
constructor(client) {
|
|
2267
|
+
this.client = client;
|
|
2268
|
+
}
|
|
2269
|
+
client;
|
|
2270
|
+
list(query = {}) {
|
|
2271
|
+
return this.client.requestWithQuery("GET", `${CONVERSATION_BASE_PATH}/channel-actions`, query);
|
|
2272
|
+
}
|
|
2273
|
+
get(id) {
|
|
2274
|
+
return this.client.request(
|
|
2275
|
+
"GET",
|
|
2276
|
+
`${CONVERSATION_BASE_PATH}/channel-actions/${encodeURIComponent(id)}`
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
perform(request) {
|
|
2280
|
+
return this.client.request("POST", `${CONVERSATION_BASE_PATH}/channel-actions`, request);
|
|
2281
|
+
}
|
|
2282
|
+
cancel(id) {
|
|
2283
|
+
return this.client.request(
|
|
2284
|
+
"POST",
|
|
2285
|
+
`${CONVERSATION_BASE_PATH}/channel-actions/${encodeURIComponent(id)}/cancel`
|
|
2286
|
+
);
|
|
2287
|
+
}
|
|
2288
|
+
respond(id, request) {
|
|
2289
|
+
return this.client.request(
|
|
2290
|
+
"POST",
|
|
2291
|
+
`${CONVERSATION_BASE_PATH}/channel-actions/${encodeURIComponent(id)}/respond`,
|
|
2292
|
+
request
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
};
|
|
2187
2296
|
|
|
2188
2297
|
// src/data/queries.ts
|
|
2189
2298
|
var QUERY_BASE_PATH = "/data/v1/query";
|