/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; export const JournalEntriesFilterStatus = { Draft: "draft", PendingApproval: "pending_approval", Approved: "approved", Posted: "posted", Voided: "voided", Rejected: "rejected", Deleted: "deleted", Other: "other", } as const; export type JournalEntriesFilterStatus = OpenEnum< typeof JournalEntriesFilterStatus >; /** * Connector-specific scope hint that controls which downstream source backs the read. On Xero, `manual` reads from `ManualJournals` (free in every tier), while `system` reads from `Journals` (the full general ledger view including manual journal postings, paid post 2026-03-02). Omitting the filter is equivalent to `system` and preserves the legacy default. Only honored on connectors where the distinction is exposed; ignored elsewhere. */ export const JournalEntriesFilterScope = { Manual: "manual", System: "system", } as const; /** * Connector-specific scope hint that controls which downstream source backs the read. On Xero, `manual` reads from `ManualJournals` (free in every tier), while `system` reads from `Journals` (the full general ledger view including manual journal postings, paid post 2026-03-02). Omitting the filter is equivalent to `system` and preserves the legacy default. Only honored on connectors where the distinction is exposed; ignored elsewhere. */ export type JournalEntriesFilterScope = OpenEnum< typeof JournalEntriesFilterScope >; export type JournalEntriesFilter = { updatedSince?: Date | undefined; /** * Journal entry number to search for */ number?: string | undefined; /** * Return only journal entries whose source_id equals the given value (the caller-supplied reference, where the connector stores one). Connectors without support reject this filter with UnsupportedFiltersError. */ sourceId?: string | undefined; /** * Return journal entries posted on or after this date (posting date, inclusive). Connectors without date-range support reject this filter with UnsupportedFiltersError. */ startDate?: Date | undefined; /** * Return journal entries posted on or before this date (posting date, inclusive). Connectors without date-range support reject this filter with UnsupportedFiltersError. */ endDate?: Date | undefined; status?: JournalEntriesFilterStatus | undefined; /** * Connector-specific scope hint that controls which downstream source backs the read. On Xero, `manual` reads from `ManualJournals` (free in every tier), while `system` reads from `Journals` (the full general ledger view including manual journal postings, paid post 2026-03-02). Omitting the filter is equivalent to `system` and preserves the legacy default. Only honored on connectors where the distinction is exposed; ignored elsewhere. */ scope?: JournalEntriesFilterScope | undefined; /** * Filter by the subsidiary (legal entity) the record belongs to. Only honored on connectors that support multi-entity scoping (e.g. NetSuite OneWorld); ignored elsewhere. */ subsidiaryId?: string | undefined; }; /** @internal */ export const JournalEntriesFilterStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, JournalEntriesFilterStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(JournalEntriesFilterStatus) ); /** @internal */ export const JournalEntriesFilterScope$outboundSchema: z.ZodType< string, z.ZodTypeDef, JournalEntriesFilterScope > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(JournalEntriesFilterScope) ); /** @internal */ export type JournalEntriesFilter$Outbound = { updated_since?: string | undefined; number?: string | undefined; source_id?: string | undefined; start_date?: string | undefined; end_date?: string | undefined; status?: string | undefined; scope?: string | undefined; subsidiary_id?: string | undefined; }; /** @internal */ export const JournalEntriesFilter$outboundSchema: z.ZodType< JournalEntriesFilter$Outbound, z.ZodTypeDef, JournalEntriesFilter > = /* @__PURE__ */ lazySchema$(() => z.object({ updatedSince: z.date().transform(v => v.toISOString()).optional(), number: z.string().optional(), sourceId: z.string().optional(), startDate: z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length) ).optional(), endDate: z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length) ).optional(), status: JournalEntriesFilterStatus$outboundSchema.optional(), scope: JournalEntriesFilterScope$outboundSchema.optional(), subsidiaryId: z.string().optional(), }).transform((v) => { return remap$(v, { updatedSince: "updated_since", sourceId: "source_id", startDate: "start_date", endDate: "end_date", subsidiaryId: "subsidiary_id", }); }) ); export function journalEntriesFilterToJSON( journalEntriesFilter: JournalEntriesFilter, ): string { return JSON.stringify( JournalEntriesFilter$outboundSchema.parse(journalEntriesFilter), ); }