@onabl/contracts 0.3.1 → 0.4.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.
- package/dist/invoices.d.ts +4 -0
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +8 -1
- package/dist/public-api.d.ts +20 -1
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +19 -1
- package/package.json +4 -4
package/dist/invoices.d.ts
CHANGED
|
@@ -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
|
package/dist/invoices.d.ts.map
CHANGED
|
@@ -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
|
+
});
|
package/dist/public-api.d.ts
CHANGED
|
@@ -239,7 +239,16 @@ export declare const InvoiceSchema: z.ZodObject<{
|
|
|
239
239
|
uuid: z.ZodString;
|
|
240
240
|
invoiceNumber: z.ZodString;
|
|
241
241
|
totalAmount: z.ZodString;
|
|
242
|
-
|
|
242
|
+
finalDueDate: z.ZodString;
|
|
243
|
+
dueMilestone: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
244
|
+
kind: z.ZodEnum<{
|
|
245
|
+
DEPOSIT: "DEPOSIT";
|
|
246
|
+
BALANCE: "BALANCE";
|
|
247
|
+
FULL: "FULL";
|
|
248
|
+
}>;
|
|
249
|
+
dueDate: z.ZodString;
|
|
250
|
+
overdue: z.ZodBoolean;
|
|
251
|
+
}, z.core.$strip>>>;
|
|
243
252
|
issueDate: z.ZodString;
|
|
244
253
|
paidAt: z.ZodNullable<z.ZodString>;
|
|
245
254
|
balancePaidAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -259,6 +268,15 @@ export declare const InvoiceSchema: z.ZodObject<{
|
|
|
259
268
|
balance_uploaded: "balance_uploaded";
|
|
260
269
|
}>>;
|
|
261
270
|
statusChangedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
voidReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
+
supersedesInvoice: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
273
|
+
id: z.ZodString;
|
|
274
|
+
invoiceNumber: z.ZodString;
|
|
275
|
+
}, z.core.$strip>>>;
|
|
276
|
+
supersededBy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
invoiceNumber: z.ZodString;
|
|
279
|
+
}, z.core.$strip>>>;
|
|
262
280
|
outstanding: z.ZodOptional<z.ZodString>;
|
|
263
281
|
depositPercent: z.ZodNullable<z.ZodNumber>;
|
|
264
282
|
depositAmount: z.ZodNullable<z.ZodString>;
|
|
@@ -269,6 +287,7 @@ export declare const InvoiceSchema: z.ZodObject<{
|
|
|
269
287
|
balanceDueDate: z.ZodNullable<z.ZodString>;
|
|
270
288
|
popUploadedAt: z.ZodNullable<z.ZodString>;
|
|
271
289
|
lineItems: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
290
|
+
lineItemsVersion: z.ZodOptional<z.ZodNumber>;
|
|
272
291
|
codeDiscountLabel: z.ZodNullable<z.ZodString>;
|
|
273
292
|
codeDiscountType: z.ZodNullable<z.ZodEnum<{
|
|
274
293
|
PERCENT: "PERCENT";
|
package/dist/public-api.d.ts.map
CHANGED
|
@@ -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+CR,CAAC;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,qBAAqB,CAAC,CAAC"}
|
package/dist/public-api.js
CHANGED
|
@@ -173,7 +173,17 @@ exports.InvoiceSchema = zod_1.z
|
|
|
173
173
|
uuid: zod_1.z.string(),
|
|
174
174
|
invoiceNumber: zod_1.z.string(),
|
|
175
175
|
totalAmount: zod_1.z.string(),
|
|
176
|
-
dueDate:
|
|
176
|
+
// INV-9 (baseline 2026-09-06, was `dueDate`): the single / final payment
|
|
177
|
+
// due date — the balance due date on a deposit invoice. NOT "what is due
|
|
178
|
+
// next" — use `dueMilestone` for that.
|
|
179
|
+
finalDueDate: zod_1.z.string(),
|
|
180
|
+
// The milestone currently outstanding + whether it is late. null once the
|
|
181
|
+
// invoice is paid / void / written off. Every "overdue" answer in the app
|
|
182
|
+
// derives from this one value.
|
|
183
|
+
dueMilestone: zod_1.z
|
|
184
|
+
.object({ kind: zod_1.z.enum(["DEPOSIT", "BALANCE", "FULL"]), dueDate: zod_1.z.string(), overdue: zod_1.z.boolean() })
|
|
185
|
+
.nullable()
|
|
186
|
+
.optional(),
|
|
177
187
|
issueDate: zod_1.z.string(),
|
|
178
188
|
paidAt: zod_1.z.string().nullable(),
|
|
179
189
|
// Deposit invoices only: the balance milestone was confirmed. null on
|
|
@@ -188,6 +198,11 @@ exports.InvoiceSchema = zod_1.z
|
|
|
188
198
|
// confirmation, and against which milestone. Orthogonal to `status`.
|
|
189
199
|
popStatus: zod_1.z.enum(["none", "deposit_uploaded", "balance_uploaded"]).optional(),
|
|
190
200
|
statusChangedAt: zod_1.z.string().nullable().optional(),
|
|
201
|
+
// E4 — void/re-issue history. Additive; absent on responses from before
|
|
202
|
+
// this field existed.
|
|
203
|
+
voidReason: zod_1.z.string().nullable().optional(),
|
|
204
|
+
supersedesInvoice: zod_1.z.object({ id: zod_1.z.string(), invoiceNumber: zod_1.z.string() }).nullable().optional(),
|
|
205
|
+
supersededBy: zod_1.z.object({ id: zod_1.z.string(), invoiceNumber: zod_1.z.string() }).nullable().optional(),
|
|
191
206
|
// E2 — total minus every recorded payment. Additive; absent on responses
|
|
192
207
|
// from before the payment ledger existed.
|
|
193
208
|
outstanding: zod_1.z.string().optional(),
|
|
@@ -200,6 +215,9 @@ exports.InvoiceSchema = zod_1.z
|
|
|
200
215
|
balanceDueDate: zod_1.z.string().nullable(),
|
|
201
216
|
popUploadedAt: zod_1.z.string().nullable(),
|
|
202
217
|
lineItems: zod_1.z.array(LineItemSchema),
|
|
218
|
+
// E5 — which shape of LineItem this snapshot was frozen under. Additive;
|
|
219
|
+
// absent on responses from before this field existed (treat as version 1).
|
|
220
|
+
lineItemsVersion: zod_1.z.number().optional(),
|
|
203
221
|
codeDiscountLabel: zod_1.z.string().nullable(),
|
|
204
222
|
codeDiscountType: zod_1.z.enum(["PERCENT", "FIXED"]).nullable(),
|
|
205
223
|
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
|
+
"version": "0.4.0",
|
|
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": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "latest",
|
|
26
|
-
"@onabl/
|
|
27
|
-
"@onabl/
|
|
26
|
+
"@onabl/typescript-config": "0.0.1",
|
|
27
|
+
"@onabl/eslint-config": "0.0.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@onabl/types": "0.
|
|
30
|
+
"@onabl/types": "0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"zod": "^4"
|