@epilot/pricing-client 3.54.3 → 3.55.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/openapi.d.ts CHANGED
@@ -1638,6 +1638,16 @@ declare namespace Components {
1638
1638
  * The cashback period, for now it's limited to either 0 months or 12 months
1639
1639
  */
1640
1640
  export type CashbackPeriod = "0" | "12";
1641
+ /**
1642
+ * List of entity fields to include or exclude from the results.
1643
+ *
1644
+ * example:
1645
+ * [
1646
+ * "!_files",
1647
+ * "!**.versions"
1648
+ * ]
1649
+ */
1650
+ export type CatalogFieldsParam = string[];
1641
1651
  /**
1642
1652
  * A catalog search payload
1643
1653
  * example:
@@ -1669,6 +1679,16 @@ declare namespace Components {
1669
1679
  * When true, enables entity hydration to resolve nested $relation references in-place.
1670
1680
  */
1671
1681
  hydrate?: boolean;
1682
+ fields?: /**
1683
+ * List of entity fields to include or exclude from the results.
1684
+ *
1685
+ * example:
1686
+ * [
1687
+ * "!_files",
1688
+ * "!**.versions"
1689
+ * ]
1690
+ */
1691
+ CatalogFieldsParam;
1672
1692
  availability?: /* Availability filters dimensions */ AvailabilityFilters;
1673
1693
  }
1674
1694
  /**
@@ -4094,6 +4114,84 @@ declare namespace Components {
4094
4114
  export interface ComputedPriceComponents {
4095
4115
  [name: string]: /* The computed price */ ComputedBasePrice;
4096
4116
  }
4117
+ /**
4118
+ * An error from a conditional-pricing operation, carrying a machine-readable `code`
4119
+ * from the conditional-pricing vocabulary plus any structured data about the failure,
4120
+ * so a client can branch on the kind of failure rather than parse the message.
4121
+ * Referenced only by the operations that emit these codes; every other operation
4122
+ * keeps the plain `Error` shape.
4123
+ *
4124
+ */
4125
+ export interface ConditionalPricingError {
4126
+ /**
4127
+ * Error message
4128
+ */
4129
+ message: string;
4130
+ /**
4131
+ * The HTTP status code
4132
+ */
4133
+ status?: number;
4134
+ /**
4135
+ * The cause of the error (visible for bad requests - http 400)
4136
+ */
4137
+ cause?: string;
4138
+ /**
4139
+ * The error message. Carries the same string as `message`, which the shared `Error`
4140
+ * schema requires — `error` is the field responses have always used, and every caller
4141
+ * to date reads. Declared here rather than on the shared `Error` because a request
4142
+ * validation failure puts a list of validation errors in this field instead of a
4143
+ * string, and those responses reference `Error` directly.
4144
+ *
4145
+ */
4146
+ error?: string;
4147
+ code?: /**
4148
+ * Machine-readable failure mode of a conditional-pricing operation, allowing clients
4149
+ * to branch on the kind of failure instead of parsing the error message.
4150
+ *
4151
+ * - `NOT_FOUND` (404): the addressed entity, variant or version does not exist
4152
+ * - `AMBIGUOUS_RESOLUTION` (409): several variants match the given context while a single result was requested
4153
+ * - `TUPLE_CONFLICT` (409): the condition tuple is already claimed by another variant
4154
+ * - `VERSION_CONFLICT` (409): a version already exists at the given `valid_from` on that variant
4155
+ * - `SUPERSEDED_VERSION` (409): the addressed version has been superseded
4156
+ * - `CONDITION_UNDEFINED` (400): the context names a condition the entity's schema does not define
4157
+ * - `OPERATOR_UNSUPPORTED` (400): the requested operator is not applicable to the condition's type
4158
+ * - `CONTEXT_FORMAT_INVALID` (400): a context value is malformed for its condition type
4159
+ * - `TOO_MANY_MATCHES` (400): a multi-match resolve exceeded its result cap
4160
+ * - `WRITE_CONFLICT` (409): transient write contention, retryable unlike `TUPLE_CONFLICT`
4161
+ *
4162
+ * Each code is emitted with the HTTP status shown above, and only with that status.
4163
+ *
4164
+ */
4165
+ ConditionalPricingErrorCode;
4166
+ /**
4167
+ * Structured data about the failure, shaped by the accompanying `code`
4168
+ * (e.g. the candidate variants of an `ambiguous-resolution`). Only present
4169
+ * when the failure has structured data to report, and never without a `code`.
4170
+ *
4171
+ */
4172
+ details?: {
4173
+ [name: string]: any;
4174
+ };
4175
+ }
4176
+ /**
4177
+ * Machine-readable failure mode of a conditional-pricing operation, allowing clients
4178
+ * to branch on the kind of failure instead of parsing the error message.
4179
+ *
4180
+ * - `NOT_FOUND` (404): the addressed entity, variant or version does not exist
4181
+ * - `AMBIGUOUS_RESOLUTION` (409): several variants match the given context while a single result was requested
4182
+ * - `TUPLE_CONFLICT` (409): the condition tuple is already claimed by another variant
4183
+ * - `VERSION_CONFLICT` (409): a version already exists at the given `valid_from` on that variant
4184
+ * - `SUPERSEDED_VERSION` (409): the addressed version has been superseded
4185
+ * - `CONDITION_UNDEFINED` (400): the context names a condition the entity's schema does not define
4186
+ * - `OPERATOR_UNSUPPORTED` (400): the requested operator is not applicable to the condition's type
4187
+ * - `CONTEXT_FORMAT_INVALID` (400): a context value is malformed for its condition type
4188
+ * - `TOO_MANY_MATCHES` (400): a multi-match resolve exceeded its result cap
4189
+ * - `WRITE_CONFLICT` (409): transient write contention, retryable unlike `TUPLE_CONFLICT`
4190
+ *
4191
+ * Each code is emitted with the HTTP status shown above, and only with that status.
4192
+ *
4193
+ */
4194
+ export type ConditionalPricingErrorCode = "NOT_FOUND" | "AMBIGUOUS_RESOLUTION" | "TUPLE_CONFLICT" | "VERSION_CONFLICT" | "SUPERSEDED_VERSION" | "CONDITION_UNDEFINED" | "OPERATOR_UNSUPPORTED" | "CONTEXT_FORMAT_INVALID" | "TOO_MANY_MATCHES" | "WRITE_CONFLICT";
4097
4195
  export type ConsumptionTypeGetAg = "household" | "heating_pump" | "night_storage_heating" | "night_storage_heating_common_meter";
