skedyul 1.5.10 → 1.5.12
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/config/types/channel.d.ts +16 -2
- package/dist/esm/index.mjs +58 -3
- package/dist/estimation/index.d.ts +2 -0
- package/dist/estimation/index.js +151 -0
- package/dist/estimation/index.mjs +116 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +64 -3
- package/dist/schemas.d.ts +105 -10
- package/dist/types/estimation.d.ts +22 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/tool.d.ts +1 -1
- package/package.json +4 -4
|
@@ -13,6 +13,16 @@ import type { FieldVisibility, InlineFieldDefinition } from './model';
|
|
|
13
13
|
* - 'video': Video calls
|
|
14
14
|
*/
|
|
15
15
|
export type CapabilityType = 'messaging' | 'voice' | 'video';
|
|
16
|
+
/**
|
|
17
|
+
* Batch messaging capability: send tool + status poll tool.
|
|
18
|
+
* Prefer this over a bare `send_batch` string when status tracking is supported.
|
|
19
|
+
*/
|
|
20
|
+
export interface ChannelBatchCapability {
|
|
21
|
+
/** Tool that accepts the batch and returns an operationId */
|
|
22
|
+
send: string;
|
|
23
|
+
/** Tool that fetches operation + per-message status by operationId */
|
|
24
|
+
get_status: string;
|
|
25
|
+
}
|
|
16
26
|
/**
|
|
17
27
|
* Capability definition with display info and handler references.
|
|
18
28
|
*/
|
|
@@ -25,8 +35,12 @@ export interface ChannelCapability {
|
|
|
25
35
|
receive?: string;
|
|
26
36
|
/** Outbound tool handle */
|
|
27
37
|
send?: string;
|
|
28
|
-
/**
|
|
29
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Batch outbound capability.
|
|
40
|
+
* - string: send tool only (legacy)
|
|
41
|
+
* - object: send tool + get_status tool for operation tracking
|
|
42
|
+
*/
|
|
43
|
+
send_batch?: string | ChannelBatchCapability;
|
|
30
44
|
}
|
|
31
45
|
/**
|
|
32
46
|
* Field permissions for channel fields.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -64,9 +64,16 @@ var MoneyMinorRangeSchema = z.object({
|
|
|
64
64
|
minorUnitsHigh: z.number().int().nonnegative(),
|
|
65
65
|
minorUnitsExpected: z.number().int().nonnegative().optional()
|
|
66
66
|
});
|
|
67
|
+
var EstimationSkippedBreakdownSchema = z.object({
|
|
68
|
+
missingAddress: z.number().int().nonnegative(),
|
|
69
|
+
optOut: z.number().int().nonnegative(),
|
|
70
|
+
emptyMessage: z.number().int().nonnegative(),
|
|
71
|
+
unavailable: z.number().int().nonnegative()
|
|
72
|
+
});
|
|
67
73
|
var EstimationSchema = z.object({
|
|
68
74
|
deliverableCount: z.number().int().nonnegative(),
|
|
69
75
|
skippedCount: z.number().int().nonnegative().optional(),
|
|
76
|
+
skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
|
|
70
77
|
cost: MoneyMinorRangeSchema.optional()
|
|
71
78
|
});
|
|
72
79
|
function createMoneyMinorRange(params) {
|
|
@@ -81,6 +88,7 @@ function createEstimation(params) {
|
|
|
81
88
|
return {
|
|
82
89
|
deliverableCount: params.deliverableCount,
|
|
83
90
|
...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
|
|
91
|
+
...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
|
|
84
92
|
...params.cost ? { cost: params.cost } : {}
|
|
85
93
|
};
|
|
86
94
|
}
|
|
@@ -110,7 +118,7 @@ function formatMoneyMinorEstimate(range, options) {
|
|
|
110
118
|
style: "currency",
|
|
111
119
|
currency: range.currency
|
|
112
120
|
});
|
|
113
|
-
const maxSpreadRatio = options?.maxSpreadRatio ??
|
|
121
|
+
const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
|
|
114
122
|
const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
|
|
115
123
|
if (spreadRatio > maxSpreadRatio) {
|
|
116
124
|
return formatMoneyMinorRange(range, options?.locale);
|
|
@@ -1303,6 +1311,10 @@ var ChannelCapabilityTypeSchema = z8.enum([
|
|
|
1303
1311
|
"video"
|
|
1304
1312
|
// Video calls (future)
|
|
1305
1313
|
]);
|
|
1314
|
+
var ChannelBatchCapabilitySchema = z8.object({
|
|
1315
|
+
send: z8.string(),
|
|
1316
|
+
get_status: z8.string()
|
|
1317
|
+
});
|
|
1306
1318
|
var ChannelCapabilitySchema = z8.object({
|
|
1307
1319
|
label: z8.string(),
|
|
1308
1320
|
// Display name: "SMS", "WhatsApp Messages"
|
|
@@ -1312,8 +1324,8 @@ var ChannelCapabilitySchema = z8.object({
|
|
|
1312
1324
|
// Inbound webhook handler
|
|
1313
1325
|
send: z8.string().optional(),
|
|
1314
1326
|
// Outbound tool handle
|
|
1315
|
-
send_batch: z8.string().optional()
|
|
1316
|
-
// Batch outbound tool handle
|
|
1327
|
+
send_batch: z8.union([z8.string(), ChannelBatchCapabilitySchema]).optional()
|
|
1328
|
+
// Batch outbound tool handle, or { send, get_status }
|
|
1317
1329
|
});
|
|
1318
1330
|
var ChannelFieldDefinitionSchema = z8.object({
|
|
1319
1331
|
handle: z8.string(),
|
|
@@ -1927,6 +1939,43 @@ var MessageBulkSendOutputSchema = z8.object({
|
|
|
1927
1939
|
acceptedCount: z8.number().int().nonnegative(),
|
|
1928
1940
|
rejectedCount: z8.number().int().nonnegative().optional()
|
|
1929
1941
|
});
|
|
1942
|
+
var MessageBulkStatusMessageSchema = z8.object({
|
|
1943
|
+
address: z8.string(),
|
|
1944
|
+
status: z8.string(),
|
|
1945
|
+
messageId: z8.string().optional(),
|
|
1946
|
+
errorCode: z8.union([z8.string(), z8.number()]).optional(),
|
|
1947
|
+
errorMessage: z8.string().optional()
|
|
1948
|
+
});
|
|
1949
|
+
var MessageBulkStatusStatsSchema = z8.object({
|
|
1950
|
+
total: z8.number().int().nonnegative().optional(),
|
|
1951
|
+
recipients: z8.number().int().nonnegative().optional(),
|
|
1952
|
+
attempts: z8.number().int().nonnegative().optional(),
|
|
1953
|
+
unaddressable: z8.number().int().nonnegative().optional(),
|
|
1954
|
+
queued: z8.number().int().nonnegative().optional(),
|
|
1955
|
+
sent: z8.number().int().nonnegative().optional(),
|
|
1956
|
+
scheduled: z8.number().int().nonnegative().optional(),
|
|
1957
|
+
delivered: z8.number().int().nonnegative().optional(),
|
|
1958
|
+
read: z8.number().int().nonnegative().optional(),
|
|
1959
|
+
undelivered: z8.number().int().nonnegative().optional(),
|
|
1960
|
+
failed: z8.number().int().nonnegative().optional(),
|
|
1961
|
+
canceled: z8.number().int().nonnegative().optional()
|
|
1962
|
+
});
|
|
1963
|
+
var MessageBulkStatusInputSchema = z8.object({
|
|
1964
|
+
channel: MessageSendChannelSchema,
|
|
1965
|
+
operationId: z8.string().min(1)
|
|
1966
|
+
});
|
|
1967
|
+
var MessageBulkStatusOutputSchema = z8.object({
|
|
1968
|
+
operationId: z8.string(),
|
|
1969
|
+
status: z8.string(),
|
|
1970
|
+
complete: z8.boolean(),
|
|
1971
|
+
/**
|
|
1972
|
+
* When true, the provider skipped real delivery (e.g. MOCK_OUTBOUND_MESSAGES).
|
|
1973
|
+
* Core should mark all recipients in the operation as sent without per-message rows.
|
|
1974
|
+
*/
|
|
1975
|
+
mock: z8.boolean().optional(),
|
|
1976
|
+
stats: MessageBulkStatusStatsSchema.optional(),
|
|
1977
|
+
messages: z8.array(MessageBulkStatusMessageSchema)
|
|
1978
|
+
});
|
|
1930
1979
|
function isModelDependency(dep) {
|
|
1931
1980
|
return "model" in dep;
|
|
1932
1981
|
}
|
|
@@ -7688,6 +7737,7 @@ export {
|
|
|
7688
7737
|
CRMSchemaZ,
|
|
7689
7738
|
CardBlockDefinitionSchema,
|
|
7690
7739
|
CardBlockHeaderSchema,
|
|
7740
|
+
ChannelBatchCapabilitySchema,
|
|
7691
7741
|
ChannelCapabilitySchema,
|
|
7692
7742
|
ChannelCapabilityTypeSchema,
|
|
7693
7743
|
ChannelDefinitionSchema,
|
|
@@ -7715,6 +7765,7 @@ export {
|
|
|
7715
7765
|
EnvVariableDefinitionSchema,
|
|
7716
7766
|
EnvVisibilitySchema,
|
|
7717
7767
|
EstimationSchema,
|
|
7768
|
+
EstimationSkippedBreakdownSchema,
|
|
7718
7769
|
EventConditionsSchema,
|
|
7719
7770
|
EventSubscriptionSchema,
|
|
7720
7771
|
EventTypeSchema,
|
|
@@ -7759,6 +7810,10 @@ export {
|
|
|
7759
7810
|
MessageBulkRecipientSchema,
|
|
7760
7811
|
MessageBulkSendInputSchema,
|
|
7761
7812
|
MessageBulkSendOutputSchema,
|
|
7813
|
+
MessageBulkStatusInputSchema,
|
|
7814
|
+
MessageBulkStatusMessageSchema,
|
|
7815
|
+
MessageBulkStatusOutputSchema,
|
|
7816
|
+
MessageBulkStatusStatsSchema,
|
|
7762
7817
|
MessageEventPayloadSchema,
|
|
7763
7818
|
MessageSendAttachmentSchema,
|
|
7764
7819
|
MessageSendChannelSchema,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { MoneyMinorUnits, MoneyMinorRange, Estimation, EstimationSkippedBreakdown, FormatMoneyMinorEstimateOptions, } from '../types/estimation';
|
|
2
|
+
export { MoneyMinorRangeSchema, EstimationSchema, EstimationSkippedBreakdownSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from '../types/estimation';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/estimation/index.ts
|
|
21
|
+
var estimation_exports = {};
|
|
22
|
+
__export(estimation_exports, {
|
|
23
|
+
EstimationSchema: () => EstimationSchema,
|
|
24
|
+
EstimationSkippedBreakdownSchema: () => EstimationSkippedBreakdownSchema,
|
|
25
|
+
MoneyMinorRangeSchema: () => MoneyMinorRangeSchema,
|
|
26
|
+
computeSkewedExpectedMinorUnits: () => computeSkewedExpectedMinorUnits,
|
|
27
|
+
createEstimation: () => createEstimation,
|
|
28
|
+
createMoneyMinorRange: () => createMoneyMinorRange,
|
|
29
|
+
formatMoneyMinorEstimate: () => formatMoneyMinorEstimate,
|
|
30
|
+
formatMoneyMinorRange: () => formatMoneyMinorRange,
|
|
31
|
+
parseEstimationFromBilling: () => parseEstimationFromBilling
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(estimation_exports);
|
|
34
|
+
|
|
35
|
+
// src/types/estimation.ts
|
|
36
|
+
var import_v4 = require("zod/v4");
|
|
37
|
+
var MoneyMinorRangeSchema = import_v4.z.object({
|
|
38
|
+
currency: import_v4.z.string().min(3).max(3),
|
|
39
|
+
minorUnitsLow: import_v4.z.number().int().nonnegative(),
|
|
40
|
+
minorUnitsHigh: import_v4.z.number().int().nonnegative(),
|
|
41
|
+
minorUnitsExpected: import_v4.z.number().int().nonnegative().optional()
|
|
42
|
+
});
|
|
43
|
+
var EstimationSkippedBreakdownSchema = import_v4.z.object({
|
|
44
|
+
missingAddress: import_v4.z.number().int().nonnegative(),
|
|
45
|
+
optOut: import_v4.z.number().int().nonnegative(),
|
|
46
|
+
emptyMessage: import_v4.z.number().int().nonnegative(),
|
|
47
|
+
unavailable: import_v4.z.number().int().nonnegative()
|
|
48
|
+
});
|
|
49
|
+
var EstimationSchema = import_v4.z.object({
|
|
50
|
+
deliverableCount: import_v4.z.number().int().nonnegative(),
|
|
51
|
+
skippedCount: import_v4.z.number().int().nonnegative().optional(),
|
|
52
|
+
skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
|
|
53
|
+
cost: MoneyMinorRangeSchema.optional()
|
|
54
|
+
});
|
|
55
|
+
function createMoneyMinorRange(params) {
|
|
56
|
+
return {
|
|
57
|
+
currency: params.currency,
|
|
58
|
+
minorUnitsLow: params.minorUnitsLow,
|
|
59
|
+
minorUnitsHigh: params.minorUnitsHigh,
|
|
60
|
+
...params.minorUnitsExpected !== void 0 ? { minorUnitsExpected: params.minorUnitsExpected } : {}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createEstimation(params) {
|
|
64
|
+
return {
|
|
65
|
+
deliverableCount: params.deliverableCount,
|
|
66
|
+
...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
|
|
67
|
+
...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
|
|
68
|
+
...params.cost ? { cost: params.cost } : {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function computeSkewedExpectedMinorUnits(range) {
|
|
72
|
+
if (range.minorUnitsExpected !== void 0) {
|
|
73
|
+
return range.minorUnitsExpected;
|
|
74
|
+
}
|
|
75
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
76
|
+
return range.minorUnitsLow;
|
|
77
|
+
}
|
|
78
|
+
return Math.round(0.8 * range.minorUnitsLow + 0.2 * range.minorUnitsHigh);
|
|
79
|
+
}
|
|
80
|
+
function formatMoneyMinorRange(range, locale) {
|
|
81
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
82
|
+
style: "currency",
|
|
83
|
+
currency: range.currency
|
|
84
|
+
});
|
|
85
|
+
const low = formatter.format(range.minorUnitsLow / 100);
|
|
86
|
+
const high = formatter.format(range.minorUnitsHigh / 100);
|
|
87
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
88
|
+
return low;
|
|
89
|
+
}
|
|
90
|
+
return `${low} \u2013 ${high}`;
|
|
91
|
+
}
|
|
92
|
+
function formatMoneyMinorEstimate(range, options) {
|
|
93
|
+
const formatter = new Intl.NumberFormat(options?.locale, {
|
|
94
|
+
style: "currency",
|
|
95
|
+
currency: range.currency
|
|
96
|
+
});
|
|
97
|
+
const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
|
|
98
|
+
const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
|
|
99
|
+
if (spreadRatio > maxSpreadRatio) {
|
|
100
|
+
return formatMoneyMinorRange(range, options?.locale);
|
|
101
|
+
}
|
|
102
|
+
const expectedMinorUnits = options?.expectedMinorUnits ?? computeSkewedExpectedMinorUnits(range);
|
|
103
|
+
const expected = formatter.format(expectedMinorUnits / 100);
|
|
104
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
105
|
+
return expected;
|
|
106
|
+
}
|
|
107
|
+
return `~${expected}`;
|
|
108
|
+
}
|
|
109
|
+
function parseEstimationFromBilling(billing) {
|
|
110
|
+
if (!billing || typeof billing !== "object") {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
const record = billing;
|
|
114
|
+
const nested = record.estimation;
|
|
115
|
+
if (nested && typeof nested === "object") {
|
|
116
|
+
const parsed = EstimationSchema.safeParse(nested);
|
|
117
|
+
if (parsed.success) {
|
|
118
|
+
return parsed.data;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const currency = typeof record.currency === "string" && record.currency.trim() !== "" ? record.currency : void 0;
|
|
122
|
+
const minorUnitsLow = typeof record.minorUnitsLow === "number" ? record.minorUnitsLow : typeof record.costCentsLow === "number" ? record.costCentsLow : void 0;
|
|
123
|
+
const minorUnitsHigh = typeof record.minorUnitsHigh === "number" ? record.minorUnitsHigh : typeof record.costCentsHigh === "number" ? record.costCentsHigh : void 0;
|
|
124
|
+
const minorUnitsExpected = typeof record.minorUnitsExpected === "number" ? record.minorUnitsExpected : typeof record.costCentsExpected === "number" ? record.costCentsExpected : void 0;
|
|
125
|
+
const deliverableCount = typeof record.deliverableCount === "number" ? record.deliverableCount : void 0;
|
|
126
|
+
if (deliverableCount === void 0 || minorUnitsLow === void 0 || minorUnitsHigh === void 0 || !currency) {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
return createEstimation({
|
|
130
|
+
deliverableCount,
|
|
131
|
+
skippedCount: typeof record.skippedCount === "number" ? record.skippedCount : void 0,
|
|
132
|
+
cost: createMoneyMinorRange({
|
|
133
|
+
currency,
|
|
134
|
+
minorUnitsLow,
|
|
135
|
+
minorUnitsHigh,
|
|
136
|
+
...minorUnitsExpected !== void 0 ? { minorUnitsExpected } : {}
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
EstimationSchema,
|
|
143
|
+
EstimationSkippedBreakdownSchema,
|
|
144
|
+
MoneyMinorRangeSchema,
|
|
145
|
+
computeSkewedExpectedMinorUnits,
|
|
146
|
+
createEstimation,
|
|
147
|
+
createMoneyMinorRange,
|
|
148
|
+
formatMoneyMinorEstimate,
|
|
149
|
+
formatMoneyMinorRange,
|
|
150
|
+
parseEstimationFromBilling
|
|
151
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// src/types/estimation.ts
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
var MoneyMinorRangeSchema = z.object({
|
|
4
|
+
currency: z.string().min(3).max(3),
|
|
5
|
+
minorUnitsLow: z.number().int().nonnegative(),
|
|
6
|
+
minorUnitsHigh: z.number().int().nonnegative(),
|
|
7
|
+
minorUnitsExpected: z.number().int().nonnegative().optional()
|
|
8
|
+
});
|
|
9
|
+
var EstimationSkippedBreakdownSchema = z.object({
|
|
10
|
+
missingAddress: z.number().int().nonnegative(),
|
|
11
|
+
optOut: z.number().int().nonnegative(),
|
|
12
|
+
emptyMessage: z.number().int().nonnegative(),
|
|
13
|
+
unavailable: z.number().int().nonnegative()
|
|
14
|
+
});
|
|
15
|
+
var EstimationSchema = z.object({
|
|
16
|
+
deliverableCount: z.number().int().nonnegative(),
|
|
17
|
+
skippedCount: z.number().int().nonnegative().optional(),
|
|
18
|
+
skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
|
|
19
|
+
cost: MoneyMinorRangeSchema.optional()
|
|
20
|
+
});
|
|
21
|
+
function createMoneyMinorRange(params) {
|
|
22
|
+
return {
|
|
23
|
+
currency: params.currency,
|
|
24
|
+
minorUnitsLow: params.minorUnitsLow,
|
|
25
|
+
minorUnitsHigh: params.minorUnitsHigh,
|
|
26
|
+
...params.minorUnitsExpected !== void 0 ? { minorUnitsExpected: params.minorUnitsExpected } : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function createEstimation(params) {
|
|
30
|
+
return {
|
|
31
|
+
deliverableCount: params.deliverableCount,
|
|
32
|
+
...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
|
|
33
|
+
...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
|
|
34
|
+
...params.cost ? { cost: params.cost } : {}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function computeSkewedExpectedMinorUnits(range) {
|
|
38
|
+
if (range.minorUnitsExpected !== void 0) {
|
|
39
|
+
return range.minorUnitsExpected;
|
|
40
|
+
}
|
|
41
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
42
|
+
return range.minorUnitsLow;
|
|
43
|
+
}
|
|
44
|
+
return Math.round(0.8 * range.minorUnitsLow + 0.2 * range.minorUnitsHigh);
|
|
45
|
+
}
|
|
46
|
+
function formatMoneyMinorRange(range, locale) {
|
|
47
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
48
|
+
style: "currency",
|
|
49
|
+
currency: range.currency
|
|
50
|
+
});
|
|
51
|
+
const low = formatter.format(range.minorUnitsLow / 100);
|
|
52
|
+
const high = formatter.format(range.minorUnitsHigh / 100);
|
|
53
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
54
|
+
return low;
|
|
55
|
+
}
|
|
56
|
+
return `${low} \u2013 ${high}`;
|
|
57
|
+
}
|
|
58
|
+
function formatMoneyMinorEstimate(range, options) {
|
|
59
|
+
const formatter = new Intl.NumberFormat(options?.locale, {
|
|
60
|
+
style: "currency",
|
|
61
|
+
currency: range.currency
|
|
62
|
+
});
|
|
63
|
+
const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
|
|
64
|
+
const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
|
|
65
|
+
if (spreadRatio > maxSpreadRatio) {
|
|
66
|
+
return formatMoneyMinorRange(range, options?.locale);
|
|
67
|
+
}
|
|
68
|
+
const expectedMinorUnits = options?.expectedMinorUnits ?? computeSkewedExpectedMinorUnits(range);
|
|
69
|
+
const expected = formatter.format(expectedMinorUnits / 100);
|
|
70
|
+
if (range.minorUnitsLow === range.minorUnitsHigh) {
|
|
71
|
+
return expected;
|
|
72
|
+
}
|
|
73
|
+
return `~${expected}`;
|
|
74
|
+
}
|
|
75
|
+
function parseEstimationFromBilling(billing) {
|
|
76
|
+
if (!billing || typeof billing !== "object") {
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
const record = billing;
|
|
80
|
+
const nested = record.estimation;
|
|
81
|
+
if (nested && typeof nested === "object") {
|
|
82
|
+
const parsed = EstimationSchema.safeParse(nested);
|
|
83
|
+
if (parsed.success) {
|
|
84
|
+
return parsed.data;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const currency = typeof record.currency === "string" && record.currency.trim() !== "" ? record.currency : void 0;
|
|
88
|
+
const minorUnitsLow = typeof record.minorUnitsLow === "number" ? record.minorUnitsLow : typeof record.costCentsLow === "number" ? record.costCentsLow : void 0;
|
|
89
|
+
const minorUnitsHigh = typeof record.minorUnitsHigh === "number" ? record.minorUnitsHigh : typeof record.costCentsHigh === "number" ? record.costCentsHigh : void 0;
|
|
90
|
+
const minorUnitsExpected = typeof record.minorUnitsExpected === "number" ? record.minorUnitsExpected : typeof record.costCentsExpected === "number" ? record.costCentsExpected : void 0;
|
|
91
|
+
const deliverableCount = typeof record.deliverableCount === "number" ? record.deliverableCount : void 0;
|
|
92
|
+
if (deliverableCount === void 0 || minorUnitsLow === void 0 || minorUnitsHigh === void 0 || !currency) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
return createEstimation({
|
|
96
|
+
deliverableCount,
|
|
97
|
+
skippedCount: typeof record.skippedCount === "number" ? record.skippedCount : void 0,
|
|
98
|
+
cost: createMoneyMinorRange({
|
|
99
|
+
currency,
|
|
100
|
+
minorUnitsLow,
|
|
101
|
+
minorUnitsHigh,
|
|
102
|
+
...minorUnitsExpected !== void 0 ? { minorUnitsExpected } : {}
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
EstimationSchema,
|
|
108
|
+
EstimationSkippedBreakdownSchema,
|
|
109
|
+
MoneyMinorRangeSchema,
|
|
110
|
+
computeSkewedExpectedMinorUnits,
|
|
111
|
+
createEstimation,
|
|
112
|
+
createMoneyMinorRange,
|
|
113
|
+
formatMoneyMinorEstimate,
|
|
114
|
+
formatMoneyMinorRange,
|
|
115
|
+
parseEstimationFromBilling
|
|
116
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export type { MoneyMinorUnits, MoneyMinorRange, Estimation } from './types';
|
|
4
|
-
export { MoneyMinorRangeSchema, EstimationSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from './types';
|
|
3
|
+
export type { MoneyMinorUnits, MoneyMinorRange, Estimation, EstimationSkippedBreakdown } from './types';
|
|
4
|
+
export { MoneyMinorRangeSchema, EstimationSchema, EstimationSkippedBreakdownSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from './types';
|
|
5
5
|
export * from './schemas';
|
|
6
6
|
export { server } from './server';
|
|
7
7
|
export { DEFAULT_DOCKERFILE } from './dockerfile';
|
|
@@ -33,7 +33,7 @@ export type { CRMContext, SenderContext, ThreadContextItem, ThreadInfo, SandboxC
|
|
|
33
33
|
export { MemoryEntryTypeSchema, MemoryEntrySchema, WorkingMemoryConfigSchema, SemanticMemoryConfigSchema, ExternalMemoryConfigSchema, MemoryConfigSchema, MemoryScopeSchema, MemoryQueryOptionsSchema, ConversationSummarySchema, AgentObservationSchema, ExternalDataCacheSchema, MemoryService, InMemoryStore, createInMemoryService, } from './memory';
|
|
34
34
|
export type { MemoryEntryType, MemoryEntry, WorkingMemoryConfig as MemoryWorkingConfig, SemanticMemoryConfig as MemorySemanticConfig, ExternalMemoryConfig as MemoryExternalConfig, MemoryConfig, MemoryScope, MemoryQueryOptions, ConversationSummary, AgentObservation, ExternalDataCache, MemoryStore, } from './memory';
|
|
35
35
|
export type { CRMFieldType, CRMFieldRequirement, CRMFieldOption, CRMFieldDefinition, CRMFieldSchema, CRMModelSchema, CRMCardinality, CRMOnDelete, CRMRelationshipLink, CRMRelationshipSchema, CRMSchema, CRMSchemaValidationResult, } from './schemas';
|
|
36
|
-
export type { SkedyulConfig, SerializableSkedyulConfig, InstallConfig, ProvisionConfig, BaseDefinition, Scope, FieldOwner, Visibility, ComputeLayer, StructuredFilter, FilterOperator, FilterCondition, FieldOption, EnvVariable, EnvSchema, FieldType, Cardinality, OnDelete, InlineFieldDefinition, FieldVisibility, FieldDefinition, ModelDefinition, RelationshipLink, RelationshipDefinition, CapabilityType, ChannelCapability, ChannelFieldPermissions, ChannelField, ChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, AgentDefinition, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, ContextMode, ContextItemModel, ContextItemTool, ContextItem, ContextDefinition, FormStyleProps, ButtonVariant, ButtonSize, ButtonProps, RelationshipExtension, FormHeader, FormActionDefinition, ActionDefinition, ModalFormDefinition, InputComponent, TextareaComponent, SelectComponent, ComboboxComponent, CheckboxComponent, DatePickerComponent, TimePickerComponent, StatusIndicator, FieldSettingComponent, ImageSettingComponent, FileSettingComponent, ListItemTemplate, ListComponent, EmptyFormComponent, AlertComponent, FormComponent, FormLayoutColumn, FormLayoutRow, FormLayoutConfig, FormProps, CardHeader, CardBlock, ListBlock, ModelMapperBlock, BlockDefinition, PageType, PageDefinition, HttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, } from './config';
|
|
36
|
+
export type { SkedyulConfig, SerializableSkedyulConfig, InstallConfig, ProvisionConfig, BaseDefinition, Scope, FieldOwner, Visibility, ComputeLayer, StructuredFilter, FilterOperator, FilterCondition, FieldOption, EnvVariable, EnvSchema, FieldType, Cardinality, OnDelete, InlineFieldDefinition, FieldVisibility, FieldDefinition, ModelDefinition, RelationshipLink, RelationshipDefinition, CapabilityType, ChannelCapability, ChannelBatchCapability, ChannelFieldPermissions, ChannelField, ChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, AgentDefinition, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, ContextMode, ContextItemModel, ContextItemTool, ContextItem, ContextDefinition, FormStyleProps, ButtonVariant, ButtonSize, ButtonProps, RelationshipExtension, FormHeader, FormActionDefinition, ActionDefinition, ModalFormDefinition, InputComponent, TextareaComponent, SelectComponent, ComboboxComponent, CheckboxComponent, DatePickerComponent, TimePickerComponent, StatusIndicator, FieldSettingComponent, ImageSettingComponent, FileSettingComponent, ListItemTemplate, ListComponent, EmptyFormComponent, AlertComponent, FormComponent, FormLayoutColumn, FormLayoutRow, FormLayoutConfig, FormProps, CardHeader, CardBlock, ListBlock, ModelMapperBlock, BlockDefinition, PageType, PageDefinition, HttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, } from './config';
|
|
37
37
|
export { compileAgent, compileWorkflow } from './compiler';
|
|
38
38
|
export type { ValidationError, ValidationWarning, ResolvedPersona, ResolvedTool, EventConfig as CompilerEventConfig, IRMemoryConfig, PolicyConfig, IRRuntimeConfig, AgentIR, WorkflowStepIR, WorkflowIR, CompilationResult, } from './compiler';
|
|
39
39
|
export { TimeStampSchema, DayOfWeekSchema, TimeWindowSlotSchema, WaitUnitSchema, WaitInputRelativeSchema, WaitInputAbsoluteSchema, WaitInputSchema, } from './scheduling/types';
|
|
@@ -41,8 +41,8 @@ export { calculateWaitTime, isTimeInWindowSlot, isTimeInPolicy, } from './schedu
|
|
|
41
41
|
export type { TimeStamp, DayOfWeek, TimeWindowSlot, WaitUnit, WaitInputRelative, WaitInputAbsolute, WaitInputType, CalculateWaitTimeResult, TimeWindowPolicy, } from './scheduling';
|
|
42
42
|
export { TimeWindowBehaviorSchema, TimeWindowPoliciesSchema, } from './schemas/agent-schema-v3';
|
|
43
43
|
export type { TimeWindowBehavior, TimeWindowPolicies, } from './schemas/agent-schema-v3';
|
|
44
|
-
export { MessageBulkRecipientSchema, MessageBulkSendInputSchema, MessageBulkSendOutputSchema, } from './schemas';
|
|
45
|
-
export type { MessageBulkRecipient, MessageBulkSendInput, MessageBulkSendOutput, } from './schemas';
|
|
44
|
+
export { MessageBulkRecipientSchema, MessageBulkSendInputSchema, MessageBulkSendOutputSchema, MessageBulkStatusInputSchema, MessageBulkStatusOutputSchema, MessageBulkStatusMessageSchema, MessageBulkStatusStatsSchema, ChannelBatchCapabilitySchema, } from './schemas';
|
|
45
|
+
export type { MessageBulkRecipient, MessageBulkSendInput, MessageBulkSendOutput, MessageBulkStatusInput, MessageBulkStatusOutput, MessageBulkStatusMessage, MessageBulkStatusStats, } from './schemas';
|
|
46
46
|
export type { QueueTouchPoint } from './types';
|
|
47
47
|
export { toGsm7, estimateSmsSegments } from './tools/sms/gsm7';
|
|
48
48
|
export type { SmsEncoding, SmsSegmentEstimate } from './tools/sms/gsm7';
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ __export(index_exports, {
|
|
|
58
58
|
CRMSchemaZ: () => CRMSchemaZ,
|
|
59
59
|
CardBlockDefinitionSchema: () => CardBlockDefinitionSchema,
|
|
60
60
|
CardBlockHeaderSchema: () => CardBlockHeaderSchema,
|
|
61
|
+
ChannelBatchCapabilitySchema: () => ChannelBatchCapabilitySchema,
|
|
61
62
|
ChannelCapabilitySchema: () => ChannelCapabilitySchema,
|
|
62
63
|
ChannelCapabilityTypeSchema: () => ChannelCapabilityTypeSchema,
|
|
63
64
|
ChannelDefinitionSchema: () => ChannelDefinitionSchema,
|
|
@@ -85,6 +86,7 @@ __export(index_exports, {
|
|
|
85
86
|
EnvVariableDefinitionSchema: () => EnvVariableDefinitionSchema,
|
|
86
87
|
EnvVisibilitySchema: () => EnvVisibilitySchema,
|
|
87
88
|
EstimationSchema: () => EstimationSchema,
|
|
89
|
+
EstimationSkippedBreakdownSchema: () => EstimationSkippedBreakdownSchema,
|
|
88
90
|
EventConditionsSchema: () => EventConditionsSchema,
|
|
89
91
|
EventSubscriptionSchema: () => EventSubscriptionSchema,
|
|
90
92
|
EventTypeSchema: () => EventTypeSchema,
|
|
@@ -129,6 +131,10 @@ __export(index_exports, {
|
|
|
129
131
|
MessageBulkRecipientSchema: () => MessageBulkRecipientSchema,
|
|
130
132
|
MessageBulkSendInputSchema: () => MessageBulkSendInputSchema,
|
|
131
133
|
MessageBulkSendOutputSchema: () => MessageBulkSendOutputSchema,
|
|
134
|
+
MessageBulkStatusInputSchema: () => MessageBulkStatusInputSchema,
|
|
135
|
+
MessageBulkStatusMessageSchema: () => MessageBulkStatusMessageSchema,
|
|
136
|
+
MessageBulkStatusOutputSchema: () => MessageBulkStatusOutputSchema,
|
|
137
|
+
MessageBulkStatusStatsSchema: () => MessageBulkStatusStatsSchema,
|
|
132
138
|
MessageEventPayloadSchema: () => MessageEventPayloadSchema,
|
|
133
139
|
MessageSendAttachmentSchema: () => MessageSendAttachmentSchema,
|
|
134
140
|
MessageSendChannelSchema: () => MessageSendChannelSchema,
|
|
@@ -408,9 +414,16 @@ var MoneyMinorRangeSchema = import_v4.z.object({
|
|
|
408
414
|
minorUnitsHigh: import_v4.z.number().int().nonnegative(),
|
|
409
415
|
minorUnitsExpected: import_v4.z.number().int().nonnegative().optional()
|
|
410
416
|
});
|
|
417
|
+
var EstimationSkippedBreakdownSchema = import_v4.z.object({
|
|
418
|
+
missingAddress: import_v4.z.number().int().nonnegative(),
|
|
419
|
+
optOut: import_v4.z.number().int().nonnegative(),
|
|
420
|
+
emptyMessage: import_v4.z.number().int().nonnegative(),
|
|
421
|
+
unavailable: import_v4.z.number().int().nonnegative()
|
|
422
|
+
});
|
|
411
423
|
var EstimationSchema = import_v4.z.object({
|
|
412
424
|
deliverableCount: import_v4.z.number().int().nonnegative(),
|
|
413
425
|
skippedCount: import_v4.z.number().int().nonnegative().optional(),
|
|
426
|
+
skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
|
|
414
427
|
cost: MoneyMinorRangeSchema.optional()
|
|
415
428
|
});
|
|
416
429
|
function createMoneyMinorRange(params) {
|
|
@@ -425,6 +438,7 @@ function createEstimation(params) {
|
|
|
425
438
|
return {
|
|
426
439
|
deliverableCount: params.deliverableCount,
|
|
427
440
|
...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
|
|
441
|
+
...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
|
|
428
442
|
...params.cost ? { cost: params.cost } : {}
|
|
429
443
|
};
|
|
430
444
|
}
|
|
@@ -454,7 +468,7 @@ function formatMoneyMinorEstimate(range, options) {
|
|
|
454
468
|
style: "currency",
|
|
455
469
|
currency: range.currency
|
|
456
470
|
});
|
|
457
|
-
const maxSpreadRatio = options?.maxSpreadRatio ??
|
|
471
|
+
const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
|
|
458
472
|
const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
|
|
459
473
|
if (spreadRatio > maxSpreadRatio) {
|
|
460
474
|
return formatMoneyMinorRange(range, options?.locale);
|
|
@@ -1647,6 +1661,10 @@ var ChannelCapabilityTypeSchema = import_v48.z.enum([
|
|
|
1647
1661
|
"video"
|
|
1648
1662
|
// Video calls (future)
|
|
1649
1663
|
]);
|
|
1664
|
+
var ChannelBatchCapabilitySchema = import_v48.z.object({
|
|
1665
|
+
send: import_v48.z.string(),
|
|
1666
|
+
get_status: import_v48.z.string()
|
|
1667
|
+
});
|
|
1650
1668
|
var ChannelCapabilitySchema = import_v48.z.object({
|
|
1651
1669
|
label: import_v48.z.string(),
|
|
1652
1670
|
// Display name: "SMS", "WhatsApp Messages"
|
|
@@ -1656,8 +1674,8 @@ var ChannelCapabilitySchema = import_v48.z.object({
|
|
|
1656
1674
|
// Inbound webhook handler
|
|
1657
1675
|
send: import_v48.z.string().optional(),
|
|
1658
1676
|
// Outbound tool handle
|
|
1659
|
-
send_batch: import_v48.z.string().optional()
|
|
1660
|
-
// Batch outbound tool handle
|
|
1677
|
+
send_batch: import_v48.z.union([import_v48.z.string(), ChannelBatchCapabilitySchema]).optional()
|
|
1678
|
+
// Batch outbound tool handle, or { send, get_status }
|
|
1661
1679
|
});
|
|
1662
1680
|
var ChannelFieldDefinitionSchema = import_v48.z.object({
|
|
1663
1681
|
handle: import_v48.z.string(),
|
|
@@ -2271,6 +2289,43 @@ var MessageBulkSendOutputSchema = import_v48.z.object({
|
|
|
2271
2289
|
acceptedCount: import_v48.z.number().int().nonnegative(),
|
|
2272
2290
|
rejectedCount: import_v48.z.number().int().nonnegative().optional()
|
|
2273
2291
|
});
|
|
2292
|
+
var MessageBulkStatusMessageSchema = import_v48.z.object({
|
|
2293
|
+
address: import_v48.z.string(),
|
|
2294
|
+
status: import_v48.z.string(),
|
|
2295
|
+
messageId: import_v48.z.string().optional(),
|
|
2296
|
+
errorCode: import_v48.z.union([import_v48.z.string(), import_v48.z.number()]).optional(),
|
|
2297
|
+
errorMessage: import_v48.z.string().optional()
|
|
2298
|
+
});
|
|
2299
|
+
var MessageBulkStatusStatsSchema = import_v48.z.object({
|
|
2300
|
+
total: import_v48.z.number().int().nonnegative().optional(),
|
|
2301
|
+
recipients: import_v48.z.number().int().nonnegative().optional(),
|
|
2302
|
+
attempts: import_v48.z.number().int().nonnegative().optional(),
|
|
2303
|
+
unaddressable: import_v48.z.number().int().nonnegative().optional(),
|
|
2304
|
+
queued: import_v48.z.number().int().nonnegative().optional(),
|
|
2305
|
+
sent: import_v48.z.number().int().nonnegative().optional(),
|
|
2306
|
+
scheduled: import_v48.z.number().int().nonnegative().optional(),
|
|
2307
|
+
delivered: import_v48.z.number().int().nonnegative().optional(),
|
|
2308
|
+
read: import_v48.z.number().int().nonnegative().optional(),
|
|
2309
|
+
undelivered: import_v48.z.number().int().nonnegative().optional(),
|
|
2310
|
+
failed: import_v48.z.number().int().nonnegative().optional(),
|
|
2311
|
+
canceled: import_v48.z.number().int().nonnegative().optional()
|
|
2312
|
+
});
|
|
2313
|
+
var MessageBulkStatusInputSchema = import_v48.z.object({
|
|
2314
|
+
channel: MessageSendChannelSchema,
|
|
2315
|
+
operationId: import_v48.z.string().min(1)
|
|
2316
|
+
});
|
|
2317
|
+
var MessageBulkStatusOutputSchema = import_v48.z.object({
|
|
2318
|
+
operationId: import_v48.z.string(),
|
|
2319
|
+
status: import_v48.z.string(),
|
|
2320
|
+
complete: import_v48.z.boolean(),
|
|
2321
|
+
/**
|
|
2322
|
+
* When true, the provider skipped real delivery (e.g. MOCK_OUTBOUND_MESSAGES).
|
|
2323
|
+
* Core should mark all recipients in the operation as sent without per-message rows.
|
|
2324
|
+
*/
|
|
2325
|
+
mock: import_v48.z.boolean().optional(),
|
|
2326
|
+
stats: MessageBulkStatusStatsSchema.optional(),
|
|
2327
|
+
messages: import_v48.z.array(MessageBulkStatusMessageSchema)
|
|
2328
|
+
});
|
|
2274
2329
|
function isModelDependency(dep) {
|
|
2275
2330
|
return "model" in dep;
|
|
2276
2331
|
}
|
|
@@ -8033,6 +8088,7 @@ var index_default = { z: import_v414.z };
|
|
|
8033
8088
|
CRMSchemaZ,
|
|
8034
8089
|
CardBlockDefinitionSchema,
|
|
8035
8090
|
CardBlockHeaderSchema,
|
|
8091
|
+
ChannelBatchCapabilitySchema,
|
|
8036
8092
|
ChannelCapabilitySchema,
|
|
8037
8093
|
ChannelCapabilityTypeSchema,
|
|
8038
8094
|
ChannelDefinitionSchema,
|
|
@@ -8060,6 +8116,7 @@ var index_default = { z: import_v414.z };
|
|
|
8060
8116
|
EnvVariableDefinitionSchema,
|
|
8061
8117
|
EnvVisibilitySchema,
|
|
8062
8118
|
EstimationSchema,
|
|
8119
|
+
EstimationSkippedBreakdownSchema,
|
|
8063
8120
|
EventConditionsSchema,
|
|
8064
8121
|
EventSubscriptionSchema,
|
|
8065
8122
|
EventTypeSchema,
|
|
@@ -8104,6 +8161,10 @@ var index_default = { z: import_v414.z };
|
|
|
8104
8161
|
MessageBulkRecipientSchema,
|
|
8105
8162
|
MessageBulkSendInputSchema,
|
|
8106
8163
|
MessageBulkSendOutputSchema,
|
|
8164
|
+
MessageBulkStatusInputSchema,
|
|
8165
|
+
MessageBulkStatusMessageSchema,
|
|
8166
|
+
MessageBulkStatusOutputSchema,
|
|
8167
|
+
MessageBulkStatusStatsSchema,
|
|
8107
8168
|
MessageEventPayloadSchema,
|
|
8108
8169
|
MessageSendAttachmentSchema,
|
|
8109
8170
|
MessageSendChannelSchema,
|
package/dist/schemas.d.ts
CHANGED
|
@@ -369,13 +369,21 @@ export declare const ChannelCapabilityTypeSchema: z.ZodEnum<{
|
|
|
369
369
|
messaging: "messaging";
|
|
370
370
|
video: "video";
|
|
371
371
|
}>;
|
|
372
|
+
/** Batch send + status poll capability (preferred over bare send_batch string) */
|
|
373
|
+
export declare const ChannelBatchCapabilitySchema: z.ZodObject<{
|
|
374
|
+
send: z.ZodString;
|
|
375
|
+
get_status: z.ZodString;
|
|
376
|
+
}, z.core.$strip>;
|
|
372
377
|
/** Capability definition with display info and handler references */
|
|
373
378
|
export declare const ChannelCapabilitySchema: z.ZodObject<{
|
|
374
379
|
label: z.ZodString;
|
|
375
380
|
icon: z.ZodOptional<z.ZodString>;
|
|
376
381
|
receive: z.ZodOptional<z.ZodString>;
|
|
377
382
|
send: z.ZodOptional<z.ZodString>;
|
|
378
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
383
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
384
|
+
send: z.ZodString;
|
|
385
|
+
get_status: z.ZodString;
|
|
386
|
+
}, z.core.$strip>]>>;
|
|
379
387
|
}, z.core.$strip>;
|
|
380
388
|
/**
|
|
381
389
|
* Field definition for channel field mappings.
|
|
@@ -456,21 +464,30 @@ export declare const ChannelDefinitionSchema: z.ZodObject<{
|
|
|
456
464
|
icon: z.ZodOptional<z.ZodString>;
|
|
457
465
|
receive: z.ZodOptional<z.ZodString>;
|
|
458
466
|
send: z.ZodOptional<z.ZodString>;
|
|
459
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
467
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
468
|
+
send: z.ZodString;
|
|
469
|
+
get_status: z.ZodString;
|
|
470
|
+
}, z.core.$strip>]>>;
|
|
460
471
|
}, z.core.$strip>>;
|
|
461
472
|
voice: z.ZodOptional<z.ZodObject<{
|
|
462
473
|
label: z.ZodString;
|
|
463
474
|
icon: z.ZodOptional<z.ZodString>;
|
|
464
475
|
receive: z.ZodOptional<z.ZodString>;
|
|
465
476
|
send: z.ZodOptional<z.ZodString>;
|
|
466
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
477
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
478
|
+
send: z.ZodString;
|
|
479
|
+
get_status: z.ZodString;
|
|
480
|
+
}, z.core.$strip>]>>;
|
|
467
481
|
}, z.core.$strip>>;
|
|
468
482
|
video: z.ZodOptional<z.ZodObject<{
|
|
469
483
|
label: z.ZodString;
|
|
470
484
|
icon: z.ZodOptional<z.ZodString>;
|
|
471
485
|
receive: z.ZodOptional<z.ZodString>;
|
|
472
486
|
send: z.ZodOptional<z.ZodString>;
|
|
473
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
487
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
488
|
+
send: z.ZodString;
|
|
489
|
+
get_status: z.ZodString;
|
|
490
|
+
}, z.core.$strip>]>>;
|
|
474
491
|
}, z.core.$strip>>;
|
|
475
492
|
}, z.core.$strip>;
|
|
476
493
|
}, z.core.$strip>;
|
|
@@ -3388,21 +3405,30 @@ export declare const ProvisionConfigSchema: z.ZodObject<{
|
|
|
3388
3405
|
icon: z.ZodOptional<z.ZodString>;
|
|
3389
3406
|
receive: z.ZodOptional<z.ZodString>;
|
|
3390
3407
|
send: z.ZodOptional<z.ZodString>;
|
|
3391
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
3408
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3409
|
+
send: z.ZodString;
|
|
3410
|
+
get_status: z.ZodString;
|
|
3411
|
+
}, z.core.$strip>]>>;
|
|
3392
3412
|
}, z.core.$strip>>;
|
|
3393
3413
|
voice: z.ZodOptional<z.ZodObject<{
|
|
3394
3414
|
label: z.ZodString;
|
|
3395
3415
|
icon: z.ZodOptional<z.ZodString>;
|
|
3396
3416
|
receive: z.ZodOptional<z.ZodString>;
|
|
3397
3417
|
send: z.ZodOptional<z.ZodString>;
|
|
3398
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
3418
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3419
|
+
send: z.ZodString;
|
|
3420
|
+
get_status: z.ZodString;
|
|
3421
|
+
}, z.core.$strip>]>>;
|
|
3399
3422
|
}, z.core.$strip>>;
|
|
3400
3423
|
video: z.ZodOptional<z.ZodObject<{
|
|
3401
3424
|
label: z.ZodString;
|
|
3402
3425
|
icon: z.ZodOptional<z.ZodString>;
|
|
3403
3426
|
receive: z.ZodOptional<z.ZodString>;
|
|
3404
3427
|
send: z.ZodOptional<z.ZodString>;
|
|
3405
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
3428
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3429
|
+
send: z.ZodString;
|
|
3430
|
+
get_status: z.ZodString;
|
|
3431
|
+
}, z.core.$strip>]>>;
|
|
3406
3432
|
}, z.core.$strip>>;
|
|
3407
3433
|
}, z.core.$strip>;
|
|
3408
3434
|
}, z.core.$strip>>>;
|
|
@@ -4114,21 +4140,30 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
|
|
|
4114
4140
|
icon: z.ZodOptional<z.ZodString>;
|
|
4115
4141
|
receive: z.ZodOptional<z.ZodString>;
|
|
4116
4142
|
send: z.ZodOptional<z.ZodString>;
|
|
4117
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
4143
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
4144
|
+
send: z.ZodString;
|
|
4145
|
+
get_status: z.ZodString;
|
|
4146
|
+
}, z.core.$strip>]>>;
|
|
4118
4147
|
}, z.core.$strip>>;
|
|
4119
4148
|
voice: z.ZodOptional<z.ZodObject<{
|
|
4120
4149
|
label: z.ZodString;
|
|
4121
4150
|
icon: z.ZodOptional<z.ZodString>;
|
|
4122
4151
|
receive: z.ZodOptional<z.ZodString>;
|
|
4123
4152
|
send: z.ZodOptional<z.ZodString>;
|
|
4124
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
4153
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
4154
|
+
send: z.ZodString;
|
|
4155
|
+
get_status: z.ZodString;
|
|
4156
|
+
}, z.core.$strip>]>>;
|
|
4125
4157
|
}, z.core.$strip>>;
|
|
4126
4158
|
video: z.ZodOptional<z.ZodObject<{
|
|
4127
4159
|
label: z.ZodString;
|
|
4128
4160
|
icon: z.ZodOptional<z.ZodString>;
|
|
4129
4161
|
receive: z.ZodOptional<z.ZodString>;
|
|
4130
4162
|
send: z.ZodOptional<z.ZodString>;
|
|
4131
|
-
send_batch: z.ZodOptional<z.ZodString
|
|
4163
|
+
send_batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
4164
|
+
send: z.ZodString;
|
|
4165
|
+
get_status: z.ZodString;
|
|
4166
|
+
}, z.core.$strip>]>>;
|
|
4132
4167
|
}, z.core.$strip>>;
|
|
4133
4168
|
}, z.core.$strip>;
|
|
4134
4169
|
}, z.core.$strip>>>;
|
|
@@ -4860,6 +4895,66 @@ export declare const MessageBulkSendOutputSchema: z.ZodObject<{
|
|
|
4860
4895
|
export type MessageBulkRecipient = z.infer<typeof MessageBulkRecipientSchema>;
|
|
4861
4896
|
export type MessageBulkSendInput = z.infer<typeof MessageBulkSendInputSchema>;
|
|
4862
4897
|
export type MessageBulkSendOutput = z.infer<typeof MessageBulkSendOutputSchema>;
|
|
4898
|
+
export declare const MessageBulkStatusMessageSchema: z.ZodObject<{
|
|
4899
|
+
address: z.ZodString;
|
|
4900
|
+
status: z.ZodString;
|
|
4901
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
4902
|
+
errorCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4903
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
4904
|
+
}, z.core.$strip>;
|
|
4905
|
+
export declare const MessageBulkStatusStatsSchema: z.ZodObject<{
|
|
4906
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
4907
|
+
recipients: z.ZodOptional<z.ZodNumber>;
|
|
4908
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
4909
|
+
unaddressable: z.ZodOptional<z.ZodNumber>;
|
|
4910
|
+
queued: z.ZodOptional<z.ZodNumber>;
|
|
4911
|
+
sent: z.ZodOptional<z.ZodNumber>;
|
|
4912
|
+
scheduled: z.ZodOptional<z.ZodNumber>;
|
|
4913
|
+
delivered: z.ZodOptional<z.ZodNumber>;
|
|
4914
|
+
read: z.ZodOptional<z.ZodNumber>;
|
|
4915
|
+
undelivered: z.ZodOptional<z.ZodNumber>;
|
|
4916
|
+
failed: z.ZodOptional<z.ZodNumber>;
|
|
4917
|
+
canceled: z.ZodOptional<z.ZodNumber>;
|
|
4918
|
+
}, z.core.$strip>;
|
|
4919
|
+
export declare const MessageBulkStatusInputSchema: z.ZodObject<{
|
|
4920
|
+
channel: z.ZodObject<{
|
|
4921
|
+
id: z.ZodString;
|
|
4922
|
+
handle: z.ZodString;
|
|
4923
|
+
identifierValue: z.ZodString;
|
|
4924
|
+
}, z.core.$strip>;
|
|
4925
|
+
operationId: z.ZodString;
|
|
4926
|
+
}, z.core.$strip>;
|
|
4927
|
+
export declare const MessageBulkStatusOutputSchema: z.ZodObject<{
|
|
4928
|
+
operationId: z.ZodString;
|
|
4929
|
+
status: z.ZodString;
|
|
4930
|
+
complete: z.ZodBoolean;
|
|
4931
|
+
mock: z.ZodOptional<z.ZodBoolean>;
|
|
4932
|
+
stats: z.ZodOptional<z.ZodObject<{
|
|
4933
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
4934
|
+
recipients: z.ZodOptional<z.ZodNumber>;
|
|
4935
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
4936
|
+
unaddressable: z.ZodOptional<z.ZodNumber>;
|
|
4937
|
+
queued: z.ZodOptional<z.ZodNumber>;
|
|
4938
|
+
sent: z.ZodOptional<z.ZodNumber>;
|
|
4939
|
+
scheduled: z.ZodOptional<z.ZodNumber>;
|
|
4940
|
+
delivered: z.ZodOptional<z.ZodNumber>;
|
|
4941
|
+
read: z.ZodOptional<z.ZodNumber>;
|
|
4942
|
+
undelivered: z.ZodOptional<z.ZodNumber>;
|
|
4943
|
+
failed: z.ZodOptional<z.ZodNumber>;
|
|
4944
|
+
canceled: z.ZodOptional<z.ZodNumber>;
|
|
4945
|
+
}, z.core.$strip>>;
|
|
4946
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
4947
|
+
address: z.ZodString;
|
|
4948
|
+
status: z.ZodString;
|
|
4949
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
4950
|
+
errorCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4951
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
4952
|
+
}, z.core.$strip>>;
|
|
4953
|
+
}, z.core.$strip>;
|
|
4954
|
+
export type MessageBulkStatusMessage = z.infer<typeof MessageBulkStatusMessageSchema>;
|
|
4955
|
+
export type MessageBulkStatusStats = z.infer<typeof MessageBulkStatusStatsSchema>;
|
|
4956
|
+
export type MessageBulkStatusInput = z.infer<typeof MessageBulkStatusInputSchema>;
|
|
4957
|
+
export type MessageBulkStatusOutput = z.infer<typeof MessageBulkStatusOutputSchema>;
|
|
4863
4958
|
export declare function isModelDependency(dep: ResourceDependency): dep is ModelDependency;
|
|
4864
4959
|
export declare function isChannelDependency(dep: ResourceDependency): dep is ChannelDependency;
|
|
4865
4960
|
export declare function isWorkflowDependency(dep: ResourceDependency): dep is WorkflowDependency;
|
|
@@ -18,6 +18,13 @@ export interface MoneyMinorRange {
|
|
|
18
18
|
/** Optional skewed expected charge for single-value display (~$X.XX). */
|
|
19
19
|
minorUnitsExpected?: number;
|
|
20
20
|
}
|
|
21
|
+
/** Why a cohort member was excluded from a bulk send estimate. */
|
|
22
|
+
export interface EstimationSkippedBreakdown {
|
|
23
|
+
missingAddress: number;
|
|
24
|
+
optOut: number;
|
|
25
|
+
emptyMessage: number;
|
|
26
|
+
unavailable: number;
|
|
27
|
+
}
|
|
21
28
|
/**
|
|
22
29
|
* Standard estimate payload for tool estimate mode and platform estimate APIs.
|
|
23
30
|
* Channel-agnostic — integrations populate `cost` when pricing is known.
|
|
@@ -25,6 +32,7 @@ export interface MoneyMinorRange {
|
|
|
25
32
|
export interface Estimation {
|
|
26
33
|
deliverableCount: number;
|
|
27
34
|
skippedCount?: number;
|
|
35
|
+
skippedBreakdown?: EstimationSkippedBreakdown;
|
|
28
36
|
cost?: MoneyMinorRange;
|
|
29
37
|
}
|
|
30
38
|
export declare const MoneyMinorRangeSchema: z.ZodObject<{
|
|
@@ -33,9 +41,21 @@ export declare const MoneyMinorRangeSchema: z.ZodObject<{
|
|
|
33
41
|
minorUnitsHigh: z.ZodNumber;
|
|
34
42
|
minorUnitsExpected: z.ZodOptional<z.ZodNumber>;
|
|
35
43
|
}, z.core.$strip>;
|
|
44
|
+
export declare const EstimationSkippedBreakdownSchema: z.ZodObject<{
|
|
45
|
+
missingAddress: z.ZodNumber;
|
|
46
|
+
optOut: z.ZodNumber;
|
|
47
|
+
emptyMessage: z.ZodNumber;
|
|
48
|
+
unavailable: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>;
|
|
36
50
|
export declare const EstimationSchema: z.ZodObject<{
|
|
37
51
|
deliverableCount: z.ZodNumber;
|
|
38
52
|
skippedCount: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
skippedBreakdown: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
missingAddress: z.ZodNumber;
|
|
55
|
+
optOut: z.ZodNumber;
|
|
56
|
+
emptyMessage: z.ZodNumber;
|
|
57
|
+
unavailable: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>>;
|
|
39
59
|
cost: z.ZodOptional<z.ZodObject<{
|
|
40
60
|
currency: z.ZodString;
|
|
41
61
|
minorUnitsLow: z.ZodNumber;
|
|
@@ -52,6 +72,7 @@ export declare function createMoneyMinorRange(params: {
|
|
|
52
72
|
export declare function createEstimation(params: {
|
|
53
73
|
deliverableCount: number;
|
|
54
74
|
skippedCount?: number;
|
|
75
|
+
skippedBreakdown?: EstimationSkippedBreakdown;
|
|
55
76
|
cost?: MoneyMinorRange;
|
|
56
77
|
}): Estimation;
|
|
57
78
|
/** Skew expected cost toward the typical case when only a range is known. */
|
|
@@ -60,7 +81,7 @@ export type FormatMoneyMinorEstimateOptions = {
|
|
|
60
81
|
locale?: string;
|
|
61
82
|
/** When set, overrides computed skew for display. */
|
|
62
83
|
expectedMinorUnits?: number;
|
|
63
|
-
/** Show a range instead of ~estimate when high/low ratio exceeds this (default
|
|
84
|
+
/** Show a range instead of ~estimate when high/low ratio exceeds this (default 4). */
|
|
64
85
|
maxSpreadRatio?: number;
|
|
65
86
|
};
|
|
66
87
|
/** Format a minor-unit cost range for display (single amount when low === high). */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export { createToolCallContext, createServerHookContext, createWebhookContext, c
|
|
|
10
10
|
export type { ToolTrigger, ProvisionToolContext, DeveloperPageActionToolContext, DeveloperFormSubmitToolContext, FieldChangeToolContext, PageActionToolContext, FormSubmitToolContext, AgentToolContext, WorkflowToolContext, CronToolContext, CronContext, ToolExecutionContext, } from './tool-context';
|
|
11
11
|
export { isProvisionContext, isRuntimeContext, isCronContext, isDeveloperContext } from './tool-context';
|
|
12
12
|
export type { ToolResult, ToolSuccess, ToolFailure, ErrorCode, ErrorCategory, ToolWarning, ToolPagination, ToolBilling, ToolRetry, ToolTiming, ToolCompletionHints, ToolConfig, QueueTouchPoint, BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, ExecutionScope, } from './tool';
|
|
13
|
-
export type { MoneyMinorUnits, MoneyMinorRange, Estimation } from './estimation';
|
|
14
|
-
export { MoneyMinorRangeSchema, EstimationSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from './estimation';
|
|
13
|
+
export type { MoneyMinorUnits, MoneyMinorRange, Estimation, EstimationSkippedBreakdown } from './estimation';
|
|
14
|
+
export { MoneyMinorRangeSchema, EstimationSchema, EstimationSkippedBreakdownSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from './estimation';
|
|
15
15
|
export type { FormatMoneyMinorEstimateOptions } from './estimation';
|
|
16
16
|
export { ToolResponseMetaSchema } from './tool';
|
|
17
17
|
export { createSuccessResponse, createListResponse, createErrorResponse, createValidationError, createNotFoundError, createAuthError, createRateLimitError, createExternalError, createTimeoutError, createPermissionError, createConflictError, isSuccess, isFailure, isRetryable, getRetryDelay, } from './tool-response';
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export interface QueueTouchPoint {
|
|
|
120
120
|
}
|
|
121
121
|
/** Workflow mutex handoff role for multi-step tool.call sequences. */
|
|
122
122
|
export interface RateLimitHandoff {
|
|
123
|
-
role: 'mutex_reserve' | 'mutex_confirm';
|
|
123
|
+
role: 'mutex_reserve' | 'mutex_confirm' | 'mutex_book';
|
|
124
124
|
group?: string;
|
|
125
125
|
}
|
|
126
126
|
export interface ToolConfig {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skedyul",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"description": "The Skedyul SDK for Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
},
|
|
65
65
|
"./estimation": {
|
|
66
66
|
"types": "./dist/types/estimation.d.ts",
|
|
67
|
-
"import": "./dist/
|
|
68
|
-
"require": "./dist/index.js",
|
|
69
|
-
"default": "./dist/index.js"
|
|
67
|
+
"import": "./dist/estimation/index.mjs",
|
|
68
|
+
"require": "./dist/estimation/index.js",
|
|
69
|
+
"default": "./dist/estimation/index.js"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"files": [
|