@campfire-interactive/master-data-client 5.52.0 → 5.53.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/types.d.ts CHANGED
@@ -605,6 +605,52 @@ export interface Rfq {
605
605
  /** Which quote won. Present exactly when `status` is `won`. A recorded fact
606
606
  * — closing the siblings is a later phase. */
607
607
  wonByQuoteId: string | null;
608
+ /**
609
+ * The ONE quote of this RFQ whose figures REPRESENT it.
610
+ *
611
+ * **⚠ This is not {@link Rfq.wonByQuoteId}, and it is the field most likely
612
+ * to be mistaken for it.** The winner says *this quote was AWARDED* and
613
+ * exists only on a `won` RFQ. The carried quote says *this quote's numbers
614
+ * stand for the request* and exists at any status — **an open RFQ has a
615
+ * carried quote and no winner**, which is the normal case and the reason
616
+ * the field exists.
617
+ *
618
+ * Read it wherever you need ONE number for an RFQ. Its quotes are
619
+ * ALTERNATIVES — three of four lose on every multi-scenario RFQ by
620
+ * construction — so summing them multiply-counts the same business, and
621
+ * picking one yourself is a different wrong answer. This is the figure the
622
+ * tenant has nominated.
623
+ *
624
+ * **Defaulted, not required.** The first of the RFQ's quotes to reach
625
+ * `submitted` fills it, and a later submission does NOT re-seat it: a value
626
+ * already there may be one a person chose, and moving it would move the
627
+ * pipeline figure under them. An RFQ with nothing submitted carries
628
+ * nothing, and null means exactly that — do not substitute a draft.
629
+ *
630
+ * **A carried quote that DIES is released.** When it reaches `lost` or
631
+ * `not_taken` the RFQ takes the freshest surviving quote of its own that
632
+ * reached the customer, or null when none has. So this never points at a
633
+ * dead figure, and a null you read may be an RFQ whose quotes all died
634
+ * rather than one nobody has quoted yet — both mean the same thing to a
635
+ * consumer: no figure.
636
+ *
637
+ * **A carried quote that LEAVES is released the same way.** Moving a quote to
638
+ * another RFQ through `quotes.update`, or detaching it, hands the one it left
639
+ * to a survivor by the same rule. Without that the RFQ it left would be
640
+ * represented by a quote now competing somewhere else.
641
+ *
642
+ * **On an awarded RFQ it IS the winner.** The request is decided, so the
643
+ * figure representing it is the one that won; `rfqs.update` refuses a patch
644
+ * naming another quote there rather than silently overruling it. A winner
645
+ * archived afterwards keeps the pointer — that is a record, not a stale
646
+ * value, and `wonByQuoteId` behaves the same way. REOPENING is where that
647
+ * ends: an RFQ leaving `won` keeps its carried quote, but if that quote died
648
+ * while the RFQ was awarded it is released, because an open RFQ may not be
649
+ * represented by a lost one.
650
+ *
651
+ * Always one of this RFQ's own quotes — `rfqs.update` 422s otherwise.
652
+ */
653
+ carriedQuoteId: string | null;
608
654
  /** What absorbed this RFQ. Present exactly when `status` is `merged`. */
609
655
  mergedIntoRfqId: string | null;
610
656
  /** When the RFQ stopped being open. Set for every non-open status,
@@ -679,6 +725,19 @@ export interface UpdateRfqInput {
679
725
  status?: RfqStatus;
680
726
  /** Required when `status` is `won`; must be one of this RFQ's own quotes. */
681
727
  wonByQuoteId?: string | null;
728
+ /**
729
+ * Override which quote's figures represent this RFQ — see
730
+ * {@link Rfq.carriedQuoteId}. Not a second winner.
731
+ *
732
+ * Must be one of this RFQ's own quotes (422 otherwise). On an awarded RFQ
733
+ * it must be the quote that won, so sending a different one is a 422 rather
734
+ * than a silent overrule; sending the winner, or omitting the field, is
735
+ * always fine.
736
+ *
737
+ * Absent from {@link CreateRfqInput} deliberately: a new RFQ has no quotes,
738
+ * so nothing could satisfy the membership rule.
739
+ */
740
+ carriedQuoteId?: string | null;
682
741
  /** Required when `status` is `merged`. Prefer `rfqs.merge(id, target)`. */
683
742
  mergedIntoRfqId?: string | null;
684
743
  }