4098
4196
  /**
4099
4197
  * The coupon entity
@@ -9760,13 +9858,50 @@ declare namespace Components {
9760
9858
  * "_updated_at": "2021-02-09T12:41:43.662Z"
9761
9859
  * }
9762
9860
  */
9763
- Tax;
9861
+ Tax | /**
9862
+ * A minimal, ad-hoc tax rate for line items with no backing tax entity
9863
+ * in the catalog (e.g. a fully custom/composite price component built
9864
+ * by a client with no product/price reference to resolve tax from).
9865
+ * Mirrors how PriceItem relates to Price: unlike Tax, this has no
9866
+ * entity identity — it isn't persisted and can't be looked up by _id,
9867
+ * so it can't be shared/reused across price items the way a catalog
9868
+ * Tax can.
9869
+ *
9870
+ * example:
9871
+ * {
9872
+ * "rate": 19,
9873
+ * "type": "VAT",
9874
+ * "description": "Custom 19% VAT"
9875
+ * }
9876
+ */
9877
+ TaxItem;
9764
9878
  }
9765
9879
  export interface TaxBreakdownInfo {
9766
9880
  rate?: number | null;
9767
9881
  type?: "VAT" | "GST" | "Custom";
9768
9882
  _id?: string;
9769
9883
  }
