@kohost/api-client 7.22.0 → 7.23.0

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.
Files changed (99) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/lib/index.d.ts +1 -0
  3. package/dist/lib/index.js +6 -1
  4. package/dist/lib/index.js.map +1 -1
  5. package/dist/lib/serviceContracts.d.ts +27 -0
  6. package/dist/lib/serviceContracts.js +34 -0
  7. package/dist/lib/serviceContracts.js.map +1 -0
  8. package/dist/models/automation.js +1 -0
  9. package/dist/models/automation.js.map +1 -1
  10. package/dist/models/cost.js +5 -0
  11. package/dist/models/cost.js.map +1 -1
  12. package/dist/models/index.d.ts +1 -0
  13. package/dist/models/index.js +3 -1
  14. package/dist/models/index.js.map +1 -1
  15. package/dist/models/serviceContract.d.ts +17 -0
  16. package/dist/models/serviceContract.js +35 -0
  17. package/dist/models/serviceContract.js.map +1 -0
  18. package/dist/models/ticket.js +1 -0
  19. package/dist/models/ticket.js.map +1 -1
  20. package/dist/schemas/automation.d.ts +4 -0
  21. package/dist/schemas/automation.js +4 -0
  22. package/dist/schemas/automation.js.map +1 -1
  23. package/dist/schemas/bill.d.ts +11 -1
  24. package/dist/schemas/bill.js +17 -3
  25. package/dist/schemas/bill.js.map +1 -1
  26. package/dist/schemas/cost.d.ts +36 -1
  27. package/dist/schemas/cost.js +29 -2
  28. package/dist/schemas/cost.js.map +1 -1
  29. package/dist/schemas/index.d.ts +1 -0
  30. package/dist/schemas/index.js +2 -1
  31. package/dist/schemas/serviceContract.d.ts +272 -0
  32. package/dist/schemas/serviceContract.js +220 -0
  33. package/dist/schemas/serviceContract.js.map +1 -0
  34. package/dist/schemas/ticket.d.ts +20 -0
  35. package/dist/schemas/ticket.js +20 -0
  36. package/dist/schemas/ticket.js.map +1 -1
  37. package/dist/useCases/activateServiceContract.d.ts +36 -0
  38. package/dist/useCases/activateServiceContract.js +47 -0
  39. package/dist/useCases/activateServiceContract.js.map +1 -0
  40. package/dist/useCases/addDueContractCosts.d.ts +27 -0
  41. package/dist/useCases/addDueContractCosts.js +47 -0
  42. package/dist/useCases/addDueContractCosts.js.map +1 -0
  43. package/dist/useCases/addServiceContractTicketSchedule.d.ts +36 -0
  44. package/dist/useCases/addServiceContractTicketSchedule.js +47 -0
  45. package/dist/useCases/addServiceContractTicketSchedule.js.map +1 -0
  46. package/dist/useCases/cancelServiceContract.d.ts +36 -0
  47. package/dist/useCases/cancelServiceContract.js +47 -0
  48. package/dist/useCases/cancelServiceContract.js.map +1 -0
  49. package/dist/useCases/createServiceContract.d.ts +27 -0
  50. package/dist/useCases/createServiceContract.js +47 -0
  51. package/dist/useCases/createServiceContract.js.map +1 -0
  52. package/dist/useCases/deleteServiceContract.d.ts +36 -0
  53. package/dist/useCases/deleteServiceContract.js +47 -0
  54. package/dist/useCases/deleteServiceContract.js.map +1 -0
  55. package/dist/useCases/describeOrganizationServiceContract.d.ts +36 -0
  56. package/dist/useCases/describeOrganizationServiceContract.js +47 -0
  57. package/dist/useCases/describeOrganizationServiceContract.js.map +1 -0
  58. package/dist/useCases/describeServiceContract.d.ts +36 -0
  59. package/dist/useCases/describeServiceContract.js +47 -0
  60. package/dist/useCases/describeServiceContract.js.map +1 -0
  61. package/dist/useCases/duplicateServiceContract.d.ts +36 -0
  62. package/dist/useCases/duplicateServiceContract.js +47 -0
  63. package/dist/useCases/duplicateServiceContract.js.map +1 -0
  64. package/dist/useCases/index.d.ts +18 -2
  65. package/dist/useCases/index.js +37 -5
  66. package/dist/useCases/index.js.map +1 -1
  67. package/dist/useCases/listConciergeCostLedger.d.ts +27 -0
  68. package/dist/useCases/listConciergeCostLedger.js +47 -0
  69. package/dist/useCases/listConciergeCostLedger.js.map +1 -0
  70. package/dist/useCases/listConciergeServiceContracts.d.ts +27 -0
  71. package/dist/useCases/listConciergeServiceContracts.js +47 -0
  72. package/dist/useCases/listConciergeServiceContracts.js.map +1 -0
  73. package/dist/useCases/{listConciergeWorkspaceBillLines.d.ts → listOrganizationServiceContracts.d.ts} +6 -6
  74. package/dist/useCases/{listConciergeWorkspaceBillLines.js → listOrganizationServiceContracts.js} +9 -9
  75. package/dist/useCases/listOrganizationServiceContracts.js.map +1 -0
  76. package/dist/useCases/listServiceContractCosts.d.ts +36 -0
  77. package/dist/useCases/listServiceContractCosts.js +47 -0
  78. package/dist/useCases/listServiceContractCosts.js.map +1 -0
  79. package/dist/useCases/listServiceContractTicketSchedules.d.ts +36 -0
  80. package/dist/useCases/listServiceContractTicketSchedules.js +47 -0
  81. package/dist/useCases/listServiceContractTicketSchedules.js.map +1 -0
  82. package/dist/useCases/{describeConciergeBillsSummary.d.ts → listServiceContracts.d.ts} +6 -6
  83. package/dist/useCases/{describeConciergeBillsSummary.js → listServiceContracts.js} +9 -9
  84. package/dist/useCases/listServiceContracts.js.map +1 -0
  85. package/dist/useCases/removeServiceContractTicketSchedule.d.ts +39 -0
  86. package/dist/useCases/removeServiceContractTicketSchedule.js +47 -0
  87. package/dist/useCases/removeServiceContractTicketSchedule.js.map +1 -0
  88. package/dist/useCases/updateServiceContract.d.ts +36 -0
  89. package/dist/useCases/updateServiceContract.js +47 -0
  90. package/dist/useCases/updateServiceContract.js.map +1 -0
  91. package/dist/useCases/updateServiceContractTicketSchedule.d.ts +39 -0
  92. package/dist/useCases/updateServiceContractTicketSchedule.js +47 -0
  93. package/dist/useCases/updateServiceContractTicketSchedule.js.map +1 -0
  94. package/dist/validate.d.ts +23 -0
  95. package/dist/validate.js +4 -1
  96. package/dist/validate.js.map +1 -1
  97. package/package.json +1 -1
  98. package/dist/useCases/describeConciergeBillsSummary.js.map +0 -1
  99. package/dist/useCases/listConciergeWorkspaceBillLines.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"bill.js","names":[],"sources":["../../.generated/schemas/bill.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\nimport { mediaFileSchema } from \"./mediaFile\";\n\n// One bill line is a discriminated union on `type`, so `lines.items` is their\n// `oneOf`. The two branches are disjoint via the `type` const plus\n// `additionalProperties: false`, so a line validates against exactly one.\n//\n// A cost line always names its entry by `costId`; `source` says which\n// collection to look it up in. A `ticket` line resolves through\n// `(ticketId, costId)`, an `adhoc` line reads `costId` straight off the costs\n// collection with `ticketId` null. The claim path is what pairs the two, since\n// JSON Schema cannot state the pairing without splitting the branch and\n// breaking the `type` discriminator every reader keys off.\n//\n// While the bill is a draft the line carries only the reference, the picked\n// `categoryId`, and any draft-time adjustment; the customer-facing `amount`,\n// `description`, and `categoryName` are live-read from the claimed entry and\n// snapshotted onto the line at mark-sent. The billed amount is the marked-up\n// actual (or the `adjustedAmount` override, floored at zero) — vendor truth on\n// the entry is never touched.\n//\n// `vendorCost`, `vendorId` and `hasActual` are a derived snapshot of that\n// vendor truth, written at mark-sent beside `amount` and re-patched when a\n// late actual lands on the claimed entry, so the transactions view and period\n// margin read one collection. `propertyId` and `ticketNumber` are snapshotted\n// beside them so that reader can address the source ticket's property without\n// resolving the ticket. The entry stays the source of truth; the vendor\n// invoice number and files are read live from it, never snapshotted.\nconst costLineSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"type\"],\n properties: {\n id: {\n type: \"string\",\n description: \"Server-minted ID of the bill line.\",\n },\n type: {\n type: \"string\",\n enum: [\"cost\"],\n description: \"Discriminator: a line drawn from a recorded cost entry.\",\n },\n source: {\n type: \"string\",\n enum: [\"ticket\", \"adhoc\"],\n default: \"ticket\",\n description:\n \"Where the claimed cost entry lives, and therefore how `costId` \" +\n \"resolves: on a ticket, or in the costs collection.\",\n },\n ticketId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the ticket the claimed cost entry lives on. Null on an \" +\n \"`adhoc` line, which no ticket carries.\",\n },\n costId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the claimed cost entry: an entry within the ticket on a \" +\n \"`ticket` line, a costs-collection document on an `adhoc` one.\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the claimed entry belongs to, snapshotted at \" +\n \"mark-sent: the source ticket's property on a `ticket` line, the \" +\n \"ad hoc entry's attributed property on an `adhoc` one. Lets a \" +\n \"cross-organization reader reach the ticket's property scope \" +\n \"without a ticket read. Internal, redacted org-side.\",\n },\n ticketNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The source ticket's number, snapshotted at mark-sent. Null on an \" +\n \"`adhoc` line. Internal, redacted org-side.\",\n },\n categoryId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The picked billing category, inherited from the claimed cost entry \" +\n \"when the claim does not name one. Optional while drafting, required \" +\n \"at mark-sent. Manual pick — never derived from the ticket's issue.\",\n },\n categoryName: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The category name snapshotted at mark-sent. Null while drafting, \" +\n \"when it live-reads from the category library.\",\n },\n adjustedAmount: {\n type: [\"integer\", \"null\"],\n minimum: 0,\n default: null,\n description:\n \"Optional draft-time override of the billed amount in integer cents, \" +\n \"floored at zero, replacing the marked-up actual at display and \" +\n \"snapshot. Requires `adjustmentReason`. A credit (below zero) is a \" +\n \"manual line instead.\",\n },\n adjustmentReason: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Short required reason accompanying `adjustedAmount`, kept for the \" +\n \"internal record.\",\n },\n amount: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"The billed amount in integer cents, snapshotted at mark-sent. Null \" +\n \"while drafting, when it live-reads (marked-up actual or the \" +\n \"adjustment) from the cost entry.\",\n },\n description: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The line description, snapshotted at mark-sent. Null while drafting, \" +\n \"when it live-reads from the cost entry.\",\n },\n vendorCost: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"What the claimed entry costs Kohost in integer cents, snapshotted \" +\n \"at mark-sent: the vendor actual when recorded, else the estimate. \" +\n \"Null while drafting or when the entry carries neither. Re-patched \" +\n \"when a late actual lands. Internal, redacted org-side.\",\n },\n vendorId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The org-scoped Vendor named on the claimed entry, snapshotted at \" +\n \"mark-sent. Internal, redacted org-side.\",\n },\n hasActual: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether `vendorCost` is the vendor's settled actual rather than the \" +\n \"estimate, snapshotted at mark-sent and re-patched when the actual \" +\n \"lands. Internal, redacted org-side.\",\n },\n taxable: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether the line's amount joins the bill's taxable subtotal. \" +\n \"Customer-facing: locks at mark-sent.\",\n },\n },\n} as const;\n\n// A manual line is a literal customer-facing row with no markup math: a\n// `description` and `amount` (which may be negative, serving as a credit) and\n// an optional `propertyId`. The independent internal fields — informational\n// `cost` (never derives the amount), `vendorId`, the vendor-invoice file, and\n// `vendorInvoiceNumber` — are redacted org-side via `canSeeCostSplit` and stay\n// editable in any bill state.\nconst manualLineSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"type\", \"description\", \"amount\"],\n properties: {\n id: {\n type: \"string\",\n description: \"Server-minted ID of the bill line.\",\n },\n type: {\n type: \"string\",\n enum: [\"manual\"],\n description: \"Discriminator: a literal, non-ticket line.\",\n },\n description: {\n type: \"string\",\n minLength: 1,\n description: \"The literal customer-facing description.\",\n },\n amount: {\n type: \"integer\",\n description:\n \"The billed amount in integer cents. May be negative, serving as a \" +\n \"credit (reference the reason in the description).\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the manual line is attributed to, when it concerns one.\",\n },\n categoryId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The picked billing category. Optional while drafting, required at \" +\n \"mark-sent.\",\n },\n categoryName: {\n type: [\"string\", \"null\"],\n default: null,\n description: \"The category name snapshotted at mark-sent.\",\n },\n cost: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"Informational internal vendor cost in integer cents. Never derives \" +\n \"the amount. Redacted org-side.\",\n },\n vendorId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Optional reference to the org-scoped Vendor. Internal, redacted \" +\n \"org-side.\",\n },\n vendorInvoice: {\n anyOf: [{ $ref: \"mediaFile.json\" }, { type: \"null\" }],\n default: null,\n description:\n \"The vendor's invoice file backing the line, mirroring the cost-entry \" +\n \"field. Internal, redacted org-side.\",\n },\n vendorInvoiceNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The vendor's own invoice number. Internal, redacted org-side.\",\n },\n taxable: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether the line's amount joins the bill's taxable subtotal. \" +\n \"Customer-facing: locks at mark-sent.\",\n },\n },\n} as const;\n\nexport const billSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"bill.json\",\n title: \"Bill\",\n description:\n \"A OneBill bill, stored platform-wide and stamped with its organization: \" +\n \"KFC staff assemble billed lines from the \" +\n \"uninvoiced cost pool (plus manual lines) into a draft, then mark it sent \" +\n \"to freeze and reveal it to the customer. Lifecycle draft → sent → paid, \" +\n \"plus void. Customers see a bill in-app only once sent.\",\n type: \"object\",\n required: [\"id\", \"organizationId\", \"status\", \"currency\", \"lines\"],\n additionalProperties: false,\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n type: {\n type: \"string\",\n enum: [\"bill\"],\n default: \"bill\",\n },\n organizationId: {\n type: \"string\",\n description:\n \"The organization the bill invoices. Bills live in one admin-database \" +\n \"collection across every organization, so each carries its owner \" +\n \"explicitly — stamped from the request context at creation, never \" +\n \"client-supplied.\",\n },\n status: {\n type: \"string\",\n enum: [\"draft\", \"sent\", \"paid\", \"void\"],\n default: \"draft\",\n description:\n \"Lifecycle state. `sent` freezes customer-facing fields and reveals \" +\n \"the bill to the org; `paid` records manual payment; `void` releases \" +\n \"cost-entry claims and hides the bill from the org view. Drafts \" +\n \"hard-delete rather than voiding.\",\n },\n invoiceNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Kohost's own invoice number, `KB-<n>` from a single global sequence. \" +\n \"System-assigned at mark-sent and never entered by hand: null while \" +\n \"the bill is a draft, immutable once set. A wrong bill is corrected \" +\n \"by void-and-reissue, so numbers gap and are never reused.\",\n },\n period: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n 'Display-only month label (e.g. \"July 2026\"). A UI hint; the bill\\'s ' +\n \"membership is defined by its lines, not a calendar bucket.\",\n },\n currency: {\n type: \"string\",\n enum: [\"USD\"],\n default: \"USD\",\n description: \"ISO 4217 currency code. USD only in v1.\",\n },\n fileId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The generated bill PDF's media-file ID, minted atomically at \" +\n \"mark-sent.\",\n },\n fileUrl: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The generated bill PDF's file-store URL, snapshotted at mark-sent \" +\n \"alongside fileId. Held so the sent-bill surface and the sent \" +\n \"notification email can mint a signed, unauthenticated download link \" +\n \"without a file lookup. Unsigned on its own (a bare link 401s).\",\n },\n memo: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Internal KFC-only note. Never customer-facing; editable in any state.\",\n },\n billingAddress: {\n anyOf: [\n { $ref: \"definitions.json#/definitions/address\" },\n { type: \"null\" },\n ],\n default: null,\n description:\n \"The org billing address snapshotted at mark-sent. Null while \" +\n \"drafting, when it live-reads from the Organization. Mark-sent \" +\n \"requires a complete address (line1, city, state, postalCode).\",\n },\n taxRate: {\n type: [\"number\", \"null\"],\n default: null,\n minimum: 0,\n description:\n \"Tax rate as a plain float percent applied to the taxable line \" +\n \"subtotal. While drafting, null means the platform default rate; the \" +\n \"effective rate is snapshotted at mark-sent.\",\n },\n taxExempt: {\n type: \"boolean\",\n default: false,\n description:\n \"The organization's tax exemption snapshotted at mark-sent. While \" +\n \"drafting it live-reads from the Organization.\",\n },\n shippingAmount: {\n type: [\"integer\", \"null\"],\n default: null,\n minimum: 0,\n description:\n \"Shipping & handling in integer cents, added to the grand total on \" +\n \"top of the line subtotal and tax. Null means none.\",\n },\n lines: {\n type: \"array\",\n default: [],\n description:\n \"The bill's lines: cost lines claimed from the uninvoiced pool and \" +\n \"literal manual lines.\",\n items: {\n oneOf: [costLineSchema, manualLineSchema],\n },\n },\n sentAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was marked sent. Absent until sent.\",\n },\n paidAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was marked paid. Absent until paid.\",\n },\n voidedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was voided. Absent unless voided.\",\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n },\n} as const;\n\nexport type BillSchema = FromSchema<\n typeof billSchema,\n {\n references: [typeof defs, typeof mediaFileSchema];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n\n/** One line on a bill: a cost line or a manual line. */\nexport type BillLine = NonNullable<BillSchema[\"lines\"]>[number];\n"],"mappings":"AAyPA,MAAa,aAAa;CACxB,SAAS;CACT,KAAK;CACL,OAAO;CACP,aACE;CAKF,MAAM;CACN,UAAU;EAAC;EAAM;EAAkB;EAAU;EAAY;CAAO;CAChE,sBAAsB;CACtB,YAAY;EACV,IAAI,EACF,MAAM,mCACR;EACA,MAAM;GACJ,MAAM;GACN,MAAM,CAAC,MAAM;GACb,SAAS;EACX;EACA,gBAAgB;GACd,MAAM;GACN,aACE;EAIJ;EACA,QAAQ;GACN,MAAM;GACN,MAAM;IAAC;IAAS;IAAQ;IAAQ;GAAM;GACtC,SAAS;GACT,aACE;EAIJ;EACA,eAAe;GACb,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAIJ;EACA,QAAQ;GACN,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,UAAU;GACR,MAAM;GACN,MAAM,CAAC,KAAK;GACZ,SAAS;GACT,aAAa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E,MAAM,iBAAiB,GAAG,EAAE,MAAM,OAAO,CAAC;MACpD,SAAS;MACT,aACE;KAEJ;KACA,qBAAqB;MACnB,MAAM,CAAC,UAAU,MAAM;MACvB,SAAS;MACT,aACE;KACJ;KACA,SAAS;MACP,MAAM;MACN,SAAS;MACT,aACE;KAEJ;IACF;GAiI8B,CAAgB,EAC1C;EACF;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,WAAW,EACT,MAAM,qCACR;EACA,WAAW,EACT,MAAM,qCACR;CACF;AACF"}
