@kohost/api-client 7.7.1 → 7.8.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.
- package/dist/httpClient.js +3 -2
- package/dist/httpClient.js.map +1 -1
- package/dist/lib/bills.d.ts +74 -0
- package/dist/lib/bills.js +83 -0
- package/dist/lib/bills.js.map +1 -0
- package/dist/lib/deviceNotifications.js +1 -4
- package/dist/lib/deviceNotifications.js.map +1 -1
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.js +27 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/kfcStatsWindow.d.ts +37 -0
- package/dist/lib/kfcStatsWindow.js +46 -0
- package/dist/lib/kfcStatsWindow.js.map +1 -0
- package/dist/lib/lowerBoundTable.d.ts +11 -0
- package/dist/lib/lowerBoundTable.js +28 -0
- package/dist/lib/lowerBoundTable.js.map +1 -0
- package/dist/lib/money.d.ts +61 -0
- package/dist/lib/money.js +80 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/policy-resolvers.js +5 -4
- package/dist/lib/policy-resolvers.js.map +1 -1
- package/dist/lib/ticketRichText.d.ts +35 -0
- package/dist/lib/ticketRichText.js +86 -0
- package/dist/lib/ticketRichText.js.map +1 -0
- package/dist/models/bill.d.ts +17 -0
- package/dist/models/bill.js +37 -0
- package/dist/models/bill.js.map +1 -0
- package/dist/models/billingCategory.d.ts +17 -0
- package/dist/models/billingCategory.js +22 -0
- package/dist/models/billingCategory.js.map +1 -0
- package/dist/models/index.d.ts +2 -1
- package/dist/models/index.js +5 -3
- package/dist/models/index.js.map +1 -1
- package/dist/models/organization.js +4 -0
- package/dist/models/organization.js.map +1 -1
- package/dist/models/ticket.js +5 -0
- package/dist/models/ticket.js.map +1 -1
- package/dist/schemas/bill.d.ts +255 -0
- package/dist/schemas/bill.js +248 -0
- package/dist/schemas/bill.js.map +1 -0
- package/dist/schemas/billingCategory.d.ts +46 -0
- package/dist/schemas/billingCategory.js +38 -0
- package/dist/schemas/billingCategory.js.map +1 -0
- package/dist/schemas/definitions.d.ts +2 -2
- package/dist/schemas/definitions.js +3 -1
- package/dist/schemas/definitions.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -1
- package/dist/schemas/index.js +3 -2
- package/dist/schemas/organization.d.ts +112 -1
- package/dist/schemas/organization.js +93 -0
- package/dist/schemas/organization.js.map +1 -1
- package/dist/schemas/property.d.ts +32 -0
- package/dist/schemas/property.js +26 -0
- package/dist/schemas/property.js.map +1 -1
- package/dist/schemas/ticket.d.ts +381 -3
- package/dist/schemas/ticket.js +419 -1
- package/dist/schemas/ticket.js.map +1 -1
- package/dist/useCases/acknowledgeCostDivergence.d.ts +39 -0
- package/dist/useCases/acknowledgeCostDivergence.js +47 -0
- package/dist/useCases/acknowledgeCostDivergence.js.map +1 -0
- package/dist/useCases/addBillLine.d.ts +36 -0
- package/dist/useCases/addBillLine.js +47 -0
- package/dist/useCases/addBillLine.js.map +1 -0
- package/dist/useCases/addStaffFunctionMember.d.ts +39 -0
- package/dist/useCases/addStaffFunctionMember.js +47 -0
- package/dist/useCases/addStaffFunctionMember.js.map +1 -0
- package/dist/useCases/cancelWorkItem.d.ts +39 -0
- package/dist/useCases/cancelWorkItem.js +47 -0
- package/dist/useCases/cancelWorkItem.js.map +1 -0
- package/dist/useCases/clearWorkItemNoCharge.d.ts +39 -0
- package/dist/useCases/clearWorkItemNoCharge.js +47 -0
- package/dist/useCases/clearWorkItemNoCharge.js.map +1 -0
- package/dist/useCases/createBill.d.ts +27 -0
- package/dist/useCases/createBill.js +47 -0
- package/dist/useCases/createBill.js.map +1 -0
- package/dist/useCases/createBillingCategory.d.ts +27 -0
- package/dist/useCases/createBillingCategory.js +47 -0
- package/dist/useCases/createBillingCategory.js.map +1 -0
- package/dist/useCases/decideApproval.d.ts +39 -0
- package/dist/useCases/decideApproval.js +47 -0
- package/dist/useCases/decideApproval.js.map +1 -0
- package/dist/useCases/deleteBill.d.ts +36 -0
- package/dist/useCases/deleteBill.js +47 -0
- package/dist/useCases/deleteBill.js.map +1 -0
- package/dist/useCases/deleteStaffUser.d.ts +36 -0
- package/dist/useCases/deleteStaffUser.js +47 -0
- package/dist/useCases/deleteStaffUser.js.map +1 -0
- package/dist/useCases/describeBill.d.ts +36 -0
- package/dist/useCases/describeBill.js +47 -0
- package/dist/useCases/describeBill.js.map +1 -0
- package/dist/useCases/describeConciergeFacilitiesViewer.d.ts +27 -0
- package/dist/useCases/describeConciergeFacilitiesViewer.js +47 -0
- package/dist/useCases/describeConciergeFacilitiesViewer.js.map +1 -0
- package/dist/useCases/describeConciergeStatsFilters.d.ts +27 -0
- package/dist/useCases/describeConciergeStatsFilters.js +47 -0
- package/dist/useCases/describeConciergeStatsFilters.js.map +1 -0
- package/dist/useCases/describeConciergeStatsHeatmap.d.ts +27 -0
- package/dist/useCases/describeConciergeStatsHeatmap.js +47 -0
- package/dist/useCases/describeConciergeStatsHeatmap.js.map +1 -0
- package/dist/useCases/describeConciergeStatsSummary.d.ts +27 -0
- package/dist/useCases/describeConciergeStatsSummary.js +47 -0
- package/dist/useCases/describeConciergeStatsSummary.js.map +1 -0
- package/dist/useCases/describeConciergeStatsTickets.d.ts +27 -0
- package/dist/useCases/describeConciergeStatsTickets.js +47 -0
- package/dist/useCases/describeConciergeStatsTickets.js.map +1 -0
- package/dist/useCases/describeConciergeWorkspaceFilters.d.ts +27 -0
- package/dist/useCases/describeConciergeWorkspaceFilters.js +47 -0
- package/dist/useCases/describeConciergeWorkspaceFilters.js.map +1 -0
- package/dist/useCases/describeOrganizationBill.d.ts +36 -0
- package/dist/useCases/describeOrganizationBill.js +47 -0
- package/dist/useCases/describeOrganizationBill.js.map +1 -0
- package/dist/useCases/describeSelfAccess.d.ts +27 -0
- package/dist/useCases/describeSelfAccess.js +47 -0
- package/dist/useCases/describeSelfAccess.js.map +1 -0
- package/dist/useCases/describeStaffFunctions.d.ts +27 -0
- package/dist/useCases/describeStaffFunctions.js +47 -0
- package/dist/useCases/describeStaffFunctions.js.map +1 -0
- package/dist/useCases/describeTicketStatsFilters.d.ts +27 -0
- package/dist/useCases/describeTicketStatsFilters.js +47 -0
- package/dist/useCases/describeTicketStatsFilters.js.map +1 -0
- package/dist/useCases/describeTicketStatsHeatmap.d.ts +27 -0
- package/dist/useCases/describeTicketStatsHeatmap.js +47 -0
- package/dist/useCases/describeTicketStatsHeatmap.js.map +1 -0
- package/dist/useCases/describeTicketStatsSummary.d.ts +27 -0
- package/dist/useCases/describeTicketStatsSummary.js +47 -0
- package/dist/useCases/describeTicketStatsSummary.js.map +1 -0
- package/dist/useCases/describeTicketStatsTickets.d.ts +27 -0
- package/dist/useCases/describeTicketStatsTickets.js +47 -0
- package/dist/useCases/describeTicketStatsTickets.js.map +1 -0
- package/dist/useCases/editCostEntry.d.ts +39 -0
- package/dist/useCases/editCostEntry.js +47 -0
- package/dist/useCases/editCostEntry.js.map +1 -0
- package/dist/useCases/index.d.ts +57 -0
- package/dist/useCases/index.js +116 -2
- package/dist/useCases/index.js.map +1 -1
- package/dist/useCases/listBillingCategories.d.ts +27 -0
- package/dist/useCases/listBillingCategories.js +47 -0
- package/dist/useCases/listBillingCategories.js.map +1 -0
- package/dist/useCases/listBills.d.ts +27 -0
- package/dist/useCases/listBills.js +47 -0
- package/dist/useCases/listBills.js.map +1 -0
- package/dist/useCases/listConciergeUninvoicedCosts.d.ts +27 -0
- package/dist/useCases/listConciergeUninvoicedCosts.js +47 -0
- package/dist/useCases/listConciergeUninvoicedCosts.js.map +1 -0
- package/dist/useCases/listConciergeWorkspaceBills.d.ts +27 -0
- package/dist/useCases/listConciergeWorkspaceBills.js +47 -0
- package/dist/useCases/listConciergeWorkspaceBills.js.map +1 -0
- package/dist/useCases/listConciergeWorkspaceTickets.d.ts +27 -0
- package/dist/useCases/listConciergeWorkspaceTickets.js +47 -0
- package/dist/useCases/listConciergeWorkspaceTickets.js.map +1 -0
- package/dist/useCases/listEligibleApprovers.d.ts +36 -0
- package/dist/useCases/listEligibleApprovers.js +47 -0
- package/dist/useCases/listEligibleApprovers.js.map +1 -0
- package/dist/useCases/listFacilitiesStaffIds.d.ts +27 -0
- package/dist/useCases/listFacilitiesStaffIds.js +47 -0
- package/dist/useCases/listFacilitiesStaffIds.js.map +1 -0
- package/dist/useCases/listKohostStaff.d.ts +27 -0
- package/dist/useCases/listKohostStaff.js +47 -0
- package/dist/useCases/listKohostStaff.js.map +1 -0
- package/dist/useCases/listOrganizationBills.d.ts +27 -0
- package/dist/useCases/listOrganizationBills.js +47 -0
- package/dist/useCases/listOrganizationBills.js.map +1 -0
- package/dist/useCases/markBillPaid.d.ts +36 -0
- package/dist/useCases/markBillPaid.js +47 -0
- package/dist/useCases/markBillPaid.js.map +1 -0
- package/dist/useCases/markBillSent.d.ts +36 -0
- package/dist/useCases/markBillSent.js +47 -0
- package/dist/useCases/markBillSent.js.map +1 -0
- package/dist/useCases/previewBill.d.ts +36 -0
- package/dist/useCases/previewBill.js +47 -0
- package/dist/useCases/previewBill.js.map +1 -0
- package/dist/useCases/recordCostActual.d.ts +39 -0
- package/dist/useCases/recordCostActual.js +47 -0
- package/dist/useCases/recordCostActual.js.map +1 -0
- package/dist/useCases/recordCostEntry.d.ts +36 -0
- package/dist/useCases/recordCostEntry.js +47 -0
- package/dist/useCases/recordCostEntry.js.map +1 -0
- package/dist/useCases/reinstateCostEntry.d.ts +39 -0
- package/dist/useCases/reinstateCostEntry.js +47 -0
- package/dist/useCases/reinstateCostEntry.js.map +1 -0
- package/dist/useCases/removeBillLine.d.ts +39 -0
- package/dist/useCases/removeBillLine.js +47 -0
- package/dist/useCases/removeBillLine.js.map +1 -0
- package/dist/useCases/removeStaffFunctionMember.d.ts +39 -0
- package/dist/useCases/removeStaffFunctionMember.js +47 -0
- package/dist/useCases/removeStaffFunctionMember.js.map +1 -0
- package/dist/useCases/requestApproval.d.ts +36 -0
- package/dist/useCases/requestApproval.js +47 -0
- package/dist/useCases/requestApproval.js.map +1 -0
- package/dist/useCases/rescheduleWorkItem.d.ts +39 -0
- package/dist/useCases/rescheduleWorkItem.js +47 -0
- package/dist/useCases/rescheduleWorkItem.js.map +1 -0
- package/dist/useCases/scheduleWorkItem.d.ts +36 -0
- package/dist/useCases/scheduleWorkItem.js +47 -0
- package/dist/useCases/scheduleWorkItem.js.map +1 -0
- package/dist/useCases/setCostVendorInvoice.d.ts +39 -0
- package/dist/useCases/setCostVendorInvoice.js +47 -0
- package/dist/useCases/setCostVendorInvoice.js.map +1 -0
- package/dist/useCases/setUserSuperAdmin.d.ts +36 -0
- package/dist/useCases/setUserSuperAdmin.js +47 -0
- package/dist/useCases/setUserSuperAdmin.js.map +1 -0
- package/dist/useCases/setWorkItemNoCharge.d.ts +39 -0
- package/dist/useCases/setWorkItemNoCharge.js +47 -0
- package/dist/useCases/setWorkItemNoCharge.js.map +1 -0
- package/dist/useCases/updateBill.d.ts +36 -0
- package/dist/useCases/updateBill.js +47 -0
- package/dist/useCases/updateBill.js.map +1 -0
- package/dist/useCases/updateBillLine.d.ts +39 -0
- package/dist/useCases/updateBillLine.js +47 -0
- package/dist/useCases/updateBillLine.js.map +1 -0
- package/dist/useCases/updateBillingCategory.d.ts +36 -0
- package/dist/useCases/updateBillingCategory.js +47 -0
- package/dist/useCases/updateBillingCategory.js.map +1 -0
- package/dist/useCases/updateOrganizationBillingAddress.d.ts +36 -0
- package/dist/useCases/updateOrganizationBillingAddress.js +47 -0
- package/dist/useCases/updateOrganizationBillingAddress.js.map +1 -0
- package/dist/useCases/updateOrganizationBillingContacts.d.ts +36 -0
- package/dist/useCases/updateOrganizationBillingContacts.js +47 -0
- package/dist/useCases/updateOrganizationBillingContacts.js.map +1 -0
- package/dist/useCases/updateOrganizationTaxExempt.d.ts +36 -0
- package/dist/useCases/updateOrganizationTaxExempt.js +47 -0
- package/dist/useCases/updateOrganizationTaxExempt.js.map +1 -0
- package/dist/useCases/updateStaffUser.d.ts +36 -0
- package/dist/useCases/updateStaffUser.js +47 -0
- package/dist/useCases/updateStaffUser.js.map +1 -0
- package/dist/useCases/voidBill.d.ts +36 -0
- package/dist/useCases/voidBill.js +47 -0
- package/dist/useCases/voidBill.js.map +1 -0
- package/dist/useCases/writeOffCostEntry.d.ts +39 -0
- package/dist/useCases/writeOffCostEntry.js +47 -0
- package/dist/useCases/writeOffCostEntry.js.map +1 -0
- package/dist/validate.d.ts +25 -8
- package/dist/validate.js +9 -4
- package/dist/validate.js.map +1 -1
- package/package.json +6 -6
- package/dist/models/order.d.ts +0 -17
- package/dist/models/order.js +0 -33
- package/dist/models/order.js.map +0 -1
- package/dist/schemas/order.d.ts +0 -186
- package/dist/schemas/order.js +0 -157
- package/dist/schemas/order.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.js","names":[],"sources":["../../.generated/lib/money.ts"],"sourcesContent":["/**\n * The money rules the API and the app must apply identically, so a price shown\n * in the browser can never disagree with the price the server persists or the\n * approval gate compares to the DNE. Before this module each rule was written\n * once per side, and the duplication had already shipped a divergence between\n * persisted copy and the live UI.\n */\n\nimport type { MarkupTier } from \"../schemas/organization.js\";\n\n/**\n * The tier table an organization keys against before anyone configures one.\n * KFC work is never billed at vendor cost, so an unconfigured organization\n * keys to a single flat tier rather than to zero. A saved table replaces this\n * outright — it is a fallback, not a floor, so an organization that should\n * carry no markup writes an explicit `0` tier.\n */\nexport const DEFAULT_MARKUP_TIERS: readonly MarkupTier[] = [\n { minAmount: 0, percent: 10 },\n];\n\n/** An organization's markup tiers, or the default when it has none of its own. */\nexport function resolveMarkupTierTable(\n tiers: readonly MarkupTier[] | undefined | null,\n): MarkupTier[] {\n if (tiers && tiers.length > 0) return [...tiers];\n return DEFAULT_MARKUP_TIERS.map((tier) => ({ ...tier }));\n}\n\n/**\n * Keys a cost entry's markup percent from the org's lower-bound tier table by\n * the entry's vendor-cost estimate (never the ticket total): the highest row\n * whose `minAmount` the estimate meets. Null when no tiers are configured.\n */\nexport function keyedMarkupPercent(\n tiers: readonly MarkupTier[],\n estimateAmount: number,\n): number | null {\n let match: MarkupTier | null = null;\n for (const tier of tiers) {\n if (tier.minAmount > estimateAmount) continue;\n if (match === null || tier.minAmount > match.minAmount) match = tier;\n }\n return match === null ? null : match.percent;\n}\n\n/**\n * The marked-up price of a vendor cost, in integer cents. Price is never stored\n * anywhere — it is always derived from vendor cost and markup on integer cents,\n * so the two sides can never let the vendor cost, markup, and price disagree.\n */\nexport function derivePrice(amount: number, percent: number): number {\n return Math.round(amount * (1 + percent / 100));\n}\n\n/** The sum of already-derived line amounts, in integer cents. */\nexport function billTotal(lineAmounts: readonly number[]): number {\n return lineAmounts.reduce((sum, amount) => sum + amount, 0);\n}\n\n/**\n * The tax rate (a plain float percent) a draft bill uses until a biller writes\n * its own onto the bill.\n */\nexport const DEFAULT_TAX_RATE = 8.375;\n\n/**\n * Tax in integer cents on a bill's taxable subtotal. Taxable credits reduce the\n * base; when they push it negative the tax clamps at zero rather than going\n * negative — a bill never emits a tax refund.\n */\nexport function billTaxAmount(\n taxableSubtotalCents: number,\n ratePercent: number,\n): number {\n return Math.max(0, Math.round((taxableSubtotalCents * ratePercent) / 100));\n}\n\n/** The bill's grand total in integer cents: line sum plus tax and shipping. */\nexport function billGrandTotal({\n subtotal,\n tax,\n shipping,\n}: {\n subtotal: number;\n tax: number;\n shipping: number;\n}): number {\n return subtotal + tax + shipping;\n}\n\n/**\n * Render integer cents as a currency string, e.g.\n * `formatMoney(123456, \"USD\")` → `\"$1,234.56\"`.\n *\n * Locale policy: `locale` defaults to `\"en-US\"` — the pin for any copy that is\n * persisted or shipped to a fixed audience (bill PDFs, emails, and the stored\n * approval/notification messages a customer reads back later). Live UI that\n * should follow the viewer passes `locale = null`, which falls back to the\n * runtime's default locale. Persisted-en-US / live-locale-aware is the\n * deliberate split; a persisted caller must never inherit the browser locale.\n */\nexport function formatMoney(\n cents: number,\n currency = \"USD\",\n locale: string | null = \"en-US\",\n): string {\n return new Intl.NumberFormat(locale ?? undefined, {\n style: \"currency\",\n currency,\n }).format(cents / 100);\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,uBAA8C,CACzD;CAAE,WAAW;CAAG,SAAS;AAAG,CAC9B;;AAGA,SAAgB,uBACd,OACc;CACd,IAAI,SAAS,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,KAAK;CAC/C,OAAO,qBAAqB,KAAK,UAAU,EAAE,GAAG,KAAK,EAAE;AACzD;;;;;;AAOA,SAAgB,mBACd,OACA,gBACe;CACf,IAAI,QAA2B;CAC/B,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,YAAY,gBAAgB;EACrC,IAAI,UAAU,QAAQ,KAAK,YAAY,MAAM,WAAW,QAAQ;CAClE;CACA,OAAO,UAAU,OAAO,OAAO,MAAM;AACvC;;;;;;AAOA,SAAgB,YAAY,QAAgB,SAAyB;CACnE,OAAO,KAAK,MAAM,UAAU,IAAI,UAAU,IAAI;AAChD;;AAGA,SAAgB,UAAU,aAAwC;CAChE,OAAO,YAAY,QAAQ,KAAK,WAAW,MAAM,QAAQ,CAAC;AAC5D;;;;;AAMA,MAAa,mBAAmB;;;;;;AAOhC,SAAgB,cACd,sBACA,aACQ;CACR,OAAO,KAAK,IAAI,GAAG,KAAK,MAAO,uBAAuB,cAAe,GAAG,CAAC;AAC3E;;AAGA,SAAgB,eAAe,EAC7B,UACA,KACA,YAKS;CACT,OAAO,WAAW,MAAM;AAC1B;;;;;;;;;;;;AAaA,SAAgB,YACd,OACA,WAAW,OACX,SAAwB,SAChB;CACR,OAAO,IAAI,KAAK,aAAa,UAAU,KAAA,GAAW;EAChD,OAAO;EACP;CACF,CAAC,CAAC,CAAC,OAAO,QAAQ,GAAG;AACvB"}
|
|
@@ -21,10 +21,11 @@ function getAllowedDeviceTypes(policies, spaceId) {
|
|
|
21
21
|
for (const policy of policies) for (const permission of policy.permissions) for (const entity of permission.entities) {
|
|
22
22
|
if (!matchesSpace(entity)) continue;
|
|
23
23
|
const [, , deviceType] = entity.split(":");
|
|
24
|
-
if (permission.effect === "Allow")
|
|
25
|
-
if (!
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (permission.effect === "Allow") {
|
|
25
|
+
if (!deviceType) {
|
|
26
|
+
if (!allowed.includes("*")) allowed.push("*");
|
|
27
|
+
} else allowed.push(deviceType);
|
|
28
|
+
} else denied.push(deviceType);
|
|
28
29
|
}
|
|
29
30
|
return allowed.filter((id) => !denied.includes(id));
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-resolvers.js","names":[],"sources":["../../.generated/lib/policy-resolvers.ts"],"sourcesContent":["export interface PolicyPermissionLike {\n entities: string[];\n effect: \"Allow\" | \"Deny\";\n}\n\nexport interface PolicyLike {\n permissions: PolicyPermissionLike[];\n}\n\nconst FEATURE_PREFIX = \"feature:\";\n\nexport function getAllowedResourceIds(\n policies: PolicyLike[],\n resource: string,\n): string[] {\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!entity.startsWith(resource)) continue;\n\n const [, id, subsystem, deviceId] = entity.split(\":\");\n const hasFinerSegment = Boolean(subsystem) || Boolean(deviceId);\n\n if (permission.effect === \"Allow\") {\n allowed.push(id);\n } else if (!hasFinerSegment) {\n denied.push(id);\n }\n }\n }\n }\n\n return denied.length > 0\n ? allowed.filter((id) => !denied.includes(id))\n : allowed;\n}\n\nexport function getAllowedDeviceTypes(\n policies: PolicyLike[],\n spaceId: string,\n): string[] {\n const prefix = `space:${spaceId}:`;\n const exactMatch = `space:${spaceId}`;\n const matchesSpace = (res: string) =>\n res === exactMatch || res.startsWith(prefix) || res.startsWith(\"space:*\");\n\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!matchesSpace(entity)) continue;\n\n const [, , deviceType] = entity.split(\":\");\n if (permission.effect === \"Allow\") {\n if (!deviceType) {\n if (!allowed.includes(\"*\")) allowed.push(\"*\");\n } else {\n allowed.push(deviceType);\n }\n } else {\n denied.push(deviceType);\n }\n }\n }\n }\n\n return allowed.filter((id) => !denied.includes(id));\n}\n\nexport function getAllowedFeatures(policies: PolicyLike[]): string[] {\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!entity.startsWith(FEATURE_PREFIX)) continue;\n\n const key = entity.slice(FEATURE_PREFIX.length);\n if (!key) continue;\n\n if (permission.effect === \"Allow\") {\n if (!allowed.includes(key)) allowed.push(key);\n } else if (!denied.includes(key)) {\n denied.push(key);\n }\n }\n }\n }\n\n return allowed.filter((key) => !denied.includes(key));\n}\n"],"mappings":";AASA,MAAM,iBAAiB;AAEvB,SAAgB,sBACd,UACA,UACU;CACV,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,UAAU,UACnB,KAAK,MAAM,cAAc,OAAO,aAC9B,KAAK,MAAM,UAAU,WAAW,UAAU;EACxC,IAAI,CAAC,OAAO,WAAW,QAAQ,GAAG;EAElC,MAAM,GAAG,IAAI,WAAW,YAAY,OAAO,MAAM,GAAG;EACpD,MAAM,kBAAkB,QAAQ,SAAS,KAAK,QAAQ,QAAQ;EAE9D,IAAI,WAAW,WAAW,SACxB,QAAQ,KAAK,EAAE;OACV,IAAI,CAAC,iBACV,OAAO,KAAK,EAAE;CAElB;CAIJ,OAAO,OAAO,SAAS,IACnB,QAAQ,QAAQ,OAAO,CAAC,OAAO,SAAS,EAAE,CAAC,IAC3C;AACN;AAEA,SAAgB,sBACd,UACA,SACU;CACV,MAAM,SAAS,SAAS,QAAQ;CAChC,MAAM,aAAa,SAAS;CAC5B,MAAM,gBAAgB,QACpB,QAAQ,cAAc,IAAI,WAAW,MAAM,KAAK,IAAI,WAAW,SAAS;CAE1E,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,UAAU,UACnB,KAAK,MAAM,cAAc,OAAO,aAC9B,KAAK,MAAM,UAAU,WAAW,UAAU;EACxC,IAAI,CAAC,aAAa,MAAM,GAAG;EAE3B,MAAM,KAAK,cAAc,OAAO,MAAM,GAAG;EACzC,IAAI,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"policy-resolvers.js","names":[],"sources":["../../.generated/lib/policy-resolvers.ts"],"sourcesContent":["export interface PolicyPermissionLike {\n entities: string[];\n effect: \"Allow\" | \"Deny\";\n}\n\nexport interface PolicyLike {\n permissions: PolicyPermissionLike[];\n}\n\nconst FEATURE_PREFIX = \"feature:\";\n\nexport function getAllowedResourceIds(\n policies: PolicyLike[],\n resource: string,\n): string[] {\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!entity.startsWith(resource)) continue;\n\n const [, id, subsystem, deviceId] = entity.split(\":\");\n const hasFinerSegment = Boolean(subsystem) || Boolean(deviceId);\n\n if (permission.effect === \"Allow\") {\n allowed.push(id);\n } else if (!hasFinerSegment) {\n denied.push(id);\n }\n }\n }\n }\n\n return denied.length > 0\n ? allowed.filter((id) => !denied.includes(id))\n : allowed;\n}\n\nexport function getAllowedDeviceTypes(\n policies: PolicyLike[],\n spaceId: string,\n): string[] {\n const prefix = `space:${spaceId}:`;\n const exactMatch = `space:${spaceId}`;\n const matchesSpace = (res: string) =>\n res === exactMatch || res.startsWith(prefix) || res.startsWith(\"space:*\");\n\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!matchesSpace(entity)) continue;\n\n const [, , deviceType] = entity.split(\":\");\n if (permission.effect === \"Allow\") {\n if (!deviceType) {\n if (!allowed.includes(\"*\")) allowed.push(\"*\");\n } else {\n allowed.push(deviceType);\n }\n } else {\n denied.push(deviceType);\n }\n }\n }\n }\n\n return allowed.filter((id) => !denied.includes(id));\n}\n\nexport function getAllowedFeatures(policies: PolicyLike[]): string[] {\n const allowed: string[] = [];\n const denied: string[] = [];\n\n for (const policy of policies) {\n for (const permission of policy.permissions) {\n for (const entity of permission.entities) {\n if (!entity.startsWith(FEATURE_PREFIX)) continue;\n\n const key = entity.slice(FEATURE_PREFIX.length);\n if (!key) continue;\n\n if (permission.effect === \"Allow\") {\n if (!allowed.includes(key)) allowed.push(key);\n } else if (!denied.includes(key)) {\n denied.push(key);\n }\n }\n }\n }\n\n return allowed.filter((key) => !denied.includes(key));\n}\n"],"mappings":";AASA,MAAM,iBAAiB;AAEvB,SAAgB,sBACd,UACA,UACU;CACV,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,UAAU,UACnB,KAAK,MAAM,cAAc,OAAO,aAC9B,KAAK,MAAM,UAAU,WAAW,UAAU;EACxC,IAAI,CAAC,OAAO,WAAW,QAAQ,GAAG;EAElC,MAAM,GAAG,IAAI,WAAW,YAAY,OAAO,MAAM,GAAG;EACpD,MAAM,kBAAkB,QAAQ,SAAS,KAAK,QAAQ,QAAQ;EAE9D,IAAI,WAAW,WAAW,SACxB,QAAQ,KAAK,EAAE;OACV,IAAI,CAAC,iBACV,OAAO,KAAK,EAAE;CAElB;CAIJ,OAAO,OAAO,SAAS,IACnB,QAAQ,QAAQ,OAAO,CAAC,OAAO,SAAS,EAAE,CAAC,IAC3C;AACN;AAEA,SAAgB,sBACd,UACA,SACU;CACV,MAAM,SAAS,SAAS,QAAQ;CAChC,MAAM,aAAa,SAAS;CAC5B,MAAM,gBAAgB,QACpB,QAAQ,cAAc,IAAI,WAAW,MAAM,KAAK,IAAI,WAAW,SAAS;CAE1E,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,UAAU,UACnB,KAAK,MAAM,cAAc,OAAO,aAC9B,KAAK,MAAM,UAAU,WAAW,UAAU;EACxC,IAAI,CAAC,aAAa,MAAM,GAAG;EAE3B,MAAM,KAAK,cAAc,OAAO,MAAM,GAAG;EACzC,IAAI,WAAW,WAAW,SAAS;GACjC,IAAI,CAAC,YACC;QAAA,CAAC,QAAQ,SAAS,GAAG,GAAG,QAAQ,KAAK,GAAG;GAAA,OAE5C,QAAQ,KAAK,UAAU;EAE3B,OACE,OAAO,KAAK,UAAU;CAE1B;CAIJ,OAAO,QAAQ,QAAQ,OAAO,CAAC,OAAO,SAAS,EAAE,CAAC;AACpD;AAEA,SAAgB,mBAAmB,UAAkC;CACnE,MAAM,UAAoB,CAAC;CAC3B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,UAAU,UACnB,KAAK,MAAM,cAAc,OAAO,aAC9B,KAAK,MAAM,UAAU,WAAW,UAAU;EACxC,IAAI,CAAC,OAAO,WAAW,cAAc,GAAG;EAExC,MAAM,MAAM,OAAO,MAAM,CAAqB;EAC9C,IAAI,CAAC,KAAK;EAEV,IAAI,WAAW,WAAW,SACpB;OAAA,CAAC,QAAQ,SAAS,GAAG,GAAG,QAAQ,KAAK,GAAG;EAAA,OACvC,IAAI,CAAC,OAAO,SAAS,GAAG,GAC7B,OAAO,KAAK,GAAG;CAEnB;CAIJ,OAAO,QAAQ,QAAQ,QAAQ,CAAC,OAAO,SAAS,GAAG,CAAC;AACtD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TicketSchema } from "../schemas/ticket.js";
|
|
2
|
+
type Message = TicketSchema["conversation"][number];
|
|
3
|
+
type ParsedBody = NonNullable<Message["parsedBody"]>;
|
|
4
|
+
export type RichTextContent = NonNullable<ParsedBody["content"]>;
|
|
5
|
+
export type RichTextBlockNode = RichTextContent[number];
|
|
6
|
+
export type RichTextInlineNode = Extract<RichTextBlockNode, {
|
|
7
|
+
type: "paragraph";
|
|
8
|
+
}>["content"][number];
|
|
9
|
+
export type RichTextListItemNode = Extract<RichTextBlockNode, {
|
|
10
|
+
type: "bulletList";
|
|
11
|
+
}>["content"][number];
|
|
12
|
+
export type RichTextMentionNode = Extract<RichTextInlineNode, {
|
|
13
|
+
type: "mention";
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Canonical plain-text projection of a rich-text tree (ADR 0012). The API
|
|
17
|
+
* derives the stored `body` from this; emails, SMS, `$text` search, ticket
|
|
18
|
+
* subjects, and previews all read that `body`, and the app reuses the same
|
|
19
|
+
* projection for client-side UI state (e.g. the submit-disabled check). Marks
|
|
20
|
+
* are dropped, mentions render as `@label`, list items get `• ` / renumbered
|
|
21
|
+
* `1. ` prefixes, and trailing newlines are trimmed.
|
|
22
|
+
*/
|
|
23
|
+
export declare function serializeRichTextBody(content: readonly RichTextBlockNode[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* True when the tree fully conforms to the current ADR 0012 vocabulary: the
|
|
26
|
+
* block/inline shapes, the whitelisted marks, and the mention fields. Anything
|
|
27
|
+
* unknown or malformed — an unrecognized block type, an out-of-vocabulary mark,
|
|
28
|
+
* an empty content array (the schema requires `minItems: 1`), a
|
|
29
|
+
* forward-versioned node — fails here. Callers react to a false result
|
|
30
|
+
* differently: the API skips serialization so the schema validator rejects the
|
|
31
|
+
* write, while the app falls back to rendering the server-derived plain-text
|
|
32
|
+
* `body`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isWellFormedRichText(content: unknown): content is RichTextContent;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//#region .generated/lib/ticketRichText.ts
|
|
2
|
+
function serializeInline(nodes) {
|
|
3
|
+
let text = "";
|
|
4
|
+
for (const node of nodes) if (node.type === "text") text += node.text;
|
|
5
|
+
else if (node.type === "mention") text += `@${node.label}`;
|
|
6
|
+
else text += "\n";
|
|
7
|
+
return text;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Canonical plain-text projection of a rich-text tree (ADR 0012). The API
|
|
11
|
+
* derives the stored `body` from this; emails, SMS, `$text` search, ticket
|
|
12
|
+
* subjects, and previews all read that `body`, and the app reuses the same
|
|
13
|
+
* projection for client-side UI state (e.g. the submit-disabled check). Marks
|
|
14
|
+
* are dropped, mentions render as `@label`, list items get `• ` / renumbered
|
|
15
|
+
* `1. ` prefixes, and trailing newlines are trimmed.
|
|
16
|
+
*/
|
|
17
|
+
function serializeRichTextBody(content) {
|
|
18
|
+
const lines = [];
|
|
19
|
+
for (const block of content) if (block.type === "paragraph") lines.push(serializeInline(block.content));
|
|
20
|
+
else if (block.type === "bulletList") for (const item of block.content) lines.push(`• ${serializeInline(item.content)}`);
|
|
21
|
+
else block.content.forEach((item, index) => {
|
|
22
|
+
lines.push(`${index + 1}. ${serializeInline(item.content)}`);
|
|
23
|
+
});
|
|
24
|
+
return lines.join("\n").replace(/\n+$/, "");
|
|
25
|
+
}
|
|
26
|
+
const INLINE_MARKS = /* @__PURE__ */ new Set([
|
|
27
|
+
"bold",
|
|
28
|
+
"italic",
|
|
29
|
+
"underline"
|
|
30
|
+
]);
|
|
31
|
+
const MENTION_DISCRIMINATORS = /* @__PURE__ */ new Set([
|
|
32
|
+
"user",
|
|
33
|
+
"vendor",
|
|
34
|
+
"system"
|
|
35
|
+
]);
|
|
36
|
+
function isRecord(value) {
|
|
37
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
function isNonEmptyArray(value) {
|
|
40
|
+
return Array.isArray(value) && value.length > 0;
|
|
41
|
+
}
|
|
42
|
+
function hasValidMarks(marks) {
|
|
43
|
+
if (marks === void 0) return true;
|
|
44
|
+
return Array.isArray(marks) && marks.every((mark) => typeof mark === "string" && INLINE_MARKS.has(mark));
|
|
45
|
+
}
|
|
46
|
+
function isInlineNode(node) {
|
|
47
|
+
if (!isRecord(node)) return false;
|
|
48
|
+
switch (node.type) {
|
|
49
|
+
case "text": return typeof node.text === "string" && hasValidMarks(node.marks);
|
|
50
|
+
case "mention": return typeof node.id === "string" && typeof node.label === "string" && typeof node.discriminator === "string" && MENTION_DISCRIMINATORS.has(node.discriminator);
|
|
51
|
+
case "hardBreak": return true;
|
|
52
|
+
default: return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isInlineContent(nodes) {
|
|
56
|
+
return isNonEmptyArray(nodes) && nodes.every(isInlineNode);
|
|
57
|
+
}
|
|
58
|
+
function isListContent(items) {
|
|
59
|
+
return isNonEmptyArray(items) && items.every((item) => isRecord(item) && item.type === "listItem" && isInlineContent(item.content));
|
|
60
|
+
}
|
|
61
|
+
function isBlockNode(node) {
|
|
62
|
+
if (!isRecord(node)) return false;
|
|
63
|
+
switch (node.type) {
|
|
64
|
+
case "paragraph": return isInlineContent(node.content);
|
|
65
|
+
case "bulletList":
|
|
66
|
+
case "orderedList": return isListContent(node.content);
|
|
67
|
+
default: return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* True when the tree fully conforms to the current ADR 0012 vocabulary: the
|
|
72
|
+
* block/inline shapes, the whitelisted marks, and the mention fields. Anything
|
|
73
|
+
* unknown or malformed — an unrecognized block type, an out-of-vocabulary mark,
|
|
74
|
+
* an empty content array (the schema requires `minItems: 1`), a
|
|
75
|
+
* forward-versioned node — fails here. Callers react to a false result
|
|
76
|
+
* differently: the API skips serialization so the schema validator rejects the
|
|
77
|
+
* write, while the app falls back to rendering the server-derived plain-text
|
|
78
|
+
* `body`.
|
|
79
|
+
*/
|
|
80
|
+
function isWellFormedRichText(content) {
|
|
81
|
+
return isNonEmptyArray(content) && content.every(isBlockNode);
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { isWellFormedRichText, serializeRichTextBody };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=ticketRichText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticketRichText.js","names":[],"sources":["../../.generated/lib/ticketRichText.ts"],"sourcesContent":["import type { TicketSchema } from \"../schemas/ticket.js\";\n\ntype Message = TicketSchema[\"conversation\"][number];\ntype ParsedBody = NonNullable<Message[\"parsedBody\"]>;\n\nexport type RichTextContent = NonNullable<ParsedBody[\"content\"]>;\nexport type RichTextBlockNode = RichTextContent[number];\nexport type RichTextInlineNode = Extract<\n RichTextBlockNode,\n { type: \"paragraph\" }\n>[\"content\"][number];\nexport type RichTextListItemNode = Extract<\n RichTextBlockNode,\n { type: \"bulletList\" }\n>[\"content\"][number];\nexport type RichTextMentionNode = Extract<\n RichTextInlineNode,\n { type: \"mention\" }\n>;\n\nfunction serializeInline(nodes: readonly RichTextInlineNode[]): string {\n let text = \"\";\n for (const node of nodes) {\n if (node.type === \"text\") text += node.text;\n else if (node.type === \"mention\") text += `@${node.label}`;\n else text += \"\\n\";\n }\n return text;\n}\n\n/**\n * Canonical plain-text projection of a rich-text tree (ADR 0012). The API\n * derives the stored `body` from this; emails, SMS, `$text` search, ticket\n * subjects, and previews all read that `body`, and the app reuses the same\n * projection for client-side UI state (e.g. the submit-disabled check). Marks\n * are dropped, mentions render as `@label`, list items get `• ` / renumbered\n * `1. ` prefixes, and trailing newlines are trimmed.\n */\nexport function serializeRichTextBody(\n content: readonly RichTextBlockNode[],\n): string {\n const lines: string[] = [];\n for (const block of content) {\n if (block.type === \"paragraph\") {\n lines.push(serializeInline(block.content));\n } else if (block.type === \"bulletList\") {\n for (const item of block.content) {\n lines.push(`• ${serializeInline(item.content)}`);\n }\n } else {\n block.content.forEach((item, index) => {\n lines.push(`${index + 1}. ${serializeInline(item.content)}`);\n });\n }\n }\n return lines.join(\"\\n\").replace(/\\n+$/, \"\");\n}\n\nconst INLINE_MARKS = new Set([\"bold\", \"italic\", \"underline\"]);\nconst MENTION_DISCRIMINATORS = new Set([\"user\", \"vendor\", \"system\"]);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isNonEmptyArray(value: unknown): value is unknown[] {\n return Array.isArray(value) && value.length > 0;\n}\n\nfunction hasValidMarks(marks: unknown): boolean {\n if (marks === undefined) return true;\n return (\n Array.isArray(marks) &&\n marks.every((mark) => typeof mark === \"string\" && INLINE_MARKS.has(mark))\n );\n}\n\nfunction isInlineNode(node: unknown): boolean {\n if (!isRecord(node)) return false;\n switch (node.type) {\n case \"text\":\n return typeof node.text === \"string\" && hasValidMarks(node.marks);\n case \"mention\":\n return (\n typeof node.id === \"string\" &&\n typeof node.label === \"string\" &&\n typeof node.discriminator === \"string\" &&\n MENTION_DISCRIMINATORS.has(node.discriminator)\n );\n case \"hardBreak\":\n return true;\n default:\n return false;\n }\n}\n\nfunction isInlineContent(nodes: unknown): boolean {\n return isNonEmptyArray(nodes) && nodes.every(isInlineNode);\n}\n\nfunction isListContent(items: unknown): boolean {\n return (\n isNonEmptyArray(items) &&\n items.every(\n (item) =>\n isRecord(item) &&\n item.type === \"listItem\" &&\n isInlineContent(item.content),\n )\n );\n}\n\nfunction isBlockNode(node: unknown): boolean {\n if (!isRecord(node)) return false;\n switch (node.type) {\n case \"paragraph\":\n return isInlineContent(node.content);\n case \"bulletList\":\n case \"orderedList\":\n return isListContent(node.content);\n default:\n return false;\n }\n}\n\n/**\n * True when the tree fully conforms to the current ADR 0012 vocabulary: the\n * block/inline shapes, the whitelisted marks, and the mention fields. Anything\n * unknown or malformed — an unrecognized block type, an out-of-vocabulary mark,\n * an empty content array (the schema requires `minItems: 1`), a\n * forward-versioned node — fails here. Callers react to a false result\n * differently: the API skips serialization so the schema validator rejects the\n * write, while the app falls back to rendering the server-derived plain-text\n * `body`.\n */\nexport function isWellFormedRichText(\n content: unknown,\n): content is RichTextContent {\n return isNonEmptyArray(content) && content.every(isBlockNode);\n}\n"],"mappings":";AAoBA,SAAS,gBAAgB,OAA8C;CACrE,IAAI,OAAO;CACX,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,SAAS,QAAQ,QAAQ,KAAK;MAClC,IAAI,KAAK,SAAS,WAAW,QAAQ,IAAI,KAAK;MAC9C,QAAQ;CAEf,OAAO;AACT;;;;;;;;;AAUA,SAAgB,sBACd,SACQ;CACR,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,SAAS,SAClB,IAAI,MAAM,SAAS,aACjB,MAAM,KAAK,gBAAgB,MAAM,OAAO,CAAC;MACpC,IAAI,MAAM,SAAS,cACxB,KAAK,MAAM,QAAQ,MAAM,SACvB,MAAM,KAAK,KAAK,gBAAgB,KAAK,OAAO,GAAG;MAGjD,MAAM,QAAQ,SAAS,MAAM,UAAU;EACrC,MAAM,KAAK,GAAG,QAAQ,EAAE,IAAI,gBAAgB,KAAK,OAAO,GAAG;CAC7D,CAAC;CAGL,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,QAAQ,QAAQ,EAAE;AAC5C;AAEA,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAQ;CAAU;AAAW,CAAC;AAC5D,MAAM,yCAAyB,IAAI,IAAI;CAAC;CAAQ;CAAU;AAAQ,CAAC;AAEnE,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,gBAAgB,OAAoC;CAC3D,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS;AAChD;AAEA,SAAS,cAAc,OAAyB;CAC9C,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,OACE,MAAM,QAAQ,KAAK,KACnB,MAAM,OAAO,SAAS,OAAO,SAAS,YAAY,aAAa,IAAI,IAAI,CAAC;AAE5E;AAEA,SAAS,aAAa,MAAwB;CAC5C,IAAI,CAAC,SAAS,IAAI,GAAG,OAAO;CAC5B,QAAQ,KAAK,MAAb;EACE,KAAK,QACH,OAAO,OAAO,KAAK,SAAS,YAAY,cAAc,KAAK,KAAK;EAClE,KAAK,WACH,OACE,OAAO,KAAK,OAAO,YACnB,OAAO,KAAK,UAAU,YACtB,OAAO,KAAK,kBAAkB,YAC9B,uBAAuB,IAAI,KAAK,aAAa;EAEjD,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,SAAS,gBAAgB,OAAyB;CAChD,OAAO,gBAAgB,KAAK,KAAK,MAAM,MAAM,YAAY;AAC3D;AAEA,SAAS,cAAc,OAAyB;CAC9C,OACE,gBAAgB,KAAK,KACrB,MAAM,OACH,SACC,SAAS,IAAI,KACb,KAAK,SAAS,cACd,gBAAgB,KAAK,OAAO,CAChC;AAEJ;AAEA,SAAS,YAAY,MAAwB;CAC3C,IAAI,CAAC,SAAS,IAAI,GAAG,OAAO;CAC5B,QAAQ,KAAK,MAAb;EACE,KAAK,aACH,OAAO,gBAAgB,KAAK,OAAO;EACrC,KAAK;EACL,KAAK,eACH,OAAO,cAAc,KAAK,OAAO;EACnC,SACE,OAAO;CACX;AACF;;;;;;;;;;;AAYA,SAAgB,qBACd,SAC4B;CAC5B,OAAO,gBAAgB,OAAO,KAAK,QAAQ,MAAM,WAAW;AAC9D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Entity } from "./entity.js";
|
|
2
|
+
import { validateBill as validate } from "../validate.js";
|
|
3
|
+
import { billSchema, type BillSchema } from "../schemas/bill.js";
|
|
4
|
+
/**
|
|
5
|
+
* Data type for Bill constructor - exported for backwards compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type BillData = BillSchema;
|
|
8
|
+
/**
|
|
9
|
+
* A OneBill bill, stored platform-wide and stamped with its organization: KFC staff assemble billed lines from the uninvoiced cost pool (plus manual lines) into a draft, then mark it sent to freeze and reveal it to the customer. Lifecycle draft → sent → paid, plus void. Customers see a bill in-app only once sent.
|
|
10
|
+
*/
|
|
11
|
+
export interface Bill extends BillSchema {
|
|
12
|
+
}
|
|
13
|
+
export declare class Bill extends Entity {
|
|
14
|
+
schema: typeof billSchema;
|
|
15
|
+
validator: typeof validate;
|
|
16
|
+
constructor(data: BillSchema);
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Entity } from "./entity.js";
|
|
2
|
+
import { billSchema } from "../schemas/bill.js";
|
|
3
|
+
import { validateBill } from "../validate.js";
|
|
4
|
+
//#region .generated/models/bill.ts
|
|
5
|
+
var Bill = class extends Entity {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.id = data.id;
|
|
9
|
+
if (data.type !== void 0) this.type = data.type;
|
|
10
|
+
this.organizationId = data.organizationId;
|
|
11
|
+
this.status = data.status;
|
|
12
|
+
if (data.invoiceNumber !== void 0) this.invoiceNumber = data.invoiceNumber;
|
|
13
|
+
if (data.period !== void 0) this.period = data.period;
|
|
14
|
+
this.currency = data.currency;
|
|
15
|
+
if (data.fileId !== void 0) this.fileId = data.fileId;
|
|
16
|
+
if (data.fileUrl !== void 0) this.fileUrl = data.fileUrl;
|
|
17
|
+
if (data.memo !== void 0) this.memo = data.memo;
|
|
18
|
+
if (data.billingAddress !== void 0) this.billingAddress = data.billingAddress;
|
|
19
|
+
if (data.taxRate !== void 0) this.taxRate = data.taxRate;
|
|
20
|
+
if (data.taxExempt !== void 0) this.taxExempt = data.taxExempt;
|
|
21
|
+
if (data.shippingAmount !== void 0) this.shippingAmount = data.shippingAmount;
|
|
22
|
+
this.lines = data.lines;
|
|
23
|
+
if (data.sentAt !== void 0) this.sentAt = data.sentAt;
|
|
24
|
+
if (data.paidAt !== void 0) this.paidAt = data.paidAt;
|
|
25
|
+
if (data.voidedAt !== void 0) this.voidedAt = data.voidedAt;
|
|
26
|
+
if (data.createdAt !== void 0) this.createdAt = data.createdAt;
|
|
27
|
+
if (data.updatedAt !== void 0) this.updatedAt = data.updatedAt;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(Bill.prototype, "schema", { value: billSchema });
|
|
31
|
+
Object.defineProperty(Bill.prototype, "validator", { get: function() {
|
|
32
|
+
return validateBill;
|
|
33
|
+
} });
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Bill };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=bill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bill.js","names":["validate"],"sources":["../../.generated/models/bill.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateBill as validate } from \"../validate.js\";\nimport { billSchema, type BillSchema } from \"../schemas/bill.js\";\n\n/**\n * Data type for Bill constructor - exported for backwards compatibility\n */\nexport type BillData = BillSchema;\n\n/**\n * A OneBill bill, stored platform-wide and stamped with its organization: KFC staff assemble billed lines from the uninvoiced cost pool (plus manual lines) into a draft, then mark it sent to freeze and reveal it to the customer. Lifecycle draft → sent → paid, plus void. Customers see a bill in-app only once sent.\n */\nexport interface Bill extends BillSchema {}\nexport class Bill extends Entity {\n declare schema: typeof billSchema;\n declare validator: typeof validate;\n\n constructor(data: BillSchema) {\n super(data);\n this.id = data.id;\n if (data.type !== undefined) this.type = data.type;\n this.organizationId = data.organizationId;\n this.status = data.status;\n if (data.invoiceNumber !== undefined) this.invoiceNumber = data.invoiceNumber;\n if (data.period !== undefined) this.period = data.period;\n this.currency = data.currency;\n if (data.fileId !== undefined) this.fileId = data.fileId;\n if (data.fileUrl !== undefined) this.fileUrl = data.fileUrl;\n if (data.memo !== undefined) this.memo = data.memo;\n if (data.billingAddress !== undefined) this.billingAddress = data.billingAddress;\n if (data.taxRate !== undefined) this.taxRate = data.taxRate;\n if (data.taxExempt !== undefined) this.taxExempt = data.taxExempt;\n if (data.shippingAmount !== undefined) this.shippingAmount = data.shippingAmount;\n this.lines = data.lines;\n if (data.sentAt !== undefined) this.sentAt = data.sentAt;\n if (data.paidAt !== undefined) this.paidAt = data.paidAt;\n if (data.voidedAt !== undefined) this.voidedAt = data.voidedAt;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Bill.prototype, \"schema\", {\n value: billSchema\n});\n\nObject.defineProperty(Bill.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,OAAb,cAA0B,OAAO;CAI/B,YAAY,MAAkB;EAC5B,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,KAAK,iBAAiB,KAAK;EAC3B,KAAK,SAAS,KAAK;EACnB,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,KAAK,WAAW,KAAK;EACrB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,mBAAmB,KAAA,GAAW,KAAK,iBAAiB,KAAK;EAClE,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,mBAAmB,KAAA,GAAW,KAAK,iBAAiB,KAAK;EAClE,KAAK,QAAQ,KAAK;EAClB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,KAAK,WAAW,UAAU,EAC9C,OAAO,WACT,CAAC;AAED,OAAO,eAAe,KAAK,WAAW,aAAa,EACjD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Entity } from "./entity.js";
|
|
2
|
+
import { validateBillingCategory as validate } from "../validate.js";
|
|
3
|
+
import { billingCategorySchema, type BillingCategorySchema } from "../schemas/billingCategory.js";
|
|
4
|
+
/**
|
|
5
|
+
* Data type for BillingCategory constructor - exported for backwards compatibility
|
|
6
|
+
*/
|
|
7
|
+
export type BillingCategoryData = BillingCategorySchema;
|
|
8
|
+
/**
|
|
9
|
+
* A label in the global, KFC-maintained billing category library, picked per bill line while drafting (e.g. "HVAC System Maintenance/Repair"). Named distinctly from the generic `category` schema (space/product/media discriminators). Archived, never deleted.
|
|
10
|
+
*/
|
|
11
|
+
export interface BillingCategory extends BillingCategorySchema {
|
|
12
|
+
}
|
|
13
|
+
export declare class BillingCategory extends Entity {
|
|
14
|
+
schema: typeof billingCategorySchema;
|
|
15
|
+
validator: typeof validate;
|
|
16
|
+
constructor(data: BillingCategorySchema);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Entity } from "./entity.js";
|
|
2
|
+
import { billingCategorySchema } from "../schemas/billingCategory.js";
|
|
3
|
+
import { validateBillingCategory } from "../validate.js";
|
|
4
|
+
//#region .generated/models/billingCategory.ts
|
|
5
|
+
var BillingCategory = class extends Entity {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.id = data.id;
|
|
9
|
+
this.name = data.name;
|
|
10
|
+
if (data.archived !== void 0) this.archived = data.archived;
|
|
11
|
+
if (data.createdAt !== void 0) this.createdAt = data.createdAt;
|
|
12
|
+
if (data.updatedAt !== void 0) this.updatedAt = data.updatedAt;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(BillingCategory.prototype, "schema", { value: billingCategorySchema });
|
|
16
|
+
Object.defineProperty(BillingCategory.prototype, "validator", { get: function() {
|
|
17
|
+
return validateBillingCategory;
|
|
18
|
+
} });
|
|
19
|
+
//#endregion
|
|
20
|
+
export { BillingCategory };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=billingCategory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billingCategory.js","names":["validate"],"sources":["../../.generated/models/billingCategory.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateBillingCategory as validate } from \"../validate.js\";\nimport { billingCategorySchema, type BillingCategorySchema } from \"../schemas/billingCategory.js\";\n\n/**\n * Data type for BillingCategory constructor - exported for backwards compatibility\n */\nexport type BillingCategoryData = BillingCategorySchema;\n\n/**\n * A label in the global, KFC-maintained billing category library, picked per bill line while drafting (e.g. \"HVAC System Maintenance/Repair\"). Named distinctly from the generic `category` schema (space/product/media discriminators). Archived, never deleted.\n */\nexport interface BillingCategory extends BillingCategorySchema {}\nexport class BillingCategory extends Entity {\n declare schema: typeof billingCategorySchema;\n declare validator: typeof validate;\n\n constructor(data: BillingCategorySchema) {\n super(data);\n this.id = data.id;\n this.name = data.name;\n if (data.archived !== undefined) this.archived = data.archived;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(BillingCategory.prototype, \"schema\", {\n value: billingCategorySchema\n});\n\nObject.defineProperty(BillingCategory.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,kBAAb,cAAqC,OAAO;CAI1C,YAAY,MAA6B;EACvC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,gBAAgB,WAAW,UAAU,EACzD,OAAO,sBACT,CAAC;AAED,OAAO,eAAe,gBAAgB,WAAW,aAAa,EAC5D,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { Entity } from "./entity.js";
|
|
|
2
2
|
export { Alarm, type AlarmData } from "./alarm.js";
|
|
3
3
|
export { Announcement, type AnnouncementData } from "./announcement.js";
|
|
4
4
|
export { Automation, type AutomationData } from "./automation.js";
|
|
5
|
+
export { Bill, type BillData } from "./bill.js";
|
|
6
|
+
export { BillingCategory, type BillingCategoryData } from "./billingCategory.js";
|
|
5
7
|
export { Camera, type CameraData } from "./camera.js";
|
|
6
8
|
export { Category, type CategoryData } from "./category.js";
|
|
7
9
|
export { Courtesy, type CourtesyData } from "./courtesy.js";
|
|
@@ -23,7 +25,6 @@ export { MediaFile, type MediaFileData } from "./mediaFile.js";
|
|
|
23
25
|
export { MediaSource, type MediaSourceData } from "./mediaSource.js";
|
|
24
26
|
export { MotionSensor, type MotionSensorData } from "./motionSensor.js";
|
|
25
27
|
export { Notification, type NotificationData } from "./notification.js";
|
|
26
|
-
export { Order, type OrderData } from "./order.js";
|
|
27
28
|
export { Organization, type OrganizationData } from "./organization.js";
|
|
28
29
|
export { Payment, type PaymentData } from "./payment.js";
|
|
29
30
|
export { Policy, type PolicyData } from "./policy.js";
|
package/dist/models/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { Entity } from "./entity.js";
|
|
|
3
3
|
import { Alarm } from "./alarm.js";
|
|
4
4
|
import { Announcement } from "./announcement.js";
|
|
5
5
|
import { Automation } from "./automation.js";
|
|
6
|
+
import { Bill } from "./bill.js";
|
|
7
|
+
import { BillingCategory } from "./billingCategory.js";
|
|
6
8
|
import { Camera } from "./camera.js";
|
|
7
9
|
import { Category } from "./category.js";
|
|
8
10
|
import { Courtesy } from "./courtesy.js";
|
|
@@ -24,7 +26,6 @@ import { MediaFile } from "./mediaFile.js";
|
|
|
24
26
|
import { MediaSource } from "./mediaSource.js";
|
|
25
27
|
import { MotionSensor } from "./motionSensor.js";
|
|
26
28
|
import { Notification } from "./notification.js";
|
|
27
|
-
import { Order } from "./order.js";
|
|
28
29
|
import { Organization } from "./organization.js";
|
|
29
30
|
import { Payment } from "./payment.js";
|
|
30
31
|
import { Policy } from "./policy.js";
|
|
@@ -51,6 +52,8 @@ var models_exports = /* @__PURE__ */ __exportAll({
|
|
|
51
52
|
Alarm: () => Alarm,
|
|
52
53
|
Announcement: () => Announcement,
|
|
53
54
|
Automation: () => Automation,
|
|
55
|
+
Bill: () => Bill,
|
|
56
|
+
BillingCategory: () => BillingCategory,
|
|
54
57
|
Camera: () => Camera,
|
|
55
58
|
Category: () => Category,
|
|
56
59
|
Courtesy: () => Courtesy,
|
|
@@ -73,7 +76,6 @@ var models_exports = /* @__PURE__ */ __exportAll({
|
|
|
73
76
|
MediaSource: () => MediaSource,
|
|
74
77
|
MotionSensor: () => MotionSensor,
|
|
75
78
|
Notification: () => Notification,
|
|
76
|
-
Order: () => Order,
|
|
77
79
|
Organization: () => Organization,
|
|
78
80
|
Payment: () => Payment,
|
|
79
81
|
Policy: () => Policy,
|
|
@@ -97,6 +99,6 @@ var models_exports = /* @__PURE__ */ __exportAll({
|
|
|
97
99
|
WindowCovering: () => WindowCovering
|
|
98
100
|
});
|
|
99
101
|
//#endregion
|
|
100
|
-
export { Alarm, Announcement, Automation, Camera, Category, Courtesy, Credential, Department, Dimmer, DiscoveredDevice, EmailMessage, EnergyReport, EnergyReportShard, Entity, Gateway, Group, Identification, Integration, Issue, Lock, Log, MediaFile, MediaSource, MotionSensor, Notification,
|
|
102
|
+
export { Alarm, Announcement, Automation, Bill, BillingCategory, Camera, Category, Courtesy, Credential, Department, Dimmer, DiscoveredDevice, EmailMessage, EnergyReport, EnergyReportShard, Entity, Gateway, Group, Identification, Integration, Issue, Lock, Log, MediaFile, MediaSource, MotionSensor, Notification, Organization, Payment, Policy, Product, Property, Reservation, SOSType, Server, Session, ShortLink, SmsMessage, Space, Switch, System, SystemUser, Thermostat, Ticket, TimeSheet, User, Vendor, WindowCovering, models_exports };
|
|
101
103
|
|
|
102
104
|
//# sourceMappingURL=index.js.map
|
package/dist/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../.generated/models/index.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nexport { Entity } from \"./entity.js\";\n\nexport { Alarm, type AlarmData } from \"./alarm.js\";\nexport { Announcement, type AnnouncementData } from \"./announcement.js\";\nexport { Automation, type AutomationData } from \"./automation.js\";\nexport { Camera, type CameraData } from \"./camera.js\";\nexport { Category, type CategoryData } from \"./category.js\";\nexport { Courtesy, type CourtesyData } from \"./courtesy.js\";\nexport { Credential, type CredentialData } from \"./credential.js\";\nexport { Department, type DepartmentData } from \"./department.js\";\nexport { Dimmer, type DimmerData } from \"./dimmer.js\";\nexport { DiscoveredDevice, type DiscoveredDeviceData } from \"./discoveredDevice.js\";\nexport { EmailMessage, type EmailMessageData } from \"./emailMessage.js\";\nexport { EnergyReport, type EnergyReportData } from \"./energyReport.js\";\nexport { EnergyReportShard, type EnergyReportShardData } from \"./energyReportShard.js\";\nexport { Gateway, type GatewayData } from \"./gateway.js\";\nexport { Group, type GroupData } from \"./group.js\";\nexport { Identification, type IdentificationData } from \"./identification.js\";\nexport { Integration, type IntegrationData } from \"./integration.js\";\nexport { Issue, type IssueData } from \"./issue.js\";\nexport { Lock, type LockData } from \"./lock.js\";\nexport { Log, type LogData } from \"./log.js\";\nexport { MediaFile, type MediaFileData } from \"./mediaFile.js\";\nexport { MediaSource, type MediaSourceData } from \"./mediaSource.js\";\nexport { MotionSensor, type MotionSensorData } from \"./motionSensor.js\";\nexport { Notification, type NotificationData } from \"./notification.js\";\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../.generated/models/index.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nexport { Entity } from \"./entity.js\";\n\nexport { Alarm, type AlarmData } from \"./alarm.js\";\nexport { Announcement, type AnnouncementData } from \"./announcement.js\";\nexport { Automation, type AutomationData } from \"./automation.js\";\nexport { Bill, type BillData } from \"./bill.js\";\nexport { BillingCategory, type BillingCategoryData } from \"./billingCategory.js\";\nexport { Camera, type CameraData } from \"./camera.js\";\nexport { Category, type CategoryData } from \"./category.js\";\nexport { Courtesy, type CourtesyData } from \"./courtesy.js\";\nexport { Credential, type CredentialData } from \"./credential.js\";\nexport { Department, type DepartmentData } from \"./department.js\";\nexport { Dimmer, type DimmerData } from \"./dimmer.js\";\nexport { DiscoveredDevice, type DiscoveredDeviceData } from \"./discoveredDevice.js\";\nexport { EmailMessage, type EmailMessageData } from \"./emailMessage.js\";\nexport { EnergyReport, type EnergyReportData } from \"./energyReport.js\";\nexport { EnergyReportShard, type EnergyReportShardData } from \"./energyReportShard.js\";\nexport { Gateway, type GatewayData } from \"./gateway.js\";\nexport { Group, type GroupData } from \"./group.js\";\nexport { Identification, type IdentificationData } from \"./identification.js\";\nexport { Integration, type IntegrationData } from \"./integration.js\";\nexport { Issue, type IssueData } from \"./issue.js\";\nexport { Lock, type LockData } from \"./lock.js\";\nexport { Log, type LogData } from \"./log.js\";\nexport { MediaFile, type MediaFileData } from \"./mediaFile.js\";\nexport { MediaSource, type MediaSourceData } from \"./mediaSource.js\";\nexport { MotionSensor, type MotionSensorData } from \"./motionSensor.js\";\nexport { Notification, type NotificationData } from \"./notification.js\";\nexport { Organization, type OrganizationData } from \"./organization.js\";\nexport { Payment, type PaymentData } from \"./payment.js\";\nexport { Policy, type PolicyData } from \"./policy.js\";\nexport { Product, type ProductData } from \"./product.js\";\nexport { Property, type PropertyData } from \"./property.js\";\nexport { Reservation, type ReservationData } from \"./reservation.js\";\nexport { Server, type ServerData } from \"./server.js\";\nexport { Session, type SessionData } from \"./session.js\";\nexport { ShortLink, type ShortLinkData } from \"./shortLink.js\";\nexport { SmsMessage, type SmsMessageData } from \"./smsMessage.js\";\nexport { SOSType, type SOSTypeData } from \"./sosType.js\";\nexport { Space, type SpaceData } from \"./space.js\";\nexport { Switch, type SwitchData } from \"./switch.js\";\nexport { System, type SystemData } from \"./system.js\";\nexport { SystemUser, type SystemUserData } from \"./systemUser.js\";\nexport { Thermostat, type ThermostatData } from \"./thermostat.js\";\nexport { Ticket, type TicketData } from \"./ticket.js\";\nexport { TimeSheet, type TimeSheetData } from \"./timeSheet.js\";\nexport { User, type UserData } from \"./user.js\";\nexport { Vendor, type VendorData } from \"./vendor.js\";\nexport { WindowCovering, type WindowCoveringData } from \"./windowCovering.js\";\n"],"mappings":""}
|
|
@@ -9,11 +9,15 @@ var Organization = class extends Entity {
|
|
|
9
9
|
this.type = data.type;
|
|
10
10
|
this.accountNumber = data.accountNumber;
|
|
11
11
|
this.name = data.name;
|
|
12
|
+
if (data.currency !== void 0) this.currency = data.currency;
|
|
12
13
|
if (data.smsNumber !== void 0) this.smsNumber = data.smsNumber;
|
|
13
14
|
if (data.properties !== void 0) this.properties = data.properties;
|
|
14
15
|
if (data.appManifest !== void 0) this.appManifest = data.appManifest;
|
|
15
16
|
if (data.features !== void 0) this.features = data.features;
|
|
16
17
|
if (data.credentials !== void 0) this.credentials = data.credentials;
|
|
18
|
+
if (data.taxExempt !== void 0) this.taxExempt = data.taxExempt;
|
|
19
|
+
if (data.billingAddress !== void 0) this.billingAddress = data.billingAddress;
|
|
20
|
+
if (data.billingContacts !== void 0) this.billingContacts = data.billingContacts;
|
|
17
21
|
if (data.createdAt !== void 0) this.createdAt = data.createdAt;
|
|
18
22
|
if (data.updatedAt !== void 0) this.updatedAt = data.updatedAt;
|
|
19
23
|
if (data.deletedAt !== void 0) this.deletedAt = data.deletedAt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","names":["validate"],"sources":["../../.generated/models/organization.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateOrganization as validate } from \"../validate.js\";\nimport { organizationSchema, type OrganizationSchema } from \"../schemas/organization.js\";\n\n/**\n * Data type for Organization constructor - exported for backwards compatibility\n */\nexport type OrganizationData = OrganizationSchema;\n\n/**\n * An organization is a group or entity that subscribes to Kohost software.\n */\nexport interface Organization extends OrganizationSchema {}\nexport class Organization extends Entity {\n declare schema: typeof organizationSchema;\n declare validator: typeof validate;\n\n constructor(data: OrganizationSchema) {\n super(data);\n this.id = data.id;\n this.type = data.type;\n this.accountNumber = data.accountNumber;\n this.name = data.name;\n if (data.smsNumber !== undefined) this.smsNumber = data.smsNumber;\n if (data.properties !== undefined) this.properties = data.properties;\n if (data.appManifest !== undefined) this.appManifest = data.appManifest;\n if (data.features !== undefined) this.features = data.features;\n if (data.credentials !== undefined) this.credentials = data.credentials;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Organization.prototype, \"schema\", {\n value: organizationSchema\n});\n\nObject.defineProperty(Organization.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,KAAK,gBAAgB,KAAK;EAC1B,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|
|
1
|
+
{"version":3,"file":"organization.js","names":["validate"],"sources":["../../.generated/models/organization.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateOrganization as validate } from \"../validate.js\";\nimport { organizationSchema, type OrganizationSchema } from \"../schemas/organization.js\";\n\n/**\n * Data type for Organization constructor - exported for backwards compatibility\n */\nexport type OrganizationData = OrganizationSchema;\n\n/**\n * An organization is a group or entity that subscribes to Kohost software.\n */\nexport interface Organization extends OrganizationSchema {}\nexport class Organization extends Entity {\n declare schema: typeof organizationSchema;\n declare validator: typeof validate;\n\n constructor(data: OrganizationSchema) {\n super(data);\n this.id = data.id;\n this.type = data.type;\n this.accountNumber = data.accountNumber;\n this.name = data.name;\n if (data.currency !== undefined) this.currency = data.currency;\n if (data.smsNumber !== undefined) this.smsNumber = data.smsNumber;\n if (data.properties !== undefined) this.properties = data.properties;\n if (data.appManifest !== undefined) this.appManifest = data.appManifest;\n if (data.features !== undefined) this.features = data.features;\n if (data.credentials !== undefined) this.credentials = data.credentials;\n if (data.taxExempt !== undefined) this.taxExempt = data.taxExempt;\n if (data.billingAddress !== undefined) this.billingAddress = data.billingAddress;\n if (data.billingContacts !== undefined) this.billingContacts = data.billingContacts;\n if (data.createdAt !== undefined) this.createdAt = data.createdAt;\n if (data.updatedAt !== undefined) this.updatedAt = data.updatedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Organization.prototype, \"schema\", {\n value: organizationSchema\n});\n\nObject.defineProperty(Organization.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,eAAb,cAAkC,OAAO;CAIvC,YAAY,MAA0B;EACpC,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,KAAK,OAAO,KAAK;EACjB,KAAK,gBAAgB,KAAK;EAC1B,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,mBAAmB,KAAA,GAAW,KAAK,iBAAiB,KAAK;EAClE,IAAI,KAAK,oBAAoB,KAAA,GAAW,KAAK,kBAAkB,KAAK;EACpE,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,aAAa,WAAW,UAAU,EACtD,OAAO,mBACT,CAAC;AAED,OAAO,eAAe,aAAa,WAAW,aAAa,EACzD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|
package/dist/models/ticket.js
CHANGED
|
@@ -23,6 +23,11 @@ var Ticket = class extends Entity {
|
|
|
23
23
|
this.priority = data.priority;
|
|
24
24
|
if (data.priorityRank !== void 0) this.priorityRank = data.priorityRank;
|
|
25
25
|
if (data.reopenCount !== void 0) this.reopenCount = data.reopenCount;
|
|
26
|
+
if (data.work !== void 0) this.work = data.work;
|
|
27
|
+
if (data.costs !== void 0) this.costs = data.costs;
|
|
28
|
+
if (data.approvals !== void 0) this.approvals = data.approvals;
|
|
29
|
+
if (data.dneAmount !== void 0) this.dneAmount = data.dneAmount;
|
|
30
|
+
if (data.approvalState !== void 0) this.approvalState = data.approvalState;
|
|
26
31
|
this.tags = data.tags;
|
|
27
32
|
if (data.rating !== void 0) this.rating = data.rating;
|
|
28
33
|
if (data.ratingComment !== void 0) this.ratingComment = data.ratingComment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket.js","names":["validate"],"sources":["../../.generated/models/ticket.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateTicket as validate } from \"../validate.js\";\nimport { ticketSchema, type TicketSchema } from \"../schemas/ticket.js\";\n\n/**\n * Data type for Ticket constructor - exported for backwards compatibility\n */\nexport type TicketData = TicketSchema;\n\n/**\n * A ticket is a request from a user.\n */\nexport interface Ticket extends TicketSchema {}\nexport class Ticket extends Entity {\n declare schema: typeof ticketSchema;\n declare validator: typeof validate;\n\n constructor(data: TicketSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n if (data.type !== undefined) this.type = data.type;\n if (data.number !== undefined) this.number = data.number;\n if (data.issueId !== undefined) this.issueId = data.issueId;\n if (data.parentAutomationId !== undefined) this.parentAutomationId = data.parentAutomationId;\n this.conversation = data.conversation;\n if (data.subject !== undefined) this.subject = data.subject;\n this.openedBy = data.openedBy;\n this.requester = data.requester;\n this.assignedTo = data.assignedTo;\n if (data.notify !== undefined) this.notify = data.notify;\n if (data.collaborators !== undefined) this.collaborators = data.collaborators;\n if (data.location !== undefined) this.location = data.location;\n this.status = data.status;\n this.priority = data.priority;\n if (data.priorityRank !== undefined) this.priorityRank = data.priorityRank;\n if (data.reopenCount !== undefined) this.reopenCount = data.reopenCount;\n this.tags = data.tags;\n if (data.rating !== undefined) this.rating = data.rating;\n if (data.ratingComment !== undefined) this.ratingComment = data.ratingComment;\n if (data.scheduleDate !== undefined) this.scheduleDate = data.scheduleDate;\n this.createdAt = data.createdAt;\n this.updatedAt = data.updatedAt;\n if (data.solvedAt !== undefined) this.solvedAt = data.solvedAt;\n if (data.lastMessageAt !== undefined) this.lastMessageAt = data.lastMessageAt;\n if (data.closedAt !== undefined) this.closedAt = data.closedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Ticket.prototype, \"schema\", {\n value: ticketSchema\n});\n\nObject.defineProperty(Ticket.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,SAAb,cAA4B,OAAO;CAIjC,YAAY,MAAoB;EAC9B,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,uBAAuB,KAAA,GAAW,KAAK,qBAAqB,KAAK;EAC1E,KAAK,eAAe,KAAK;EACzB,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,KAAK,WAAW,KAAK;EACrB,KAAK,YAAY,KAAK;EACtB,KAAK,aAAa,KAAK;EACvB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,KAAK,SAAS,KAAK;EACnB,KAAK,WAAW,KAAK;EACrB,IAAI,KAAK,iBAAiB,KAAA,GAAW,KAAK,eAAe,KAAK;EAC9D,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,iBAAiB,KAAA,GAAW,KAAK,eAAe,KAAK;EAC9D,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY,KAAK;EACtB,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,OAAO,WAAW,UAAU,EAChD,OAAO,aACT,CAAC;AAED,OAAO,eAAe,OAAO,WAAW,aAAa,EACnD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ticket.js","names":["validate"],"sources":["../../.generated/models/ticket.ts"],"sourcesContent":["/* This file is automatically generated. Do not modify it manually. */\n\nimport { Entity } from \"./entity.js\";\nimport { validateTicket as validate } from \"../validate.js\";\nimport { ticketSchema, type TicketSchema } from \"../schemas/ticket.js\";\n\n/**\n * Data type for Ticket constructor - exported for backwards compatibility\n */\nexport type TicketData = TicketSchema;\n\n/**\n * A ticket is a request from a user.\n */\nexport interface Ticket extends TicketSchema {}\nexport class Ticket extends Entity {\n declare schema: typeof ticketSchema;\n declare validator: typeof validate;\n\n constructor(data: TicketSchema) {\n super(data);\n this.id = data.id;\n if (data.propertyId !== undefined) this.propertyId = data.propertyId;\n if (data.type !== undefined) this.type = data.type;\n if (data.number !== undefined) this.number = data.number;\n if (data.issueId !== undefined) this.issueId = data.issueId;\n if (data.parentAutomationId !== undefined) this.parentAutomationId = data.parentAutomationId;\n this.conversation = data.conversation;\n if (data.subject !== undefined) this.subject = data.subject;\n this.openedBy = data.openedBy;\n this.requester = data.requester;\n this.assignedTo = data.assignedTo;\n if (data.notify !== undefined) this.notify = data.notify;\n if (data.collaborators !== undefined) this.collaborators = data.collaborators;\n if (data.location !== undefined) this.location = data.location;\n this.status = data.status;\n this.priority = data.priority;\n if (data.priorityRank !== undefined) this.priorityRank = data.priorityRank;\n if (data.reopenCount !== undefined) this.reopenCount = data.reopenCount;\n if (data.work !== undefined) this.work = data.work;\n if (data.costs !== undefined) this.costs = data.costs;\n if (data.approvals !== undefined) this.approvals = data.approvals;\n if (data.dneAmount !== undefined) this.dneAmount = data.dneAmount;\n if (data.approvalState !== undefined) this.approvalState = data.approvalState;\n this.tags = data.tags;\n if (data.rating !== undefined) this.rating = data.rating;\n if (data.ratingComment !== undefined) this.ratingComment = data.ratingComment;\n if (data.scheduleDate !== undefined) this.scheduleDate = data.scheduleDate;\n this.createdAt = data.createdAt;\n this.updatedAt = data.updatedAt;\n if (data.solvedAt !== undefined) this.solvedAt = data.solvedAt;\n if (data.lastMessageAt !== undefined) this.lastMessageAt = data.lastMessageAt;\n if (data.closedAt !== undefined) this.closedAt = data.closedAt;\n if (data.deletedAt !== undefined) this.deletedAt = data.deletedAt;\n }\n\n\n\n\n\n\n\n\n}\n\nObject.defineProperty(Ticket.prototype, \"schema\", {\n value: ticketSchema\n});\n\nObject.defineProperty(Ticket.prototype, \"validator\", {\n get: function() { return validate; }\n});\n"],"mappings":";;;;AAeA,IAAa,SAAb,cAA4B,OAAO;CAIjC,YAAY,MAAoB;EAC9B,MAAM,IAAI;EACV,KAAK,KAAK,KAAK;EACf,IAAI,KAAK,eAAe,KAAA,GAAW,KAAK,aAAa,KAAK;EAC1D,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,IAAI,KAAK,uBAAuB,KAAA,GAAW,KAAK,qBAAqB,KAAK;EAC1E,KAAK,eAAe,KAAK;EACzB,IAAI,KAAK,YAAY,KAAA,GAAW,KAAK,UAAU,KAAK;EACpD,KAAK,WAAW,KAAK;EACrB,KAAK,YAAY,KAAK;EACtB,KAAK,aAAa,KAAK;EACvB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,KAAK,SAAS,KAAK;EACnB,KAAK,WAAW,KAAK;EACrB,IAAI,KAAK,iBAAiB,KAAA,GAAW,KAAK,eAAe,KAAK;EAC9D,IAAI,KAAK,gBAAgB,KAAA,GAAW,KAAK,cAAc,KAAK;EAC5D,IAAI,KAAK,SAAS,KAAA,GAAW,KAAK,OAAO,KAAK;EAC9C,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;EAChD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;EACxD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,WAAW,KAAA,GAAW,KAAK,SAAS,KAAK;EAClD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,iBAAiB,KAAA,GAAW,KAAK,eAAe,KAAK;EAC9D,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY,KAAK;EACtB,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,kBAAkB,KAAA,GAAW,KAAK,gBAAgB,KAAK;EAChE,IAAI,KAAK,aAAa,KAAA,GAAW,KAAK,WAAW,KAAK;EACtD,IAAI,KAAK,cAAc,KAAA,GAAW,KAAK,YAAY,KAAK;CAC1D;AASF;AAEA,OAAO,eAAe,OAAO,WAAW,UAAU,EAChD,OAAO,aACT,CAAC;AAED,OAAO,eAAe,OAAO,WAAW,aAAa,EACnD,KAAK,WAAW;CAAE,OAAOA;AAAU,EACrC,CAAC"}
|