@campfire-interactive/master-data-client 5.19.0 → 5.22.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.
@@ -2,9 +2,9 @@ import { HttpTransport } from './http';
2
2
  import type { TenantProgram, ListTenantProgramsOptions, GetTenantProgramOptions, CreateTenantProgramInput, UpdateTenantProgramInput, TenantProgramFinishedGood, AddTenantProgramFinishedGoodsInput, UpdateTenantProgramFinishedGoodInput, TenantProgramFinishedGoodHolder, AvailableAwardedLine, ListAvailableAwardedLinesOptions, AuditLogEntry, SingleResponse, ListResponse, CreateResponse } from './types';
3
3
  /**
4
4
  * The tenant's own programs ("Campfire Programs") at /v1/tenant-programs.
5
- * `client.programs` is the LEGACY program and is unchanged; these take the
6
- * plain name once legacy is gone (nextgen plan
7
- * 2026-10-08-tenant-programs-pm-first.md).
5
+ * Every legacy program became one of these under its own id; the legacy
6
+ * `client.programs` was removed in 5.19.0 (nextgen plan
7
+ * 2026-10-09-legacy-program-swap.md).
8
8
  */
9
9
  export declare class TenantProgramResource {
10
10
  private readonly http;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TenantProgramResource = void 0;
4
4
  /**
5
5
  * The tenant's own programs ("Campfire Programs") at /v1/tenant-programs.
6
- * `client.programs` is the LEGACY program and is unchanged; these take the
7
- * plain name once legacy is gone (nextgen plan
8
- * 2026-10-08-tenant-programs-pm-first.md).
6
+ * Every legacy program became one of these under its own id; the legacy
7
+ * `client.programs` was removed in 5.19.0 (nextgen plan
8
+ * 2026-10-09-legacy-program-swap.md).
9
9
  */
10
10
  class TenantProgramResource {
11
11
  http;
package/dist/types.d.ts CHANGED
@@ -48,86 +48,6 @@ export interface Location {
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
50
  }
51
- /** LEGACY: the old program (master-data table `programs_legacy`), in practice
52
- * an OEM's vehicle program scoped to one customer. Unchanged on the wire for
53
- * the apps still on it; the tenant's own program is {@link TenantProgram}
54
- * (`client.tenantPrograms`). */
55
- export interface Program {
56
- id: string;
57
- tenantId: string;
58
- customerCompanyId: string;
59
- /** @deprecated Use customerCompanyId. Removed in the next major. Mirrors customerCompanyId during the additive-deprecate window. */
60
- oemCompanyId: string;
61
- name: string;
62
- code: string;
63
- description: string | null;
64
- sopDate: string | null;
65
- eopDate: string | null;
66
- status: 'active' | 'archived';
67
- quality: 'draft' | 'verified';
68
- createdBy: string;
69
- updatedBy: string;
70
- createdAt: string;
71
- updatedAt: string;
72
- /** The scope dimensions this program belongs to. Null means NOT SET, which is
73
- * legal and is where every record starts — resolve the id through
74
- * `geographicScopes` / `productScopes`, and label the field with the
75
- * tenant's alias from `scopeDimensionSettings`, never "Region". */
76
- geographicScopeId: string | null;
77
- productScopeId: string | null;
78
- customerCompany?: Company;
79
- /** @deprecated Use customerCompany. Removed in the next major. Mirrors customerCompany. */
80
- oemCompany?: Company;
81
- }
82
- export interface CreateProgramInput {
83
- customerCompanyId?: string;
84
- /** @deprecated Use customerCompanyId. Removed in the next major. Server rejects when both are set to differing values. */
85
- oemCompanyId?: string;
86
- name: string;
87
- code: string;
88
- description?: string;
89
- sopDate?: string;
90
- eopDate?: string;
91
- /** Must name an ACTIVE scope in this tenant, or the server 400s naming the
92
- * field. Omit (or send null) to leave it unset. */
93
- geographicScopeId?: string | null;
94
- productScopeId?: string | null;
95
- }
96
- export interface UpdateProgramInput {
97
- name?: string;
98
- code?: string;
99
- description?: string;
100
- sopDate?: string | null;
101
- eopDate?: string | null;
102
- quality?: 'draft' | 'verified';
103
- /** Set, change, or clear with null. Must name an ACTIVE scope. */
104
- geographicScopeId?: string | null;
105
- productScopeId?: string | null;
106
- }
107
- export interface ListProgramsOptions {
108
- limit?: number;
109
- cursor?: string;
110
- sort?: string;
111
- q?: string;
112
- status?: 'active' | 'archived' | 'all';
113
- quality?: 'draft' | 'verified';
114
- customerCompanyId?: string;
115
- /** @deprecated Use customerCompanyId. Removed in the next major. */
116
- oemCompanyId?: string;
117
- /** Batch-get a specific set of programs by id — returns them regardless of
118
- * status. Comma-joined server-side; cap ~100/call for URL length and chunk
119
- * larger sets. The server bumps the page size to cover the ids. */
120
- ids?: string[];
121
- include?: ('customerCompany' | 'oemCompany')[];
122
- /** Filter to one scope, or pass `'none'` for programs with NO scope set —
123
- * the bucket every tenant starts in, and how you ask "what still needs a
124
- * scope?". */
125
- geographicScopeId?: string;
126
- productScopeId?: string;
127
- }
128
- export interface GetProgramOptions {
129
- include?: ('customerCompany' | 'oemCompany')[];
130
- }
131
51
  export interface TenantProgram {
132
52
  id: string;
133
53
  tenantId: string;
@@ -151,6 +71,10 @@ export interface TenantProgram {
151
71
  createdAt: string;
152
72
  updatedAt: string;
153
73
  }
74
+ /** A quote's program as `include=program` embeds it: the tenant program's own
75
+ * fields, without the derived customers or the attribute values, which
76
+ * `client.tenantPrograms.get` serves. */
77
+ export type QuoteProgram = Pick<TenantProgram, 'id' | 'tenantId' | 'code' | 'name' | 'description' | 'status' | 'geographicScopeId' | 'productScopeId' | 'createdBy' | 'updatedBy' | 'createdAt' | 'updatedAt'>;
154
78
  export interface ListTenantProgramsOptions {
155
79
  limit?: number;
156
80
  cursor?: string;
@@ -497,7 +421,8 @@ export interface Quote {
497
421
  createdAt: string;
498
422
  updatedAt: string;
499
423
  customerCompany?: Company;
500
- program?: Program;
424
+ /** The quote's tenant program, present when the read includes `program`. */
425
+ program?: QuoteProgram | null;
501
426
  /** Expanded region — present only when the read includes the relation. */
502
427
  region?: Region;
503
428
  }
@@ -1352,7 +1277,7 @@ export interface PlantMatchBatchInput {
1352
1277
  limit?: number;
1353
1278
  }
1354
1279
  /** Parallel arrays — `data[i]` is the matches for `queries[i]`. Failed
1355
- * per-query lookups surface as empty arrays (mirrors Program match batch). */
1280
+ * per-query lookups surface as empty arrays. */
1356
1281
  export interface PlantMatchBatchResponse {
1357
1282
  data: PlantMatch[][];
1358
1283
  meta: ApiMeta;
@@ -3140,8 +3065,9 @@ export interface AttributeDefinitionImportRow {
3140
3065
  dataType: string;
3141
3066
  group: string | null;
3142
3067
  valueCount: number;
3143
- /** ready / error before a commit; created / failed after one. */
3144
- status: 'ready' | 'error' | 'created' | 'failed';
3068
+ /** ready / error / skipped before a commit; created / failed (or still skipped) after one.
3069
+ * `skipped`: the key already exists in the registry, so the row is left alone (since 5.21.0). */
3070
+ status: 'ready' | 'error' | 'skipped' | 'created' | 'failed';
3145
3071
  errors: string[];
3146
3072
  warnings: string[];
3147
3073
  }
@@ -3160,6 +3086,7 @@ export interface AttributeDefinitionImportReport {
3160
3086
  total: number;
3161
3087
  ready: number;
3162
3088
  errors: number;
3089
+ skipped: number;
3163
3090
  created: number;
3164
3091
  failed: number;
3165
3092
  };
@@ -3904,51 +3831,6 @@ export interface MatchBatchResponse {
3904
3831
  data: Record<string, CompanyMatch[]>;
3905
3832
  meta: ApiMeta;
3906
3833
  }
3907
- /** Discriminates the high-confidence (exact (tenantId, customerCompanyId,
3908
- * code) match) from the fuzzy pg_trgm-on-name match. Callers can auto-resolve
3909
- * `exact_code` without re-scoring; `trgm_name` typically requires operator
3910
- * confirmation. */
3911
- export type ProgramMatchType = 'exact_code' | 'trgm_name';
3912
- export interface ProgramMatch {
3913
- id: string;
3914
- name: string;
3915
- code: string;
3916
- customerCompanyId: string;
3917
- /** @deprecated Use customerCompanyId. Removed in the next major. Mirrors customerCompanyId. */
3918
- oemCompanyId?: string;
3919
- /** 1.0 for exact-code match; pg_trgm similarity in (threshold..1] otherwise. */
3920
- score: number;
3921
- matchType: ProgramMatchType;
3922
- }
3923
- export interface ProgramMatchQuery {
3924
- name: string;
3925
- customerCompanyId?: string;
3926
- /** @deprecated Use customerCompanyId. Removed in the next major. Server rejects when both are set to differing values. */
3927
- oemCompanyId?: string;
3928
- /** When present, an exact match on (tenantId, customerCompanyId, code) is
3929
- * unioned at score=1.0 ahead of fuzzy matches. */
3930
- code?: string;
3931
- }
3932
- export interface ProgramMatchByNameInput extends ProgramMatchQuery {
3933
- /** Similarity floor, 0.05..0.95 (clamped server-side). Default 0.3. */
3934
- threshold?: number;
3935
- /** Max trgm matches returned, 1..25 (clamped). Default 5. An exact-code
3936
- * hit is returned in addition to the trgm matches. */
3937
- limit?: number;
3938
- }
3939
- export interface ProgramMatchBatchInput {
3940
- /** Non-empty; max 500 queries per request. */
3941
- queries: ProgramMatchQuery[];
3942
- threshold?: number;
3943
- limit?: number;
3944
- }
3945
- /** Response shape for the batch endpoint — parallel arrays. `data[i]` is
3946
- * the matches for `queries[i]`. Failed queries surface as empty arrays
3947
- * (per-query failures don't fail the batch, mirroring Company match). */
3948
- export interface ProgramMatchBatchResponse {
3949
- data: ProgramMatch[][];
3950
- meta: ApiMeta;
3951
- }
3952
3834
  export interface ListLocationsOptions {
3953
3835
  type?: LocationType;
3954
3836
  }
@@ -4119,102 +4001,6 @@ export interface UpdateScopeDimensionSettingInput {
4119
4001
  labelPlural?: string;
4120
4002
  enabled?: boolean;
4121
4003
  }
4122
- /** The five sources a stored value can name. */
4123
- export type StandardAttributeSource = 'customer_rfq' | 'volume_intelligence' | 'master_data' | 'prior_quote' | 'user';
4124
- export interface StandardAttribute {
4125
- id: string;
4126
- /** Immutable. The cross-tenant reporting key every stored value references. */
4127
- key: string;
4128
- label: string;
4129
- position: number;
4130
- /** 'string' | 'date' — matches VI's dimension catalog vocabulary. */
4131
- dataType: string;
4132
- /** The VI dimension this resolves through, when it has one. */
4133
- viCatalogKey: string | null;
4134
- /** Whether THIS TENANT tracks it. Distinct from the platform lifecycle below. */
4135
- enabled: boolean;
4136
- status: 'active' | 'archived';
4137
- createdAt: string;
4138
- updatedAt: string;
4139
- }
4140
- /**
4141
- * The PLATFORM-wide catalog row a tenant's copy is seeded from.
4142
- *
4143
- * No `enabled` and no `status`: those are a tenant's answer about a tenant's
4144
- * copy. The default is simply the definition.
4145
- */
4146
- export interface StandardAttributeDefault {
4147
- id: string;
4148
- /** Immutable, and the key every tenant copy and stored value carries. */
4149
- key: string;
4150
- label: string;
4151
- position: number;
4152
- dataType: string;
4153
- viCatalogKey: string | null;
4154
- createdAt: string;
4155
- updatedAt: string;
4156
- }
4157
- /** Creating one. `key` is an identifier: lower snake_case, immutable after
4158
- * create, and what every stored value references. */
4159
- export interface CreateStandardAttributeInput {
4160
- key: string;
4161
- label: string;
4162
- position?: number;
4163
- dataType?: string;
4164
- viCatalogKey?: string | null;
4165
- }
4166
- /** Same shape for the platform catalog. */
4167
- export type CreateStandardAttributeDefaultInput = CreateStandardAttributeInput;
4168
- /** Label and position only. The catalog is code-seeded, so there is no create,
4169
- * no delete, and `key` is immutable. */
4170
- export interface UpdateStandardAttributeDefaultInput {
4171
- label?: string;
4172
- position?: number;
4173
- }
4174
- /** `key` is absent by design — it is immutable after create. */
4175
- export interface UpdateStandardAttributeInput {
4176
- label?: string;
4177
- position?: number;
4178
- enabled?: boolean;
4179
- status?: 'active' | 'archived';
4180
- }
4181
- export interface StandardAttributeValue {
4182
- key: string;
4183
- value: string;
4184
- /** Which system supplied it. */
4185
- source: StandardAttributeSource;
4186
- /** Why this value — free text, e.g. "Prior quote Q-2026-118". */
4187
- sourceDetail: string | null;
4188
- setAt: string;
4189
- setBy: string;
4190
- }
4191
- export interface SetStandardAttributeValueInput {
4192
- key: string;
4193
- value: string;
4194
- source: StandardAttributeSource;
4195
- sourceDetail?: string | null;
4196
- /**
4197
- * Leave an existing value alone. The enrichment pass sets this; a person
4198
- * editing the card does not.
4199
- */
4200
- onlyIfBlank?: boolean;
4201
- }
4202
- export interface SetStandardAttributeValueResult {
4203
- key: string;
4204
- written: boolean;
4205
- skipped?: 'already-set';
4206
- }
4207
- export interface StandardAttributeHistoryEntry {
4208
- id: string;
4209
- quoteId: string;
4210
- key: string;
4211
- /** NULL on the first write — no previous value, which is not an empty one. */
4212
- oldValue: string | null;
4213
- newValue: string;
4214
- source: StandardAttributeSource;
4215
- changedAt: string;
4216
- changedBy: string;
4217
- }
4218
4004
  /** The settings a call resolves to. Never partial - every field has a value. */
4219
4005
  export interface AiLlmSettings {
4220
4006
  provider: string;