@blazingagents/sdk 0.57.0 → 0.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { paginatedResponseSchema, receivedApiErrorCodeSchema } from "../api.js";
3
3
  import { agentIdSchema, sessionIdSchema, taskIdSchema, taskRunIdSchema, tenantIdSchema, turnIdSchema, } from "../ids.js";
4
4
  import { MAX_TASK_NAME_LENGTH, MAX_TASK_PROMPT_LENGTH, MIN_TASK_INTERVAL_MS, } from "../limitations.js";
5
- import { atLeastOneFieldMessage, hasObjectKeys } from "../utils.js";
5
+ import { atLeastOneFieldMessage, hasObjectKeys, instantSchema, } from "../utils.js";
6
6
  import { agentConfigSchema } from "./agents.js";
7
7
  import { metadataSchema, userIdSchema } from "./attribution.js";
8
8
  import { sessionMessagesResponseSchema } from "./sessions.js";
@@ -13,7 +13,7 @@ import { sessionMessagesResponseSchema } from "./sessions.js";
13
13
  export const taskScheduleKindSchema = z.enum(["once", "interval", "cron"]);
14
14
  export const taskOnceConfigSchema = z
15
15
  .object({
16
- at: z.iso.datetime({ offset: true }),
16
+ at: instantSchema,
17
17
  })
18
18
  .strict();
19
19
  export const taskIntervalConfigSchema = z
@@ -35,4 +35,4 @@ export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuery
35
35
  export type { WorkspaceTier } from "./entities/workspaces.ts";
36
36
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceNetworkPolicySchema, workspaceSchema, workspacesListResponseSchema, workspaceTierSchema, } from "./entities/workspaces.ts";
37
37
  export { agentIdSchema, apiKeyTokenSchema, functionCallIdSchema, isAdminAgentId, merchantUsageEventIdSchema, promptIdSchema, sessionIdSchema, } from "./ids.ts";
38
- export { calendarDateSchema } from "./utils.ts";
38
+ export { calendarDateSchema, instantSchema } from "./utils.ts";
@@ -23,4 +23,4 @@ export { tenantDeletionSchema, tenantSettingsResponseSchema, updateTenantSetting
23
23
  export { sessionUsageQuerySchema, sessionUsageResponseSchema, usageOverviewQuerySchema, usageOverviewResponseSchema, usageResponseSchema, } from "./entities/usage.js";
24
24
  export { createWorkspaceBodySchema, updateWorkspaceBodySchema, workspaceNetworkPolicySchema, workspaceSchema, workspacesListResponseSchema, workspaceTierSchema, } from "./entities/workspaces.js";
25
25
  export { agentIdSchema, apiKeyTokenSchema, functionCallIdSchema, isAdminAgentId, merchantUsageEventIdSchema, promptIdSchema, sessionIdSchema, } from "./ids.js";
26
- export { calendarDateSchema } from "./utils.js";
26
+ export { calendarDateSchema, instantSchema } from "./utils.js";
@@ -18,3 +18,12 @@ export declare function hasUniqueValues(values: string[]): boolean;
18
18
  * that passes the date on would answer 500 instead of `validation_failed`.
19
19
  */
20
20
  export declare const calendarDateSchema: z.ZodISODate;
21
+ /**
22
+ * An ISO 8601 instant with an offset that PostgreSQL's `timestamptz` holds.
23
+ * `z.iso.datetime()` accepts what PostgreSQL refuses: year `0000`, an offset
24
+ * that moves `0001-01-01T00:00:00+05:00` to UTC year 0 (`toISOString()` prints
25
+ * `0000-12-31T19:00:00.000Z`), and an offset of 16 hours or more, such as
26
+ * `+23:59`. A route that passes the instant on would answer 500 instead of
27
+ * `validation_failed`.
28
+ */
29
+ export declare const instantSchema: z.ZodISODateTime;
@@ -26,3 +26,19 @@ export const calendarDateSchema = z.iso
26
26
  .refine((date) => !date.startsWith("0000-"), {
27
27
  message: "Year 0000 does not exist.",
28
28
  });
29
+ const OFFSET_PATTERN = /[+-](\d{2})(?::?\d{2})?$/;
30
+ /** PostgreSQL refuses a UTC offset of 16 hours or more. */
31
+ const MAX_OFFSET_HOURS = 15;
32
+ /**
33
+ * An ISO 8601 instant with an offset that PostgreSQL's `timestamptz` holds.
34
+ * `z.iso.datetime()` accepts what PostgreSQL refuses: year `0000`, an offset
35
+ * that moves `0001-01-01T00:00:00+05:00` to UTC year 0 (`toISOString()` prints
36
+ * `0000-12-31T19:00:00.000Z`), and an offset of 16 hours or more, such as
37
+ * `+23:59`. A route that passes the instant on would answer 500 instead of
38
+ * `validation_failed`.
39
+ */
40
+ export const instantSchema = z.iso
41
+ .datetime({ offset: true })
42
+ .refine((instant) => !instant.startsWith("0000-") &&
43
+ new Date(instant).getUTCFullYear() >= 1 &&
44
+ Number(OFFSET_PATTERN.exec(instant)?.[1] ?? 0) <= MAX_OFFSET_HOURS, { message: "Not an instant PostgreSQL's timestamptz holds." });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazingagents/sdk",
3
- "version": "0.57.0",
3
+ "version": "0.57.1",
4
4
  "description": "TypeScript SDK for the Blazing Agents API",
5
5
  "homepage": "https://docs.blazingagents.com",
6
6
  "bugs": {