@purpleschool/gptbot 0.13.21 → 0.14.1-stage-2
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/api/controllers/http/agents/agent-dialog.ts +0 -11
- package/api/controllers/http/agents/agent-lead-form.ts +0 -2
- package/api/controllers/http/agents/agent-lead.ts +0 -1
- package/api/controllers/http/agents/agent-template.ts +0 -4
- package/api/controllers/http/agents/agent-tool.ts +1 -2
- package/api/controllers/http/agents/agent.ts +3 -0
- package/api/controllers/http/agents/index.ts +0 -1
- package/api/controllers/http/b2b-compatible.ts +14 -0
- package/api/controllers/http/b2b-usage-log.ts +5 -0
- package/api/controllers/http/index.ts +2 -2
- package/api/routes.ts +19 -38
- package/build/api/controllers/http/agents/agent-dialog.js +0 -7
- package/build/api/controllers/http/agents/agent-lead-form.js +0 -2
- package/build/api/controllers/http/agents/agent-lead.js +0 -1
- package/build/api/controllers/http/agents/agent-template.js +0 -4
- package/build/api/controllers/http/agents/agent-tool.js +1 -2
- package/build/api/controllers/http/agents/agent.js +2 -0
- package/build/api/controllers/http/agents/index.js +0 -1
- package/build/api/controllers/http/b2b-compatible.js +15 -0
- package/build/api/controllers/http/b2b-usage-log.js +7 -0
- package/build/api/controllers/http/index.js +2 -2
- package/build/api/routes.js +16 -22
- package/build/commands/agents/agent-dialog/find-agent-dialogs.command.js +0 -1
- package/build/commands/agents/agent-dialog/index.js +0 -5
- package/build/commands/agents/agent-dialog/send-cabinet-message.command.js +4 -4
- package/build/commands/agents/agent-lead/find-agent-leads.command.js +4 -2
- package/build/commands/agents/agent-template/index.js +0 -1
- package/build/commands/agents/agent-tool/find-agent-tools-catalog.command.js +0 -2
- package/build/commands/agents/agent-tool/find-agent-tools.command.js +0 -2
- package/build/commands/agents/agents/index.js +0 -1
- package/build/commands/ai-studio/canvas-tool/index.js +0 -1
- package/build/commands/b2b/send-text-request.command.js +8 -1
- package/build/commands/b2b-compatible/anthropic-files.command.js +21 -0
- package/build/commands/b2b-compatible/anthropic-messages.command.js +217 -0
- package/build/commands/b2b-compatible/anthropic-models.command.js +26 -0
- package/build/commands/b2b-compatible/common.schemas.js +46 -0
- package/build/commands/{ai-studio/canvas-tool/var-gen → b2b-compatible}/index.js +7 -3
- package/build/commands/b2b-compatible/openai-files.command.js +26 -0
- package/build/commands/b2b-compatible/openai-models.command.js +24 -0
- package/build/commands/b2b-compatible/openai-responses.command.js +171 -0
- package/build/commands/b2b-usage-log/get-b2b-usage-statistics.command.js +111 -0
- package/build/{constants/photo-studio/enums → commands/b2b-usage-log}/index.js +1 -1
- package/build/commands/index.js +2 -1
- package/build/constants/b2b/enums/b2b-debit-status.enum.js +9 -0
- package/build/constants/b2b/enums/b2b-endpoint-family.enum.js +9 -0
- package/build/constants/b2b/enums/b2b-statistics-granularity.enum.js +8 -0
- package/build/constants/b2b/enums/b2b-statistics-period.enum.js +13 -0
- package/build/constants/b2b/enums/b2b-usage-operation.enum.js +8 -0
- package/build/constants/b2b/enums/b2b-usage-spend-component.enum.js +12 -0
- package/build/constants/b2b/enums/b2b-usage-status.enum.js +8 -0
- package/build/{models/photo-studio → constants/b2b/enums}/index.js +7 -4
- package/build/constants/index.js +1 -1
- package/build/models/agents/index.js +0 -2
- package/build/models/b2b/b2b-usage-statistics.schema.js +69 -0
- package/build/models/b2b/index.js +1 -0
- package/build/models/canvas-node.schema.js +2 -2
- package/build/models/file.schema.js +1 -7
- package/build/models/index.js +0 -1
- package/build/models/tools/image-generation/image-generation-job.schema.js +0 -3
- package/commands/agents/agent-dialog/find-agent-dialogs.command.ts +0 -1
- package/commands/agents/agent-dialog/index.ts +0 -5
- package/commands/agents/agent-dialog/send-cabinet-message.command.ts +10 -18
- package/commands/agents/agent-lead/find-agent-leads.command.ts +4 -2
- package/commands/agents/agent-template/index.ts +0 -1
- package/commands/agents/agent-tool/find-agent-tools-catalog.command.ts +0 -2
- package/commands/agents/agent-tool/find-agent-tools.command.ts +0 -2
- package/commands/agents/agents/index.ts +0 -1
- package/commands/ai-studio/canvas-tool/index.ts +0 -1
- package/commands/b2b/send-text-request.command.ts +10 -1
- package/commands/b2b-compatible/anthropic-files.command.ts +29 -0
- package/commands/b2b-compatible/anthropic-messages.command.ts +244 -0
- package/commands/b2b-compatible/anthropic-models.command.ts +31 -0
- package/commands/b2b-compatible/common.schemas.ts +55 -0
- package/commands/b2b-compatible/index.ts +7 -0
- package/commands/b2b-compatible/openai-files.command.ts +37 -0
- package/commands/b2b-compatible/openai-models.command.ts +29 -0
- package/commands/b2b-compatible/openai-responses.command.ts +191 -0
- package/commands/b2b-usage-log/get-b2b-usage-statistics.command.ts +128 -0
- package/commands/b2b-usage-log/index.ts +1 -0
- package/commands/index.ts +2 -1
- package/constants/b2b/enums/b2b-debit-status.enum.ts +5 -0
- package/constants/b2b/enums/b2b-endpoint-family.enum.ts +5 -0
- package/constants/b2b/enums/b2b-statistics-granularity.enum.ts +4 -0
- package/constants/b2b/enums/b2b-statistics-period.enum.ts +9 -0
- package/constants/b2b/enums/b2b-usage-operation.enum.ts +4 -0
- package/constants/b2b/enums/b2b-usage-spend-component.enum.ts +8 -0
- package/constants/b2b/enums/b2b-usage-status.enum.ts +4 -0
- package/constants/b2b/enums/index.ts +7 -0
- package/constants/index.ts +1 -1
- package/models/agents/index.ts +0 -2
- package/models/b2b/b2b-usage-statistics.schema.ts +81 -0
- package/models/b2b/index.ts +1 -0
- package/models/canvas-node.schema.ts +2 -2
- package/models/file.schema.ts +0 -8
- package/models/index.ts +0 -1
- package/models/tools/image-generation/image-generation-job.schema.ts +0 -3
- package/package.json +1 -1
- package/api/controllers/http/agents/agent-statistics.ts +0 -5
- package/api/controllers/http/canvas-var-generation.ts +0 -7
- package/api/controllers/http/photo-studio.ts +0 -21
- package/build/api/controllers/http/agents/agent-statistics.js +0 -7
- package/build/api/controllers/http/canvas-var-generation.js +0 -9
- package/build/api/controllers/http/photo-studio.js +0 -21
- package/build/commands/agents/agent-dialog/get-cabinet-config.command.js +0 -12
- package/build/commands/agents/agent-dialog/get-cabinet-price-preview.command.js +0 -28
- package/build/commands/agents/agent-dialog/get-dialog-context-length.command.js +0 -30
- package/build/commands/agents/agent-dialog/rename-agent-dialog.command.js +0 -17
- package/build/commands/agents/agent-dialog/stop-cabinet-stream.command.js +0 -15
- package/build/commands/agents/agent-template/get-agent-template-instructions-by-template.command.js +0 -14
- package/build/commands/agents/agents/get-agent-statistics.command.js +0 -20
- package/build/commands/ai-studio/canvas-tool/var-gen/generate-variables.command.js +0 -18
- package/build/commands/ai-studio/canvas-tool/var-gen/get-var-gen-config.command.js +0 -11
- package/build/commands/ai-studio/canvas-tool/var-gen/get-var-gen-price.command.js +0 -18
- package/build/commands/photo-studio/add-photo-studio-checkpoint.command.js +0 -17
- package/build/commands/photo-studio/clear-photo-studio-checkpoints.command.js +0 -12
- package/build/commands/photo-studio/create-photo-studio-canvas.command.js +0 -15
- package/build/commands/photo-studio/delete-photo-studio-canvas.command.js +0 -11
- package/build/commands/photo-studio/delete-photo-studio-checkpoint.command.js +0 -14
- package/build/commands/photo-studio/execute-photo-studio-action.command.js +0 -47
- package/build/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.js +0 -12
- package/build/commands/photo-studio/find-photo-studio-canvases.query.js +0 -18
- package/build/commands/photo-studio/find-photo-studio-checkpoints.query.js +0 -12
- package/build/commands/photo-studio/find-photo-studio-job-by-id.query.js +0 -32
- package/build/commands/photo-studio/find-photo-studio-jobs.query.js +0 -18
- package/build/commands/photo-studio/get-photo-studio-actions.query.js +0 -11
- package/build/commands/photo-studio/index.js +0 -31
- package/build/commands/photo-studio/save-photo-studio-canvas.command.js +0 -18
- package/build/commands/photo-studio/update-photo-studio-canvas.command.js +0 -15
- package/build/commands/photo-studio/update-photo-studio-checkpoint.command.js +0 -19
- package/build/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.js +0 -11
- package/build/models/agents/agent-statistics.schema.js +0 -33
- package/build/models/agents/message-attachment.schema.js +0 -21
- package/build/models/photo-studio/photo-studio-action.schema.js +0 -17
- package/build/models/photo-studio/photo-studio-checkpoint.schema.js +0 -21
- package/build/models/photo-studio/photo-studio-image-node.schema.js +0 -19
- package/build/models/photo-studio/photo-studio.schema.js +0 -15
- package/commands/agents/agent-dialog/get-cabinet-config.command.ts +0 -11
- package/commands/agents/agent-dialog/get-cabinet-price-preview.command.ts +0 -30
- package/commands/agents/agent-dialog/get-dialog-context-length.command.ts +0 -33
- package/commands/agents/agent-dialog/rename-agent-dialog.command.ts +0 -19
- package/commands/agents/agent-dialog/stop-cabinet-stream.command.ts +0 -15
- package/commands/agents/agent-template/get-agent-template-instructions-by-template.command.ts +0 -14
- package/commands/agents/agents/get-agent-statistics.command.ts +0 -28
- package/commands/ai-studio/canvas-tool/var-gen/generate-variables.command.ts +0 -20
- package/commands/ai-studio/canvas-tool/var-gen/get-var-gen-config.command.ts +0 -9
- package/commands/ai-studio/canvas-tool/var-gen/get-var-gen-price.command.ts +0 -18
- package/commands/ai-studio/canvas-tool/var-gen/index.ts +0 -3
- package/commands/photo-studio/add-photo-studio-checkpoint.command.ts +0 -23
- package/commands/photo-studio/clear-photo-studio-checkpoints.command.ts +0 -12
- package/commands/photo-studio/create-photo-studio-canvas.command.ts +0 -16
- package/commands/photo-studio/delete-photo-studio-canvas.command.ts +0 -11
- package/commands/photo-studio/delete-photo-studio-checkpoint.command.ts +0 -14
- package/commands/photo-studio/execute-photo-studio-action.command.ts +0 -49
- package/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.ts +0 -12
- package/commands/photo-studio/find-photo-studio-canvases.query.ts +0 -20
- package/commands/photo-studio/find-photo-studio-checkpoints.query.ts +0 -12
- package/commands/photo-studio/find-photo-studio-job-by-id.query.ts +0 -36
- package/commands/photo-studio/find-photo-studio-jobs.query.ts +0 -20
- package/commands/photo-studio/get-photo-studio-actions.query.ts +0 -10
- package/commands/photo-studio/index.ts +0 -15
- package/commands/photo-studio/save-photo-studio-canvas.command.ts +0 -24
- package/commands/photo-studio/update-photo-studio-canvas.command.ts +0 -17
- package/commands/photo-studio/update-photo-studio-checkpoint.command.ts +0 -25
- package/constants/photo-studio/enums/index.ts +0 -1
- package/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.ts +0 -7
- package/models/agents/agent-statistics.schema.ts +0 -38
- package/models/agents/message-attachment.schema.ts +0 -22
- package/models/photo-studio/index.ts +0 -4
- package/models/photo-studio/photo-studio-action.schema.ts +0 -18
- package/models/photo-studio/photo-studio-checkpoint.schema.ts +0 -22
- package/models/photo-studio/photo-studio-image-node.schema.ts +0 -22
- package/models/photo-studio/photo-studio.schema.ts +0 -16
- /package/build/constants/{photo-studio → b2b}/index.js +0 -0
- /package/constants/{photo-studio → b2b}/index.ts +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnthropicMessagesCommand = exports.AnthropicMessageSchema = exports.AnthropicSystemContentBlockSchema = exports.AnthropicMessageContentBlockSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_schemas_1 = require("./common.schemas");
|
|
6
|
+
const AnthropicCacheControlSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.string(),
|
|
9
|
+
})
|
|
10
|
+
.passthrough();
|
|
11
|
+
const AnthropicTextBlockSchema = zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
type: zod_1.z.literal('text'),
|
|
14
|
+
text: zod_1.z.string(),
|
|
15
|
+
cache_control: AnthropicCacheControlSchema.optional(),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
const AnthropicBase64SourceSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
type: zod_1.z.literal('base64'),
|
|
21
|
+
media_type: zod_1.z.string(),
|
|
22
|
+
data: zod_1.z.string(),
|
|
23
|
+
})
|
|
24
|
+
.passthrough();
|
|
25
|
+
const AnthropicUrlSourceSchema = zod_1.z
|
|
26
|
+
.object({
|
|
27
|
+
type: zod_1.z.literal('url'),
|
|
28
|
+
url: zod_1.z.string(),
|
|
29
|
+
})
|
|
30
|
+
.passthrough();
|
|
31
|
+
const AnthropicFileSourceSchema = zod_1.z
|
|
32
|
+
.object({
|
|
33
|
+
type: zod_1.z.literal('file'),
|
|
34
|
+
file_id: zod_1.z.string(),
|
|
35
|
+
})
|
|
36
|
+
.passthrough();
|
|
37
|
+
const AnthropicTextSourceSchema = zod_1.z
|
|
38
|
+
.object({
|
|
39
|
+
type: zod_1.z.literal('text'),
|
|
40
|
+
media_type: zod_1.z.string().optional(),
|
|
41
|
+
data: zod_1.z.string(),
|
|
42
|
+
})
|
|
43
|
+
.passthrough();
|
|
44
|
+
const AnthropicImageBlockSchema = zod_1.z
|
|
45
|
+
.object({
|
|
46
|
+
type: zod_1.z.literal('image'),
|
|
47
|
+
source: zod_1.z.discriminatedUnion('type', [
|
|
48
|
+
AnthropicBase64SourceSchema,
|
|
49
|
+
AnthropicUrlSourceSchema,
|
|
50
|
+
AnthropicFileSourceSchema,
|
|
51
|
+
]),
|
|
52
|
+
cache_control: AnthropicCacheControlSchema.optional(),
|
|
53
|
+
})
|
|
54
|
+
.passthrough();
|
|
55
|
+
const AnthropicDocumentBlockSchema = zod_1.z
|
|
56
|
+
.object({
|
|
57
|
+
type: zod_1.z.literal('document'),
|
|
58
|
+
source: zod_1.z.discriminatedUnion('type', [
|
|
59
|
+
AnthropicBase64SourceSchema,
|
|
60
|
+
AnthropicUrlSourceSchema,
|
|
61
|
+
AnthropicFileSourceSchema,
|
|
62
|
+
AnthropicTextSourceSchema,
|
|
63
|
+
]),
|
|
64
|
+
title: zod_1.z.string().optional(),
|
|
65
|
+
cache_control: AnthropicCacheControlSchema.optional(),
|
|
66
|
+
})
|
|
67
|
+
.passthrough();
|
|
68
|
+
const AnthropicUnknownContentBlockSchema = zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
type: zod_1.z.string(),
|
|
71
|
+
})
|
|
72
|
+
.passthrough();
|
|
73
|
+
exports.AnthropicMessageContentBlockSchema = zod_1.z.union([
|
|
74
|
+
AnthropicTextBlockSchema,
|
|
75
|
+
AnthropicImageBlockSchema,
|
|
76
|
+
AnthropicDocumentBlockSchema,
|
|
77
|
+
AnthropicUnknownContentBlockSchema,
|
|
78
|
+
]);
|
|
79
|
+
exports.AnthropicSystemContentBlockSchema = zod_1.z.union([
|
|
80
|
+
AnthropicTextBlockSchema,
|
|
81
|
+
AnthropicUnknownContentBlockSchema,
|
|
82
|
+
]);
|
|
83
|
+
exports.AnthropicMessageSchema = zod_1.z
|
|
84
|
+
.object({
|
|
85
|
+
// `system` appears here (not just in the top-level `system` field) when the client
|
|
86
|
+
// uses the mid-conversation-system beta — Claude Code injects operator instructions
|
|
87
|
+
// as `{ role: 'system', content }` entries inside messages[].
|
|
88
|
+
role: zod_1.z.enum(['user', 'assistant', 'system']),
|
|
89
|
+
content: zod_1.z.union([zod_1.z.string(), zod_1.z.array(exports.AnthropicMessageContentBlockSchema)]),
|
|
90
|
+
})
|
|
91
|
+
.passthrough();
|
|
92
|
+
const AnthropicToolSchema = zod_1.z
|
|
93
|
+
.object({
|
|
94
|
+
// Custom tools (the bulk of what the Claude CLI sends) are `{ name, description,
|
|
95
|
+
// input_schema }` with NO `type`. Only server tools (web_search_*, bash_*, …)
|
|
96
|
+
// carry a `type`. Requiring it here 400s every tool-bearing request.
|
|
97
|
+
type: zod_1.z.string().optional(),
|
|
98
|
+
name: zod_1.z.string().optional(),
|
|
99
|
+
user_location: zod_1.z
|
|
100
|
+
.object({
|
|
101
|
+
type: zod_1.z.literal('approximate').optional(),
|
|
102
|
+
country: zod_1.z.string().optional(),
|
|
103
|
+
region: zod_1.z.string().optional(),
|
|
104
|
+
city: zod_1.z.string().optional(),
|
|
105
|
+
})
|
|
106
|
+
.passthrough()
|
|
107
|
+
.optional(),
|
|
108
|
+
})
|
|
109
|
+
.passthrough();
|
|
110
|
+
const AnthropicThinkingSchema = zod_1.z
|
|
111
|
+
.object({
|
|
112
|
+
type: zod_1.z.string().optional(),
|
|
113
|
+
})
|
|
114
|
+
.passthrough();
|
|
115
|
+
var AnthropicMessagesCommand;
|
|
116
|
+
(function (AnthropicMessagesCommand) {
|
|
117
|
+
AnthropicMessagesCommand.HeadersSchema = common_schemas_1.AnthropicHeadersSchema;
|
|
118
|
+
AnthropicMessagesCommand.BodySchema = zod_1.z
|
|
119
|
+
.object({
|
|
120
|
+
model: zod_1.z.string(),
|
|
121
|
+
max_tokens: zod_1.z.number().int().positive(),
|
|
122
|
+
messages: zod_1.z.array(exports.AnthropicMessageSchema).min(1),
|
|
123
|
+
system: zod_1.z.union([zod_1.z.string(), zod_1.z.array(exports.AnthropicSystemContentBlockSchema)]).optional(),
|
|
124
|
+
stream: zod_1.z.boolean().optional(),
|
|
125
|
+
tools: zod_1.z.array(AnthropicToolSchema).optional(),
|
|
126
|
+
container: zod_1.z.unknown().optional(),
|
|
127
|
+
context_management: zod_1.z.unknown().optional(),
|
|
128
|
+
mcp_servers: zod_1.z.array(zod_1.z.unknown()).optional(),
|
|
129
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
130
|
+
service_tier: zod_1.z.string().optional(),
|
|
131
|
+
stop_sequences: zod_1.z.array(zod_1.z.string()).optional(),
|
|
132
|
+
temperature: zod_1.z.number().optional(),
|
|
133
|
+
thinking: AnthropicThinkingSchema.optional(),
|
|
134
|
+
tool_choice: zod_1.z.unknown().optional(),
|
|
135
|
+
top_k: zod_1.z.number().optional(),
|
|
136
|
+
top_p: zod_1.z.number().optional(),
|
|
137
|
+
})
|
|
138
|
+
.passthrough();
|
|
139
|
+
AnthropicMessagesCommand.UsageSchema = zod_1.z
|
|
140
|
+
.object({
|
|
141
|
+
input_tokens: zod_1.z.number().int().nonnegative(),
|
|
142
|
+
output_tokens: zod_1.z.number().int().nonnegative(),
|
|
143
|
+
cache_creation_input_tokens: zod_1.z.number().int().nonnegative().optional(),
|
|
144
|
+
cache_read_input_tokens: zod_1.z.number().int().nonnegative().optional(),
|
|
145
|
+
})
|
|
146
|
+
.strict();
|
|
147
|
+
AnthropicMessagesCommand.TextContentBlockResponseSchema = zod_1.z
|
|
148
|
+
.object({
|
|
149
|
+
type: zod_1.z.literal('text'),
|
|
150
|
+
text: zod_1.z.string(),
|
|
151
|
+
})
|
|
152
|
+
.strict();
|
|
153
|
+
AnthropicMessagesCommand.ResponseSchema = zod_1.z
|
|
154
|
+
.object({
|
|
155
|
+
id: zod_1.z.string(),
|
|
156
|
+
type: zod_1.z.literal('message'),
|
|
157
|
+
role: zod_1.z.literal('assistant'),
|
|
158
|
+
content: zod_1.z.array(AnthropicMessagesCommand.TextContentBlockResponseSchema),
|
|
159
|
+
model: zod_1.z.string(),
|
|
160
|
+
stop_reason: common_schemas_1.NullableStringSchema,
|
|
161
|
+
stop_sequence: common_schemas_1.NullableStringSchema,
|
|
162
|
+
usage: AnthropicMessagesCommand.UsageSchema,
|
|
163
|
+
})
|
|
164
|
+
.strict();
|
|
165
|
+
AnthropicMessagesCommand.StreamEventSchema = zod_1.z.union([
|
|
166
|
+
zod_1.z
|
|
167
|
+
.object({
|
|
168
|
+
type: zod_1.z.literal('message_start'),
|
|
169
|
+
message: AnthropicMessagesCommand.ResponseSchema,
|
|
170
|
+
})
|
|
171
|
+
.strict(),
|
|
172
|
+
zod_1.z
|
|
173
|
+
.object({
|
|
174
|
+
type: zod_1.z.literal('content_block_start'),
|
|
175
|
+
index: zod_1.z.number().int(),
|
|
176
|
+
content_block: AnthropicMessagesCommand.TextContentBlockResponseSchema,
|
|
177
|
+
})
|
|
178
|
+
.strict(),
|
|
179
|
+
zod_1.z
|
|
180
|
+
.object({
|
|
181
|
+
type: zod_1.z.literal('content_block_delta'),
|
|
182
|
+
index: zod_1.z.number().int(),
|
|
183
|
+
delta: zod_1.z
|
|
184
|
+
.object({
|
|
185
|
+
type: zod_1.z.literal('text_delta'),
|
|
186
|
+
text: zod_1.z.string(),
|
|
187
|
+
})
|
|
188
|
+
.strict(),
|
|
189
|
+
})
|
|
190
|
+
.strict(),
|
|
191
|
+
zod_1.z
|
|
192
|
+
.object({
|
|
193
|
+
type: zod_1.z.literal('content_block_stop'),
|
|
194
|
+
index: zod_1.z.number().int(),
|
|
195
|
+
})
|
|
196
|
+
.strict(),
|
|
197
|
+
zod_1.z
|
|
198
|
+
.object({
|
|
199
|
+
type: zod_1.z.literal('message_delta'),
|
|
200
|
+
delta: zod_1.z
|
|
201
|
+
.object({
|
|
202
|
+
stop_reason: common_schemas_1.NullableStringSchema.optional(),
|
|
203
|
+
stop_sequence: common_schemas_1.NullableStringSchema.optional(),
|
|
204
|
+
})
|
|
205
|
+
.strict(),
|
|
206
|
+
usage: AnthropicMessagesCommand.UsageSchema.partial().optional(),
|
|
207
|
+
})
|
|
208
|
+
.strict(),
|
|
209
|
+
zod_1.z
|
|
210
|
+
.object({
|
|
211
|
+
type: zod_1.z.literal('message_stop'),
|
|
212
|
+
})
|
|
213
|
+
.strict(),
|
|
214
|
+
common_schemas_1.AnthropicErrorResponseSchema,
|
|
215
|
+
]);
|
|
216
|
+
AnthropicMessagesCommand.ErrorResponseSchema = common_schemas_1.AnthropicErrorResponseSchema;
|
|
217
|
+
})(AnthropicMessagesCommand || (exports.AnthropicMessagesCommand = AnthropicMessagesCommand = {}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnthropicModelsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_schemas_1 = require("./common.schemas");
|
|
6
|
+
var AnthropicModelsCommand;
|
|
7
|
+
(function (AnthropicModelsCommand) {
|
|
8
|
+
AnthropicModelsCommand.HeadersSchema = common_schemas_1.AnthropicHeadersSchema;
|
|
9
|
+
AnthropicModelsCommand.ModelSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
id: zod_1.z.string(),
|
|
12
|
+
type: zod_1.z.literal('model'),
|
|
13
|
+
display_name: zod_1.z.string(),
|
|
14
|
+
created_at: zod_1.z.string().datetime(),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
AnthropicModelsCommand.ResponseSchema = zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
data: zod_1.z.array(AnthropicModelsCommand.ModelSchema),
|
|
20
|
+
first_id: zod_1.z.string().nullable(),
|
|
21
|
+
last_id: zod_1.z.string().nullable(),
|
|
22
|
+
has_more: zod_1.z.boolean(),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
AnthropicModelsCommand.ErrorResponseSchema = common_schemas_1.AnthropicErrorResponseSchema;
|
|
26
|
+
})(AnthropicModelsCommand || (exports.AnthropicModelsCommand = AnthropicModelsCommand = {}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompatibleFileUploadMetadataSchema = exports.AnthropicErrorResponseSchema = exports.OpenAIErrorResponseSchema = exports.AnthropicHeadersSchema = exports.OpenAIHeadersSchema = exports.NullableStringSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.NullableStringSchema = zod_1.z.string().nullable();
|
|
6
|
+
exports.OpenAIHeadersSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
authorization: zod_1.z.string(),
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
exports.AnthropicHeadersSchema = zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
'x-api-key': zod_1.z.string(),
|
|
14
|
+
'anthropic-version': zod_1.z.string().optional(),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
exports.OpenAIErrorResponseSchema = zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
error: zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
message: zod_1.z.string(),
|
|
22
|
+
type: zod_1.z.string(),
|
|
23
|
+
param: exports.NullableStringSchema,
|
|
24
|
+
code: exports.NullableStringSchema,
|
|
25
|
+
})
|
|
26
|
+
.strict(),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
exports.AnthropicErrorResponseSchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
type: zod_1.z.literal('error'),
|
|
32
|
+
error: zod_1.z
|
|
33
|
+
.object({
|
|
34
|
+
type: zod_1.z.string(),
|
|
35
|
+
message: zod_1.z.string(),
|
|
36
|
+
})
|
|
37
|
+
.strict(),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
exports.CompatibleFileUploadMetadataSchema = zod_1.z
|
|
41
|
+
.object({
|
|
42
|
+
filename: zod_1.z.string(),
|
|
43
|
+
mimetype: zod_1.z.string(),
|
|
44
|
+
size: zod_1.z.number().int().nonnegative(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./anthropic-files.command"), exports);
|
|
18
|
+
__exportStar(require("./anthropic-messages.command"), exports);
|
|
19
|
+
__exportStar(require("./anthropic-models.command"), exports);
|
|
20
|
+
__exportStar(require("./common.schemas"), exports);
|
|
21
|
+
__exportStar(require("./openai-files.command"), exports);
|
|
22
|
+
__exportStar(require("./openai-models.command"), exports);
|
|
23
|
+
__exportStar(require("./openai-responses.command"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAIFilesCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_schemas_1 = require("./common.schemas");
|
|
6
|
+
var OpenAIFilesCommand;
|
|
7
|
+
(function (OpenAIFilesCommand) {
|
|
8
|
+
OpenAIFilesCommand.HeadersSchema = common_schemas_1.OpenAIHeadersSchema;
|
|
9
|
+
OpenAIFilesCommand.BodySchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
purpose: zod_1.z.enum(['assistants', 'batch', 'fine-tune', 'vision', 'user_data', 'evals']),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
OpenAIFilesCommand.FileMetadataSchema = common_schemas_1.CompatibleFileUploadMetadataSchema;
|
|
15
|
+
OpenAIFilesCommand.ResponseSchema = zod_1.z
|
|
16
|
+
.object({
|
|
17
|
+
id: zod_1.z.string().uuid(),
|
|
18
|
+
object: zod_1.z.literal('file'),
|
|
19
|
+
bytes: zod_1.z.number().int().nonnegative(),
|
|
20
|
+
created_at: zod_1.z.number().int(),
|
|
21
|
+
filename: zod_1.z.string(),
|
|
22
|
+
purpose: OpenAIFilesCommand.BodySchema.shape.purpose,
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
OpenAIFilesCommand.ErrorResponseSchema = common_schemas_1.OpenAIErrorResponseSchema;
|
|
26
|
+
})(OpenAIFilesCommand || (exports.OpenAIFilesCommand = OpenAIFilesCommand = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAIModelsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_schemas_1 = require("./common.schemas");
|
|
6
|
+
var OpenAIModelsCommand;
|
|
7
|
+
(function (OpenAIModelsCommand) {
|
|
8
|
+
OpenAIModelsCommand.HeadersSchema = common_schemas_1.OpenAIHeadersSchema;
|
|
9
|
+
OpenAIModelsCommand.ModelSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
id: zod_1.z.string(),
|
|
12
|
+
object: zod_1.z.literal('model'),
|
|
13
|
+
created: zod_1.z.number().int(),
|
|
14
|
+
owned_by: zod_1.z.literal('rugpt'),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
OpenAIModelsCommand.ResponseSchema = zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
object: zod_1.z.literal('list'),
|
|
20
|
+
data: zod_1.z.array(OpenAIModelsCommand.ModelSchema),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
OpenAIModelsCommand.ErrorResponseSchema = common_schemas_1.OpenAIErrorResponseSchema;
|
|
24
|
+
})(OpenAIModelsCommand || (exports.OpenAIModelsCommand = OpenAIModelsCommand = {}));
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAIResponsesCommand = exports.OpenAIResponseInputMessageSchema = exports.OpenAIResponseInputContentPartSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_schemas_1 = require("./common.schemas");
|
|
6
|
+
const OpenAIInputTextContentPartSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
type: zod_1.z.enum(['input_text', 'text', 'output_text']),
|
|
9
|
+
text: zod_1.z.string(),
|
|
10
|
+
})
|
|
11
|
+
.passthrough();
|
|
12
|
+
const OpenAIInputImageContentPartSchema = zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
type: zod_1.z.literal('input_image'),
|
|
15
|
+
image_url: zod_1.z.string().optional(),
|
|
16
|
+
file_id: zod_1.z.string().optional(),
|
|
17
|
+
detail: zod_1.z.enum(['auto', 'low', 'high']).optional(),
|
|
18
|
+
})
|
|
19
|
+
.passthrough();
|
|
20
|
+
const OpenAIInputFileContentPartSchema = zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
type: zod_1.z.literal('input_file'),
|
|
23
|
+
file_id: zod_1.z.string().optional(),
|
|
24
|
+
file_data: zod_1.z.string().optional(),
|
|
25
|
+
file_url: zod_1.z.string().optional(),
|
|
26
|
+
filename: zod_1.z.string().optional(),
|
|
27
|
+
mime_type: zod_1.z.string().optional(),
|
|
28
|
+
})
|
|
29
|
+
.passthrough();
|
|
30
|
+
exports.OpenAIResponseInputContentPartSchema = zod_1.z.discriminatedUnion('type', [
|
|
31
|
+
OpenAIInputTextContentPartSchema,
|
|
32
|
+
OpenAIInputImageContentPartSchema,
|
|
33
|
+
OpenAIInputFileContentPartSchema,
|
|
34
|
+
]);
|
|
35
|
+
exports.OpenAIResponseInputMessageSchema = zod_1.z
|
|
36
|
+
.object({
|
|
37
|
+
type: zod_1.z.literal('message').optional(),
|
|
38
|
+
role: zod_1.z.enum(['system', 'developer', 'user', 'assistant']),
|
|
39
|
+
content: zod_1.z.union([zod_1.z.string(), zod_1.z.array(exports.OpenAIResponseInputContentPartSchema)]),
|
|
40
|
+
})
|
|
41
|
+
.passthrough();
|
|
42
|
+
const OpenAIAnyToolSchema = zod_1.z
|
|
43
|
+
.object({
|
|
44
|
+
type: zod_1.z.string(),
|
|
45
|
+
})
|
|
46
|
+
.passthrough();
|
|
47
|
+
const OpenAIResponseMetadataSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
48
|
+
const OpenAIResponseReasoningSchema = zod_1.z
|
|
49
|
+
.object({
|
|
50
|
+
effort: zod_1.z.string().optional(),
|
|
51
|
+
summary: zod_1.z.string().nullable().optional(),
|
|
52
|
+
})
|
|
53
|
+
.passthrough();
|
|
54
|
+
const OpenAIResponseTextOptionsSchema = zod_1.z
|
|
55
|
+
.object({
|
|
56
|
+
format: zod_1.z.unknown().optional(),
|
|
57
|
+
verbosity: zod_1.z.string().optional(),
|
|
58
|
+
})
|
|
59
|
+
.passthrough();
|
|
60
|
+
const OpenAIResponseUsageSchema = zod_1.z
|
|
61
|
+
.object({
|
|
62
|
+
input_tokens: zod_1.z.number().int().nonnegative(),
|
|
63
|
+
output_tokens: zod_1.z.number().int().nonnegative(),
|
|
64
|
+
total_tokens: zod_1.z.number().int().nonnegative(),
|
|
65
|
+
input_tokens_details: zod_1.z
|
|
66
|
+
.object({
|
|
67
|
+
cached_tokens: zod_1.z.number().int().nonnegative().optional(),
|
|
68
|
+
})
|
|
69
|
+
.strict()
|
|
70
|
+
.optional(),
|
|
71
|
+
})
|
|
72
|
+
.strict();
|
|
73
|
+
const OpenAIResponseOutputTextSchema = zod_1.z
|
|
74
|
+
.object({
|
|
75
|
+
type: zod_1.z.literal('output_text'),
|
|
76
|
+
text: zod_1.z.string(),
|
|
77
|
+
annotations: zod_1.z.array(zod_1.z.unknown()),
|
|
78
|
+
})
|
|
79
|
+
.strict();
|
|
80
|
+
const OpenAIResponseOutputMessageSchema = zod_1.z
|
|
81
|
+
.object({
|
|
82
|
+
id: zod_1.z.string(),
|
|
83
|
+
type: zod_1.z.literal('message'),
|
|
84
|
+
status: zod_1.z.literal('completed'),
|
|
85
|
+
role: zod_1.z.literal('assistant'),
|
|
86
|
+
content: zod_1.z.array(OpenAIResponseOutputTextSchema),
|
|
87
|
+
})
|
|
88
|
+
.strict();
|
|
89
|
+
var OpenAIResponsesCommand;
|
|
90
|
+
(function (OpenAIResponsesCommand) {
|
|
91
|
+
OpenAIResponsesCommand.HeadersSchema = common_schemas_1.OpenAIHeadersSchema;
|
|
92
|
+
OpenAIResponsesCommand.BodySchema = zod_1.z
|
|
93
|
+
.object({
|
|
94
|
+
model: zod_1.z.string(),
|
|
95
|
+
input: zod_1.z.union([zod_1.z.string(), zod_1.z.array(exports.OpenAIResponseInputMessageSchema).min(1)]),
|
|
96
|
+
instructions: zod_1.z.string().optional(),
|
|
97
|
+
stream: zod_1.z.boolean().optional(),
|
|
98
|
+
max_output_tokens: zod_1.z.number().int().positive().optional(),
|
|
99
|
+
tools: zod_1.z.array(OpenAIAnyToolSchema).optional(),
|
|
100
|
+
background: zod_1.z.boolean().optional(),
|
|
101
|
+
include: zod_1.z.array(zod_1.z.string()).optional(),
|
|
102
|
+
max_tool_calls: zod_1.z.number().int().positive().optional(),
|
|
103
|
+
metadata: OpenAIResponseMetadataSchema.nullable().optional(),
|
|
104
|
+
parallel_tool_calls: zod_1.z.boolean().optional(),
|
|
105
|
+
previous_response_id: zod_1.z.string().nullable().optional(),
|
|
106
|
+
prompt: zod_1.z.unknown().optional(),
|
|
107
|
+
reasoning: OpenAIResponseReasoningSchema.nullable().optional(),
|
|
108
|
+
safety_identifier: zod_1.z.string().optional(),
|
|
109
|
+
service_tier: zod_1.z.string().optional(),
|
|
110
|
+
store: zod_1.z.boolean().nullable().optional(),
|
|
111
|
+
stream_options: zod_1.z.unknown().optional(),
|
|
112
|
+
temperature: zod_1.z.number().optional(),
|
|
113
|
+
text: OpenAIResponseTextOptionsSchema.optional(),
|
|
114
|
+
tool_choice: zod_1.z.unknown().optional(),
|
|
115
|
+
top_p: zod_1.z.number().optional(),
|
|
116
|
+
truncation: zod_1.z.string().optional(),
|
|
117
|
+
user: zod_1.z.string().optional(),
|
|
118
|
+
})
|
|
119
|
+
.passthrough();
|
|
120
|
+
OpenAIResponsesCommand.UsageSchema = OpenAIResponseUsageSchema;
|
|
121
|
+
OpenAIResponsesCommand.ResponseSchema = zod_1.z
|
|
122
|
+
.object({
|
|
123
|
+
id: zod_1.z.string(),
|
|
124
|
+
object: zod_1.z.literal('response'),
|
|
125
|
+
created_at: zod_1.z.number().int(),
|
|
126
|
+
status: zod_1.z.literal('completed'),
|
|
127
|
+
model: zod_1.z.string(),
|
|
128
|
+
output: zod_1.z.array(OpenAIResponseOutputMessageSchema),
|
|
129
|
+
output_text: zod_1.z.string(),
|
|
130
|
+
usage: OpenAIResponsesCommand.UsageSchema,
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
OpenAIResponsesCommand.StreamEventSchema = zod_1.z.union([
|
|
134
|
+
zod_1.z
|
|
135
|
+
.object({
|
|
136
|
+
type: zod_1.z.literal('response.created'),
|
|
137
|
+
response: OpenAIResponsesCommand.ResponseSchema.omit({ status: true }).extend({
|
|
138
|
+
status: zod_1.z.literal('in_progress'),
|
|
139
|
+
output: zod_1.z.array(zod_1.z.never()),
|
|
140
|
+
output_text: zod_1.z.literal(''),
|
|
141
|
+
}),
|
|
142
|
+
})
|
|
143
|
+
.strict(),
|
|
144
|
+
zod_1.z
|
|
145
|
+
.object({
|
|
146
|
+
type: zod_1.z.literal('response.output_text.delta'),
|
|
147
|
+
response_id: zod_1.z.string(),
|
|
148
|
+
output_index: zod_1.z.number().int(),
|
|
149
|
+
content_index: zod_1.z.number().int(),
|
|
150
|
+
delta: zod_1.z.string(),
|
|
151
|
+
})
|
|
152
|
+
.strict(),
|
|
153
|
+
zod_1.z
|
|
154
|
+
.object({
|
|
155
|
+
type: zod_1.z.literal('response.output_text.done'),
|
|
156
|
+
response_id: zod_1.z.string(),
|
|
157
|
+
output_index: zod_1.z.number().int(),
|
|
158
|
+
content_index: zod_1.z.number().int(),
|
|
159
|
+
text: zod_1.z.string(),
|
|
160
|
+
})
|
|
161
|
+
.strict(),
|
|
162
|
+
zod_1.z
|
|
163
|
+
.object({
|
|
164
|
+
type: zod_1.z.literal('response.completed'),
|
|
165
|
+
response: OpenAIResponsesCommand.ResponseSchema,
|
|
166
|
+
})
|
|
167
|
+
.strict(),
|
|
168
|
+
common_schemas_1.OpenAIErrorResponseSchema,
|
|
169
|
+
]);
|
|
170
|
+
OpenAIResponsesCommand.ErrorResponseSchema = common_schemas_1.OpenAIErrorResponseSchema;
|
|
171
|
+
})(OpenAIResponsesCommand || (exports.OpenAIResponsesCommand = OpenAIResponsesCommand = {}));
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetB2bUsageStatisticsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const b2b_1 = require("../../models/b2b");
|
|
7
|
+
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
8
|
+
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
9
|
+
const DateOnlySchema = zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(DATE_ONLY_PATTERN)
|
|
12
|
+
.refine((value) => {
|
|
13
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
14
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
15
|
+
return (date.getUTCFullYear() === year &&
|
|
16
|
+
date.getUTCMonth() === month - 1 &&
|
|
17
|
+
date.getUTCDate() === day);
|
|
18
|
+
}, { message: 'Invalid calendar date' });
|
|
19
|
+
const formatLocalDate = (date) => {
|
|
20
|
+
const year = date.getFullYear();
|
|
21
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
22
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
23
|
+
return `${year}-${month}-${day}`;
|
|
24
|
+
};
|
|
25
|
+
const toUtcCalendarTimestamp = (value) => {
|
|
26
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
27
|
+
return Date.UTC(year, month - 1, day);
|
|
28
|
+
};
|
|
29
|
+
var GetB2bUsageStatisticsCommand;
|
|
30
|
+
(function (GetB2bUsageStatisticsCommand) {
|
|
31
|
+
GetB2bUsageStatisticsCommand.RequestQuerySchema = zod_1.z
|
|
32
|
+
.object({
|
|
33
|
+
period: zod_1.z.nativeEnum(constants_1.B2B_STATISTICS_PERIOD).default(constants_1.B2B_STATISTICS_PERIOD.THIRTY_DAYS),
|
|
34
|
+
dateFrom: DateOnlySchema.optional(),
|
|
35
|
+
dateTo: DateOnlySchema.optional(),
|
|
36
|
+
apiKeyId: zod_1.z.string().uuid().optional(),
|
|
37
|
+
})
|
|
38
|
+
.superRefine((query, context) => {
|
|
39
|
+
const isCustom = query.period === constants_1.B2B_STATISTICS_PERIOD.CUSTOM;
|
|
40
|
+
if (!isCustom) {
|
|
41
|
+
if (query.dateFrom !== undefined) {
|
|
42
|
+
context.addIssue({
|
|
43
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
44
|
+
path: ['dateFrom'],
|
|
45
|
+
message: 'dateFrom is only allowed for custom period',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (query.dateTo !== undefined) {
|
|
49
|
+
context.addIssue({
|
|
50
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
51
|
+
path: ['dateTo'],
|
|
52
|
+
message: 'dateTo is only allowed for custom period',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (query.dateFrom === undefined) {
|
|
58
|
+
context.addIssue({
|
|
59
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
60
|
+
path: ['dateFrom'],
|
|
61
|
+
message: 'dateFrom is required for custom period',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (query.dateTo === undefined) {
|
|
65
|
+
context.addIssue({
|
|
66
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
67
|
+
path: ['dateTo'],
|
|
68
|
+
message: 'dateTo is required for custom period',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (query.dateFrom === undefined || query.dateTo === undefined) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const today = formatLocalDate(new Date());
|
|
75
|
+
if (query.dateFrom > today) {
|
|
76
|
+
context.addIssue({
|
|
77
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
78
|
+
path: ['dateFrom'],
|
|
79
|
+
message: 'dateFrom cannot be in the future',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (query.dateTo > today) {
|
|
83
|
+
context.addIssue({
|
|
84
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
85
|
+
path: ['dateTo'],
|
|
86
|
+
message: 'dateTo cannot be in the future',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (query.dateFrom > query.dateTo) {
|
|
90
|
+
context.addIssue({
|
|
91
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
92
|
+
path: ['dateTo'],
|
|
93
|
+
message: 'dateTo must be on or after dateFrom',
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const inclusiveDays = (toUtcCalendarTimestamp(query.dateTo) - toUtcCalendarTimestamp(query.dateFrom)) /
|
|
98
|
+
MILLISECONDS_PER_DAY +
|
|
99
|
+
1;
|
|
100
|
+
if (inclusiveDays > 90) {
|
|
101
|
+
context.addIssue({
|
|
102
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
103
|
+
path: ['dateTo'],
|
|
104
|
+
message: 'Custom period cannot exceed 90 calendar days',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
GetB2bUsageStatisticsCommand.ResponseSchema = zod_1.z.object({
|
|
109
|
+
data: b2b_1.B2bUsageStatisticsSchema,
|
|
110
|
+
});
|
|
111
|
+
})(GetB2bUsageStatisticsCommand || (exports.GetB2bUsageStatisticsCommand = GetB2bUsageStatisticsCommand = {}));
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./get-b2b-usage-statistics.command"), exports);
|
package/build/commands/index.js
CHANGED
|
@@ -37,7 +37,6 @@ __exportStar(require("./midjourney"), exports);
|
|
|
37
37
|
__exportStar(require("./page"), exports);
|
|
38
38
|
__exportStar(require("./order"), exports);
|
|
39
39
|
__exportStar(require("./payment"), exports);
|
|
40
|
-
__exportStar(require("./photo-studio"), exports);
|
|
41
40
|
__exportStar(require("./product"), exports);
|
|
42
41
|
__exportStar(require("./question"), exports);
|
|
43
42
|
__exportStar(require("./referral"), exports);
|
|
@@ -66,6 +65,8 @@ __exportStar(require("./cabinet"), exports);
|
|
|
66
65
|
__exportStar(require("./webmaster"), exports);
|
|
67
66
|
__exportStar(require("./webmaster-click"), exports);
|
|
68
67
|
__exportStar(require("./b2b"), exports);
|
|
68
|
+
__exportStar(require("./b2b-usage-log"), exports);
|
|
69
|
+
__exportStar(require("./b2b-compatible"), exports);
|
|
69
70
|
__exportStar(require("./community"), exports);
|
|
70
71
|
__exportStar(require("./user-profile"), exports);
|
|
71
72
|
__exportStar(require("./team-account"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.B2B_DEBIT_STATUS = void 0;
|
|
4
|
+
var B2B_DEBIT_STATUS;
|
|
5
|
+
(function (B2B_DEBIT_STATUS) {
|
|
6
|
+
B2B_DEBIT_STATUS["NOT_APPLICABLE"] = "not_applicable";
|
|
7
|
+
B2B_DEBIT_STATUS["SUCCESS"] = "success";
|
|
8
|
+
B2B_DEBIT_STATUS["FAILED"] = "failed";
|
|
9
|
+
})(B2B_DEBIT_STATUS || (exports.B2B_DEBIT_STATUS = B2B_DEBIT_STATUS = {}));
|