9884
+ /**
9885
+ * A minimal, ad-hoc tax rate for line items with no backing tax entity
9886
+ * in the catalog (e.g. a fully custom/composite price component built
9887
+ * by a client with no product/price reference to resolve tax from).
9888
+ * Mirrors how PriceItem relates to Price: unlike Tax, this has no
9889
+ * entity identity — it isn't persisted and can't be looked up by _id,
9890
+ * so it can't be shared/reused across price items the way a catalog
9891
+ * Tax can.
9892
+ *
9893
+ * example:
9894
+ * {
9895
+ * "rate": 19,
9896
+ * "type": "VAT",
9897
+ * "description": "Custom 19% VAT"
9898
+ * }
9899
+ */
9900
+ export interface TaxItem {
9901
+ type: "VAT" | "GST" | "Custom";
9902
+ rate: number | null;
9903
+ description?: string;
9904
+ }
9770
9905
  export interface TierDetails {
9771
9906
  quantity: number;
9772
9907
  unit_amount: number;
@@ -12000,6 +12135,7 @@ export type CartDto = Components.Schemas.CartDto;
12000
12135
  export type CashbackAmount = Components.Schemas.CashbackAmount;
12001
12136
  export type CashbackAmounts = Components.Schemas.CashbackAmounts;
12002
12137
  export type CashbackPeriod = Components.Schemas.CashbackPeriod;
12138
+ export type CatalogFieldsParam = Components.Schemas.CatalogFieldsParam;
12003
12139
  export type CatalogSearch = Components.Schemas.CatalogSearch;
12004
12140
  export type CatalogSearchResult = Components.Schemas.CatalogSearchResult;
12005
12141
  export type CheckoutCart = Components.Schemas.CheckoutCart;
@@ -12016,6 +12152,8 @@ export type ComputePriceResult = Components.Schemas.ComputePriceResult;
12016
12152
  export type ComputedBasePrice = Components.Schemas.ComputedBasePrice;
12017
12153
  export type ComputedPriceBreakdown = Components.Schemas.ComputedPriceBreakdown;
12018
12154
  export type ComputedPriceComponents = Components.Schemas.ComputedPriceComponents;
12155
+ export type ConditionalPricingError = Components.Schemas.ConditionalPricingError;
12156
+ export type ConditionalPricingErrorCode = Components.Schemas.ConditionalPricingErrorCode;
12019
12157
  export type ConsumptionTypeGetAg = Components.Schemas.ConsumptionTypeGetAg;
12020
12158
  export type Coupon = Components.Schemas.Coupon;
12021
12159
  export type CouponItem = Components.Schemas.CouponItem;
@@ -12120,6 +12258,7 @@ export type TaxAmount = Components.Schemas.TaxAmount;
12120
12258
  export type TaxAmountBreakdown = Components.Schemas.TaxAmountBreakdown;
12121
12259
  export type TaxAmountDto = Components.Schemas.TaxAmountDto;
12122
12260
  export type TaxBreakdownInfo = Components.Schemas.TaxBreakdownInfo;
12261
+ export type TaxItem = Components.Schemas.TaxItem;
12123
12262
  export type TierDetails = Components.Schemas.TierDetails;
12124
12263
  export type TotalDetails = Components.Schemas.TotalDetails;
12125
12264
  export type TypeGetAg = Components.Schemas.TypeGetAg;
package/dist/openapi.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Pricing API",
5
5
  "description": "The `pricing-api` hub sets the foundations for the following Pricing APIs:\n\n### Order API\nThis api enables the management of orders in epilot 360, providing features such as:\n - Automatic calculation of totals and price breakdowns for taxes on the Order entity\n - Product and pricing data validation\n\n### Shopping Cart API\nUsed to interact with a cart during a customer's checkout session, providing:\n - An unified data model to model a Shopping Cart\n - Product and pricing data validation\n - Checkout a cart into an order or quote\n\n### Catalog API\nProvides a way to query the entire catalog of products and prices.\n\n### Availability API\nProvides endpoints for querying products availability by a set of predefined dimensions.\n\n### Spot Market API\nProvides endpoints to fetch (historic) spot market price data.\n\n### External Integrations API\nProvides endpoints for external integrations. E.g. GetAG.\n\n### External Catalog API\nProvides endpoints for external catalog.\n\n### Product Recommendations API\nProvides endpoints for product recommendations.\n",
6
- "version": "1.1.0",
6
+ "version": "1.2.0",
7
7
  "termsOfService": "https://epilot.cloud/agb",
8
8
  "contact": {
9
9
  "name": "Support",
@@ -3430,6 +3430,22 @@
3430
3430
  "external-catalog"
3431
3431
  ]
3432
3432
  },
