Files
medusa-store/www/apps/docs/content/references/medusa/classes/medusa.AbstractCartCompletionStrategy.mdx
Shahed Nasser 892d737c1f docs: enhance how references are generated (#5805)
* adjusted configurations

* enhancements to tool and configurations

* change reference in docs

* fixed issue in workflows reference

* added project name

* more optimizations

* fix context error

* added a types reference

* resolved missing types

* fix reference reflection types not having children

* add an expand url parameter

* added new option to the README

* added details about new option
2023-12-05 15:29:41 +02:00

521 lines
12 KiB
Plaintext

---
displayed_sidebar: homepage
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# AbstractCartCompletionStrategy
## constructor
### Parameters
<ParameterTypes parameters={[
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__configModule__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
___
## Properties
<ParameterTypes parameters={[
{
"name": "__configModule__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
___
## Accessors
### activeManager\_
#### Returns
<ParameterTypes parameters={[
{
"name": "EntityManager",
"type": "`EntityManager`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
## Methods
### atomicPhase\_
Wraps some work within a transactional block. If the service already has
a transaction manager attached this will be reused, otherwise a new
transaction manager is created.
#### Type Parameters
<ParameterTypes parameters={[
{
"name": "TResult",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "TError",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Parameters
<ParameterTypes parameters={[
{
"name": "work",
"type": "(`transactionManager`: `EntityManager`) => Promise&#60;TResult&#62;",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;TResult&#62;",
"optional": false,
"defaultValue": "",
"description": "the result of the transactional work",
"expandable": false,
"children": [
{
"name": "TResult",
"type": "`TResult`",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### complete
Takes a cart id and completes the cart. This for example takes place when
creating an order or confirming a swap.
#### Parameters
<ParameterTypes parameters={[
{
"name": "cartId",
"type": "`string`",
"description": "the id of the Cart to complete.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "idempotencyKey",
"type": "[IdempotencyKey](../../entities/classes/entities.IdempotencyKey.mdx)",
"description": "Idempotency Key is used to continue a process in case of any failure that might occur.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "created_at",
"type": "`Date`",
"description": "Date which the idempotency key was locked.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The idempotency key's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "idempotency_key",
"type": "`string`",
"description": "The unique randomly generated key used to determine the state of a process.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "locked_at",
"type": "`Date`",
"description": "Date which the idempotency key was locked.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "recovery_point",
"type": "`string`",
"description": "Where to continue from.",
"optional": false,
"defaultValue": "started",
"expandable": false,
"children": []
},
{
"name": "request_method",
"type": "`string`",
"description": "The method of the request",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "request_params",
"type": "`Record<string, unknown>`",
"description": "The parameters passed to the request",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "request_path",
"type": "`string`",
"description": "The request's path",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "response_body",
"type": "`Record<string, unknown>`",
"description": "The response's body",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "response_code",
"type": "`number`",
"description": "The response's code.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "context",
"type": "[RequestContext](../types/medusa.RequestContext.mdx)",
"description": "the request context for the completion request",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ip",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
#### Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[CartCompletionResponse](../types/medusa.CartCompletionResponse.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "the response for the completion request",
"expandable": false,
"children": [
{
"name": "CartCompletionResponse",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
___
### shouldRetryTransaction\_
#### Parameters
<ParameterTypes parameters={[
{
"name": "err",
"type": "`Record<string, unknown>` \\| `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
#### Returns
<ParameterTypes parameters={[
{
"name": "boolean",
"type": "`boolean`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### withTransaction
#### Parameters
<ParameterTypes parameters={[
{
"name": "transactionManager",
"type": "`EntityManager`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>
#### Returns
<ParameterTypes parameters={[
{
"name": "constructor",
"type": "(`__container__`: `any`, `__configModule__?`: `Record<string, unknown>`, `__moduleDeclaration__?`: `Record<string, unknown>`) => [AbstractCartCompletionStrategy](medusa.AbstractCartCompletionStrategy.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__configModule__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record<string, unknown>`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "activeManager_",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "atomicPhase_",
"type": "`<TResult, TError>`(`work`: (`transactionManager`: `EntityManager`) => Promise&#60;TResult&#62;, `isolationOrErrorHandler?`: `IsolationLevel` \\| (`error`: `TError`) => Promise&#60;void \\| TResult&#62;, `maybeErrorHandlerOrDontFail?`: (`error`: `TError`) => Promise&#60;void \\| TResult&#62;) => Promise&#60;TResult&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "complete",
"type": "(`cartId`: `string`, `idempotencyKey`: [IdempotencyKey](../../entities/classes/entities.IdempotencyKey.mdx), `context`: [RequestContext](../types/medusa.RequestContext.mdx)) => Promise&#60;[CartCompletionResponse](../types/medusa.CartCompletionResponse.mdx)&#62;",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "shouldRetryTransaction_",
"type": "(`err`: `Record<string, unknown>` \\| ``{ code: string }``) => `boolean`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withTransaction",
"type": "(`transactionManager?`: `EntityManager`) => [AbstractCartCompletionStrategy](medusa.AbstractCartCompletionStrategy.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />