skedyul 1.5.2 → 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.
@@ -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,5 +1,7 @@
1
1
  import { z } from 'zod/v4';
2
2
  export * from './types';
3
+ export type { MoneyMinorUnits, MoneyMinorRange, Estimation, EstimationSkippedBreakdown } from './types';
4
+ export { MoneyMinorRangeSchema, EstimationSchema, EstimationSkippedBreakdownSchema, createMoneyMinorRange, createEstimation, parseEstimationFromBilling, formatMoneyMinorRange, formatMoneyMinorEstimate, computeSkewedExpectedMinorUnits, } from './types';
3
5
  export * from './schemas';
4
6
  export { server } from './server';
5
7
  export { DEFAULT_DOCKERFILE } from './dockerfile';
@@ -31,7 +33,7 @@ export type { CRMContext, SenderContext, ThreadContextItem, ThreadInfo, SandboxC
31
33
  export { MemoryEntryTypeSchema, MemoryEntrySchema, WorkingMemoryConfigSchema, SemanticMemoryConfigSchema, ExternalMemoryConfigSchema, MemoryConfigSchema, MemoryScopeSchema, MemoryQueryOptionsSchema, ConversationSummarySchema, AgentObservationSchema, ExternalDataCacheSchema, MemoryService, InMemoryStore, createInMemoryService, } from './memory';
32
34
  export type { MemoryEntryType, MemoryEntry, WorkingMemoryConfig as MemoryWorkingConfig, SemanticMemoryConfig as MemorySemanticConfig, ExternalMemoryConfig as MemoryExternalConfig, MemoryConfig, MemoryScope, MemoryQueryOptions, ConversationSummary, AgentObservation, ExternalDataCache, MemoryStore, } from './memory';
33
35
  export type { CRMFieldType, CRMFieldRequirement, CRMFieldOption, CRMFieldDefinition, CRMFieldSchema, CRMModelSchema, CRMCardinality, CRMOnDelete, CRMRelationshipLink, CRMRelationshipSchema, CRMSchema, CRMSchemaValidationResult, } from './schemas';
34
- 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';
35
37
  export { compileAgent, compileWorkflow } from './compiler';
36
38
  export type { ValidationError, ValidationWarning, ResolvedPersona, ResolvedTool, EventConfig as CompilerEventConfig, IRMemoryConfig, PolicyConfig, IRRuntimeConfig, AgentIR, WorkflowStepIR, WorkflowIR, CompilationResult, } from './compiler';
37
39
  export { TimeStampSchema, DayOfWeekSchema, TimeWindowSlotSchema, WaitUnitSchema, WaitInputRelativeSchema, WaitInputAbsoluteSchema, WaitInputSchema, } from './scheduling/types';
@@ -39,3 +41,8 @@ export { calculateWaitTime, isTimeInWindowSlot, isTimeInPolicy, } from './schedu
39
41
  export type { TimeStamp, DayOfWeek, TimeWindowSlot, WaitUnit, WaitInputRelative, WaitInputAbsolute, WaitInputType, CalculateWaitTimeResult, TimeWindowPolicy, } from './scheduling';
40
42
  export { TimeWindowBehaviorSchema, TimeWindowPoliciesSchema, } from './schemas/agent-schema-v3';
41
43
  export type { TimeWindowBehavior, TimeWindowPolicies, } from './schemas/agent-schema-v3';
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
+ export type { QueueTouchPoint } from './types';
47
+ export { toGsm7, estimateSmsSegments } from './tools/sms/gsm7';
48
+ export type { SmsEncoding, SmsSegmentEstimate } from './tools/sms/gsm7';