3433
+ "ConditionalPricingErrorCode": {
3434
+ "type": "string",
3435
+ "description": "Machine-readable failure mode of a conditional-pricing operation, allowing clients\nto branch on the kind of failure instead of parsing the error message.\n\n- `NOT_FOUND` (404): the addressed entity, variant or version does not exist\n- `AMBIGUOUS_RESOLUTION` (409): several variants match the given context while a single result was requested\n- `TUPLE_CONFLICT` (409): the condition tuple is already claimed by another variant\n- `VERSION_CONFLICT` (409): a version already exists at the given `valid_from` on that variant\n- `SUPERSEDED_VERSION` (409): the addressed version has been superseded\n- `CONDITION_UNDEFINED` (400): the context names a condition the entity's schema does not define\n- `OPERATOR_UNSUPPORTED` (400): the requested operator is not applicable to the condition's type\n- `CONTEXT_FORMAT_INVALID` (400): a context value is malformed for its condition type\n- `TOO_MANY_MATCHES` (400): a multi-match resolve exceeded its result cap\n- `WRITE_CONFLICT` (409): transient write contention, retryable unlike `TUPLE_CONFLICT`\n\nEach code is emitted with the HTTP status shown above, and only with that status.\n",
3436
+ "enum": [
3437
+ "NOT_FOUND",
3438
+ "AMBIGUOUS_RESOLUTION",
3439
+ "TUPLE_CONFLICT",
3440
+ "VERSION_CONFLICT",
3441
+ "SUPERSEDED_VERSION",
3442
+ "CONDITION_UNDEFINED",
3443
+ "OPERATOR_UNSUPPORTED",
3444
+ "CONTEXT_FORMAT_INVALID",
3445
+ "TOO_MANY_MATCHES",
3446
+ "WRITE_CONFLICT"
3447
+ ]
3448
+ },
3433
3449
  "Error": {
3434
3450
  "required": [
3435
3451
  "message"
@@ -3449,6 +3465,31 @@
3449
3465
  }
3450
3466
  }
3451
3467
  },
3468
+ "ConditionalPricingError": {
3469
+ "description": "An error from a conditional-pricing operation, carrying a machine-readable `code`\nfrom the conditional-pricing vocabulary plus any structured data about the failure,\nso a client can branch on the kind of failure rather than parse the message.\nReferenced only by the operations that emit these codes; every other operation\nkeeps the plain `Error` shape.\n",
3470
+ "allOf": [
3471
+ {
3472
+ "$ref": "#/components/schemas/Error"
3473
+ },
3474
+ {
3475
+ "type": "object",
3476
+ "properties": {
3477
+ "error": {
3478
+ "type": "string",
3479
+ "description": "The error message. Carries the same string as `message`, which the shared `Error`\nschema requires — `error` is the field responses have always used, and every caller\nto date reads. Declared here rather than on the shared `Error` because a request\nvalidation failure puts a list of validation errors in this field instead of a\nstring, and those responses reference `Error` directly.\n"
3480
+ },
3481
+ "code": {
3482
+ "$ref": "#/components/schemas/ConditionalPricingErrorCode"
3483
+ },
3484
+ "details": {
3485
+ "type": "object",
3486
+ "additionalProperties": true,
3487
+ "description": "Structured data about the failure, shaped by the accompanying `code`\n(e.g. the candidate variants of an `ambiguous-resolution`). Only present\nwhen the failure has structured data to report, and never without a `code`.\n"
3488
+ }
3489
+ }
3490
+ }
3491
+ ]
3492
+ },
3452
3493
  "Product": {
3453
3494
  "type": "object",
3454
3495
  "description": "The product entity",
@@ -5569,6 +5610,9 @@
5569
5610
  "description": "When true, enables entity hydration to resolve nested $relation references in-place.",
5570
5611
  "default": false
5571
5612
  },
5613
+ "fields": {
5614
+ "$ref": "#/components/schemas/CatalogFieldsParam"
5615
+ },
5572
5616
  "availability": {
5573
5617
  "$ref": "#/components/schemas/AvailabilityFilters"
5574
5618
  }
@@ -5583,6 +5627,17 @@
5583
5627
  "q"
5584
5628
  ]
5585
5629
  },
