@vindentech/api-client 0.3.0-next.35 → 0.3.0-next.37

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 (34) hide show
  1. package/dist/generated/_all.d.ts +1 -0
  2. package/dist/generated/_all.d.ts.map +1 -1
  3. package/dist/generated/_all.js +1 -0
  4. package/dist/generated/_all.js.map +1 -1
  5. package/dist/generated/_permissions.d.ts +33 -1
  6. package/dist/generated/_permissions.d.ts.map +1 -1
  7. package/dist/generated/_permissions.js +8 -0
  8. package/dist/generated/_permissions.js.map +1 -1
  9. package/dist/generated/billable-events/billable-events.d.ts +58 -0
  10. package/dist/generated/billable-events/billable-events.d.ts.map +1 -0
  11. package/dist/generated/billable-events/billable-events.js +40 -0
  12. package/dist/generated/billable-events/billable-events.js.map +1 -0
  13. package/dist/generated/billing-accounts/billing-accounts.d.ts +2 -2
  14. package/dist/generated/index.schemas.d.ts +270 -2
  15. package/dist/generated/index.schemas.d.ts.map +1 -1
  16. package/dist/generated/index.schemas.js +41 -0
  17. package/dist/generated/index.schemas.js.map +1 -1
  18. package/dist/generated/invoices/invoices.d.ts +22 -1
  19. package/dist/generated/invoices/invoices.d.ts.map +1 -1
  20. package/dist/generated/invoices/invoices.js +11 -0
  21. package/dist/generated/invoices/invoices.js.map +1 -1
  22. package/dist/generated/price-lists/price-lists.d.ts +53 -4
  23. package/dist/generated/price-lists/price-lists.d.ts.map +1 -1
  24. package/dist/generated/price-lists/price-lists.js +22 -1
  25. package/dist/generated/price-lists/price-lists.js.map +1 -1
  26. package/dist/generated/pricing-rules/pricing-rules.d.ts +36 -1
  27. package/dist/generated/pricing-rules/pricing-rules.d.ts.map +1 -1
  28. package/dist/generated/pricing-rules/pricing-rules.js +21 -0
  29. package/dist/generated/pricing-rules/pricing-rules.js.map +1 -1
  30. package/dist/generated/transport-legs/transport-legs.d.ts +3 -3
  31. package/dist/generated/transport-legs/transport-legs.d.ts.map +1 -1
  32. package/dist/generated/transport-legs/transport-legs.js +2 -2
  33. package/dist/generated/transport-legs/transport-legs.js.map +1 -1
  34. package/package.json +1 -1