1
+ {"version":3,"file":"bill.js","names":[],"sources":["../../.generated/schemas/bill.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\nimport { mediaFileSchema } from \"./mediaFile\";\n\n// One bill line is a discriminated union on `type`, so `lines.items` is their\n// `oneOf`. The two branches are disjoint via the `type` const plus\n// `additionalProperties: false`, so a line validates against exactly one.\n//\n// A cost line always names its entry by `costId`; `source` says which\n// collection to look it up in. A `ticket` line resolves through\n// `(ticketId, costId)`, a ticket-less line (`adhoc`, or `contract` for an\n// entry a Service contract minted) reads `costId` straight off the costs\n// collection with `ticketId` null. The claim path is what pairs the two, since\n// JSON Schema cannot state the pairing without splitting the branch and\n// breaking the `type` discriminator every reader keys off.\n//\n// While the bill is a draft the line carries only the reference, the picked\n// `categoryId`, and any draft-time adjustment; the customer-facing `amount`,\n// `description`, and `categoryName` are live-read from the claimed entry and\n// snapshotted onto the line at mark-sent. The billed amount is the marked-up\n// actual (or the `adjustedAmount` override, floored at zero) — vendor truth on\n// the entry is never touched.\n//\n// `vendorCost`, `vendorId` and `hasActual` are a derived snapshot of that\n// vendor truth, written at mark-sent beside `amount` and re-patched when a\n// late actual lands on the claimed entry, so the transactions view and period\n// margin read one collection. `propertyId` and `ticketNumber` are snapshotted\n// beside them so that reader can address the source ticket's property without\n// resolving the ticket. The entry stays the source of truth; the vendor\n// invoice number and files are read live from it, never snapshotted.\nconst costLineSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"type\"],\n properties: {\n id: {\n type: \"string\",\n description: \"Server-minted ID of the bill line.\",\n },\n type: {\n type: \"string\",\n enum: [\"cost\"],\n description: \"Discriminator: a line drawn from a recorded cost entry.\",\n },\n source: {\n type: \"string\",\n enum: [\"ticket\", \"adhoc\", \"contract\"],\n default: \"ticket\",\n description:\n \"Where the claimed cost entry lives, and therefore how `costId` \" +\n \"resolves: on a ticket, or in the costs collection. `contract` is a \" +\n \"costs-collection entry a Service contract minted; it bills by the \" +\n \"same rules as `adhoc`.\",\n },\n ticketId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the ticket the claimed cost entry lives on. Null on an \" +\n \"`adhoc` line, which no ticket carries.\",\n },\n costId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the claimed cost entry: an entry within the ticket on a \" +\n \"`ticket` line, a costs-collection document on an `adhoc` one.\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the claimed entry belongs to, snapshotted at \" +\n \"mark-sent: the source ticket's property on a `ticket` line, the \" +\n \"ad hoc entry's attributed property on an `adhoc` one. Lets a \" +\n \"cross-organization reader reach the ticket's property scope \" +\n \"without a ticket read. Internal, redacted org-side.\",\n },\n ticketNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The source ticket's number, snapshotted at mark-sent. Null on a \" +\n \"ticket-less line. Internal, redacted org-side.\",\n },\n serviceContractId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The Service contract that minted the claimed entry. Null on every \" +\n \"other line. Customer-facing: the org bill links the line to the \" +\n \"contract it recurs under.\",\n },\n serviceContractName: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The contract's name, snapshotted at mark-sent so a sent bill reads \" +\n \"the same after the contract is renamed. Null while drafting, when \" +\n \"it live-reads from the contract.\",\n },\n categoryId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The picked billing category, inherited from the claimed cost entry \" +\n \"when the claim does not name one. Optional while drafting, required \" +\n \"at mark-sent. Manual pick — never derived from the ticket's issue.\",\n },\n categoryName: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The category name snapshotted at mark-sent. Null while drafting, \" +\n \"when it live-reads from the category library.\",\n },\n adjustedAmount: {\n type: [\"integer\", \"null\"],\n minimum: 0,\n default: null,\n description:\n \"Optional draft-time override of the billed amount in integer cents, \" +\n \"floored at zero, replacing the marked-up actual at display and \" +\n \"snapshot. Requires `adjustmentReason`. A credit (below zero) is a \" +\n \"manual line instead.\",\n },\n adjustmentReason: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Short required reason accompanying `adjustedAmount`, kept for the \" +\n \"internal record.\",\n },\n amount: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"The billed amount in integer cents, snapshotted at mark-sent. Null \" +\n \"while drafting, when it live-reads (marked-up actual or the \" +\n \"adjustment) from the cost entry.\",\n },\n description: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The line description, snapshotted at mark-sent. Null while drafting, \" +\n \"when it live-reads from the cost entry.\",\n },\n vendorCost: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"What the claimed entry costs Kohost in integer cents, snapshotted \" +\n \"at mark-sent: the vendor actual when recorded, else the estimate. \" +\n \"Null while drafting or when the entry carries neither. Re-patched \" +\n \"when a late actual lands. Internal, redacted org-side.\",\n },\n vendorId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The org-scoped Vendor named on the claimed entry, snapshotted at \" +\n \"mark-sent. Internal, redacted org-side.\",\n },\n hasActual: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether `vendorCost` is the vendor's settled actual rather than the \" +\n \"estimate, snapshotted at mark-sent and re-patched when the actual \" +\n \"lands. Internal, redacted org-side.\",\n },\n taxable: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether the line's amount joins the bill's taxable subtotal. \" +\n \"Customer-facing: locks at mark-sent.\",\n },\n },\n} as const;\n\n// A manual line is a literal customer-facing row with no markup math: a\n// `description` and `amount` (which may be negative, serving as a credit) and\n// an optional `propertyId`. The independent internal fields — informational\n// `cost` (never derives the amount), `vendorId`, the vendor-invoice file, and\n// `vendorInvoiceNumber` — are redacted org-side via `canSeeCostSplit` and stay\n// editable in any bill state.\nconst manualLineSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"id\", \"type\", \"description\", \"amount\"],\n properties: {\n id: {\n type: \"string\",\n description: \"Server-minted ID of the bill line.\",\n },\n type: {\n type: \"string\",\n enum: [\"manual\"],\n description: \"Discriminator: a literal, non-ticket line.\",\n },\n description: {\n type: \"string\",\n minLength: 1,\n description: \"The literal customer-facing description.\",\n },\n amount: {\n type: \"integer\",\n description:\n \"The billed amount in integer cents. May be negative, serving as a \" +\n \"credit (reference the reason in the description).\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the manual line is attributed to, when it concerns one.\",\n },\n categoryId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The picked billing category. Optional while drafting, required at \" +\n \"mark-sent.\",\n },\n categoryName: {\n type: [\"string\", \"null\"],\n default: null,\n description: \"The category name snapshotted at mark-sent.\",\n },\n cost: {\n type: [\"integer\", \"null\"],\n default: null,\n description:\n \"Informational internal vendor cost in integer cents. Never derives \" +\n \"the amount. Redacted org-side.\",\n },\n vendorId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Optional reference to the org-scoped Vendor. Internal, redacted \" +\n \"org-side.\",\n },\n vendorInvoice: {\n anyOf: [{ $ref: \"mediaFile.json\" }, { type: \"null\" }],\n default: null,\n description:\n \"The vendor's invoice file backing the line, mirroring the cost-entry \" +\n \"field. Internal, redacted org-side.\",\n },\n vendorInvoiceNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The vendor's own invoice number. Internal, redacted org-side.\",\n },\n taxable: {\n type: \"boolean\",\n default: false,\n description:\n \"Whether the line's amount joins the bill's taxable subtotal. \" +\n \"Customer-facing: locks at mark-sent.\",\n },\n },\n} as const;\n\nexport const billSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"bill.json\",\n title: \"Bill\",\n description:\n \"A OneBill bill, stored platform-wide and stamped with its organization: \" +\n \"KFC staff assemble billed lines from the \" +\n \"uninvoiced cost pool (plus manual lines) into a draft, then mark it sent \" +\n \"to freeze and reveal it to the customer. Lifecycle draft → sent → paid, \" +\n \"plus void. Customers see a bill in-app only once sent.\",\n type: \"object\",\n required: [\"id\", \"organizationId\", \"status\", \"currency\", \"lines\"],\n additionalProperties: false,\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n type: {\n type: \"string\",\n enum: [\"bill\"],\n default: \"bill\",\n },\n organizationId: {\n type: \"string\",\n description:\n \"The organization the bill invoices. Bills live in one admin-database \" +\n \"collection across every organization, so each carries its owner \" +\n \"explicitly — stamped from the request context at creation, never \" +\n \"client-supplied.\",\n },\n status: {\n type: \"string\",\n enum: [\"draft\", \"sent\", \"paid\", \"void\"],\n default: \"draft\",\n description:\n \"Lifecycle state. `sent` freezes customer-facing fields and reveals \" +\n \"the bill to the org; `paid` records manual payment; `void` releases \" +\n \"cost-entry claims and hides the bill from the org view. Drafts \" +\n \"hard-delete rather than voiding.\",\n },\n invoiceNumber: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Kohost's own invoice number, `KB-<n>` from a single global sequence. \" +\n \"System-assigned at mark-sent and never entered by hand: null while \" +\n \"the bill is a draft, immutable once set. A wrong bill is corrected \" +\n \"by void-and-reissue, so numbers gap and are never reused.\",\n },\n period: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n 'Display-only month label (e.g. \"July 2026\"). A UI hint; the bill\\'s ' +\n \"membership is defined by its lines, not a calendar bucket.\",\n },\n currency: {\n type: \"string\",\n enum: [\"USD\"],\n default: \"USD\",\n description: \"ISO 4217 currency code. USD only in v1.\",\n },\n fileId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The generated bill PDF's media-file ID, minted atomically at \" +\n \"mark-sent.\",\n },\n fileUrl: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The generated bill PDF's file-store URL, snapshotted at mark-sent \" +\n \"alongside fileId. Held so the sent-bill surface and the sent \" +\n \"notification email can mint a signed, unauthenticated download link \" +\n \"without a file lookup. Unsigned on its own (a bare link 401s).\",\n },\n memo: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"Internal KFC-only note. Never customer-facing; editable in any state.\",\n },\n billingAddress: {\n anyOf: [\n { $ref: \"definitions.json#/definitions/address\" },\n { type: \"null\" },\n ],\n default: null,\n description:\n \"The org billing address snapshotted at mark-sent. Null while \" +\n \"drafting, when it live-reads from the Organization. Mark-sent \" +\n \"requires a complete address (line1, city, state, postalCode).\",\n },\n taxRate: {\n type: [\"number\", \"null\"],\n default: null,\n minimum: 0,\n description:\n \"Tax rate as a plain float percent applied to the taxable line \" +\n \"subtotal. While drafting, null means the platform default rate; the \" +\n \"effective rate is snapshotted at mark-sent.\",\n },\n taxExempt: {\n type: \"boolean\",\n default: false,\n description:\n \"The organization's tax exemption snapshotted at mark-sent. While \" +\n \"drafting it live-reads from the Organization.\",\n },\n shippingAmount: {\n type: [\"integer\", \"null\"],\n default: null,\n minimum: 0,\n description:\n \"Shipping & handling in integer cents, added to the grand total on \" +\n \"top of the line subtotal and tax. Null means none.\",\n },\n lines: {\n type: \"array\",\n default: [],\n description:\n \"The bill's lines: cost lines claimed from the uninvoiced pool and \" +\n \"literal manual lines.\",\n items: {\n oneOf: [costLineSchema, manualLineSchema],\n },\n },\n sentAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was marked sent. Absent until sent.\",\n },\n paidAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was marked paid. Absent until paid.\",\n },\n voidedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the bill was voided. Absent unless voided.\",\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n },\n} as const;\n\nexport type BillSchema = FromSchema<\n typeof billSchema,\n {\n references: [typeof defs, typeof mediaFileSchema];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n\n/** One line on a bill: a cost line or a manual line. */\nexport type BillLine = NonNullable<BillSchema[\"lines\"]>[number];\n"],"mappings":"AA4QA,MAAa,aAAa;CACxB,SAAS;CACT,KAAK;CACL,OAAO;CACP,aACE;CAKF,MAAM;CACN,UAAU;EAAC;EAAM;EAAkB;EAAU;EAAY;CAAO;CAChE,sBAAsB;CACtB,YAAY;EACV,IAAI,EACF,MAAM,mCACR;EACA,MAAM;GACJ,MAAM;GACN,MAAM,CAAC,MAAM;GACb,SAAS;EACX;EACA,gBAAgB;GACd,MAAM;GACN,aACE;EAIJ;EACA,QAAQ;GACN,MAAM;GACN,MAAM;IAAC;IAAS;IAAQ;IAAQ;GAAM;GACtC,SAAS;GACT,aACE;EAIJ;EACA,eAAe;GACb,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAIJ;EACA,QAAQ;GACN,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,UAAU;GACR,MAAM;GACN,MAAM,CAAC,KAAK;GACZ,SAAS;GACT,aAAa;EACf;EACA,QAAQ;GACN,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,SAAS;GACP,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAIJ;EACA,MAAM;GACJ,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EACJ;EACA,gBAAgB;GACd,OAAO,CACL,EAAE,MAAM,wCAAwC,GAChD,EAAE,MAAM,OAAO,CACjB;GACA,SAAS;GACT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S;MACP,MAAM;MACN,SAAS;MACT,aACE;KAEJ;IACF;GAiI8B,CAAgB,EAC1C;EACF;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,WAAW,EACT,MAAM,qCACR;EACA,WAAW,EACT,MAAM,qCACR;CACF;AACF"}
@@ -186,10 +186,45 @@ export declare const costSchema: {
186
186
  };