5630
+ "CatalogFieldsParam": {
5631
+ "type": "array",
5632
+ "description": "List of entity fields to include or exclude from the results.\n",
5633
+ "items": {
5634
+ "type": "string"
5635
+ },
5636
+ "example": [
5637
+ "!_files",
5638
+ "!**.versions"
5639
+ ]
5640
+ },
5586
5641
  "CatalogSearchResult": {
5587
5642
  "description": "The query result payload",
5588
5643
  "type": "object",
@@ -6953,7 +7008,14 @@
6953
7008
  "description": "The deprecated tax rate applied.\nThis field has been deprecated in favor of the new Tax Management. You should use the new tax fields pointing to a proper tax entity.\n"
6954
7009
  },
6955
7010
  "tax": {
6956
- "$ref": "#/components/schemas/Tax"
7011
+ "oneOf": [
7012
+ {
7013
+ "$ref": "#/components/schemas/Tax"
7014
+ },
7015
+ {
7016
+ "$ref": "#/components/schemas/TaxItem"
7017
+ }
7018
+ ]
6957
7019
  }
6958
7020
  }
6959
7021
  },
@@ -8429,6 +8491,37 @@
8429
8491
  "_updated_at": "2021-02-09T12:41:43.662Z"
8430
8492
  }
8431
8493
  },
8494
+ "TaxItem": {
8495
+ "type": "object",
8496
+ "description": "A minimal, ad-hoc tax rate for line items with no backing tax entity\nin the catalog (e.g. a fully custom/composite price component built\nby a client with no product/price reference to resolve tax from).\nMirrors how PriceItem relates to Price: unlike Tax, this has no\nentity identity — it isn't persisted and can't be looked up by _id,\nso it can't be shared/reused across price items the way a catalog\nTax can.\n",
8497
+ "additionalProperties": false,
8498
+ "required": [
8499
+ "type",
8500
+ "rate"
8501
+ ],
8502
+ "properties": {
8503
+ "type": {
8504
+ "type": "string",
8505
+ "enum": [
8506
+ "VAT",
8507
+ "GST",
8508
+ "Custom"
8509
+ ]
8510
+ },
8511
+ "rate": {
8512
+ "type": "number",
8513
+ "nullable": true
8514
+ },
8515
+ "description": {
8516
+ "type": "string"
8517
+ }
8518
+ },
8519
+ "example": {
8520
+ "rate": 19,
8521
+ "type": "VAT",
8522
+ "description": "Custom 19% VAT"
8523
+ }
8524
+ },
8432
8525
  "TaxBreakdownInfo": {
8433
8526
  "type": "object",
8434
8527
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/pricing-client",
3
- "version": "3.54.3",
3
+ "version": "3.55.0",
4
4
  "description": "Client for epilot Pricing APIs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,6 +24,18 @@
24
24
  "cart",
25
25
  "pricing"
26
26
  ],
27
+ "scripts": {
28
+ "test": "vitest",
29
+ "bundle-definition": "webpack",
30
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/pricing-api.yaml",
31
+ "openapi:local": "node ../../scripts/update-openapi.js ../../../pricing-api/lambda/ApiHandlerFunction/openapi.yml",
32
+ "typegen": "openapi typegen src/openapi.json --client > src/openapi.d.ts",
33
+ "build": "tsc && npm run build:patch && npm run bundle-definition",
34
+ "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
35
+ "build:watch": "npm run build && tsc -w",
36
+ "prepublishOnly": "npm run typegen && npm run build",
37
+ "lint": "biome check src"
38
+ },
27
39
  "files": [
28
40
  "*.js",
29
41
  "*.d.ts",
@@ -60,16 +72,5 @@
60
72
  "webpack": "^5.18.0",
61
73
  "webpack-cli": "^4.4.0"
62
74
  },
63
- "gitHead": "39426e86cfb320fa3227dc03f60ee6a10848e7c7",
64
- "scripts": {
65
- "test": "vitest",
66
- "bundle-definition": "webpack",
67
- "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/pricing-api.yaml",
68
- "openapi:local": "node ../../scripts/update-openapi.js ../../../pricing-api/lambda/ApiHandlerFunction/openapi.yml",
69
- "typegen": "openapi typegen src/openapi.json --client > src/openapi.d.ts",
70
- "build": "tsc && npm run build:patch && npm run bundle-definition",
71
- "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
72
- "build:watch": "npm run build && tsc -w",
73
- "lint": "biome check src"
74
- }
75
- }
75
+ "gitHead": "39426e86cfb320fa3227dc03f60ee6a10848e7c7"
76
+ }