@@ -42,6 +42,8 @@ export interface OrderSummaryDto {
42
42
  recipientName: string | null;
43
43
  /** Live product lines on the job (voided and deleted lines excluded). Scoped by the caller's own row visibility, so it matches what `GET /v1/orders/{id}` would show them. */
44
44
  productCount: number;
45
+ /** Merchandise lines on the job (public.sales_order_merchandise) — always 0 except on a MERCHANDISE_SALE job, which carries merchandise instead of product lines. Distinct from `productCount`, which never counts these. Scoped by the caller's own row visibility like `productCount`: 0 can mean 'no merchandise' or 'withheld by scope' (no warehouse/carrier read branch exists yet on this table). */
46
+ merchandiseCount: number;
45
47
  /**
46
48
  * Dispatch warehouse (NULL for service-only / field jobs).
47
49
  * @nullable
@@ -152,6 +154,26 @@ export interface OrderProductDto {
152
154
  quantity: number;
153
155
  status: string;
154
156
  }
157
+ export interface OrderMerchandiseDto {
158
+ salesOrderMerchandiseId: string;
159
+ /** The tenant SKU (public.tenant_goods) this line was placed against. */
160
+ tenantGoodsId: string;
161
+ /** Denormalized snapshot of the SKU's code at placement. */
162
+ goodsCode: string;
163
+ /** Denormalized snapshot of the SKU's name at placement. */
164
+ goodsName: string;
165
+ /** Units placed. */
166
+ quantity: number;
167
+ /**
168
+ * Per-unit price ex VAT, frozen at placement, in minor units (e.g. öre/cent).
169
+ * @minimum 0
170
+ */
171
+ unitPriceExVatMinor: number;
172
+ /** VAT rate frozen at placement (numeric column → string, e.g. "25.0000"). */
173
+ vatRate: string;
174
+ /** Frozen at placement (ISO 4217). */
175
+ currencyCode: string;
176
+ }
155
177
  export interface OrderEstimateItemDto {
156
178
  /**
157
179
  * What the customer called it.
@@ -303,6 +325,8 @@ export interface OrderDetailDto {
303
325
  recipientName: string | null;
304
326
  /** Live product lines on the job (voided and deleted lines excluded). Scoped by the caller's own row visibility, so it matches what `GET /v1/orders/{id}` would show them. */
305
327
  productCount: number;
328
+ /** Merchandise lines on the job (public.sales_order_merchandise) — always 0 except on a MERCHANDISE_SALE job, which carries merchandise instead of product lines. Distinct from `productCount`, which never counts these. Scoped by the caller's own row visibility like `productCount`: 0 can mean 'no merchandise' or 'withheld by scope' (no warehouse/carrier read branch exists yet on this table). */
329
+ merchandiseCount: number;
306
330
  /**
307
331
  * Dispatch warehouse (NULL for service-only / field jobs).
308
332
  * @nullable
@@ -363,6 +387,8 @@ export interface OrderDetailDto {
363
387
  /** @nullable */
364
388
  organization: OrderDetailDtoOrganization;
365
389
  products: OrderProductDto[];
390
+ /** Merchandise lines (public.sales_order_merchandise) — populated on a MERCHANDISE_SALE job, empty on every other order type. Scoped by the caller's own row visibility like `merchandiseCount`: empty can mean 'no merchandise' or 'withheld by scope'. */
391
+ merchandise: OrderMerchandiseDto[];
366
392
  /** @nullable */
367
393
  estimate: OrderDetailDtoEstimate;
368
394
  legs: OrderLegDto[];
@@ -4084,9 +4110,26 @@ export interface CompleteStopResultDto {
4084
4110
  /** True when this was an idempotent replay. */
4085
4111
  idempotent: boolean;
4086
4112
  }
4113
+ /**
4114
+ * Structured failure-reason code. Drives customer-fault billing attribution — omit or use an operational code to never bill.
4115
+ */
4116
+ export type FailStopDtoFailureReasonCode = typeof FailStopDtoFailureReasonCode[keyof typeof FailStopDtoFailureReasonCode];
4117
+ export declare const FailStopDtoFailureReasonCode: {
4118
+ readonly RECIPIENT_NOT_HOME: "RECIPIENT_NOT_HOME";
4119
+ readonly ACCESS_BLOCKED: "ACCESS_BLOCKED";
4120
+ readonly ADDRESS_INVALID: "ADDRESS_INVALID";
4121
+ readonly DELIVERY_REFUSED: "DELIVERY_REFUSED";
4122
+ readonly CARRIER_VEHICLE_ISSUE: "CARRIER_VEHICLE_ISSUE";
4123
+ readonly CARRIER_CAPACITY: "CARRIER_CAPACITY";
4124
+ readonly WAREHOUSE_ERROR: "WAREHOUSE_ERROR";
4125
+ readonly WEATHER_OR_ROAD_CONDITIONS: "WEATHER_OR_ROAD_CONDITIONS";
4126
+ readonly OTHER_OPERATIONAL: "OTHER_OPERATIONAL";
4127
+ };
4087
4128
  export interface FailStopDto {
4088
4129
  /** Why the delivery failed (required). */
4089
4130
  failureReason: string;
4131
+ /** Structured failure-reason code. Drives customer-fault billing attribution — omit or use an operational code to never bill. */
4132
+ failureReasonCode?: FailStopDtoFailureReasonCode;
4090
4133
  /** @maxLength 1000 */
4091
4134
  notes?: string;
4092
4135
  photoFileIds?: string[];
@@ -4177,6 +4220,22 @@ export declare const TransportLegDtoStatus: {
4177
4220
  readonly CANCELLED: "CANCELLED";
4178
4221
  readonly FAILED: "FAILED";
4179
4222
  };
4223
+ /**
4224
+ * Structured failure-reason taxonomy code, set on fail(). NULL = not classified (BE-1832).
4225
+ * @nullable
4226
+ */
4227
+ export type TransportLegDtoFailureReasonCode = typeof TransportLegDtoFailureReasonCode[keyof typeof TransportLegDtoFailureReasonCode] | null;
4228
+ export declare const TransportLegDtoFailureReasonCode: {
4229
+ readonly RECIPIENT_NOT_HOME: "RECIPIENT_NOT_HOME";
4230
+ readonly ACCESS_BLOCKED: "ACCESS_BLOCKED";
4231
+ readonly ADDRESS_INVALID: "ADDRESS_INVALID";
4232
+ readonly DELIVERY_REFUSED: "DELIVERY_REFUSED";
4233
+ readonly CARRIER_VEHICLE_ISSUE: "CARRIER_VEHICLE_ISSUE";
4234
+ readonly CARRIER_CAPACITY: "CARRIER_CAPACITY";
4235
+ readonly WAREHOUSE_ERROR: "WAREHOUSE_ERROR";
4236
+ readonly WEATHER_OR_ROAD_CONDITIONS: "WEATHER_OR_ROAD_CONDITIONS";
4237
+ readonly OTHER_OPERATIONAL: "OTHER_OPERATIONAL";
4238
+ };
4180
4239
  /**
4181
4240
  * @nullable
4182
4241
  */
@@ -4189,6 +4248,11 @@ export interface TransportLegDto {
4189
4248
  legType: string;
4190
4249
  legSequence: number;
4191
4250
  status: TransportLegDtoStatus;
4251
+ /**
4252
+ * Structured failure-reason taxonomy code, set on fail(). NULL = not classified (BE-1832).
4253
+ * @nullable
4254
+ */
4255
+ failureReasonCode: TransportLegDtoFailureReasonCode;
4192
4256
  /** @nullable */
4193
4257
  transportServiceId: string | null;
4194
4258
  /** @nullable */
@@ -4313,6 +4377,32 @@ export interface CompleteLegDto {
4313
4377
  /** A file_asset id linked via entity_file. */
4314
4378
  proofOfDeliveryFileId?: string;
4315
4379
  }
4380
+ /**
4381
+ * Structured failure-reason code. Drives customer-fault billing attribution — omit or use an operational code to never bill.
4382
+ */
4383
+ export type FailTransportLegDtoFailureReasonCode = typeof FailTransportLegDtoFailureReasonCode[keyof typeof FailTransportLegDtoFailureReasonCode];
4384
+ export declare const FailTransportLegDtoFailureReasonCode: {
4385
+ readonly RECIPIENT_NOT_HOME: "RECIPIENT_NOT_HOME";
4386
+ readonly ACCESS_BLOCKED: "ACCESS_BLOCKED";
4387
+ readonly ADDRESS_INVALID: "ADDRESS_INVALID";
4388
+ readonly DELIVERY_REFUSED: "DELIVERY_REFUSED";
4389
+ readonly CARRIER_VEHICLE_ISSUE: "CARRIER_VEHICLE_ISSUE";
4390
+ readonly CARRIER_CAPACITY: "CARRIER_CAPACITY";
4391
+ readonly WAREHOUSE_ERROR: "WAREHOUSE_ERROR";
4392
+ readonly WEATHER_OR_ROAD_CONDITIONS: "WEATHER_OR_ROAD_CONDITIONS";
4393
+ readonly OTHER_OPERATIONAL: "OTHER_OPERATIONAL";
4394
+ };
4395
+ export interface FailTransportLegDto {
4396
+ /**
4397
+ * Required — the failure/cancellation reason.
4398
+ * @maxLength 500
4399
+ */
4400
+ reason?: string;
4401
+ /** When the event occurred (client clock). */
4402
+ occurredAt?: string;
4403
+ /** Structured failure-reason code. Drives customer-fault billing attribution — omit or use an operational code to never bill. */
4404
+ failureReasonCode?: FailTransportLegDtoFailureReasonCode;
4405
+ }
4316
4406
  export interface FailLegDto {
4317
4407
  /**
4318
4408
  * Required — the failure/cancellation reason.
@@ -7052,6 +7142,17 @@ export interface VoidInvoiceDto {
7052
7142
  /** Why the invoice is being voided (required, recorded on the row). */
7053
7143
  voidReason: string;
7054
7144
  }
7145
+ export interface ReprocessInvoiceFromBasisResponseDto {
7146
+ invoiceId: string;
7147
+ /** Always CANCELLED on success. */
7148
+ invoiceStatus: string;
7149
+ /** New invoice_basis_row(s) inserted across all events behind this invoice. */
7150
+ insertedCount: number;
7151
+ /** invoice_basis_row_supersession row(s) inserted. */
7152
+ supersededCount: number;
7153
+ /** Explains that the replacement invoice is produced asynchronously by the next scheduled aggregation run, not by this call. */
7154
+ note: string;
7155
+ }
7055
7156
  export interface CreditNoteRowDto {
7056
7157
  invoiceRowId: string;
7057
7158
  /** Amount (excl. VAT, minor units, POSITIVE magnitude) to refund off this row. The service writes it as a negative credit-note row. */
@@ -7184,7 +7285,7 @@ export interface PriceListDto {
7184
7285
  /** @nullable */
7185
7286
  effectiveUntil: string | null;
7186
7287
  isActive: boolean;
7187
- /** Lifecycle status (draft / approved / ...). */
7288
+ /** Lifecycle status (draft / pending_approval / active / archived). */
7188
7289
  lifecycleStatus: string;
7189
7290
  createdAt: string;
7190
7291
  updatedAt: string;
@@ -7213,7 +7314,7 @@ export interface PriceListItemDto {
7213
7314
  /** @nullable */
7214
7315
  effectiveUntil: string | null;
7215
7316
  isActive: boolean;
7216
- /** Lifecycle status (draft / approved / ...). */
7317
+ /** Lifecycle status (draft / pending_approval / active / archived). */
7217
7318
  lifecycleStatus: string;
7218
7319
  createdAt: string;
7219
7320
  updatedAt: string;
@@ -7229,6 +7330,14 @@ export interface CreatePriceListDto {
7229
7330
  effectiveUntil?: string;
7230
7331
  changeReason?: string;
7231
7332
  }
7333
+ /**
7334
+ * Move between draft and pending_approval only. Activation/archival are dedicated endpoints.
7335
+ */
7336
+ export type UpdatePriceListDtoLifecycleStatus = typeof UpdatePriceListDtoLifecycleStatus[keyof typeof UpdatePriceListDtoLifecycleStatus];
7337
+ export declare const UpdatePriceListDtoLifecycleStatus: {
7338
+ readonly draft: "draft";
7339
+ readonly pending_approval: "pending_approval";
7340
+ };
7232
7341
  export interface UpdatePriceListDto {
7233
7342
  name?: string;
7234
7343
  code?: string;
@@ -7237,6 +7346,12 @@ export interface UpdatePriceListDto {
7237
7346
  effectiveFrom?: string;
7238
7347
  effectiveUntil?: string;
7239
7348
  changeReason?: string;
7349
+ /** Move between draft and pending_approval only. Activation/archival are dedicated endpoints. */
7350
+ lifecycleStatus?: UpdatePriceListDtoLifecycleStatus;
7351
+ }
7352
+ export interface PriceListLifecycleActionDto {
7353
+ /** Optional justification for this decision. */
7354
+ changeReason?: string;
7240
7355
  }
7241
7356
  export interface CreatePriceListItemDto {
7242
7357
  articleId: string;
@@ -8042,6 +8157,8 @@ export interface BillingModelTemplateDto {
8042
8157
  description: string;
8043
8158
  /** The billable event type the produced rules price. */
8044
8159
  billableEventType: string;
8160
+ /** Whether a live backend emitter produces this template's billable event type today. `false` means a rule created from this template is valid but currently dormant — no in-platform producer fires the event yet. */
8161
+ emitterReady: boolean;
8045
8162
  /** Calculation methods this template emits. */
8046
8163
  generatesCalculationMethods: string[];
8047
8164
  /** JSON Schema for the authoring form. */
@@ -8108,6 +8225,7 @@ export interface ApplyTemplateDto {
8108
8225
  currencyCode: string;
8109
8226
  /** Omit for the tenant-wide default; set for a per-customer override. */
8110
8227
  billingAccountId?: string;
8228
+ /** Reserved for price-list-scoped rules (#70) — not implemented yet, so a non-null value is rejected with 400 (BE-1822). Omit this field. */
8111
8229
  priceListId?: string;
8112
8230
  /** Template form values, per the template's uiFormSchema (e.g. { amount_minor: 49900 }). */
8113
8231
  input: ApplyTemplateDtoInput;
@@ -8211,6 +8329,20 @@ export interface SimulatePricingResponseDto {
8211
8329
  basisRows: SimulatedBasisRowDto[];
8212
8330
  projectedInvoiceRowsBeforeDiscounts: ProjectedInvoiceRowDto[];
8213
8331
  }
8332
+ /**
8333
+ * Method-specific parameters (JSON), re-validated on write.
8334
+ */
8335
+ export type UpdatePricingRuleDtoParameters = {
8336
+ [key: string]: unknown;
8337
+ };
8338
+ export interface UpdatePricingRuleDto {
8339
+ /** Close (or narrow) the rule's active window. */
8340
+ effectiveUntil?: string;
8341
+ isActive?: boolean;
8342
+ /** Method-specific parameters (JSON), re-validated on write. */
8343
+ parameters?: UpdatePricingRuleDtoParameters;
8344
+ changeReason?: string;
8345
+ }
8214
8346
  export interface BillableEventTypeDto {
8215
8347
  /** Canonical event_type key (e.g. picking_order_processed). */
8216
8348
  eventType: string;
@@ -8220,6 +8352,8 @@ export interface BillableEventTypeDto {
8220
8352
  category: string;
8221
8353
  /** Whether a pricing_rule may target this type. Filter to `true` for the rule-authoring dropdown; `false` are state/audit or system events. */
8222
8354
  pricingTarget: boolean;
8355
+ /** Whether a live backend emitter produces this event type today. `false` means a pricing_rule targeting it is valid but currently dormant — no in-platform producer fires it yet. */
8356
+ emitterReady: boolean;
8223
8357
  description: string;
8224
8358
  }
8225
8359
  export interface PaymentInstrumentDto {
@@ -8309,6 +8443,119 @@ export interface InvoiceDetailsDto {
8309
8443
  */
8310
8444
  paymentMethodName: string | null;
8311
8445
  }
8446
+ export interface BillableEventDto {
8447
+ billableEventId: string;
8448
+ tenantId: string;
8449
+ organizationId: string;
8450
+ /**
8451
+ * Null until the operational source resolves the billing account.
8452
+ * @nullable
8453
+ */
8454
+ billingAccountId: string | null;
8455
+ /** e.g. picking_order_processed, storage_snapshot. */
8456
+ eventType: string;
8457
+ /** Operational source table this event was raised from. */
8458
+ sourceTable: string;
8459
+ /** Id of the row in sourceTable. */
8460
+ sourceId: string;
8461
+ /**
8462
+ * Disambiguates multiple events for the same source in one period (e.g. a credit note's invoice id).
8463
+ * @nullable
8464
+ */
8465
+ sourceDiscriminator: string | null;
8466
+ basisPeriodStart: string;
8467
+ /** @nullable */
8468
+ basisPeriodEnd: string | null;
8469
+ /**
8470
+ * Informational snapshot only — NOT authoritative pricing.
8471
+ * @nullable
8472
+ */
8473
+ amountMinor: number | null;
8474
+ /**
8475
+ * ISO 4217 currency code.
8476
+ * @nullable
8477
+ */
8478
+ currencyCode: string | null;
8479
+ createdAt: string;
8480
+ /**
8481
+ * Set once the pricing materializer has consumed this event (0 basis rows is still processed).
8482
+ * @nullable
8483
+ */
8484
+ processedAt: string | null;
8485
+ }
8486
+ export interface PaginatedBillableEventsDto {
8487
+ /** The page of rows. */
8488
+ items: BillableEventDto[];
8489
+ /** Exact count of all rows matching the filter, pre-pagination (RLS-scoped). */
8490
+ total: number;
8491
+ /** Effective max rows applied (after defaults/clamp). */
8492
+ limit: number;
8493
+ /** Effective rows skipped applied. */
8494
+ offset: number;
8495
+ }
8496
+ /**
8497
+ * Raw operational payload.
8498
+ * @nullable
8499
+ */
8500
+ export type BillableEventDetailDtoPayload = {
8501
+ [key: string]: unknown;
8502
+ } | null;
8503
+ export interface BillableEventDetailDto {
8504
+ billableEventId: string;
8505
+ tenantId: string;
8506
+ organizationId: string;
8507
+ /**
8508
+ * Null until the operational source resolves the billing account.
8509
+ * @nullable
8510
+ */
8511
+ billingAccountId: string | null;
8512
+ /** e.g. picking_order_processed, storage_snapshot. */
8513
+ eventType: string;
8514
+ /** Operational source table this event was raised from. */
8515
+ sourceTable: string;
8516
+ /** Id of the row in sourceTable. */
8517
+ sourceId: string;
8518
+ /**
8519
+ * Disambiguates multiple events for the same source in one period (e.g. a credit note's invoice id).
8520
+ * @nullable
8521
+ */
8522
+ sourceDiscriminator: string | null;
8523
+ basisPeriodStart: string;
8524
+ /** @nullable */
8525
+ basisPeriodEnd: string | null;
8526
+ /**
8527
+ * Informational snapshot only — NOT authoritative pricing.
8528
+ * @nullable
8529
+ */
8530
+ amountMinor: number | null;
8531
+ /**
8532
+ * ISO 4217 currency code.
8533
+ * @nullable
8534
+ */
8535
+ currencyCode: string | null;
8536
+ createdAt: string;
8537
+ /**
8538
+ * Set once the pricing materializer has consumed this event (0 basis rows is still processed).
8539
+ * @nullable
8540
+ */
8541
+ processedAt: string | null;
8542
+ /**
8543
+ * Raw operational payload.
8544
+ * @nullable
8545
+ */
8546
+ payload: BillableEventDetailDtoPayload;
8547
+ }
8548
+ export interface ReprocessPricingDto {
8549
+ /** Why this event is being reprocessed (recorded on the supersession row). */
8550
+ reason?: string;
8551
+ }
8552
+ export interface ReprocessPricingResponseDto {
8553
+ billableEventId: string;
8554
+ /** New invoice_basis_row(s) inserted by this call. */
8555
+ insertedCount: number;
8556
+ /** invoice_basis_row_supersession row(s) inserted by this call. */
8557
+ supersededCount: number;
8558
+ }
8312
8559
  export interface StripeWebhookAckDto {
8313
8560
  /** Always true once the event was accepted. */
8314
8561
  received: boolean;
@@ -11599,6 +11846,27 @@ export type PricingRulesControllerListPricingRulesV1Params = {
11599
11846
  */
11600
11847
  offset?: number;
11601
11848
  };
11849
+ export type BillableEventsControllerListBillableEventsV1Params = {
11850
+ /**
11851
+ * Max rows to return (1–100).
11852
+ * @minimum 1
11853
+ * @maximum 100
11854
+ */
11855
+ limit?: number;
11856
+ /**
11857
+ * Rows to skip.
11858
+ * @minimum 0
11859
+ */
11860
+ offset?: number;
11861
+ /**
11862
+ * Filter by the operational source table.
11863
+ */
11864
+ sourceTable?: string;
11865
+ /**
11866
+ * Filter by the operational source row id.
11867
+ */
11868
+ sourceId?: string;
11869
+ };
11602
11870
  export type UsersControllerListV1Params = {
11603
11871
  /**
11604
11872
  * Case-insensitive substring match over display name OR email. Omit to list the first page of the directory.