187
187
  readonly source: {
188
188
  readonly type: "string";
189
- readonly enum: readonly ["adhoc"];
189
+ readonly enum: readonly ["adhoc", "contract"];
190
190
  readonly default: "adhoc";
191
191
  readonly description: string;
192
192
  };
193
+ readonly serviceContractId: {
194
+ readonly type: readonly ["string", "null"];
195
+ readonly default: null;
196
+ readonly description: string;
197
+ };
198
+ readonly splitId: {
199
+ readonly type: readonly ["string", "null"];
200
+ readonly default: null;
201
+ readonly description: "The customer split the entry was minted for. Set once at mint.";
202
+ };
203
+ readonly periodStart: {
204
+ readonly anyOf: readonly [{
205
+ readonly $ref: "definitions.json#/definitions/date";
206
+ }, {
207
+ readonly type: "null";
208
+ }];
209
+ readonly default: null;
210
+ readonly description: string;
211
+ };
212
+ readonly customerPeriodStarts: {
213
+ readonly type: "array";
214
+ readonly default: readonly [];
215
+ readonly items: {
216
+ readonly $ref: "definitions.json#/definitions/date";
217
+ };
218
+ readonly description: string;
219
+ };
220
+ readonly vendorPeriodStarts: {
221
+ readonly type: "array";
222
+ readonly default: readonly [];
223
+ readonly items: {
224
+ readonly $ref: "definitions.json#/definitions/date";
225
+ };
226
+ readonly description: string;
227
+ };
193
228
  readonly organizationId: {
194
229
  readonly type: "string";
195
230
  readonly description: string;
@@ -17,9 +17,36 @@ const costSchema = {
17
17
  },
18
18
  source: {
19
19
  type: "string",
20
- enum: ["adhoc"],
20
+ enum: ["adhoc", "contract"],
21
21
  default: "adhoc",
22
- description: "How the entry came to be recorded. Only `adhoc` today, a biller typing in a charge; the enum is what lets a later importer or integration land in the same collection without a second one. A ticket cost entry carries no source: living on the ticket is what says where it came from."
22
+ description: "How the entry came to be recorded: `adhoc` when a biller typed in a charge, `contract` when a Service contract minted it for a line period. A contract entry's price is fixed by the contract: it skips the below-cost checks, and one priced at zero is never billed. A ticket cost entry carries no source: living on the ticket is what says where it came from."
23
+ },
24
+ serviceContractId: {
25
+ type: ["string", "null"],
26
+ default: null,
27
+ description: "The Service contract that minted the entry. Set once at mint and never edited; null on an ad hoc cost."
28
+ },
29
+ splitId: {
30
+ type: ["string", "null"],
31
+ default: null,
32
+ description: "The customer split the entry was minted for. Set once at mint."
33
+ },
34
+ periodStart: {
35
+ anyOf: [{ $ref: "definitions.json#/definitions/date" }, { type: "null" }],
36
+ default: null,
37
+ description: "The first day (UTC) of the line period the entry was minted for. With the contract and split it is the slot a line occupies, so a line is never minted twice."
38
+ },
39
+ customerPeriodStarts: {
40
+ type: "array",
41
+ default: [],
42
+ items: { $ref: "definitions.json#/definitions/date" },
43
+ description: "The first day (UTC) of each customer period whose price landed on this line: none or one. Empty on an ad hoc cost."
44
+ },
45
+ vendorPeriodStarts: {
46
+ type: "array",
47
+ default: [],
48
+ items: { $ref: "definitions.json#/definitions/date" },
49
+ description: "The first day (UTC) of each vendor period whose invoice day falls in this line, so its vendor amount landed here. Empty on an ad hoc cost and on a line whose vendor side is a settled zero."
23
50
  },
24
51
  organizationId: {
25
52
  type: "string",
@@ -1 +1 @@
1
- {"version":3,"file":"cost.js","names":[],"sources":["../../.generated/schemas/cost.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\nimport { costEntryProperties, costEntryRequired } from \"./costEntry\";\nimport { mediaFileSchema } from \"./mediaFile\";\n\nexport const costSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"cost.json\",\n title: \"Cost\",\n description:\n \"A OneBill cost entry that no ticket carries: a recurring vendor charge, \" +\n \"an expense found while reconciling an invoice, a pass-through cost. It \" +\n \"shares the money shape and reconciliation lifecycle of a ticket cost \" +\n \"entry and moves through the uninvoiced pool the same way, but because no \" +\n \"ticket carries it the DNE approval gate never applies. Stored \" +\n \"platform-wide beside bills and stamped with its organization.\",\n type: \"object\",\n required: [...costEntryRequired, \"organizationId\"],\n additionalProperties: false,\n properties: {\n ...costEntryProperties,\n type: {\n type: \"string\",\n enum: [\"cost\"],\n default: \"cost\",\n },\n source: {\n type: \"string\",\n enum: [\"adhoc\"],\n default: \"adhoc\",\n description:\n \"How the entry came to be recorded. Only `adhoc` today, a biller \" +\n \"typing in a charge; the enum is what lets a later importer or \" +\n \"integration land in the same collection without a second one. A \" +\n \"ticket cost entry carries no source: living on the ticket is what \" +\n \"says where it came from.\",\n },\n organizationId: {\n type: \"string\",\n description:\n \"The organization the cost is billed to. These entries live in one \" +\n \"admin-database collection across every organization, so each \" +\n \"carries its owner explicitly — stamped from the request context at \" +\n \"creation, never client-supplied.\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the cost is attributed to, when it concerns one.\",\n },\n createdBy: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the billing staff member who recorded the entry. Null \" +\n \"when the write was not user-attributable.\",\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n },\n} as const;\n\nexport type CostSchema = FromSchema<\n typeof costSchema,\n {\n references: [typeof defs, typeof mediaFileSchema];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n\n/** One entry of a cost's append-only billing review history. */\nexport type CostBillingReviewEntry = NonNullable<\n CostSchema[\"billingReview\"]\n>[number];\n"],"mappings":";;AAKA,MAAa,aAAa;CACxB,SAAS;CACT,KAAK;CACL,OAAO;CACP,aACE;CAMF,MAAM;CACN,UAAU,CAAC,GAAG,mBAAmB,gBAAgB;CACjD,sBAAsB;CACtB,YAAY;EACV,GAAG;EACH,MAAM;GACJ,MAAM;GACN,MAAM,CAAC,MAAM;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,MAAM,CAAC,OAAO;GACd,SAAS;GACT,aACE;EAKJ;EACA,gBAAgB;GACd,MAAM;GACN,aACE;EAIJ;EACA,YAAY;GACV,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EACJ;EACA,WAAW;GACT,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,WAAW,EACT,MAAM,qCACR;EACA,WAAW,EACT,MAAM,qCACR;CACF;AACF"}
1
+ {"version":3,"file":"cost.js","names":[],"sources":["../../.generated/schemas/cost.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\nimport { costEntryProperties, costEntryRequired } from \"./costEntry\";\nimport { mediaFileSchema } from \"./mediaFile\";\n\nexport const costSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"cost.json\",\n title: \"Cost\",\n description:\n \"A OneBill cost entry that no ticket carries: a recurring vendor charge, \" +\n \"an expense found while reconciling an invoice, a pass-through cost. It \" +\n \"shares the money shape and reconciliation lifecycle of a ticket cost \" +\n \"entry and moves through the uninvoiced pool the same way, but because no \" +\n \"ticket carries it the DNE approval gate never applies. Stored \" +\n \"platform-wide beside bills and stamped with its organization.\",\n type: \"object\",\n required: [...costEntryRequired, \"organizationId\"],\n additionalProperties: false,\n properties: {\n ...costEntryProperties,\n type: {\n type: \"string\",\n enum: [\"cost\"],\n default: \"cost\",\n },\n source: {\n type: \"string\",\n enum: [\"adhoc\", \"contract\"],\n default: \"adhoc\",\n description:\n \"How the entry came to be recorded: `adhoc` when a biller typed in a \" +\n \"charge, `contract` when a Service contract minted it for a line \" +\n \"period. A contract entry's price is fixed by the contract: it skips \" +\n \"the below-cost checks, and one priced at zero is never billed. A \" +\n \"ticket cost entry carries no source: living on the ticket is what \" +\n \"says where it came from.\",\n },\n serviceContractId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The Service contract that minted the entry. Set once at mint and \" +\n \"never edited; null on an ad hoc cost.\",\n },\n splitId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The customer split the entry was minted for. Set once at mint.\",\n },\n periodStart: {\n anyOf: [{ $ref: \"definitions.json#/definitions/date\" }, { type: \"null\" }],\n default: null,\n description:\n \"The first day (UTC) of the line period the entry was minted for. \" +\n \"With the contract and split it is the slot a line occupies, so a \" +\n \"line is never minted twice.\",\n },\n customerPeriodStarts: {\n type: \"array\",\n default: [],\n items: { $ref: \"definitions.json#/definitions/date\" },\n description:\n \"The first day (UTC) of each customer period whose price landed on \" +\n \"this line: none or one. Empty on an ad hoc cost.\",\n },\n vendorPeriodStarts: {\n type: \"array\",\n default: [],\n items: { $ref: \"definitions.json#/definitions/date\" },\n description:\n \"The first day (UTC) of each vendor period whose invoice day falls \" +\n \"in this line, so its vendor amount landed here. Empty on an ad hoc \" +\n \"cost and on a line whose vendor side is a settled zero.\",\n },\n organizationId: {\n type: \"string\",\n description:\n \"The organization the cost is billed to. These entries live in one \" +\n \"admin-database collection across every organization, so each \" +\n \"carries its owner explicitly — stamped from the request context at \" +\n \"creation, never client-supplied.\",\n },\n propertyId: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The property the cost is attributed to, when it concerns one.\",\n },\n createdBy: {\n type: [\"string\", \"null\"],\n default: null,\n description:\n \"The ID of the billing staff member who recorded the entry. Null \" +\n \"when the write was not user-attributable.\",\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n },\n} as const;\n\nexport type CostSchema = FromSchema<\n typeof costSchema,\n {\n references: [typeof defs, typeof mediaFileSchema];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n\n/** One entry of a cost's append-only billing review history. */\nexport type CostBillingReviewEntry = NonNullable<\n CostSchema[\"billingReview\"]\n>[number];\n"],"mappings":";;AAKA,MAAa,aAAa;CACxB,SAAS;CACT,KAAK;CACL,OAAO;CACP,aACE;CAMF,MAAM;CACN,UAAU,CAAC,GAAG,mBAAmB,gBAAgB;CACjD,sBAAsB;CACtB,YAAY;EACV,GAAG;EACH,MAAM;GACJ,MAAM;GACN,MAAM,CAAC,MAAM;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,MAAM,CAAC,SAAS,UAAU;GAC1B,SAAS;GACT,aACE;EAMJ;EACA,mBAAmB;GACjB,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,SAAS;GACP,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EACJ;EACA,aAAa;GACX,OAAO,CAAC,EAAE,MAAM,qCAAqC,GAAG,EAAE,MAAM,OAAO,CAAC;GACxE,SAAS;GACT,aACE;EAGJ;EACA,sBAAsB;GACpB,MAAM;GACN,SAAS,CAAC;GACV,OAAO,EAAE,MAAM,qCAAqC;GACpD,aACE;EAEJ;EACA,oBAAoB;GAClB,MAAM;GACN,SAAS,CAAC;GACV,OAAO,EAAE,MAAM,qCAAqC;GACpD,aACE;EAGJ;EACA,gBAAgB;GACd,MAAM;GACN,aACE;EAIJ;EACA,YAAY;GACV,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EACJ;EACA,WAAW;GACT,MAAM,CAAC,UAAU,MAAM;GACvB,SAAS;GACT,aACE;EAEJ;EACA,WAAW,EACT,MAAM,qCACR;EACA,WAAW,EACT,MAAM,qCACR;CACF;AACF"}
@@ -33,6 +33,7 @@ export { propertySchema, type PropertySchema } from "./property.js";
33
33
  export { reservationSchema, type ReservationSchema } from "./reservation.js";
34
34
  export { resourceSchema, type ResourceSchema } from "./resource.js";
35
35
  export { serverSchema, type ServerSchema } from "./server.js";
36
+ export { serviceContractSchema, type ServiceContractSchema, type ServiceContractCustomerStream, type ServiceContractSplit, type ServiceContractVendorStream, } from "./serviceContract.js";
36
37
  export { sessionSchema, type SessionSchema } from "./session.js";
37
38
  export { shortLinkSchema, type ShortLinkSchema } from "./shortLink.js";
38
39
  export { smsMessageSchema, type SmsMessageSchema } from "./smsMessage.js";
@@ -33,6 +33,7 @@ import { propertySchema } from "./property.js";
33
33
  import { reservationSchema } from "./reservation.js";
34
34
  import { resourceSchema } from "./resource.js";
35
35
  import { serverSchema } from "./server.js";
36
+ import { serviceContractSchema } from "./serviceContract.js";
36
37
  import { sessionSchema } from "./session.js";
37
38
  import { shortLinkSchema } from "./shortLink.js";
38
39
  import { smsMessageSchema } from "./smsMessage.js";
@@ -48,4 +49,4 @@ import { timeSheetSchema } from "./timeSheet.js";
48
49
  import { getters, userSchema } from "./user.js";
49
50
  import { vendorSchema } from "./vendor.js";
50
51
  import { windowCoveringSchema } from "./windowCovering.js";
51
- export { alarmSchema, announcementSchema, automationSchema, billSchema, billingCategorySchema, cameraSchema, categorySchema, costSchema, courtesySchema, credentialSchema, departmentSchema, dimmerSchema, discoveredDeviceSchema, emailMessageSchema, energyReportSchema, energyReportShardSchema, gatewaySchema, groupSchema, identificationSchema, integrationSchema, issueSchema, lockSchema, logSchema, methods as mediaFileMethods, mediaFileSchema, mediaSourceSchema, motionSensorSchema, notificationSchema, organizationSchema, paymentSchema, policySchema, productSchema, propertySchema, reservationSchema, resourceSchema, serverSchema, sessionSchema, shortLinkSchema, smsMessageSchema, sosEventSchema, sosTypeSchema, spaceSchema, switchSchema, systemSchema, systemUserSchema, thermostatSchema, ticketSchema, timeSheetSchema, getters as userGetters, userSchema, vendorSchema, windowCoveringSchema };
52
+ export { alarmSchema, announcementSchema, automationSchema, billSchema, billingCategorySchema, cameraSchema, categorySchema, costSchema, courtesySchema, credentialSchema, departmentSchema, dimmerSchema, discoveredDeviceSchema, emailMessageSchema, energyReportSchema, energyReportShardSchema, gatewaySchema, groupSchema, identificationSchema, integrationSchema, issueSchema, lockSchema, logSchema, methods as mediaFileMethods, mediaFileSchema, mediaSourceSchema, motionSensorSchema, notificationSchema, organizationSchema, paymentSchema, policySchema, productSchema, propertySchema, reservationSchema, resourceSchema, serverSchema, serviceContractSchema, sessionSchema, shortLinkSchema, smsMessageSchema, sosEventSchema, sosTypeSchema, spaceSchema, switchSchema, systemSchema, systemUserSchema, thermostatSchema, ticketSchema, timeSheetSchema, getters as userGetters, userSchema, vendorSchema, windowCoveringSchema };
@@ -0,0 +1,272 @@
1
+ import defs, { ISODateString } from "./definitions.js";
2
+ import type { FromSchema } from "json-schema-to-ts";
3
+ import { mediaFileSchema } from "./mediaFile.js";
4
+ export declare const serviceContractSchema: {
5
+ readonly $schema: "http://json-schema.org/draft-07/schema";
6
+ readonly $id: "serviceContract.json";
7
+ readonly title: "Service Contract";
8
+ readonly description: string;
9
+ readonly type: "object";
10
+ readonly required: readonly ["id", "type", "organizationId", "name", "startsAt", "customer", "status"];
11
+ readonly additionalProperties: false;
12
+ readonly properties: {
13
+ readonly id: {
14
+ readonly $ref: "definitions.json#/definitions/id";
15
+ };
16
+ readonly type: {
17
+ readonly type: "string";
18
+ readonly enum: readonly ["serviceContract"];
19
+ readonly default: "serviceContract";
20
+ };
21
+ readonly organizationId: {
22
+ readonly type: "string";
23
+ readonly description: string;
24
+ };
25
+ readonly name: {
26
+ readonly type: "string";
27
+ readonly minLength: 1;
28
+ };
29
+ readonly reference: {
30
+ readonly type: readonly ["string", "null"];
31
+ readonly default: null;
32
+ readonly description: "The vendor's own contract number.";
33
+ };
34
+ readonly description: {
35
+ readonly type: "string";
36
+ readonly default: "";
37
+ readonly description: string;
38
+ };
39
+ readonly startsAt: {
40
+ readonly $ref: "definitions.json#/definitions/date";
41
+ };
42
+ readonly endsAt: {
43
+ readonly anyOf: readonly [{
44
+ readonly $ref: "definitions.json#/definitions/date";
45
+ }, {
46
+ readonly type: "null";
47
+ }];
48
+ readonly default: null;
49
+ readonly description: "Null on an open-ended contract.";
50
+ };
51
+ readonly customer: {
52
+ readonly type: "object";
53
+ readonly additionalProperties: false;
54
+ readonly description: string;
55
+ readonly required: readonly ["amount", "cadence", "startsAt", "splits"];
56
+ readonly properties: {
57
+ readonly amount: {
58
+ readonly type: "integer";
59
+ readonly minimum: 0;
60
+ readonly description: "The per-period total, in integer cents.";
61
+ };
62
+ readonly cadence: {
63
+ readonly type: "object";
64
+ readonly additionalProperties: false;
65
+ readonly required: readonly ["months"];
66
+ readonly properties: {
67
+ readonly months: {
68
+ readonly type: "integer";
69
+ readonly enum: readonly [1, 3, 6, 12];
70
+ readonly description: "Length of one period in whole months.";
71
+ };
72
+ };
73
+ };
74
+ readonly startsAt: {
75
+ readonly $ref: "definitions.json#/definitions/date";
76
+ readonly description: string;
77
+ };
78
+ readonly nextPeriodStartsAt: {
79
+ readonly anyOf: readonly [{
80
+ readonly $ref: "definitions.json#/definitions/date";
81
+ }, {
82
+ readonly type: "null";
83
+ }];
84
+ readonly default: null;
85
+ readonly description: string;
86
+ };
87
+ readonly splits: {
88
+ readonly type: "array";
89
+ readonly default: readonly [];
90
+ readonly items: {
91
+ readonly type: "object";
92
+ readonly additionalProperties: false;
93
+ readonly required: readonly ["id", "propertyId", "amount"];
94
+ readonly properties: {
95
+ readonly id: {
96
+ readonly type: "string";
97
+ };
98
+ readonly propertyId: {
99
+ readonly type: readonly ["string", "null"];
100
+ readonly description: "Null on an org-wide split.";
101
+ };
102
+ readonly label: {
103
+ readonly type: readonly ["string", "null"];
104
+ readonly default: null;
105
+ };
106
+ readonly amount: {
107
+ readonly type: "integer";
108
+ readonly minimum: 0;
109
+ readonly description: string;
110
+ };
111
+ readonly categoryId: {
112
+ readonly type: readonly ["string", "null"];
113
+ readonly default: null;
114
+ readonly description: "The billing category the split's Contract costs arrive under.";
115
+ };
116
+ readonly vendorAmount: {
117
+ readonly type: readonly ["integer", "null"];
118
+ readonly minimum: 0;
119
+ readonly default: null;
120
+ readonly description: string;
121
+ };
122
+ };
123
+ };
124
+ };
125
+ };
126
+ };
127
+ readonly vendor: {
128
+ readonly anyOf: readonly [{
129
+ readonly type: "object";
130
+ readonly additionalProperties: false;
131
+ readonly description: string;
132
+ readonly required: readonly ["amount", "cadence", "startsAt", "vendorId"];
133
+ readonly properties: {
134
+ readonly amount: {
135
+ readonly type: "integer";
136
+ readonly minimum: 0;
137
+ readonly description: "The per-period total, in integer cents.";
138
+ };
139
+ readonly cadence: {
140
+ readonly type: "object";
141
+ readonly additionalProperties: false;
142
+ readonly required: readonly ["months"];
143
+ readonly properties: {
144
+ readonly months: {
145
+ readonly type: "integer";
146
+ readonly enum: readonly [1, 3, 6, 12];
147
+ readonly description: "Length of one period in whole months.";
148
+ };
149
+ };
150
+ };
151
+ readonly startsAt: {
152
+ readonly $ref: "definitions.json#/definitions/date";
153
+ readonly description: string;
154
+ };
155
+ readonly nextPeriodStartsAt: {
156
+ readonly anyOf: readonly [{
157
+ readonly $ref: "definitions.json#/definitions/date";
158
+ }, {
159
+ readonly type: "null";
160
+ }];
161
+ readonly default: null;
162
+ readonly description: string;
163
+ };
164
+ readonly vendorId: {
165
+ readonly type: readonly ["string", "null"];
166
+ readonly default: null;
167
+ readonly description: "Required to activate.";
168
+ };
169
+ readonly invoicing: {
170
+ readonly type: "string";
171
+ readonly enum: readonly ["advance", "arrears"];
172
+ readonly default: "arrears";
173
+ readonly description: string;
174
+ };
175
+ };
176
+ }, {
177
+ readonly type: "null";
178
+ }];
179
+ readonly default: null;
180
+ readonly description: "Null on a contract with no vendor stream.";
181
+ };
182
+ readonly approval: {
183
+ readonly type: readonly ["object", "null"];
184
+ readonly default: null;
185
+ readonly additionalProperties: false;
186
+ readonly description: "The organization's written approval of the recurring charge.";
187
+ readonly properties: {
188
+ readonly file: {
189
+ readonly anyOf: readonly [{
190
+ readonly $ref: "mediaFile.json";
191
+ }, {
192
+ readonly type: "null";
193
+ }];
194
+ };
195
+ readonly approvedBy: {
196
+ readonly type: readonly ["object", "null"];
197
+ readonly additionalProperties: false;
198
+ readonly required: readonly ["name"];
199
+ readonly properties: {
200
+ readonly name: {
201
+ readonly type: "string";
202
+ };
203
+ readonly title: {
204
+ readonly type: readonly ["string", "null"];
205
+ };
206
+ };
207
+ };
208
+ readonly approvedAt: {
209
+ readonly anyOf: readonly [{
210
+ readonly $ref: "definitions.json#/definitions/date";
211
+ }, {
212
+ readonly type: "null";
213
+ }];
214
+ };
215
+ };
216
+ };
217
+ readonly documents: {
218
+ readonly type: "array";
219
+ readonly items: {
220
+ readonly $ref: "mediaFile.json";
221
+ };
222
+ readonly default: readonly [];
223
+ };
224
+ readonly ticketSchedules: {
225
+ readonly type: "array";
226
+ readonly default: readonly [];
227
+ readonly items: {
228
+ readonly type: "object";
229
+ readonly additionalProperties: false;
230
+ readonly required: readonly ["automationId"];
231
+ readonly properties: {
232
+ readonly automationId: {
233
+ readonly type: "string";
234
+ };
235
+ };
236
+ };
237
+ };
238
+ readonly status: {
239
+ readonly type: "string";
240
+ readonly enum: readonly ["draft", "active", "ended", "cancelled"];
241
+ readonly default: "draft";
242
+ };
243
+ readonly cancelledReason: {
244
+ readonly type: readonly ["string", "null"];
245
+ readonly default: null;
246
+ };
247
+ readonly createdBy: {
248
+ readonly type: readonly ["string", "null"];
249
+ readonly default: null;
250
+ };
251
+ readonly createdAt: {
252
+ readonly $ref: "definitions.json#/definitions/date";
253
+ };
254
+ readonly updatedAt: {
255
+ readonly $ref: "definitions.json#/definitions/date";
256
+ };
257
+ };
258
+ };
259
+ export type ServiceContractSchema = FromSchema<typeof serviceContractSchema, {
260
+ references: [typeof defs, typeof mediaFileSchema];
261
+ deserialize: [
262
+ {
263
+ pattern: {
264
+ format: "date-time";
265
+ };
266
+ output: Date | ISODateString;
267
+ }
268
+ ];
269
+ }>;
270
+ export type ServiceContractCustomerStream = ServiceContractSchema["customer"];
271
+ export type ServiceContractVendorStream = NonNullable<ServiceContractSchema["vendor"]>;
272
+ export type ServiceContractSplit = ServiceContractCustomerStream["splits"][number];