@onabl/contracts 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,4 +28,8 @@ export declare const PaymentSummarySchema: z.ZodObject<{
28
28
  note: z.ZodNullable<z.ZodString>;
29
29
  }, z.core.$strip>;
30
30
  export type PaymentSummary = z.infer<typeof PaymentSummarySchema>;
31
+ export declare const VoidInvoiceSchema: z.ZodObject<{
32
+ reason: z.ZodString;
33
+ }, z.core.$strip>;
34
+ export type VoidInvoice = z.infer<typeof VoidInvoiceSchema>;
31
35
  //# sourceMappingURL=invoices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,eAAe,2CAA4C,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAO/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,eAAe,2CAA4C,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAO/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
package/dist/invoices.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaymentSummarySchema = exports.RecordPaymentSchema = exports.PAYMENT_METHODS = void 0;
3
+ exports.VoidInvoiceSchema = exports.PaymentSummarySchema = exports.RecordPaymentSchema = exports.PAYMENT_METHODS = void 0;
4
4
  // packages/contracts/src/invoices.ts
5
5
  // E2 — the payment ledger. Request validation for POST /invoices/:uuid/payments
6
6
  // (tenant-authenticated, not part of the public-api.ts surface — no external
@@ -25,3 +25,10 @@ exports.PaymentSummarySchema = zod_1.z.object({
25
25
  receivedAt: zod_1.z.string(),
26
26
  note: zod_1.z.string().nullable(),
27
27
  });
28
+ // E4 — request validation for POST /invoices/:uuid/void and
29
+ // POST /invoices/:uuid/reissue (both tenant-authenticated). Same reason
30
+ // requirement either way — reissue voids the old invoice before creating the
31
+ // replacement.
32
+ exports.VoidInvoiceSchema = zod_1.z.object({
33
+ reason: zod_1.z.string().trim().min(1).max(500),
34
+ });
@@ -259,6 +259,15 @@ export declare const InvoiceSchema: z.ZodObject<{
259
259
  balance_uploaded: "balance_uploaded";
260
260
  }>>;
261
261
  statusChangedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ voidReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
263
+ supersedesInvoice: z.ZodOptional<z.ZodNullable<z.ZodObject<{
264
+ id: z.ZodString;
265
+ invoiceNumber: z.ZodString;
266
+ }, z.core.$strip>>>;
267
+ supersededBy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
268
+ id: z.ZodString;
269
+ invoiceNumber: z.ZodString;
270
+ }, z.core.$strip>>>;
262
271
  outstanding: z.ZodOptional<z.ZodString>;
263
272
  depositPercent: z.ZodNullable<z.ZodNumber>;
264
273
  depositAmount: z.ZodNullable<z.ZodString>;
@@ -269,6 +278,7 @@ export declare const InvoiceSchema: z.ZodObject<{
269
278
  balanceDueDate: z.ZodNullable<z.ZodString>;
270
279
  popUploadedAt: z.ZodNullable<z.ZodString>;
271
280
  lineItems: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
281
+ lineItemsVersion: z.ZodOptional<z.ZodNumber>;
272
282
  codeDiscountLabel: z.ZodNullable<z.ZodString>;
273
283
  codeDiscountType: z.ZodNullable<z.ZodEnum<{
274
284
  PERCENT: "PERCENT";
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAkC9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBlB,CAAC;AAEjB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BnB,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBb,CAAC;AAIjB,eAAO,MAAM,0BAA0B;;;;;;mBAA2H,CAAC;AAInK,eAAO,MAAM,8BAA8B;;;;iBAIzC,CAAC;AAIH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA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  // confirmation, and against which milestone. Orthogonal to `status`.
189
189
  popStatus: zod_1.z.enum(["none", "deposit_uploaded", "balance_uploaded"]).optional(),
190
190
  statusChangedAt: zod_1.z.string().nullable().optional(),
191
+ // E4 — void/re-issue history. Additive; absent on responses from before
192
+ // this field existed.
193
+ voidReason: zod_1.z.string().nullable().optional(),
194
+ supersedesInvoice: zod_1.z.object({ id: zod_1.z.string(), invoiceNumber: zod_1.z.string() }).nullable().optional(),
195
+ supersededBy: zod_1.z.object({ id: zod_1.z.string(), invoiceNumber: zod_1.z.string() }).nullable().optional(),
191
196
  // E2 — total minus every recorded payment. Additive; absent on responses
192
197
  // from before the payment ledger existed.
193
198
  outstanding: zod_1.z.string().optional(),
@@ -200,6 +205,9 @@ exports.InvoiceSchema = zod_1.z
200
205
  balanceDueDate: zod_1.z.string().nullable(),
201
206
  popUploadedAt: zod_1.z.string().nullable(),
202
207
  lineItems: zod_1.z.array(LineItemSchema),
208
+ // E5 — which shape of LineItem this snapshot was frozen under. Additive;
209
+ // absent on responses from before this field existed (treat as version 1).
210
+ lineItemsVersion: zod_1.z.number().optional(),
203
211
  codeDiscountLabel: zod_1.z.string().nullable(),
204
212
  codeDiscountType: zod_1.z.enum(["PERCENT", "FIXED"]).nullable(),
205
213
  codeDiscountValue: zod_1.z.string().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onabl/contracts",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Zod request/response validation schemas for onabl's public API — the SDK's typed contract with the API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "@onabl/typescript-config": "0.0.1"
28
28
  },
29
29
  "dependencies": {
30
- "@onabl/types": "0.4.0"
30
+ "@onabl/types": "0.5.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^4"