diff --git a/gen/openapi.json b/gen/openapi.json index b94e9d8a..41a44b0c 100644 --- a/gen/openapi.json +++ b/gen/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "Commerce Layer API", - "version": "7.3.1", + "version": "7.4.0", "contact": { "name": "API Support", "url": "https://commercelayer.io", @@ -15770,6 +15770,33 @@ } } }, + "/markets/{marketId}/stores": { + "get": { + "operationId": "GET/marketId/stores", + "summary": "Retrieve the stores associated to the market", + "description": "Retrieve the stores associated to the market", + "tags": [ + "has_many", + "stores" + ], + "parameters": [ + { + "name": "marketId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The stores associated to the market" + } + } + } + }, "/markets/{marketId}/price_list_schedulers": { "get": { "operationId": "GET/marketId/price_list_schedulers", @@ -17589,6 +17616,33 @@ } } }, + "/orders/{orderId}/store": { + "get": { + "operationId": "GET/orderId/store", + "summary": "Retrieve the store associated to the order", + "description": "Retrieve the store associated to the order", + "tags": [ + "has_one", + "stores" + ], + "parameters": [ + { + "name": "orderId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The store associated to the order" + } + } + } + }, "/orders/{orderId}/available_payment_methods": { "get": { "operationId": "GET/orderId/available_payment_methods", @@ -19482,6 +19536,33 @@ } } }, + "/payment_methods/{paymentMethodId}/store": { + "get": { + "operationId": "GET/paymentMethodId/store", + "summary": "Retrieve the store associated to the payment method", + "description": "Retrieve the store associated to the payment method", + "tags": [ + "has_one", + "stores" + ], + "parameters": [ + { + "name": "paymentMethodId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The store associated to the payment method" + } + } + } + }, "/payment_methods/{paymentMethodId}/attachments": { "get": { "operationId": "GET/paymentMethodId/attachments", @@ -29007,6 +29088,33 @@ } } }, + "/stock_locations/{stockLocationId}/stores": { + "get": { + "operationId": "GET/stockLocationId/stores", + "summary": "Retrieve the stores associated to the stock location", + "description": "Retrieve the stores associated to the stock location", + "tags": [ + "has_many", + "stores" + ], + "parameters": [ + { + "name": "stockLocationId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The stores associated to the stock location" + } + } + } + }, "/stock_locations/{stockLocationId}/attachments": { "get": { "operationId": "GET/stockLocationId/attachments", @@ -29793,6 +29901,345 @@ } } }, + "/stores": { + "get": { + "operationId": "GET/stores", + "summary": "List all stores", + "description": "List all stores", + "tags": [ + "stores" + ], + "responses": { + "200": { + "description": "A list of store objects", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeResponseList" + } + } + } + } + } + }, + "post": { + "operationId": "POST/stores", + "summary": "Create a store", + "description": "Create a store", + "tags": [ + "stores" + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeCreate" + } + } + } + }, + "responses": { + "201": { + "description": "The created store object", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeResponse" + } + } + } + } + } + } + }, + "/stores/{storeId}": { + "get": { + "operationId": "GET/stores/storeId", + "summary": "Retrieve a store", + "description": "Retrieve a store", + "tags": [ + "stores" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The store object", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeResponse" + } + } + } + } + } + }, + "patch": { + "operationId": "PATCH/stores/storeId", + "summary": "Update a store", + "description": "Update a store", + "tags": [ + "stores" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "The updated store object", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/storeResponse" + } + } + } + } + } + }, + "delete": { + "operationId": "DELETE/stores/storeId", + "summary": "Delete a store", + "description": "Delete a store", + "tags": [ + "stores" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "204": { + "description": "No content" + } + } + } + }, + "/stores/{storeId}/market": { + "get": { + "operationId": "GET/storeId/market", + "summary": "Retrieve the market associated to the store", + "description": "Retrieve the market associated to the store", + "tags": [ + "has_one", + "markets" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The market associated to the store" + } + } + } + }, + "/stores/{storeId}/merchant": { + "get": { + "operationId": "GET/storeId/merchant", + "summary": "Retrieve the merchant associated to the store", + "description": "Retrieve the merchant associated to the store", + "tags": [ + "has_one", + "merchants" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The merchant associated to the store" + } + } + } + }, + "/stores/{storeId}/stock_location": { + "get": { + "operationId": "GET/storeId/stock_location", + "summary": "Retrieve the stock location associated to the store", + "description": "Retrieve the stock location associated to the store", + "tags": [ + "has_one", + "stock_locations" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The stock_location associated to the store" + } + } + } + }, + "/stores/{storeId}/orders": { + "get": { + "operationId": "GET/storeId/orders", + "summary": "Retrieve the orders associated to the store", + "description": "Retrieve the orders associated to the store", + "tags": [ + "has_many", + "orders" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The orders associated to the store" + } + } + } + }, + "/stores/{storeId}/payment_methods": { + "get": { + "operationId": "GET/storeId/payment_methods", + "summary": "Retrieve the payment methods associated to the store", + "description": "Retrieve the payment methods associated to the store", + "tags": [ + "has_many", + "payment_methods" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The payment_methods associated to the store" + } + } + } + }, + "/stores/{storeId}/events": { + "get": { + "operationId": "GET/storeId/events", + "summary": "Retrieve the events associated to the store", + "description": "Retrieve the events associated to the store", + "tags": [ + "has_many", + "events" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The events associated to the store" + } + } + } + }, + "/stores/{storeId}/versions": { + "get": { + "operationId": "GET/storeId/versions", + "summary": "Retrieve the versions associated to the store", + "description": "Retrieve the versions associated to the store", + "tags": [ + "has_many", + "versions" + ], + "parameters": [ + { + "name": "storeId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The versions associated to the store" + } + } + } + }, "/stripe_gateways": { "get": { "operationId": "GET/stripe_gateways", @@ -72825,6 +73272,28 @@ } } }, + "stores": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "price_list_schedulers": { "type": "object", "properties": { @@ -73804,7 +74273,7 @@ } } }, - "price_list_schedulers": { + "stores": { "type": "object", "properties": { "links": { @@ -73827,7 +74296,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "price_list_schedulers" + "stores" ] }, "id": { @@ -73838,7 +74307,7 @@ } } }, - "attachments": { + "price_list_schedulers": { "type": "object", "properties": { "links": { @@ -73861,7 +74330,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "attachments" + "price_list_schedulers" ] }, "id": { @@ -73872,7 +74341,7 @@ } } }, - "versions": { + "attachments": { "type": "object", "properties": { "links": { @@ -73895,7 +74364,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "versions" + "attachments" ] }, "id": { @@ -73905,134 +74374,23 @@ } } } - } - } - } - } - } - } - }, - "marketResponseList": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/marketResponse/properties/data" - } - } - } - }, - "merchant": { - "type": "object", - "properties": { - "data": { - "type": "object", - "required": [ - "type", - "attributes" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "merchants" - ] - }, - "attributes": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The merchant's internal name.", - "example": "The Brand Inc.", - "nullable": false - }, - "created_at": { - "type": "string", - "description": "Time at which the resource was created.", - "example": "2018-01-01T12:00:00.000Z", - "nullable": false - }, - "updated_at": { - "type": "string", - "description": "Time at which the resource was last updated.", - "example": "2018-01-01T12:00:00.000Z", - "nullable": false - }, - "reference": { - "type": "string", - "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", - "example": "ANY-EXTERNAL-REFEFERNCE", - "nullable": true - }, - "reference_origin": { - "type": "string", - "description": "Any identifier of the third party system that defines the reference code.", - "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", - "nullable": true - }, - "metadata": { - "type": "object", - "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", - "example": { - "foo": "bar" - }, - "nullable": true - } - } - }, - "relationships": { - "type": "object", - "properties": { - "address": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "addresses" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } }, - "attachments": { + "versions": { "type": "object", "properties": { - "data": { + "links": { "type": "object", "properties": { - "type": { + "self": { "type": "string", - "description": "The resource's type", - "enum": [ - "attachments" - ] + "description": "URL" }, - "id": { + "related": { "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" + "description": "URL" } } - } - } - }, - "versions": { - "type": "object", - "properties": { + }, "data": { "type": "object", "properties": { @@ -74045,8 +74403,7 @@ }, "id": { "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" + "description": "The resource ID" } } } @@ -74058,104 +74415,24 @@ } } }, - "merchantCreate": { - "required": [ - "data" - ], + "marketResponseList": { "type": "object", "properties": { "data": { - "type": "object", - "required": [ - "type", - "attributes" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "merchants" - ] - }, - "attributes": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The merchant's internal name.", - "example": "The Brand Inc." - }, - "reference": { - "type": "string", - "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", - "example": "ANY-EXTERNAL-REFEFERNCE" - }, - "reference_origin": { - "type": "string", - "description": "Any identifier of the third party system that defines the reference code.", - "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" - }, - "metadata": { - "type": "object", - "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", - "example": { - "foo": "bar" - } - } - }, - "required": [ - "name" - ] - }, - "relationships": { - "type": "object", - "properties": { - "address": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "addresses" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - } - }, - "required": [ - "address" - ] - } + "type": "array", + "items": { + "$ref": "#/components/schemas/marketResponse/properties/data" } } } }, - "merchantUpdate": { - "required": [ - "data" - ], + "merchant": { "type": "object", "properties": { "data": { "type": "object", "required": [ "type", - "id", "attributes" ], "properties": { @@ -74166,11 +74443,237 @@ "merchants" ] }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The merchant's internal name.", + "example": "The Brand Inc.", + "nullable": false + }, + "created_at": { + "type": "string", + "description": "Time at which the resource was created.", + "example": "2018-01-01T12:00:00.000Z", + "nullable": false + }, + "updated_at": { + "type": "string", + "description": "Time at which the resource was last updated.", + "example": "2018-01-01T12:00:00.000Z", + "nullable": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE", + "nullable": true + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + }, + "nullable": true + } + } + }, + "relationships": { + "type": "object", + "properties": { + "address": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "addresses" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "attachments": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "attachments" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "versions": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "versions" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + } + } + }, + "merchantCreate": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "merchants" + ] + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The merchant's internal name.", + "example": "The Brand Inc." + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + }, + "required": [ + "name" + ] + }, + "relationships": { + "type": "object", + "properties": { + "address": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "addresses" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + }, + "required": [ + "address" + ] + } + } + } + } + }, + "merchantUpdate": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "merchants" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, "attributes": { "type": "object", "properties": { @@ -78719,6 +79222,28 @@ } } }, + "store": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "available_payment_methods": { "type": "object", "properties": { @@ -79683,6 +80208,31 @@ } } }, + "store": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "payment_method": { "required": [ "data" @@ -80248,6 +80798,31 @@ } } }, + "store": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "payment_method": { "required": [ "data" @@ -80539,6 +81114,40 @@ } } }, + "store": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "store" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, "available_payment_methods": { "type": "object", "properties": { @@ -81778,6 +82387,12 @@ "example": false, "nullable": true }, + "api_purge_single_resource": { + "type": "boolean", + "description": "Enables the purge of cached single resources when list is purged.", + "example": false, + "nullable": true + }, "addresses_phone_required": { "type": "boolean", "description": "Indicates if the phone attribute is required for addresses, default is true.", @@ -81862,6 +82477,12 @@ "example": 10, "nullable": true }, + "imports_purge_cache": { + "type": "boolean", + "description": "Enables purging of cached resources upon succeeded imports.", + "example": true, + "nullable": true + }, "promotions_max_concurrent_count": { "type": "integer", "description": "The maximum number of active concurrent promotions allowed for your organization, default is 10.", @@ -84629,6 +85250,28 @@ } } }, + "store": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "attachments": { "type": "object", "properties": { @@ -84845,6 +85488,31 @@ } } } + }, + "store": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } } }, "required": [ @@ -85037,6 +85705,31 @@ } } } + }, + "store": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } } } } @@ -85145,6 +85838,40 @@ } } }, + "store": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "store" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, "attachments": { "type": "object", "properties": { @@ -108226,7 +108953,7 @@ } } }, - "attachments": { + "stores": { "type": "object", "properties": { "data": { @@ -108236,7 +108963,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "attachments" + "stores" ] }, "id": { @@ -108248,7 +108975,7 @@ } } }, - "versions": { + "attachments": { "type": "object", "properties": { "data": { @@ -108258,7 +108985,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "versions" + "attachments" ] }, "id": { @@ -108269,85 +108996,8 @@ } } } - } - } - } - } - } - } - }, - "stockLocationCreate": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "required": [ - "type", - "attributes" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "stock_locations" - ] - }, - "attributes": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The stock location's internal name.", - "example": "Primary warehouse" - }, - "code": { - "type": "string", - "description": "A string that you can use to identify the stock location (must be unique within the environment).", - "example": "europe1" - }, - "label_format": { - "type": "string", - "description": "The shipping label format for this stock location. Can be one of 'PDF', 'ZPL', 'EPL2', or 'PNG'.", - "example": "PDF" - }, - "suppress_etd": { - "type": "boolean", - "description": "Flag it if you want to skip the electronic invoice creation when generating the customs info for this stock location shipments.", - "example": false }, - "reference": { - "type": "string", - "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", - "example": "ANY-EXTERNAL-REFEFERNCE" - }, - "reference_origin": { - "type": "string", - "description": "Any identifier of the third party system that defines the reference code.", - "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" - }, - "metadata": { - "type": "object", - "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", - "example": { - "foo": "bar" - } - } - }, - "required": [ - "name" - ] - }, - "relationships": { - "type": "object", - "properties": { - "address": { - "required": [ - "data" - ], + "versions": { "type": "object", "properties": { "data": { @@ -108357,7 +109007,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "addresses" + "versions" ] }, "id": { @@ -108369,16 +109019,13 @@ } } } - }, - "required": [ - "address" - ] + } } } } } }, - "stockLocationUpdate": { + "stockLocationCreate": { "required": [ "data" ], @@ -108388,7 +109035,6 @@ "type": "object", "required": [ "type", - "id", "attributes" ], "properties": { @@ -108399,59 +109045,162 @@ "stock_locations" ] }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - }, "attributes": { "type": "object", "properties": { "name": { "type": "string", "description": "The stock location's internal name.", - "example": "Primary warehouse", - "nullable": false + "example": "Primary warehouse" }, "code": { "type": "string", "description": "A string that you can use to identify the stock location (must be unique within the environment).", - "example": "europe1", - "nullable": true + "example": "europe1" }, "label_format": { "type": "string", "description": "The shipping label format for this stock location. Can be one of 'PDF', 'ZPL', 'EPL2', or 'PNG'.", - "example": "PDF", - "nullable": true + "example": "PDF" }, "suppress_etd": { "type": "boolean", "description": "Flag it if you want to skip the electronic invoice creation when generating the customs info for this stock location shipments.", - "example": false, - "nullable": false + "example": false }, "reference": { "type": "string", "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", - "example": "ANY-EXTERNAL-REFEFERNCE", - "nullable": true + "example": "ANY-EXTERNAL-REFEFERNCE" }, "reference_origin": { "type": "string", "description": "Any identifier of the third party system that defines the reference code.", - "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", - "nullable": true + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" }, "metadata": { "type": "object", "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", "example": { "foo": "bar" - }, - "nullable": true + } } - } + }, + "required": [ + "name" + ] + }, + "relationships": { + "type": "object", + "properties": { + "address": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "addresses" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + }, + "required": [ + "address" + ] + } + } + } + } + }, + "stockLocationUpdate": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The stock location's internal name.", + "example": "Primary warehouse", + "nullable": false + }, + "code": { + "type": "string", + "description": "A string that you can use to identify the stock location (must be unique within the environment).", + "example": "europe1", + "nullable": true + }, + "label_format": { + "type": "string", + "description": "The shipping label format for this stock location. Can be one of 'PDF', 'ZPL', 'EPL2', or 'PNG'.", + "example": "PDF", + "nullable": true + }, + "suppress_etd": { + "type": "boolean", + "description": "Flag it if you want to skip the electronic invoice creation when generating the customs info for this stock location shipments.", + "example": false, + "nullable": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE", + "nullable": true + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + }, + "nullable": true + } + } }, "relationships": { "type": "object", @@ -108690,6 +109439,40 @@ } } }, + "stores": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, "attachments": { "type": "object", "properties": { @@ -109784,7 +110567,1024 @@ } } }, - "stockTransferCreate": { + "stockTransferCreate": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_transfers" + ] + }, + "attributes": { + "type": "object", + "properties": { + "number": { + "type": "string", + "description": "Unique identifier for the stock transfer (numeric).", + "example": "1234" + }, + "sku_code": { + "type": "string", + "description": "The code of the associated SKU.", + "example": "TSHIRTMM000000FFFFFFXLXX" + }, + "quantity": { + "type": "integer", + "description": "The stock quantity to be transferred from the origin stock location to destination one.", + "example": 2 + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + }, + "required": [ + "quantity" + ] + }, + "relationships": { + "type": "object", + "properties": { + "sku": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "skus" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "origin_stock_location": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "destination_stock_location": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "shipment": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "shipments" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "line_item": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "line_items" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + }, + "required": [ + "sku", + "origin_stock_location", + "destination_stock_location" + ] + } + } + } + } + }, + "stockTransferUpdate": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_transfers" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "attributes": { + "type": "object", + "properties": { + "number": { + "type": "string", + "description": "Unique identifier for the stock transfer (numeric).", + "example": "1234", + "nullable": true + }, + "sku_code": { + "type": "string", + "description": "The code of the associated SKU.", + "example": "TSHIRTMM000000FFFFFFXLXX", + "nullable": true + }, + "_upcoming": { + "type": "boolean", + "description": "Send this attribute if you want to mark this stock transfer as upcoming.", + "example": true, + "nullable": false + }, + "_on_hold": { + "type": "boolean", + "description": "Send this attribute if you want to put this stock transfer on hold.", + "example": true, + "nullable": false + }, + "_picking": { + "type": "boolean", + "description": "Send this attribute if you want to start picking this stock transfer.", + "example": true, + "nullable": false + }, + "_in_transit": { + "type": "boolean", + "description": "Send this attribute if you want to mark this stock transfer as in transit.", + "example": true, + "nullable": false + }, + "_complete": { + "type": "boolean", + "description": "Send this attribute if you want to complete this stock transfer.", + "example": true, + "nullable": false + }, + "_cancel": { + "type": "boolean", + "description": "Send this attribute if you want to cancel this stock transfer.", + "example": true, + "nullable": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE", + "nullable": true + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + }, + "nullable": true + } + } + }, + "relationships": { + "type": "object", + "properties": { + "sku": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "skus" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "origin_stock_location": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "destination_stock_location": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "shipment": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "shipments" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "line_item": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "line_items" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + } + } + }, + "stockTransferResponse": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_transfers" + ] + }, + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + } + } + }, + "attributes": { + "$ref": "#/components/schemas/stockTransfer/properties/data/properties/attributes" + }, + "relationships": { + "type": "object", + "properties": { + "sku": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "sku" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "origin_stock_location": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "origin_stock_location" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "destination_stock_location": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "destination_stock_location" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "shipment": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "shipment" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "line_item": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "line_item" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "stock_reservation": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_reservation" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "attachments": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "attachments" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "events": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "events" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, + "versions": { + "type": "object", + "properties": { + "links": { + "type": "object", + "properties": { + "self": { + "type": "string", + "description": "URL" + }, + "related": { + "type": "string", + "description": "URL" + } + } + }, + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "versions" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + } + } + } + } + } + } + }, + "stockTransferResponseList": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/stockTransferResponse/properties/data" + } + } + } + }, + "store": { + "type": "object", + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stores" + ] + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The store's internal name.", + "example": "Rome Shop", + "nullable": false + }, + "code": { + "type": "string", + "description": "A string that you can use to identify the store (must be unique within the environment).", + "example": "europe1", + "nullable": true + }, + "created_at": { + "type": "string", + "description": "Time at which the resource was created.", + "example": "2018-01-01T12:00:00.000Z", + "nullable": false + }, + "updated_at": { + "type": "string", + "description": "Time at which the resource was last updated.", + "example": "2018-01-01T12:00:00.000Z", + "nullable": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE", + "nullable": true + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code.", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + }, + "nullable": true + } + } + }, + "relationships": { + "type": "object", + "properties": { + "market": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "markets" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "merchant": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "merchants" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "stock_location": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "stock_locations" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "orders": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "orders" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "payment_methods": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "payment_methods" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "events": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "events" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, + "versions": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "versions" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + } + } + }, + "storeCreate": { "required": [ "data" ], @@ -109801,26 +111601,21 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_transfers" + "stores" ] }, "attributes": { "type": "object", "properties": { - "number": { + "name": { "type": "string", - "description": "Unique identifier for the stock transfer (numeric).", - "example": "1234" + "description": "The store's internal name.", + "example": "Rome Shop" }, - "sku_code": { + "code": { "type": "string", - "description": "The code of the associated SKU.", - "example": "TSHIRTMM000000FFFFFFXLXX" - }, - "quantity": { - "type": "integer", - "description": "The stock quantity to be transferred from the origin stock location to destination one.", - "example": 2 + "description": "A string that you can use to identify the store (must be unique within the environment).", + "example": "europe1" }, "reference": { "type": "string", @@ -109841,13 +111636,13 @@ } }, "required": [ - "quantity" + "name" ] }, "relationships": { "type": "object", "properties": { - "sku": { + "market": { "required": [ "data" ], @@ -109860,7 +111655,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "skus" + "markets" ] }, "id": { @@ -109872,7 +111667,7 @@ } } }, - "origin_stock_location": { + "merchant": { "required": [ "data" ], @@ -109885,7 +111680,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_locations" + "merchants" ] }, "id": { @@ -109897,7 +111692,7 @@ } } }, - "destination_stock_location": { + "stock_location": { "required": [ "data" ], @@ -109921,69 +111716,17 @@ } } } - }, - "shipment": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "shipments" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - }, - "line_item": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "line_items" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } } }, "required": [ - "sku", - "origin_stock_location", - "destination_stock_location" + "market" ] } } } } }, - "stockTransferUpdate": { + "storeUpdate": { "required": [ "data" ], @@ -110001,7 +111744,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_transfers" + "stores" ] }, "id": { @@ -110012,54 +111755,18 @@ "attributes": { "type": "object", "properties": { - "number": { + "name": { "type": "string", - "description": "Unique identifier for the stock transfer (numeric).", - "example": "1234", - "nullable": true + "description": "The store's internal name.", + "example": "Rome Shop", + "nullable": false }, - "sku_code": { + "code": { "type": "string", - "description": "The code of the associated SKU.", - "example": "TSHIRTMM000000FFFFFFXLXX", + "description": "A string that you can use to identify the store (must be unique within the environment).", + "example": "europe1", "nullable": true }, - "_upcoming": { - "type": "boolean", - "description": "Send this attribute if you want to mark this stock transfer as upcoming.", - "example": true, - "nullable": false - }, - "_on_hold": { - "type": "boolean", - "description": "Send this attribute if you want to put this stock transfer on hold.", - "example": true, - "nullable": false - }, - "_picking": { - "type": "boolean", - "description": "Send this attribute if you want to start picking this stock transfer.", - "example": true, - "nullable": false - }, - "_in_transit": { - "type": "boolean", - "description": "Send this attribute if you want to mark this stock transfer as in transit.", - "example": true, - "nullable": false - }, - "_complete": { - "type": "boolean", - "description": "Send this attribute if you want to complete this stock transfer.", - "example": true, - "nullable": false - }, - "_cancel": { - "type": "boolean", - "description": "Send this attribute if you want to cancel this stock transfer.", - "example": true, - "nullable": false - }, "reference": { "type": "string", "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", @@ -110085,7 +111792,7 @@ "relationships": { "type": "object", "properties": { - "sku": { + "market": { "required": [ "data" ], @@ -110098,7 +111805,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "skus" + "markets" ] }, "id": { @@ -110110,7 +111817,7 @@ } } }, - "origin_stock_location": { + "merchant": { "required": [ "data" ], @@ -110123,7 +111830,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_locations" + "merchants" ] }, "id": { @@ -110135,7 +111842,7 @@ } } }, - "destination_stock_location": { + "stock_location": { "required": [ "data" ], @@ -110159,56 +111866,6 @@ } } } - }, - "shipment": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "shipments" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - }, - "line_item": { - "required": [ - "data" - ], - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "line_items" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } } } } @@ -110216,7 +111873,7 @@ } } }, - "stockTransferResponse": { + "storeResponse": { "type": "object", "properties": { "data": { @@ -110231,7 +111888,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_transfers" + "stores" ] }, "links": { @@ -110244,80 +111901,12 @@ } }, "attributes": { - "$ref": "#/components/schemas/stockTransfer/properties/data/properties/attributes" + "$ref": "#/components/schemas/store/properties/data/properties/attributes" }, "relationships": { "type": "object", "properties": { - "sku": { - "type": "object", - "properties": { - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - }, - "related": { - "type": "string", - "description": "URL" - } - } - }, - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "sku" - ] - }, - "id": { - "type": "string", - "description": "The resource ID" - } - } - } - } - }, - "origin_stock_location": { - "type": "object", - "properties": { - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - }, - "related": { - "type": "string", - "description": "URL" - } - } - }, - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "origin_stock_location" - ] - }, - "id": { - "type": "string", - "description": "The resource ID" - } - } - } - } - }, - "destination_stock_location": { + "market": { "type": "object", "properties": { "links": { @@ -110340,7 +111929,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "destination_stock_location" + "market" ] }, "id": { @@ -110351,7 +111940,7 @@ } } }, - "shipment": { + "merchant": { "type": "object", "properties": { "links": { @@ -110374,7 +111963,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "shipment" + "merchant" ] }, "id": { @@ -110385,7 +111974,7 @@ } } }, - "line_item": { + "stock_location": { "type": "object", "properties": { "links": { @@ -110408,7 +111997,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "line_item" + "stock_location" ] }, "id": { @@ -110419,7 +112008,7 @@ } } }, - "stock_reservation": { + "orders": { "type": "object", "properties": { "links": { @@ -110442,7 +112031,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "stock_reservation" + "orders" ] }, "id": { @@ -110453,7 +112042,7 @@ } } }, - "attachments": { + "payment_methods": { "type": "object", "properties": { "links": { @@ -110476,7 +112065,7 @@ "type": "string", "description": "The resource's type", "enum": [ - "attachments" + "payment_methods" ] }, "id": { @@ -110561,13 +112150,13 @@ } } }, - "stockTransferResponseList": { + "storeResponseList": { "type": "object", "properties": { "data": { "type": "array", "items": { - "$ref": "#/components/schemas/stockTransferResponse/properties/data" + "$ref": "#/components/schemas/storeResponse/properties/data" } } } @@ -116855,6 +118444,10 @@ "name": "stock_transfers", "description": "resource type" }, + { + "name": "stores", + "description": "resource type" + }, { "name": "stripe_gateways", "description": "resource type" diff --git a/gen/resources.json b/gen/resources.json index 08956088..b6cfeb5e 100644 --- a/gen/resources.json +++ b/gen/resources.json @@ -10843,7 +10843,8 @@ "fetchable": true, "filterable": true, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "id": { "format": "id", @@ -10945,7 +10946,8 @@ "fetchable": true, "filterable": false, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "metadata": { "type": "object", @@ -14808,8 +14810,8 @@ "creatable": false, "updatable": false, "fetchable": true, - "filterable": true, - "sortable": true, + "filterable": false, + "sortable": false, "example": "SUMMERDISCOUNT" }, "id": { @@ -15116,7 +15118,6 @@ "name", "image_url", "item_type", - "coupon_code", "circuit_state", "circuit_failure_count", "created_at", @@ -16392,6 +16393,14 @@ "parent_resource": "Api::MarketResource", "class_name": "Geocoder" }, + "stores": { + "type": "has_many", + "desc": "The associated stores.", + "filterable": true, + "sortable": false, + "parent_resource": "Api::MarketResource", + "class_name": "Store" + }, "price_list_schedulers": { "type": "has_many", "desc": "The associated price list schedulers.", @@ -16449,6 +16458,7 @@ "tax_calculator_id", "customer_group_id", "geocoder_id", + "stores_id", "price_list_schedulers_id", "order_validation_rules_id", "attachments_id", @@ -18318,6 +18328,17 @@ "sortable": false, "parent_resource": "Api::OrderResource" }, + "store": { + "type": "has_one", + "desc": "The associated store.", + "required": "optional, set by scope", + "creatable": true, + "updatable": true, + "filterable": true, + "sortable": true, + "parent_resource": "Api::OrderResource", + "class_name": "Store" + }, "available_payment_methods": { "type": "has_many", "desc": "The available payment methods for the order. Useful to present the customer with a list of choices during the checkout. Only enabled payment methods are included in the list.", @@ -18646,6 +18667,7 @@ "customer_id", "shipping_address_id", "billing_address_id", + "store_id", "payment_method_id", "payment_source_id", "line_items_id", @@ -20602,6 +20624,17 @@ "sortable": false, "example": "false" }, + "api_purge_single_resource": { + "type": "boolean", + "default": false, + "desc": "Enables the purge of cached single resources when list is purged.", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": false, + "sortable": false, + "example": "false" + }, "addresses_phone_required": { "type": "boolean", "default": true, @@ -20756,6 +20789,17 @@ "sortable": false, "example": "10" }, + "imports_purge_cache": { + "type": "boolean", + "default": true, + "desc": "Enables purging of cached resources upon succeeded imports.", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": false, + "sortable": false, + "example": "true" + }, "promotions_max_concurrent_count": { "type": "integer", "default": 10, @@ -22208,6 +22252,17 @@ "parent_resource": "Api::PaymentMethodResource", "class_name": "PaymentGateway" }, + "store": { + "type": "has_one", + "desc": "The associated store.", + "required": "optional", + "creatable": true, + "updatable": true, + "filterable": true, + "sortable": true, + "parent_resource": "Api::PaymentMethodResource", + "class_name": "Store" + }, "attachments": { "type": "has_many", "desc": "The associated attachments.", @@ -22243,6 +22298,7 @@ "q", "market_id", "payment_gateway_id", + "store_id", "attachments_id", "ids", "disabled_at_from", @@ -23494,7 +23550,8 @@ "fetchable": true, "filterable": true, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "rule_outcomes": { "type": "object", @@ -23505,7 +23562,8 @@ "fetchable": true, "filterable": false, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "jwt_custom_claim": { "type": "object", @@ -23999,7 +24057,8 @@ "fetchable": true, "filterable": true, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "rule_outcomes": { "type": "object", @@ -24010,7 +24069,8 @@ "fetchable": true, "filterable": false, "sortable": false, - "example": "{}" + "example": "{}", + "action": "show" }, "metadata": { "type": "object", @@ -31894,6 +31954,13 @@ "parent_resource": "Api::StockLocationResource", "class_name": "StockTransfer" }, + "stores": { + "type": "has_many", + "desc": "The associated stores.", + "filterable": true, + "parent_resource": "Api::StockLocationResource", + "class_name": "Store" + }, "attachments": { "type": "has_many", "desc": "The associated attachments.", @@ -31931,6 +31998,7 @@ "inventory_return_locations_id", "stock_items_id", "stock_transfers_id", + "stores_id", "attachments_id", "ids", "created_at_from", @@ -32582,6 +32650,202 @@ ] } }, + { + "id": "store", + "type": "resources", + "attributes": { + "singleton": false, + "deprecated": false, + "actions": [ + "list", + "retrieve", + "create", + "update", + "delete" + ], + "examples": {}, + "filter_scopes": [], + "fields": { + "name": { + "type": "string", + "desc": "The store's internal name.", + "required": "required", + "creatable": true, + "updatable": true, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "Rome Shop" + }, + "code": { + "type": "string", + "desc": "A string that you can use to identify the store (must be unique within the environment).", + "required": "optional", + "creatable": true, + "updatable": true, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "europe1" + }, + "id": { + "format": "id", + "type": "string", + "desc": "Unique identifier for the resource (hash).", + "required": "required", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "XAyRWNUzyN" + }, + "created_at": { + "type": "datetime", + "desc": "Time at which the resource was created.", + "required": "required", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "2018-01-01T12:00:00.000Z" + }, + "updated_at": { + "type": "datetime", + "desc": "Time at which the resource was last updated.", + "required": "required", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "2018-01-01T12:00:00.000Z" + }, + "reference": { + "type": "string", + "desc": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "required": "optional", + "creatable": true, + "updatable": true, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "desc": "Any identifier of the third party system that defines the reference code.", + "required": "optional", + "creatable": true, + "updatable": true, + "fetchable": true, + "filterable": true, + "sortable": true, + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "desc": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "required": "optional", + "creatable": true, + "updatable": true, + "fetchable": true, + "filterable": true, + "sortable": false, + "example": { + "foo": "bar" + } + } + }, + "relationships": { + "market": { + "type": "has_one", + "desc": "The associated market.", + "required": "required", + "creatable": true, + "updatable": true, + "filterable": true, + "sortable": true, + "parent_resource": "Api::StoreResource", + "class_name": "Market" + }, + "merchant": { + "type": "has_one", + "desc": "The associated merchant.", + "required": "optional", + "creatable": true, + "updatable": true, + "filterable": true, + "sortable": false, + "parent_resource": "Api::StoreResource", + "class_name": "Merchant" + }, + "stock_location": { + "type": "has_one", + "desc": "The associated stock location.", + "required": "optional", + "creatable": true, + "updatable": true, + "filterable": true, + "sortable": true, + "parent_resource": "Api::StoreResource", + "class_name": "StockLocation" + }, + "orders": { + "type": "has_many", + "desc": "The associated orders.", + "parent_resource": "Api::StoreResource", + "class_name": "Order" + }, + "payment_methods": { + "type": "has_many", + "desc": "The associated payment methods.", + "parent_resource": "Api::StoreResource", + "class_name": "PaymentMethod" + }, + "events": { + "type": "has_many", + "desc": "The associated events.", + "filterable": true, + "sortable": false, + "parent_resource": "Api::StoreResource", + "class_name": "Event" + }, + "versions": { + "type": "has_many", + "desc": "The associated changes.", + "creatable": false, + "updatable": false, + "fetchable": true, + "filterable": false, + "sortable": false, + "parent_resource": "Api::StoreResource", + "class_name": "Version" + } + }, + "filters": [ + "id", + "name", + "code", + "created_at", + "updated_at", + "reference", + "reference_origin", + "metadata", + "q", + "market_id", + "merchant_id", + "stock_location_id", + "events_id", + "ids", + "created_at_from", + "created_at_to", + "updated_at_from", + "updated_at_to" + ] + } + }, { "id": "stripe_gateway", "type": "resources", diff --git a/package.json b/package.json index 39cf1bb3..bd187b72 100644 --- a/package.json +++ b/package.json @@ -35,12 +35,12 @@ "@babel/preset-env": "^7.26.0", "@babel/preset-typescript": "^7.26.0", "@commercelayer/eslint-config-ts": "1.4.5", - "@commercelayer/js-auth": "^6.6.4", + "@commercelayer/js-auth": "^6.7.0", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", "@types/debug": "^4.1.12", "@types/jest": "^29.5.14", - "@types/node": "^22.8.4", + "@types/node": "^22.9.0", "dotenv": "^16.4.5", "eslint": "^8.57.1", "jest": "^29.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index defad3f8..98bed72d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,8 +21,8 @@ importers: specifier: 1.4.5 version: 1.4.5(eslint@8.57.1)(typescript@5.6.3) '@commercelayer/js-auth': - specifier: ^6.6.4 - version: 6.6.4 + specifier: ^6.7.0 + version: 6.7.0 '@semantic-release/changelog': specifier: ^6.0.3 version: 6.0.3(semantic-release@24.2.0(typescript@5.6.3)) @@ -36,8 +36,8 @@ importers: specifier: ^29.5.14 version: 29.5.14 '@types/node': - specifier: ^22.8.4 - version: 22.8.4 + specifier: ^22.9.0 + version: 22.9.0 dotenv: specifier: ^16.4.5 version: 16.4.5 @@ -46,7 +46,7 @@ importers: version: 8.57.1 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.8.4) + version: 29.7.0(@types/node@22.9.0) json-typescript: specifier: ^1.1.2 version: 1.1.2 @@ -75,20 +75,20 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - '@babel/code-frame@7.26.0': - resolution: {integrity: sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g==} + '@babel/code-frame@7.26.2': + resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} engines: {node: '>=6.9.0'} - '@babel/compat-data@7.26.0': - resolution: {integrity: sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA==} + '@babel/compat-data@7.26.2': + resolution: {integrity: sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==} engines: {node: '>=6.9.0'} '@babel/core@7.26.0': resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} engines: {node: '>=6.9.0'} - '@babel/generator@7.26.0': - resolution: {integrity: sha512-/AIkAmInnWwgEAJGQr9vY0c66Mj6kjkE2ZPB1PurTRaRAh3U+J45sAQMjQDJdh4WbR3l0x5xkimXBKyBXXAu2w==} + '@babel/generator@7.26.2': + resolution: {integrity: sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==} engines: {node: '>=6.9.0'} '@babel/helper-annotate-as-pure@7.25.9': @@ -182,8 +182,8 @@ packages: resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} engines: {node: '>=6.9.0'} - '@babel/parser@7.26.1': - resolution: {integrity: sha512-reoQYNiAJreZNsJzyrDNzFQ+IQ5JFiIzAHJg9bn94S3l+4++J7RsIhNMoB+lgP/9tpmiAQqspv+xfdxTSzREOw==} + '@babel/parser@7.26.2': + resolution: {integrity: sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==} engines: {node: '>=6.0.0'} hasBin: true @@ -678,8 +678,8 @@ packages: eslint: '>=8.0' typescript: '>=5.0' - '@commercelayer/js-auth@6.6.4': - resolution: {integrity: sha512-US18p9YrHJ7ZAc7EHkoZ9KxAqQcb19ygn93PciFS5GfM2GMk7Nkgt7zJp/aVhxoydno/afXVechOHGnPqnvraQ==} + '@commercelayer/js-auth@6.7.0': + resolution: {integrity: sha512-Eh4v00OVvz0w1iYqz6PTVptNl/ipVs6nBG9NUzYKRSI/8Nnd+qU0MYfiogQYjm4sSoX5+4j0BsJW+9N/6s9Jjw==} engines: {node: '>=18.0.0'} '@esbuild/aix-ppc64@0.23.1': @@ -1177,93 +1177,93 @@ packages: resolution: {integrity: sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw==} engines: {node: '>=12'} - '@rollup/rollup-android-arm-eabi@4.24.3': - resolution: {integrity: sha512-ufb2CH2KfBWPJok95frEZZ82LtDl0A6QKTa8MoM+cWwDZvVGl5/jNb79pIhRvAalUu+7LD91VYR0nwRD799HkQ==} + '@rollup/rollup-android-arm-eabi@4.24.4': + resolution: {integrity: sha512-jfUJrFct/hTA0XDM5p/htWKoNNTbDLY0KRwEt6pyOA6k2fmk0WVwl65PdUdJZgzGEHWx+49LilkcSaumQRyNQw==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.24.3': - resolution: {integrity: sha512-iAHpft/eQk9vkWIV5t22V77d90CRofgR2006UiCjHcHJFVI1E0oBkQIAbz+pLtthFw3hWEmVB4ilxGyBf48i2Q==} + '@rollup/rollup-android-arm64@4.24.4': + resolution: {integrity: sha512-j4nrEO6nHU1nZUuCfRKoCcvh7PIywQPUCBa2UsootTHvTHIoIu2BzueInGJhhvQO/2FTRdNYpf63xsgEqH9IhA==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.24.3': - resolution: {integrity: sha512-QPW2YmkWLlvqmOa2OwrfqLJqkHm7kJCIMq9kOz40Zo9Ipi40kf9ONG5Sz76zszrmIZZ4hgRIkez69YnTHgEz1w==} + '@rollup/rollup-darwin-arm64@4.24.4': + resolution: {integrity: sha512-GmU/QgGtBTeraKyldC7cDVVvAJEOr3dFLKneez/n7BvX57UdhOqDsVwzU7UOnYA7AAOt+Xb26lk79PldDHgMIQ==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.24.3': - resolution: {integrity: sha512-KO0pN5x3+uZm1ZXeIfDqwcvnQ9UEGN8JX5ufhmgH5Lz4ujjZMAnxQygZAVGemFWn+ZZC0FQopruV4lqmGMshow==} + '@rollup/rollup-darwin-x64@4.24.4': + resolution: {integrity: sha512-N6oDBiZCBKlwYcsEPXGDE4g9RoxZLK6vT98M8111cW7VsVJFpNEqvJeIPfsCzbf0XEakPslh72X0gnlMi4Ddgg==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.24.3': - resolution: {integrity: sha512-CsC+ZdIiZCZbBI+aRlWpYJMSWvVssPuWqrDy/zi9YfnatKKSLFCe6fjna1grHuo/nVaHG+kiglpRhyBQYRTK4A==} + '@rollup/rollup-freebsd-arm64@4.24.4': + resolution: {integrity: sha512-py5oNShCCjCyjWXCZNrRGRpjWsF0ic8f4ieBNra5buQz0O/U6mMXCpC1LvrHuhJsNPgRt36tSYMidGzZiJF6mw==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.24.3': - resolution: {integrity: sha512-F0nqiLThcfKvRQhZEzMIXOQG4EeX61im61VYL1jo4eBxv4aZRmpin6crnBJQ/nWnCsjH5F6J3W6Stdm0mBNqBg==} + '@rollup/rollup-freebsd-x64@4.24.4': + resolution: {integrity: sha512-L7VVVW9FCnTTp4i7KrmHeDsDvjB4++KOBENYtNYAiYl96jeBThFfhP6HVxL74v4SiZEVDH/1ILscR5U9S4ms4g==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.24.3': - resolution: {integrity: sha512-KRSFHyE/RdxQ1CSeOIBVIAxStFC/hnBgVcaiCkQaVC+EYDtTe4X7z5tBkFyRoBgUGtB6Xg6t9t2kulnX6wJc6A==} + '@rollup/rollup-linux-arm-gnueabihf@4.24.4': + resolution: {integrity: sha512-10ICosOwYChROdQoQo589N5idQIisxjaFE/PAnX2i0Zr84mY0k9zul1ArH0rnJ/fpgiqfu13TFZR5A5YJLOYZA==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.24.3': - resolution: {integrity: sha512-h6Q8MT+e05zP5BxEKz0vi0DhthLdrNEnspdLzkoFqGwnmOzakEHSlXfVyA4HJ322QtFy7biUAVFPvIDEDQa6rw==} + '@rollup/rollup-linux-arm-musleabihf@4.24.4': + resolution: {integrity: sha512-ySAfWs69LYC7QhRDZNKqNhz2UKN8LDfbKSMAEtoEI0jitwfAG2iZwVqGACJT+kfYvvz3/JgsLlcBP+WWoKCLcw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.24.3': - resolution: {integrity: sha512-fKElSyXhXIJ9pqiYRqisfirIo2Z5pTTve5K438URf08fsypXrEkVmShkSfM8GJ1aUyvjakT+fn2W7Czlpd/0FQ==} + '@rollup/rollup-linux-arm64-gnu@4.24.4': + resolution: {integrity: sha512-uHYJ0HNOI6pGEeZ/5mgm5arNVTI0nLlmrbdph+pGXpC9tFHFDQmDMOEqkmUObRfosJqpU8RliYoGz06qSdtcjg==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.24.3': - resolution: {integrity: sha512-YlddZSUk8G0px9/+V9PVilVDC6ydMz7WquxozToozSnfFK6wa6ne1ATUjUvjin09jp34p84milxlY5ikueoenw==} + '@rollup/rollup-linux-arm64-musl@4.24.4': + resolution: {integrity: sha512-38yiWLemQf7aLHDgTg85fh3hW9stJ0Muk7+s6tIkSUOMmi4Xbv5pH/5Bofnsb6spIwD5FJiR+jg71f0CH5OzoA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.24.3': - resolution: {integrity: sha512-yNaWw+GAO8JjVx3s3cMeG5Esz1cKVzz8PkTJSfYzE5u7A+NvGmbVFEHP+BikTIyYWuz0+DX9kaA3pH9Sqxp69g==} + '@rollup/rollup-linux-powerpc64le-gnu@4.24.4': + resolution: {integrity: sha512-q73XUPnkwt9ZNF2xRS4fvneSuaHw2BXuV5rI4cw0fWYVIWIBeDZX7c7FWhFQPNTnE24172K30I+dViWRVD9TwA==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.24.3': - resolution: {integrity: sha512-lWKNQfsbpv14ZCtM/HkjCTm4oWTKTfxPmr7iPfp3AHSqyoTz5AgLemYkWLwOBWc+XxBbrU9SCokZP0WlBZM9lA==} + '@rollup/rollup-linux-riscv64-gnu@4.24.4': + resolution: {integrity: sha512-Aie/TbmQi6UXokJqDZdmTJuZBCU3QBDA8oTKRGtd4ABi/nHgXICulfg1KI6n9/koDsiDbvHAiQO3YAUNa/7BCw==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.24.3': - resolution: {integrity: sha512-HoojGXTC2CgCcq0Woc/dn12wQUlkNyfH0I1ABK4Ni9YXyFQa86Fkt2Q0nqgLfbhkyfQ6003i3qQk9pLh/SpAYw==} + '@rollup/rollup-linux-s390x-gnu@4.24.4': + resolution: {integrity: sha512-P8MPErVO/y8ohWSP9JY7lLQ8+YMHfTI4bAdtCi3pC2hTeqFJco2jYspzOzTUB8hwUWIIu1xwOrJE11nP+0JFAQ==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.24.3': - resolution: {integrity: sha512-mnEOh4iE4USSccBOtcrjF5nj+5/zm6NcNhbSEfR3Ot0pxBwvEn5QVUXcuOwwPkapDtGZ6pT02xLoPaNv06w7KQ==} + '@rollup/rollup-linux-x64-gnu@4.24.4': + resolution: {integrity: sha512-K03TljaaoPK5FOyNMZAAEmhlyO49LaE4qCsr0lYHUKyb6QacTNF9pnfPpXnFlFD3TXuFbFbz7tJ51FujUXkXYA==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.24.3': - resolution: {integrity: sha512-rMTzawBPimBQkG9NKpNHvquIUTQPzrnPxPbCY1Xt+mFkW7pshvyIS5kYgcf74goxXOQk0CP3EoOC1zcEezKXhw==} + '@rollup/rollup-linux-x64-musl@4.24.4': + resolution: {integrity: sha512-VJYl4xSl/wqG2D5xTYncVWW+26ICV4wubwN9Gs5NrqhJtayikwCXzPL8GDsLnaLU3WwhQ8W02IinYSFJfyo34Q==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.24.3': - resolution: {integrity: sha512-2lg1CE305xNvnH3SyiKwPVsTVLCg4TmNCF1z7PSHX2uZY2VbUpdkgAllVoISD7JO7zu+YynpWNSKAtOrX3AiuA==} + '@rollup/rollup-win32-arm64-msvc@4.24.4': + resolution: {integrity: sha512-ku2GvtPwQfCqoPFIJCqZ8o7bJcj+Y54cZSr43hHca6jLwAiCbZdBUOrqE6y29QFajNAzzpIOwsckaTFmN6/8TA==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.24.3': - resolution: {integrity: sha512-9SjYp1sPyxJsPWuhOCX6F4jUMXGbVVd5obVpoVEi8ClZqo52ViZewA6eFz85y8ezuOA+uJMP5A5zo6Oz4S5rVQ==} + '@rollup/rollup-win32-ia32-msvc@4.24.4': + resolution: {integrity: sha512-V3nCe+eTt/W6UYNr/wGvO1fLpHUrnlirlypZfKCT1fG6hWfqhPgQV/K/mRBXBpxc0eKLIF18pIOFVPh0mqHjlg==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.24.3': - resolution: {integrity: sha512-HGZgRFFYrMrP3TJlq58nR1xy8zHKId25vhmm5S9jETEfDf6xybPxsavFTJaufe2zgOGYJBskGlj49CwtEuFhWQ==} + '@rollup/rollup-win32-x64-msvc@4.24.4': + resolution: {integrity: sha512-LTw1Dfd0mBIEqUVCxbvTE/LLo+9ZxVC9k99v1v4ahg9Aak6FpqOfNu5kRkeTAn0wphoC4JU7No1/rL+bBCEwhg==} cpu: [x64] os: [win32] @@ -1377,8 +1377,8 @@ packages: '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} - '@types/node@22.8.4': - resolution: {integrity: sha512-SpNNxkftTJOPk0oN+y2bIqurEXHTA2AOZ3EJDDKeJ5VzkvvORSvmQXGQarcOzWV1ac7DCaPBEdMDxBsM+d8jWw==} + '@types/node@22.9.0': + resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -1694,8 +1694,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - caniuse-lite@1.0.30001675: - resolution: {integrity: sha512-/wV1bQwPrkLiQMjaJF5yUMVM/VdRPOCU8QZ+PmG6uW6DvYSrNY1bpwHI/3mOcUosLaJCzYDi5o91IQB51ft6cg==} + caniuse-lite@1.0.30001677: + resolution: {integrity: sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==} chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -1810,8 +1810,8 @@ packages: convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - core-js-compat@3.38.1: - resolution: {integrity: sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==} + core-js-compat@3.39.0: + resolution: {integrity: sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==} core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -1928,8 +1928,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.5.49: - resolution: {integrity: sha512-ZXfs1Of8fDb6z7WEYZjXpgIRF6MEu8JdeGA0A40aZq6OQbS+eJpnnV49epZRna2DU/YsEjSQuGtQPPtvt6J65A==} + electron-to-chromium@1.5.52: + resolution: {integrity: sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ==} emittery@0.13.1: resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} @@ -2925,11 +2925,11 @@ packages: makeerror@1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} - marked-terminal@7.1.0: - resolution: {integrity: sha512-+pvwa14KZL74MVXjYdPR3nSInhGhNvPce/3mqLVZT2oUvt654sL1XImFuLZ1pkA866IYZ3ikDTOFUIC7XzpZZg==} + marked-terminal@7.2.1: + resolution: {integrity: sha512-rQ1MoMFXZICWNsKMiiHwP/Z+92PLKskTPXj+e7uwXmuMPkNn7iTqC+IvDekVm1MPeC9wYQeLxeFaOvudRR/XbQ==} engines: {node: '>=16.0.0'} peerDependencies: - marked: '>=1 <14' + marked: '>=1 <15' marked@12.0.2: resolution: {integrity: sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==} @@ -3451,8 +3451,8 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rollup@4.24.3: - resolution: {integrity: sha512-HBW896xR5HGmoksbi3JBDtmVzWiPAYqp7wip50hjQ67JbDz61nyoMPdqu1DvVW9asYb2M65Z20ZHsyJCMqMyDg==} + rollup@4.24.4: + resolution: {integrity: sha512-vGorVWIsWfX3xbcyAS+I047kFKapHYivmkaT63Smj77XwvLSJos6M1xGqZnBPFQFBRZDOcG1QnYEIxAvTr/HjA==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -3726,8 +3726,8 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true - ts-api-utils@1.3.0: - resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + ts-api-utils@1.4.0: + resolution: {integrity: sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==} engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' @@ -3738,8 +3738,8 @@ packages: tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} - tslib@2.8.0: - resolution: {integrity: sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==} + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} tsup@8.3.5: resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} @@ -3977,23 +3977,23 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@babel/code-frame@7.26.0': + '@babel/code-frame@7.26.2': dependencies: '@babel/helper-validator-identifier': 7.25.9 js-tokens: 4.0.0 picocolors: 1.1.1 - '@babel/compat-data@7.26.0': {} + '@babel/compat-data@7.26.2': {} '@babel/core@7.26.0': dependencies: '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.26.0 - '@babel/generator': 7.26.0 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.2 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) '@babel/helpers': 7.26.0 - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@babel/template': 7.25.9 '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 @@ -4005,9 +4005,9 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/generator@7.26.0': + '@babel/generator@7.26.2': dependencies: - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@babel/types': 7.26.0 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 @@ -4026,7 +4026,7 @@ snapshots: '@babel/helper-compilation-targets@7.25.9': dependencies: - '@babel/compat-data': 7.26.0 + '@babel/compat-data': 7.26.2 '@babel/helper-validator-option': 7.25.9 browserslist: 4.24.2 lru-cache: 5.1.1 @@ -4143,7 +4143,7 @@ snapshots: '@babel/template': 7.25.9 '@babel/types': 7.26.0 - '@babel/parser@7.26.1': + '@babel/parser@7.26.2': dependencies: '@babel/types': 7.26.0 @@ -4618,7 +4618,7 @@ snapshots: '@babel/preset-env@7.26.0(@babel/core@7.26.0)': dependencies: - '@babel/compat-data': 7.26.0 + '@babel/compat-data': 7.26.2 '@babel/core': 7.26.0 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 @@ -4686,7 +4686,7 @@ snapshots: babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.26.0) babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.26.0) babel-plugin-polyfill-regenerator: 0.6.2(@babel/core@7.26.0) - core-js-compat: 3.38.1 + core-js-compat: 3.39.0 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -4715,15 +4715,15 @@ snapshots: '@babel/template@7.25.9': dependencies: - '@babel/code-frame': 7.26.0 - '@babel/parser': 7.26.1 + '@babel/code-frame': 7.26.2 + '@babel/parser': 7.26.2 '@babel/types': 7.26.0 '@babel/traverse@7.25.9': dependencies: - '@babel/code-frame': 7.26.0 - '@babel/generator': 7.26.0 - '@babel/parser': 7.26.1 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.2 + '@babel/parser': 7.26.2 '@babel/template': 7.25.9 '@babel/types': 7.26.0 debug: 4.3.7 @@ -4760,7 +4760,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - '@commercelayer/js-auth@6.6.4': {} + '@commercelayer/js-auth@6.7.0': {} '@esbuild/aix-ppc64@0.23.1': optional: true @@ -4963,7 +4963,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -4976,14 +4976,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@22.8.4) + jest-config: 29.7.0(@types/node@22.9.0) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -5008,7 +5008,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -5026,7 +5026,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 22.8.4 + '@types/node': 22.9.0 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -5048,7 +5048,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -5118,7 +5118,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 22.8.4 + '@types/node': 22.9.0 '@types/yargs': 17.0.33 chalk: 4.1.2 @@ -5226,58 +5226,58 @@ snapshots: '@pnpm/network.ca-file': 1.0.2 config-chain: 1.1.13 - '@rollup/rollup-android-arm-eabi@4.24.3': + '@rollup/rollup-android-arm-eabi@4.24.4': optional: true - '@rollup/rollup-android-arm64@4.24.3': + '@rollup/rollup-android-arm64@4.24.4': optional: true - '@rollup/rollup-darwin-arm64@4.24.3': + '@rollup/rollup-darwin-arm64@4.24.4': optional: true - '@rollup/rollup-darwin-x64@4.24.3': + '@rollup/rollup-darwin-x64@4.24.4': optional: true - '@rollup/rollup-freebsd-arm64@4.24.3': + '@rollup/rollup-freebsd-arm64@4.24.4': optional: true - '@rollup/rollup-freebsd-x64@4.24.3': + '@rollup/rollup-freebsd-x64@4.24.4': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.24.3': + '@rollup/rollup-linux-arm-gnueabihf@4.24.4': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.24.3': + '@rollup/rollup-linux-arm-musleabihf@4.24.4': optional: true - '@rollup/rollup-linux-arm64-gnu@4.24.3': + '@rollup/rollup-linux-arm64-gnu@4.24.4': optional: true - '@rollup/rollup-linux-arm64-musl@4.24.3': + '@rollup/rollup-linux-arm64-musl@4.24.4': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.24.3': + '@rollup/rollup-linux-powerpc64le-gnu@4.24.4': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.24.3': + '@rollup/rollup-linux-riscv64-gnu@4.24.4': optional: true - '@rollup/rollup-linux-s390x-gnu@4.24.3': + '@rollup/rollup-linux-s390x-gnu@4.24.4': optional: true - '@rollup/rollup-linux-x64-gnu@4.24.3': + '@rollup/rollup-linux-x64-gnu@4.24.4': optional: true - '@rollup/rollup-linux-x64-musl@4.24.3': + '@rollup/rollup-linux-x64-musl@4.24.4': optional: true - '@rollup/rollup-win32-arm64-msvc@4.24.3': + '@rollup/rollup-win32-arm64-msvc@4.24.4': optional: true - '@rollup/rollup-win32-ia32-msvc@4.24.3': + '@rollup/rollup-win32-ia32-msvc@4.24.4': optional: true - '@rollup/rollup-win32-x64-msvc@4.24.3': + '@rollup/rollup-win32-x64-msvc@4.24.4': optional: true '@rtsao/scc@1.1.0': {} @@ -5397,7 +5397,7 @@ snapshots: '@types/babel__core@7.20.5': dependencies: - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@babel/types': 7.26.0 '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.4 @@ -5409,7 +5409,7 @@ snapshots: '@types/babel__template@7.4.4': dependencies: - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@babel/types': 7.26.0 '@types/babel__traverse@7.20.6': @@ -5424,7 +5424,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 22.8.4 + '@types/node': 22.9.0 '@types/istanbul-lib-coverage@2.0.6': {} @@ -5445,7 +5445,7 @@ snapshots: '@types/ms@0.7.34': {} - '@types/node@22.8.4': + '@types/node@22.9.0': dependencies: undici-types: 6.19.8 @@ -5473,7 +5473,7 @@ snapshots: graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 - ts-api-utils: 1.3.0(typescript@5.6.3) + ts-api-utils: 1.4.0(typescript@5.6.3) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -5521,7 +5521,7 @@ snapshots: '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.6.3) debug: 4.3.7 eslint: 8.57.1 - ts-api-utils: 1.3.0(typescript@5.6.3) + ts-api-utils: 1.4.0(typescript@5.6.3) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -5540,7 +5540,7 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.3 semver: 7.6.3 - ts-api-utils: 1.3.0(typescript@5.6.3) + ts-api-utils: 1.4.0(typescript@5.6.3) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -5555,7 +5555,7 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.6.3 - ts-api-utils: 1.3.0(typescript@5.6.3) + ts-api-utils: 1.4.0(typescript@5.6.3) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -5738,7 +5738,7 @@ snapshots: babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.26.0): dependencies: - '@babel/compat-data': 7.26.0 + '@babel/compat-data': 7.26.2 '@babel/core': 7.26.0 '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.26.0) semver: 6.3.1 @@ -5749,7 +5749,7 @@ snapshots: dependencies: '@babel/core': 7.26.0 '@babel/helper-define-polyfill-provider': 0.6.2(@babel/core@7.26.0) - core-js-compat: 3.38.1 + core-js-compat: 3.39.0 transitivePeerDependencies: - supports-color @@ -5806,8 +5806,8 @@ snapshots: browserslist@4.24.2: dependencies: - caniuse-lite: 1.0.30001675 - electron-to-chromium: 1.5.49 + caniuse-lite: 1.0.30001677 + electron-to-chromium: 1.5.52 node-releases: 2.0.18 update-browserslist-db: 1.1.1(browserslist@4.24.2) @@ -5844,7 +5844,7 @@ snapshots: camelcase@6.3.0: {} - caniuse-lite@1.0.30001675: {} + caniuse-lite@1.0.30001677: {} chalk@2.4.2: dependencies: @@ -5956,7 +5956,7 @@ snapshots: convert-source-map@2.0.0: {} - core-js-compat@3.38.1: + core-js-compat@3.39.0: dependencies: browserslist: 4.24.2 @@ -5971,13 +5971,13 @@ snapshots: optionalDependencies: typescript: 5.6.3 - create-jest@29.7.0(@types/node@22.8.4): + create-jest@29.7.0(@types/node@22.9.0): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@22.8.4) + jest-config: 29.7.0(@types/node@22.9.0) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -6070,7 +6070,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.5.49: {} + electron-to-chromium@1.5.52: {} emittery@0.13.1: {} @@ -6906,7 +6906,7 @@ snapshots: istanbul-lib-instrument@5.2.1: dependencies: '@babel/core': 7.26.0 - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 6.3.1 @@ -6916,7 +6916,7 @@ snapshots: istanbul-lib-instrument@6.0.3: dependencies: '@babel/core': 7.26.0 - '@babel/parser': 7.26.1 + '@babel/parser': 7.26.2 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 7.6.3 @@ -6962,7 +6962,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3 @@ -6982,16 +6982,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@22.8.4): + jest-cli@29.7.0(@types/node@22.9.0): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@22.8.4) + create-jest: 29.7.0(@types/node@22.9.0) exit: 0.1.2 import-local: 3.2.0 - jest-config: 29.7.0(@types/node@22.8.4) + jest-config: 29.7.0(@types/node@22.9.0) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -7001,7 +7001,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@22.8.4): + jest-config@29.7.0(@types/node@22.9.0): dependencies: '@babel/core': 7.26.0 '@jest/test-sequencer': 29.7.0 @@ -7026,7 +7026,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 22.8.4 + '@types/node': 22.9.0 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -7055,7 +7055,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -7065,7 +7065,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 22.8.4 + '@types/node': 22.9.0 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -7091,7 +7091,7 @@ snapshots: jest-message-util@29.7.0: dependencies: - '@babel/code-frame': 7.26.0 + '@babel/code-frame': 7.26.2 '@jest/types': 29.6.3 '@types/stack-utils': 2.0.3 chalk: 4.1.2 @@ -7104,7 +7104,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -7139,7 +7139,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -7167,7 +7167,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 cjs-module-lexer: 1.4.1 collect-v8-coverage: 1.0.2 @@ -7188,7 +7188,7 @@ snapshots: jest-snapshot@29.7.0: dependencies: '@babel/core': 7.26.0 - '@babel/generator': 7.26.0 + '@babel/generator': 7.26.2 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.26.0) '@babel/types': 7.26.0 @@ -7213,7 +7213,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -7232,7 +7232,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.8.4 + '@types/node': 22.9.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -7241,17 +7241,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 22.8.4 + '@types/node': 22.9.0 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@22.8.4): + jest@29.7.0(@types/node@22.9.0): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@22.8.4) + jest-cli: 29.7.0(@types/node@22.9.0) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -7376,9 +7376,10 @@ snapshots: dependencies: tmpl: 1.0.5 - marked-terminal@7.1.0(marked@12.0.2): + marked-terminal@7.2.1(marked@12.0.2): dependencies: ansi-escapes: 7.0.0 + ansi-regex: 5.0.1 chalk: 5.3.0 cli-highlight: 2.1.11 cli-table3: 0.6.5 @@ -7579,14 +7580,14 @@ snapshots: parse-json@5.2.0: dependencies: - '@babel/code-frame': 7.26.0 + '@babel/code-frame': 7.26.2 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 parse-json@8.1.0: dependencies: - '@babel/code-frame': 7.26.0 + '@babel/code-frame': 7.26.2 index-to-position: 0.1.2 type-fest: 4.26.1 @@ -7781,28 +7782,28 @@ snapshots: dependencies: glob: 7.2.3 - rollup@4.24.3: + rollup@4.24.4: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.24.3 - '@rollup/rollup-android-arm64': 4.24.3 - '@rollup/rollup-darwin-arm64': 4.24.3 - '@rollup/rollup-darwin-x64': 4.24.3 - '@rollup/rollup-freebsd-arm64': 4.24.3 - '@rollup/rollup-freebsd-x64': 4.24.3 - '@rollup/rollup-linux-arm-gnueabihf': 4.24.3 - '@rollup/rollup-linux-arm-musleabihf': 4.24.3 - '@rollup/rollup-linux-arm64-gnu': 4.24.3 - '@rollup/rollup-linux-arm64-musl': 4.24.3 - '@rollup/rollup-linux-powerpc64le-gnu': 4.24.3 - '@rollup/rollup-linux-riscv64-gnu': 4.24.3 - '@rollup/rollup-linux-s390x-gnu': 4.24.3 - '@rollup/rollup-linux-x64-gnu': 4.24.3 - '@rollup/rollup-linux-x64-musl': 4.24.3 - '@rollup/rollup-win32-arm64-msvc': 4.24.3 - '@rollup/rollup-win32-ia32-msvc': 4.24.3 - '@rollup/rollup-win32-x64-msvc': 4.24.3 + '@rollup/rollup-android-arm-eabi': 4.24.4 + '@rollup/rollup-android-arm64': 4.24.4 + '@rollup/rollup-darwin-arm64': 4.24.4 + '@rollup/rollup-darwin-x64': 4.24.4 + '@rollup/rollup-freebsd-arm64': 4.24.4 + '@rollup/rollup-freebsd-x64': 4.24.4 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.4 + '@rollup/rollup-linux-arm-musleabihf': 4.24.4 + '@rollup/rollup-linux-arm64-gnu': 4.24.4 + '@rollup/rollup-linux-arm64-musl': 4.24.4 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.4 + '@rollup/rollup-linux-riscv64-gnu': 4.24.4 + '@rollup/rollup-linux-s390x-gnu': 4.24.4 + '@rollup/rollup-linux-x64-gnu': 4.24.4 + '@rollup/rollup-linux-x64-musl': 4.24.4 + '@rollup/rollup-win32-arm64-msvc': 4.24.4 + '@rollup/rollup-win32-ia32-msvc': 4.24.4 + '@rollup/rollup-win32-x64-msvc': 4.24.4 fsevents: 2.3.3 run-parallel@1.2.0: @@ -7845,7 +7846,7 @@ snapshots: import-from-esm: 1.3.4 lodash-es: 4.17.21 marked: 12.0.2 - marked-terminal: 7.1.0(marked@12.0.2) + marked-terminal: 7.2.1(marked@12.0.2) micromatch: 4.0.8 p-each-series: 3.0.0 p-reduce: 3.0.0 @@ -8059,7 +8060,7 @@ snapshots: synckit@0.9.2: dependencies: '@pkgr/core': 0.1.1 - tslib: 2.8.0 + tslib: 2.8.1 temp-dir@3.0.0: {} @@ -8116,7 +8117,7 @@ snapshots: tree-kill@1.2.2: {} - ts-api-utils@1.3.0(typescript@5.6.3): + ts-api-utils@1.4.0(typescript@5.6.3): dependencies: typescript: 5.6.3 @@ -8129,7 +8130,7 @@ snapshots: minimist: 1.2.8 strip-bom: 3.0.0 - tslib@2.8.0: {} + tslib@2.8.1: {} tsup@8.3.5(tsx@4.19.2)(typescript@5.6.3)(yaml@2.4.5): dependencies: @@ -8143,7 +8144,7 @@ snapshots: picocolors: 1.1.1 postcss-load-config: 6.0.1(tsx@4.19.2)(yaml@2.4.5) resolve-from: 5.0.0 - rollup: 4.24.3 + rollup: 4.24.4 source-map: 0.8.0-beta.0 sucrase: 3.35.0 tinyexec: 0.3.1 diff --git a/specs/error.spec.ts b/specs/error.spec.ts index bb0fb34a..6dc26a53 100644 --- a/specs/error.spec.ts +++ b/specs/error.spec.ts @@ -1,5 +1,5 @@ -import { CommerceLayerClient } from '../src' +import { CommerceLayerClient, ErrorObj } from '../src' import { ErrorType } from '../src/error' import { getClient } from '../test/common' @@ -9,6 +9,8 @@ let cl: CommerceLayerClient beforeAll(async () => { cl = await getClient({}) }) +afterAll(() => { cl.removeInterceptors() }) + describe('SDK:error suite', () => { @@ -40,4 +42,28 @@ describe('SDK:error suite', () => { } }) + + it('ErrorInterceptor.response', async () => { + + cl = await getClient({}) + + let interceptor = false + + cl.addResponseInterceptor(undefined, (error: ErrorObj): ErrorObj => { + expect(error).toBeDefined() + expect(error.request).toBeDefined() + expect(error.request?.method).toBe('POST') + interceptor = true + return error + }) + + try { + await cl.customers.create({ email: '' }) + } catch (error) { + expect(error.type).toBe(ErrorType.RESPONSE) + expect(interceptor).toBeTruthy() + } + + }) + }) diff --git a/specs/resources/markets.spec.ts b/specs/resources/markets.spec.ts index e82075fb..0842f5a0 100644 --- a/specs/resources/markets.spec.ts +++ b/specs/resources/markets.spec.ts @@ -375,6 +375,27 @@ describe('Markets resource', () => { /* relationship.geocoder stop */ + /* relationship.stores start */ + it(resourceType + '.stores', async () => { + + const id = TestData.id + const params = { fields: { stores: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'stores') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].stores(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.stores stop */ + + /* relationship.price_list_schedulers start */ it(resourceType + '.price_list_schedulers', async () => { diff --git a/specs/resources/orders.spec.ts b/specs/resources/orders.spec.ts index a5615c9a..d0dbb9ba 100644 --- a/specs/resources/orders.spec.ts +++ b/specs/resources/orders.spec.ts @@ -29,6 +29,7 @@ describe('Orders resource', () => { customer: cl.customers.relationship(TestData.id), shipping_address: cl.addresses.relationship(TestData.id), billing_address: cl.addresses.relationship(TestData.id), + store: cl.stores.relationship(TestData.id), payment_method: cl.payment_methods.relationship(TestData.id), payment_source: cl.adyen_payments.relationship(TestData.id), tags: [ cl.tags.relationship(TestData.id) ], @@ -290,6 +291,27 @@ describe('Orders resource', () => { /* relationship.billing_address stop */ + /* relationship.store start */ + it(resourceType + '.store', async () => { + + const id = TestData.id + const params = { fields: { stores: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'store') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].store(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.store stop */ + + /* relationship.available_payment_methods start */ it(resourceType + '.available_payment_methods', async () => { diff --git a/specs/resources/payment_methods.spec.ts b/specs/resources/payment_methods.spec.ts index d2be15d0..e69780d5 100644 --- a/specs/resources/payment_methods.spec.ts +++ b/specs/resources/payment_methods.spec.ts @@ -29,6 +29,7 @@ describe('PaymentMethods resource', () => { price_amount_cents: randomValue('integer', 'price_amount_cents'), market: cl.markets.relationship(TestData.id), payment_gateway: cl.payment_gateways.relationship(TestData.id), + store: cl.stores.relationship(TestData.id), } const attributes = { ...createAttributes, reference: TestData.reference } @@ -245,6 +246,27 @@ describe('PaymentMethods resource', () => { /* relationship.payment_gateway stop */ + /* relationship.store start */ + it(resourceType + '.store', async () => { + + const id = TestData.id + const params = { fields: { stores: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'store') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].store(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.store stop */ + + /* relationship.attachments start */ it(resourceType + '.attachments', async () => { diff --git a/specs/resources/stock_locations.spec.ts b/specs/resources/stock_locations.spec.ts index 130fb9ee..9678acf7 100644 --- a/specs/resources/stock_locations.spec.ts +++ b/specs/resources/stock_locations.spec.ts @@ -306,6 +306,27 @@ describe('StockLocations resource', () => { /* relationship.stock_transfers stop */ + /* relationship.stores start */ + it(resourceType + '.stores', async () => { + + const id = TestData.id + const params = { fields: { stores: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'stores') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].stores(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.stores stop */ + + /* relationship.attachments start */ it(resourceType + '.attachments', async () => { diff --git a/specs/resources/stores.spec.ts b/specs/resources/stores.spec.ts new file mode 100644 index 00000000..f6aff600 --- /dev/null +++ b/specs/resources/stores.spec.ts @@ -0,0 +1,353 @@ +/** + * ©2024 Commerce Layer Inc. + * Source code generated automatically by SDK codegen + **/ + +import { CommerceLayerClient, Store } from '../../src' +import isEqual from 'lodash.isequal' +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { getClient, TestData, CommonData, handleError, interceptRequest, checkCommon, checkCommonData, checkCommonParamsList, checkCommonParams, currentAccessToken, randomValue } from '../../test/common' + + + +let cl: CommerceLayerClient + + +beforeAll(async () => { cl = await getClient() }) + + +describe('Stores resource', () => { + + const resourceType = 'stores' + + + /* spec.create.start */ + it(resourceType + '.create', async () => { + + const createAttributes = { + name: randomValue('string', 'name'), + market: cl.markets.relationship(TestData.id), + merchant: cl.merchants.relationship(TestData.id), + stock_location: cl.stock_locations.relationship(TestData.id), + } + + const attributes = { ...createAttributes, reference: TestData.reference } + const params = { fields: { [resourceType]: CommonData.paramsFields } } + const resData = attributes + + cl.addRequestInterceptor((request) => { + const data = JSON.parse(String(request.options.body)) + expect(request.options.method).toBe('POST') + checkCommon(request, resourceType) + checkCommonData(data, resourceType, attributes) + expect(cl[resourceType].isStore(data.data)).toBeTruthy() + return interceptRequest() + }) + + await cl[resourceType].create(resData, params, CommonData.options) + .then((res: Store) => expect(res).not.toBeNull()) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* spec.create.stop */ + + + /* spec.retrieve.start */ + it(resourceType + '.retrieve', async () => { + + const id = TestData.id + const params = { fields: {[resourceType]: CommonData.paramsFields } } + + cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken) + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].retrieve(id, params, CommonData.options) + .then((res: Store) => expect(res).not.toBeNull()) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* spec.retrieve.stop */ + + + /* spec.update.start */ + it(resourceType + '.update', async () => { + + const attributes = { reference_origin: TestData.reference_origin, metadata: TestData.metadata } + const params = { fields: { [resourceType]: CommonData.paramsFields } } + const resData = { id: TestData.id, ...attributes} + + cl.addRequestInterceptor((request) => { + const data = JSON.parse(String(request.options.body)) + expect(request.options.method).toBe('PATCH') + checkCommon(request, resourceType, resData.id, currentAccessToken) + checkCommonData(data, resourceType, attributes, resData.id) + return interceptRequest() + }) + + await cl[resourceType].update(resData, params, CommonData.options) + .then((res: Store) => expect(res).not.toBeNull()) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* spec.update.stop */ + + + /* spec.delete.start */ + it(resourceType + '.delete', async () => { + + const id = TestData.id + + cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('DELETE') + checkCommon(request, resourceType, id, currentAccessToken) + return interceptRequest() + }) + + await cl[resourceType].delete(id, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* spec.delete.stop */ + + + /* spec.list.start */ + it(resourceType + '.list', async () => { + + const params = CommonData.paramsList + + cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType) + checkCommonParamsList(request, params) + return interceptRequest() + }) + + await cl[resourceType].list(params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* spec.list.stop */ + + + /* spec.type.start */ + it(resourceType + '.type', async () => { + + const resource = { id: TestData.id, type: resourceType } + expect(cl[resourceType].isStore(resource)).toBeTruthy() + + const type = cl[resourceType].type() + expect(type).toBe(resourceType) + + }) + /* spec.type.stop */ + + + /* spec.relationship.start */ + it(resourceType + '.relationship', async () => { + + const relId = cl[resourceType].relationship(TestData.id) + expect(isEqual(relId, { id: TestData.id, type: resourceType})) + + const relResId = cl[resourceType].relationship({ id: TestData.id, type: resourceType }) + expect(isEqual(relResId, { id: TestData.id, type: resourceType})) + + }) + /* spec.relationship.stop */ + + + /* spec.parse.start */ + /* + it(resourceType + '.parse', async () => { + + const reference = 'myReferenceId' + + const payload = ` + { + "data": { + "id": "AbcdEfgHiL", + "meta": { + "mode": "test", + "organization_id": "myOrgId" + }, + "type": "${resourceType}", + "links": { + "self": "https://sdk-test-org.commercelayer.io/api/${resourceType}/AbcdEfgHiL" + }, + "attributes": { + "metadata": {}, + "reference": "${reference}", + "created_at": "2023-10-01T05:53:29.296Z", + "updated_at": "2023-10-10T08:52:13.251Z" + } + } + } + ` + + const res = cl[resourceType].parse(payload) as Store + + expect(res.type).toBe(resourceType) + expect(res.reference).toBe(reference) + + }) + */ + /* spec.parse.stop */ + + + + /* relationship.market start */ + it(resourceType + '.market', async () => { + + const id = TestData.id + const params = { fields: { markets: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'market') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].market(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.market stop */ + + + /* relationship.merchant start */ + it(resourceType + '.merchant', async () => { + + const id = TestData.id + const params = { fields: { merchants: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'merchant') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].merchant(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.merchant stop */ + + + /* relationship.stock_location start */ + it(resourceType + '.stock_location', async () => { + + const id = TestData.id + const params = { fields: { stock_locations: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'stock_location') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].stock_location(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.stock_location stop */ + + + /* relationship.orders start */ + it(resourceType + '.orders', async () => { + + const id = TestData.id + const params = { fields: { orders: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'orders') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].orders(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.orders stop */ + + + /* relationship.payment_methods start */ + it(resourceType + '.payment_methods', async () => { + + const id = TestData.id + const params = { fields: { payment_methods: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'payment_methods') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].payment_methods(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.payment_methods stop */ + + + /* relationship.events start */ + it(resourceType + '.events', async () => { + + const id = TestData.id + const params = { fields: { events: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'events') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].events(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.events stop */ + + + /* relationship.versions start */ + it(resourceType + '.versions', async () => { + + const id = TestData.id + const params = { fields: { versions: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'versions') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].versions(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.versions stop */ + + +}) diff --git a/src/api.ts b/src/api.ts index abda8ae3..b66d62b9 100644 --- a/src/api.ts +++ b/src/api.ts @@ -118,6 +118,7 @@ export { default as StockLineItems } from './resources/stock_line_items' export { default as StockLocations } from './resources/stock_locations' export { default as StockReservations } from './resources/stock_reservations' export { default as StockTransfers } from './resources/stock_transfers' +export { default as Stores } from './resources/stores' export { default as StripeGateways } from './resources/stripe_gateways' export { default as StripePayments } from './resources/stripe_payments' export { default as SubscriptionModels } from './resources/subscription_models' @@ -246,6 +247,7 @@ export type ResourceTypeLock = | 'stock_locations' | 'stock_reservations' | 'stock_transfers' +| 'stores' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' @@ -374,6 +376,7 @@ export const resourceList = [ 'stock_locations', 'stock_reservations', 'stock_transfers', + 'stores', 'stripe_gateways', 'stripe_payments', 'subscription_models', @@ -532,6 +535,7 @@ export type CreatableResourceType = | 'stock_locations' | 'stock_reservations' | 'stock_transfers' +| 'stores' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' @@ -649,6 +653,7 @@ export type UpdatableResourceType = | 'stock_locations' | 'stock_reservations' | 'stock_transfers' +| 'stores' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' @@ -763,6 +768,7 @@ export type DeletableResourceType = | 'stock_locations' | 'stock_reservations' | 'stock_transfers' +| 'stores' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' @@ -902,6 +908,7 @@ export type VersionableResourceType = | 'stock_line_items' | 'stock_locations' | 'stock_transfers' +| 'stores' | 'stripe_gateways' | 'stripe_payments' | 'tax_calculators' @@ -1033,6 +1040,7 @@ export type ResourceFields = { stock_locations: models.StockLocation, stock_reservations: models.StockReservation, stock_transfers: models.StockTransfer, + stores: models.Store, stripe_gateways: models.StripeGateway, stripe_payments: models.StripePayment, subscription_models: models.SubscriptionModel, @@ -1162,6 +1170,7 @@ export type ResourceSortFields = { stock_locations: models.StockLocationSort, stock_reservations: models.StockReservationSort, stock_transfers: models.StockTransferSort, + stores: models.StoreSort, stripe_gateways: models.StripeGatewaySort, stripe_payments: models.StripePaymentSort, subscription_models: models.SubscriptionModelSort, diff --git a/src/commercelayer.ts b/src/commercelayer.ts index 938e8a7e..c2e308da 100644 --- a/src/commercelayer.ts +++ b/src/commercelayer.ts @@ -12,7 +12,7 @@ const debug = Debug('commercelayer') // Autogenerated schema version number, do not remove this line -const OPEN_API_SCHEMA_VERSION = '7.3.1' +const OPEN_API_SCHEMA_VERSION = '7.4.0' export { OPEN_API_SCHEMA_VERSION } @@ -146,6 +146,7 @@ class CommerceLayerClient { #stock_locations?: api.StockLocations #stock_reservations?: api.StockReservations #stock_transfers?: api.StockTransfers + #stores?: api.Stores #stripe_gateways?: api.StripeGateways #stripe_payments?: api.StripePayments #subscription_models?: api.SubscriptionModels @@ -294,6 +295,7 @@ class CommerceLayerClient { get stock_locations(): api.StockLocations { return this.#stock_locations || (this.#stock_locations = new api.StockLocations(this.#adapter)) } get stock_reservations(): api.StockReservations { return this.#stock_reservations || (this.#stock_reservations = new api.StockReservations(this.#adapter)) } get stock_transfers(): api.StockTransfers { return this.#stock_transfers || (this.#stock_transfers = new api.StockTransfers(this.#adapter)) } + get stores(): api.Stores { return this.#stores || (this.#stores = new api.Stores(this.#adapter)) } get stripe_gateways(): api.StripeGateways { return this.#stripe_gateways || (this.#stripe_gateways = new api.StripeGateways(this.#adapter)) } get stripe_payments(): api.StripePayments { return this.#stripe_payments || (this.#stripe_payments = new api.StripePayments(this.#adapter)) } get subscription_models(): api.SubscriptionModels { return this.#subscription_models || (this.#subscription_models = new api.SubscriptionModels(this.#adapter)) } diff --git a/src/fetch.ts b/src/fetch.ts index 762539e1..58527f84 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -26,12 +26,14 @@ export class FetchError extends Error { readonly #errors?: any[] readonly #status: number readonly #statusText: string + readonly #request?: Partial - constructor(status: number, statusText: string, body?: any) { + constructor(status: number, statusText: string, body?: any, request?: FetchRequestOptions) { super(statusText) this.#status = status this.#statusText = statusText if (body) this.#errors = body.errors + if (request) this.#request = request } @@ -41,6 +43,8 @@ export class FetchError extends Error { get statusText(): string { return this.#statusText } + get request(): Partial | undefined { return this.#request } + } @@ -75,7 +79,7 @@ export const fetchURL = async (url: URL, requestOptions: FetchRequestOptions, cl : undefined if (!response.ok) { - let error = new FetchError(response.status, response.statusText, responseBody) + let error = new FetchError(response.status, response.statusText, responseBody, requestOptions) if (interceptors?.response?.onFailure) error = await interceptors.response.onFailure(error) if (error) throw error } diff --git a/src/model.ts b/src/model.ts index 0aca949c..fd736211 100644 --- a/src/model.ts +++ b/src/model.ts @@ -114,6 +114,7 @@ export type { StockLineItem, StockLineItemCreate, StockLineItemUpdate, StockLine export type { StockLocation, StockLocationCreate, StockLocationUpdate, StockLocationSort } from './resources/stock_locations' export type { StockReservation, StockReservationCreate, StockReservationUpdate, StockReservationSort } from './resources/stock_reservations' export type { StockTransfer, StockTransferCreate, StockTransferUpdate, StockTransferSort } from './resources/stock_transfers' +export type { Store, StoreCreate, StoreUpdate, StoreSort } from './resources/stores' export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate, StripeGatewaySort } from './resources/stripe_gateways' export type { StripePayment, StripePaymentCreate, StripePaymentUpdate, StripePaymentSort } from './resources/stripe_payments' export type { SubscriptionModel, SubscriptionModelCreate, SubscriptionModelUpdate, SubscriptionModelSort } from './resources/subscription_models' diff --git a/src/resources/line_items.ts b/src/resources/line_items.ts index 83f5e1cc..6f342eff 100644 --- a/src/resources/line_items.ts +++ b/src/resources/line_items.ts @@ -46,8 +46,8 @@ type FlexPromotionRel = ResourceRel & { type: FlexPromotionType } type TagRel = ResourceRel & { type: TagType } -export type LineItemSort = Pick & ResourceSort -// export type LineItemFilter = Pick & ResourceFilter +export type LineItemSort = Pick & ResourceSort +// export type LineItemFilter = Pick & ResourceFilter interface LineItem extends Resource { diff --git a/src/resources/markets.ts b/src/resources/markets.ts index ec3a592a..84c5468f 100644 --- a/src/resources/markets.ts +++ b/src/resources/markets.ts @@ -9,6 +9,7 @@ import type { SubscriptionModel, SubscriptionModelType } from './subscription_mo import type { TaxCalculator } from './tax_calculators' import type { CustomerGroup, CustomerGroupType } from './customer_groups' import type { Geocoder, GeocoderType } from './geocoders' +import type { Store } from './stores' import type { PriceListScheduler } from './price_list_schedulers' import type { Attachment } from './attachments' import type { Version } from './versions' @@ -104,6 +105,7 @@ interface Market extends Resource { tax_calculator?: AvalaraAccount | TaxjarAccount | ManualTaxCalculator | ExternalTaxCalculator | null customer_group?: CustomerGroup | null geocoder?: Geocoder | null + stores?: Store[] | null price_list_schedulers?: PriceListScheduler[] | null attachments?: Attachment[] | null versions?: Version[] | null @@ -285,6 +287,11 @@ class Markets extends ApiResource { return this.resources.fetch({ type: 'geocoders' }, `markets/${_marketId}/geocoder`, params, options) as unknown as Geocoder } + async stores(marketId: string | Market, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _marketId = (marketId as Market).id || marketId as string + return this.resources.fetch({ type: 'stores' }, `markets/${_marketId}/stores`, params, options) as unknown as ListResponse + } + async price_list_schedulers(marketId: string | Market, params?: QueryParamsList, options?: ResourcesConfig): Promise> { const _marketId = (marketId as Market).id || marketId as string return this.resources.fetch({ type: 'price_list_schedulers' }, `markets/${_marketId}/price_list_schedulers`, params, options) as unknown as ListResponse diff --git a/src/resources/orders.ts b/src/resources/orders.ts index ec111285..699930e8 100644 --- a/src/resources/orders.ts +++ b/src/resources/orders.ts @@ -5,6 +5,7 @@ import type { QueryParamsRetrieve, QueryParamsList } from '../query' import type { Market, MarketType } from './markets' import type { Customer, CustomerType } from './customers' import type { Address, AddressType } from './addresses' +import type { Store, StoreType } from './stores' import type { PaymentMethod, PaymentMethodType } from './payment_methods' import type { CustomerPaymentSource } from './customer_payment_sources' import type { Sku } from './skus' @@ -48,6 +49,7 @@ type OrderRel = ResourceRel & { type: OrderType } type MarketRel = ResourceRel & { type: MarketType } type CustomerRel = ResourceRel & { type: CustomerType } type AddressRel = ResourceRel & { type: AddressType } +type StoreRel = ResourceRel & { type: StoreType } type PaymentMethodRel = ResourceRel & { type: PaymentMethodType } type AdyenPaymentRel = ResourceRel & { type: AdyenPaymentType } type AxervePaymentRel = ResourceRel & { type: AxervePaymentType } @@ -606,6 +608,7 @@ interface Order extends Resource { customer?: Customer | null shipping_address?: Address | null billing_address?: Address | null + store?: Store | null available_payment_methods?: PaymentMethod[] | null available_customer_payment_sources?: CustomerPaymentSource[] | null available_free_skus?: Sku[] | null @@ -741,6 +744,7 @@ interface OrderCreate extends ResourceCreate { customer?: CustomerRel | null shipping_address?: AddressRel | null billing_address?: AddressRel | null + store?: StoreRel | null payment_method?: PaymentMethodRel | null payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel | null tags?: TagRel[] | null @@ -998,6 +1002,7 @@ interface OrderUpdate extends ResourceUpdate { customer?: CustomerRel | null shipping_address?: AddressRel | null billing_address?: AddressRel | null + store?: StoreRel | null payment_method?: PaymentMethodRel | null payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel | null tags?: TagRel[] | null @@ -1041,6 +1046,11 @@ class Orders extends ApiResource { return this.resources.fetch
({ type: 'addresses' }, `orders/${_orderId}/billing_address`, params, options) as unknown as Address } + async store(orderId: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + const _orderId = (orderId as Order).id || orderId as string + return this.resources.fetch({ type: 'stores' }, `orders/${_orderId}/store`, params, options) as unknown as Store + } + async available_payment_methods(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise> { const _orderId = (orderId as Order).id || orderId as string return this.resources.fetch({ type: 'payment_methods' }, `orders/${_orderId}/available_payment_methods`, params, options) as unknown as ListResponse diff --git a/src/resources/organization.ts b/src/resources/organization.ts index b3f72464..6af1a58c 100644 --- a/src/resources/organization.ts +++ b/src/resources/organization.ts @@ -80,6 +80,10 @@ interface Organization extends Resource { * Enables the rules engine for flex promotions and price list rules. */ api_rules_engine?: boolean | null + /** + * Enables the purge of cached single resources when list is purged. + */ + api_purge_single_resource?: boolean | null /** * Indicates if the phone attribute is required for addresses, default is true. * @example ```"true"``` @@ -148,6 +152,11 @@ interface Organization extends Resource { * @example ```"10"``` */ imports_max_concurrent_count?: number | null + /** + * Enables purging of cached resources upon succeeded imports. + * @example ```"true"``` + */ + imports_purge_cache?: boolean | null /** * The maximum number of active concurrent promotions allowed for your organization, default is 10. * @example ```"10"``` diff --git a/src/resources/payment_methods.ts b/src/resources/payment_methods.ts index a43e4449..151c88be 100644 --- a/src/resources/payment_methods.ts +++ b/src/resources/payment_methods.ts @@ -4,6 +4,7 @@ import type { QueryParamsRetrieve, QueryParamsList } from '../query' import type { Market, MarketType } from './markets' import type { PaymentGateway, PaymentGatewayType } from './payment_gateways' +import type { Store, StoreType } from './stores' import type { Attachment } from './attachments' import type { Version } from './versions' @@ -12,6 +13,7 @@ type PaymentMethodType = 'payment_methods' type PaymentMethodRel = ResourceRel & { type: PaymentMethodType } type MarketRel = ResourceRel & { type: MarketType } type PaymentGatewayRel = ResourceRel & { type: PaymentGatewayType } +type StoreRel = ResourceRel & { type: StoreType } export type PaymentMethodSort = Pick & ResourceSort @@ -89,6 +91,7 @@ interface PaymentMethod extends Resource { market?: Market | null payment_gateway?: PaymentGateway | null + store?: Store | null attachments?: Attachment[] | null versions?: Version[] | null @@ -151,6 +154,7 @@ interface PaymentMethodCreate extends ResourceCreate { market?: MarketRel | null payment_gateway: PaymentGatewayRel + store?: StoreRel | null } @@ -211,6 +215,7 @@ interface PaymentMethodUpdate extends ResourceUpdate { market?: MarketRel | null payment_gateway?: PaymentGatewayRel | null + store?: StoreRel | null } @@ -241,6 +246,11 @@ class PaymentMethods extends ApiResource { return this.resources.fetch({ type: 'payment_gateways' }, `payment_methods/${_paymentMethodId}/payment_gateway`, params, options) as unknown as PaymentGateway } + async store(paymentMethodId: string | PaymentMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + const _paymentMethodId = (paymentMethodId as PaymentMethod).id || paymentMethodId as string + return this.resources.fetch({ type: 'stores' }, `payment_methods/${_paymentMethodId}/store`, params, options) as unknown as Store + } + async attachments(paymentMethodId: string | PaymentMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise> { const _paymentMethodId = (paymentMethodId as PaymentMethod).id || paymentMethodId as string return this.resources.fetch({ type: 'attachments' }, `payment_methods/${_paymentMethodId}/attachments`, params, options) as unknown as ListResponse diff --git a/src/resources/stock_locations.ts b/src/resources/stock_locations.ts index d08c1052..02be6603 100644 --- a/src/resources/stock_locations.ts +++ b/src/resources/stock_locations.ts @@ -7,6 +7,7 @@ import type { InventoryStockLocation } from './inventory_stock_locations' import type { InventoryReturnLocation } from './inventory_return_locations' import type { StockItem } from './stock_items' import type { StockTransfer } from './stock_transfers' +import type { Store } from './stores' import type { Attachment } from './attachments' import type { Version } from './versions' @@ -54,6 +55,7 @@ interface StockLocation extends Resource { inventory_return_locations?: InventoryReturnLocation[] | null stock_items?: StockItem[] | null stock_transfers?: StockTransfer[] | null + stores?: Store[] | null attachments?: Attachment[] | null versions?: Version[] | null @@ -155,6 +157,11 @@ class StockLocations extends ApiResource { return this.resources.fetch({ type: 'stock_transfers' }, `stock_locations/${_stockLocationId}/stock_transfers`, params, options) as unknown as ListResponse } + async stores(stockLocationId: string | StockLocation, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _stockLocationId = (stockLocationId as StockLocation).id || stockLocationId as string + return this.resources.fetch({ type: 'stores' }, `stock_locations/${_stockLocationId}/stores`, params, options) as unknown as ListResponse + } + async attachments(stockLocationId: string | StockLocation, params?: QueryParamsList, options?: ResourcesConfig): Promise> { const _stockLocationId = (stockLocationId as StockLocation).id || stockLocationId as string return this.resources.fetch({ type: 'attachments' }, `stock_locations/${_stockLocationId}/attachments`, params, options) as unknown as ListResponse diff --git a/src/resources/stores.ts b/src/resources/stores.ts new file mode 100644 index 00000000..951d2457 --- /dev/null +++ b/src/resources/stores.ts @@ -0,0 +1,166 @@ +import { ApiResource } from '../resource' +import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse, ResourceSort, /* ResourceFilter */ } from '../resource' +import type { QueryParamsRetrieve, QueryParamsList } from '../query' + +import type { Market, MarketType } from './markets' +import type { Merchant, MerchantType } from './merchants' +import type { StockLocation, StockLocationType } from './stock_locations' +import type { Order } from './orders' +import type { PaymentMethod } from './payment_methods' +import type { Event } from './events' +import type { Version } from './versions' + + +type StoreType = 'stores' +type StoreRel = ResourceRel & { type: StoreType } +type MarketRel = ResourceRel & { type: MarketType } +type MerchantRel = ResourceRel & { type: MerchantType } +type StockLocationRel = ResourceRel & { type: StockLocationType } + + +export type StoreSort = Pick & ResourceSort +// export type StoreFilter = Pick & ResourceFilter + + +interface Store extends Resource { + + readonly type: StoreType + + /** + * The store's internal name. + * @example ```"Rome Shop"``` + */ + name: string + /** + * A string that you can use to identify the store (must be unique within the environment). + * @example ```"europe1"``` + */ + code?: string | null + + market?: Market | null + merchant?: Merchant | null + stock_location?: StockLocation | null + orders?: Order[] | null + payment_methods?: PaymentMethod[] | null + events?: Event[] | null + versions?: Version[] | null + +} + + +interface StoreCreate extends ResourceCreate { + + /** + * The store's internal name. + * @example ```"Rome Shop"``` + */ + name: string + /** + * A string that you can use to identify the store (must be unique within the environment). + * @example ```"europe1"``` + */ + code?: string | null + + market: MarketRel + merchant?: MerchantRel | null + stock_location?: StockLocationRel | null + +} + + +interface StoreUpdate extends ResourceUpdate { + + /** + * The store's internal name. + * @example ```"Rome Shop"``` + */ + name?: string | null + /** + * A string that you can use to identify the store (must be unique within the environment). + * @example ```"europe1"``` + */ + code?: string | null + + market?: MarketRel | null + merchant?: MerchantRel | null + stock_location?: StockLocationRel | null + +} + + +class Stores extends ApiResource { + + static readonly TYPE: StoreType = 'stores' as const + + async create(resource: StoreCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.create({ ...resource, type: Stores.TYPE }, params, options) + } + + async update(resource: StoreUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.update({ ...resource, type: Stores.TYPE }, params, options) + } + + async delete(id: string | ResourceId, options?: ResourcesConfig): Promise { + await this.resources.delete((typeof id === 'string')? { id, type: Stores.TYPE } : id, options) + } + + async market(storeId: string | Store, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'markets' }, `stores/${_storeId}/market`, params, options) as unknown as Market + } + + async merchant(storeId: string | Store, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'merchants' }, `stores/${_storeId}/merchant`, params, options) as unknown as Merchant + } + + async stock_location(storeId: string | Store, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'stock_locations' }, `stores/${_storeId}/stock_location`, params, options) as unknown as StockLocation + } + + async orders(storeId: string | Store, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'orders' }, `stores/${_storeId}/orders`, params, options) as unknown as ListResponse + } + + async payment_methods(storeId: string | Store, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'payment_methods' }, `stores/${_storeId}/payment_methods`, params, options) as unknown as ListResponse + } + + async events(storeId: string | Store, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'events' }, `stores/${_storeId}/events`, params, options) as unknown as ListResponse + } + + async versions(storeId: string | Store, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _storeId = (storeId as Store).id || storeId as string + return this.resources.fetch({ type: 'versions' }, `stores/${_storeId}/versions`, params, options) as unknown as ListResponse + } + + + isStore(resource: any): resource is Store { + return resource.type && (resource.type === Stores.TYPE) + } + + + relationship(id: string | ResourceId | null): StoreRel { + return super.relationshipOneToOne(id) + } + + relationshipToMany(...ids: string[]): StoreRel[] { + return super.relationshipOneToMany(...ids) + } + + + type(): StoreType { + return Stores.TYPE + } + +} + + +export default Stores + +export type { Store, StoreCreate, StoreUpdate, StoreType }