@@ -5215,4 +5274,254 @@ export interface ImportRisksResult {
5215
5274
  /** Ids already in master-data, left as they were. */
5216
5275
  skipped: number;
5217
5276
  }
5277
+ export type SupplierQuoteSource = 'MANUAL' | 'ERFQ';
5278
+ export interface SupplierQuoteBookEffectivePrice {
5279
+ unitCost: number | null;
5280
+ currency: string | null;
5281
+ freightPerPc: number | null;
5282
+ dutyPerPc: number | null;
5283
+ /** unitCost + freight + duty; null only if no unit cost resolves. */
5284
+ landed: number | null;
5285
+ /** Which fields came from the Any plant price. All false on the Any plant price itself. */
5286
+ inherits: {
5287
+ unitCost: boolean;
5288
+ freightPerPc: boolean;
5289
+ dutyPerPc: boolean;
5290
+ };
5291
+ /** Price attribute values: the plant's own over the Any plant price's. */
5292
+ attributes: SupplierQuoteBookAttributes;
5293
+ /** The attribute keys that came from the Any plant price. Empty on the Any plant price itself. */
5294
+ inheritsAttributes: string[];
5295
+ }
5296
+ /**
5297
+ * Custom attribute values from the Attribute Registry, in the value store's bag
5298
+ * shape (an option's value, a number, a `YYYY-MM-DD` date, an array for a
5299
+ * multi-select or text list). Entry attributes (registry entity type
5300
+ * `supplier_quote_book_entry`) are facts about the quote that do not change by
5301
+ * plant; price attributes (`supplier_quote_book_price`) are what differs by
5302
+ * plant. Neither is ever added into `landed`. On a write, null clears a key and
5303
+ * a key left out is unchanged.
5304
+ */
5305
+ export type SupplierQuoteBookAttributes = Record<string, unknown>;
5306
+ export interface SupplierQuoteBookPrice {
5307
+ id: string;
5308
+ entryId: string;
5309
+ /** Null = the Any plant price. */
5310
+ plantId: string | null;
5311
+ /** The row's own values. On a plant price, null = use the Any plant price's. */
5312
+ unitCost: number | null;
5313
+ /** Goes with unitCost: null exactly when it is. */
5314
+ currency: string | null;
5315
+ freightPerPc: number | null;
5316
+ dutyPerPc: number | null;
5317
+ /** The row's own price attribute values; a key it lacks uses the Any plant price's. */
5318
+ attributes: SupplierQuoteBookAttributes;
5319
+ /** The price with its blanks filled from the Any plant price. */
5320
+ effective: SupplierQuoteBookEffectivePrice;
5321
+ /** When this price went live. */
5322
+ priceEffectiveFrom: string;
5323
+ priceSetBy: string | null;
5324
+ /** The import that last changed it. */
5325
+ lastUploadId: string | null;
5326
+ createdAt: string;
5327
+ updatedAt: string;
5328
+ }
5329
+ export interface SupplierQuoteBookEntry {
5330
+ id: string;
5331
+ partNumber: string;
5332
+ supplierCompanyId: string;
5333
+ /** The supplier's ship-from site; information only, never a price key. */
5334
+ supplierLocationId: string | null;
5335
+ leadTimeDays: number;
5336
+ moq: number;
5337
+ supplierQuoteRef: string | null;
5338
+ /** A calendar day, `YYYY-MM-DD` at midnight UTC. */
5339
+ supplierQuotedOn: string | null;
5340
+ validUntil: string | null;
5341
+ supplierTooling: number | null;
5342
+ supplierEdd: number | null;
5343
+ paymentTerms: string | null;
5344
+ source: SupplierQuoteSource;
5345
+ /** Entry attribute values. */
5346
+ attributes: SupplierQuoteBookAttributes;
5347
+ createdAt: string;
5348
+ updatedAt: string;
5349
+ /** The Any plant price first, then by plant name. */
5350
+ prices: SupplierQuoteBookPrice[];
5351
+ }
5352
+ export interface ListSupplierQuoteBookOptions {
5353
+ /** At most 200. */
5354
+ limit?: number;
5355
+ cursor?: string;
5356
+ /** Part number or quote ref, contains, case-insensitive. */
5357
+ q?: string;
5358
+ partNumber?: string;
5359
+ partNumbers?: string[];
5360
+ supplierCompanyId?: string;
5361
+ /** Entries with a price at this plant; `'any'` for an Any plant price. */
5362
+ plantId?: string | 'any';
5363
+ }
5364
+ /**
5365
+ * A whole price. On a plant price, a null or omitted unit cost, freight or
5366
+ * duty uses the Any plant price's (0 is a real value). Refused with a 422 when
5367
+ * the entry has no Any plant price to use, or when a plant priced in another
5368
+ * currency would take the Any plant price's freight or duty.
5369
+ */
5370
+ export interface SupplierQuoteBookPriceInput {
5371
+ /** Omit or null for the Any plant price. */
5372
+ plantId?: string | null;
5373
+ /** Required on the Any plant price. */
5374
+ unitCost?: number | null;
5375
+ /** Defaults to USD; ignored when the unit cost is inherited. */
5376
+ currency?: string;
5377
+ freightPerPc?: number | null;
5378
+ dutyPerPc?: number | null;
5379
+ /** Price attribute values to set; null clears one. Refused with a 422 if the registry would refuse them. */
5380
+ attributes?: SupplierQuoteBookAttributes;
5381
+ }
5382
+ export interface CreateSupplierQuoteBookEntryInput {
5383
+ partNumber: string;
5384
+ supplierCompanyId: string;
5385
+ supplierLocationId?: string | null;
5386
+ leadTimeDays: number;
5387
+ moq: number;
5388
+ supplierQuoteRef?: string | null;
5389
+ supplierQuotedOn?: string | null;
5390
+ validUntil?: string | null;
5391
+ supplierTooling?: number | null;
5392
+ supplierEdd?: number | null;
5393
+ paymentTerms?: string | null;
5394
+ source?: SupplierQuoteSource;
5395
+ /** Entry attribute values to set; null clears one. Refused with a 422 if the registry would refuse them. */
5396
+ attributes?: SupplierQuoteBookAttributes;
5397
+ /** The first price. */
5398
+ price?: SupplierQuoteBookPriceInput;
5399
+ }
5400
+ /** Fields left out are unchanged; null clears one. */
5401
+ export type UpdateSupplierQuoteBookEntryInput = Partial<Omit<CreateSupplierQuoteBookEntryInput, 'partNumber' | 'supplierCompanyId' | 'source' | 'price'>>;
5402
+ export interface SupplierQuoteBookResolveLookup {
5403
+ partNumber: string;
5404
+ supplierCompanyId: string;
5405
+ /** Null or omitted: the Any plant price, else the most recently updated plant price. */
5406
+ plantId?: string | null;
5407
+ }
5408
+ export interface SupplierQuoteBookResolved {
5409
+ entry: Omit<SupplierQuoteBookEntry, 'prices'>;
5410
+ price: SupplierQuoteBookPrice;
5411
+ }
5412
+ export type SupplierQuoteBookChangeType = 'upload' | 'manual' | 'delete' | 'migrated';
5413
+ /** One closed price period, `[effectiveFrom, recordedAt)`. */
5414
+ export interface SupplierQuoteBookHistoryEntry {
5415
+ id: string;
5416
+ priceId: string;
5417
+ partNumber: string;
5418
+ supplierCompanyId: string;
5419
+ plantId: string | null;
5420
+ /** The row's own values when it was replaced; null where it used the Any plant price's. */
5421
+ unitCost: number | null;
5422
+ currency: string | null;
5423
+ freightPerPc: number | null;
5424
+ dutyPerPc: number | null;
5425
+ supplierQuoteRef: string | null;
5426
+ supplierQuotedOn: string | null;
5427
+ /** Null only for a period moved from cpq that predates the column. */
5428
+ effectiveFrom: string | null;
5429
+ changeType: SupplierQuoteBookChangeType;
5430
+ changedBy: string | null;
5431
+ uploadId: string | null;
5432
+ recordedAt: string;
5433
+ }
5434
+ export interface SupplierQuoteBookHistoryQuery {
5435
+ partNumber?: string;
5436
+ supplierCompanyId?: string;
5437
+ priceId?: string;
5438
+ }
5439
+ /**
5440
+ * One spreadsheet row. A blank cell keeps the stored value; the last non-blank
5441
+ * value of an entry field wins when a file repeats it per plant.
5442
+ */
5443
+ export interface SupplierQuoteBookImportRow {
5444
+ partNumber: string;
5445
+ /** Matched to an active supplier company by name, case-insensitive. */
5446
+ supplierName: string;
5447
+ /** Blank = the Any plant price. */
5448
+ plantCode?: string | null;
5449
+ /** Blank on a new plant price = use the Any plant price's; on an existing price, keep. */
5450
+ unitCost?: number | null;
5451
+ leadTimeDays: number;
5452
+ moq: number;
5453
+ currency?: string | null;
5454
+ supplierTooling?: number | null;
5455
+ supplierEdd?: number | null;
5456
+ paymentTerms?: string | null;
5457
+ freightPerPc?: number | null;
5458
+ dutyPerPc?: number | null;
5459
+ supplierQuoteRef?: string | null;
5460
+ supplierQuotedOn?: string | null;
5461
+ /** Entry attribute values; a blank keeps the stored value. A bad value fails its row. */
5462
+ attributes?: SupplierQuoteBookAttributes;
5463
+ /** This row's price attribute values; a blank keeps the stored value. A bad value fails its row. */
5464
+ priceAttributes?: SupplierQuoteBookAttributes;
5465
+ }
5466
+ export interface SupplierQuoteBookImportError {
5467
+ /** 1-based, in the order sent. */
5468
+ row: number;
5469
+ reason: string;
5470
+ }
5471
+ export interface SupplierQuoteBookImportValidation {
5472
+ summary: {
5473
+ rows: number;
5474
+ willCreate: number;
5475
+ willUpdate: number;
5476
+ /** Rows that match the stored price and will write nothing. */
5477
+ unchanged: number;
5478
+ errors: number;
5479
+ };
5480
+ errors: SupplierQuoteBookImportError[];
5481
+ }
5482
+ export interface SupplierQuoteBookImportResult {
5483
+ uploadId: string;
5484
+ created: number;
5485
+ updated: number;
5486
+ unchanged: number;
5487
+ errors: SupplierQuoteBookImportError[];
5488
+ }
5489
+ /** The one-time move from cpq. System callers only; ids are kept and a rerun is safe. */
5490
+ export interface SupplierQuoteBookMigrateBatch {
5491
+ entries?: (Omit<CreateSupplierQuoteBookEntryInput, 'price'> & {
5492
+ createdAt?: string;
5493
+ updatedAt?: string;
5494
+ prices: (SupplierQuoteBookPriceInput & {
5495
+ id: string;
5496
+ unitCost: number;
5497
+ currency: string;
5498
+ priceEffectiveFrom: string;
5499
+ priceSetBy?: string | null;
5500
+ lastUploadId?: string | null;
5501
+ createdAt?: string;
5502
+ updatedAt?: string;
5503
+ })[];
5504
+ })[];
5505
+ uploads?: {
5506
+ id: string;
5507
+ fileName?: string | null;
5508
+ rowsTotal: number;
5509
+ rowsCreated: number;
5510
+ rowsUpdated: number;
5511
+ rowsErrored: number;
5512
+ uploadedBy?: string | null;
5513
+ uploadedAt?: string;
5514
+ }[];
5515
+ history?: (Omit<SupplierQuoteBookHistoryEntry, 'effectiveFrom' | 'changedBy' | 'uploadId'> & {
5516
+ effectiveFrom?: string | null;
5517
+ changedBy?: string | null;
5518
+ uploadId?: string | null;
5519
+ })[];
5520
+ }
5521
+ export interface SupplierQuoteBookMigrateResult {
5522
+ uploads: number;
5523
+ entries: number;
5524
+ prices: number;
5525
+ history: number;
5526
+ }
5218
5527
  //# sourceMappingURL=types.d.ts.map