chore: add 202 to finalize
This commit is contained in:
@@ -11749,6 +11749,18 @@ paths:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
"202":
|
||||
description: Accepted. Autumn is experiencing degraded service from a downstream
|
||||
provider, so the finalize request was allowed fail-open.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
x-speakeasy-name-override: finalize
|
||||
parameters:
|
||||
- name: x-api-version
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 05940b80-1ef8-40f4-9878-822fb2792070
|
||||
management:
|
||||
docChecksum: 71f79714d53e08866fb358e107703e46
|
||||
docChecksum: 3b0105075304498181ec21487da5dde1
|
||||
docVersion: 2.2.0
|
||||
speakeasyVersion: 1.718.0
|
||||
generationVersion: 2.824.1
|
||||
releaseVersion: 0.4.18
|
||||
configChecksum: 2263d20254e354a1792248274002f650
|
||||
persistentEdits:
|
||||
generation_id: 71c5c2a6-fc87-4ba8-8fef-e3c454b1c28b
|
||||
pristine_commit_hash: 78c5e7adf5a1da77bd61e73764294164bce8adc0
|
||||
pristine_tree_hash: 107415c12473f68b45cf8f59cc8b9f3dffd9194f
|
||||
generation_id: d616998f-b2f5-4063-9d50-d20bc25f9662
|
||||
pristine_commit_hash: 53175f3eeab520ce59b5ae996858dee9866ee954
|
||||
pristine_tree_hash: 8df2c620f7f06898196bbc902cc1691a96e2652f
|
||||
features:
|
||||
python:
|
||||
additionalDependencies: 1.0.0
|
||||
@@ -1073,8 +1073,16 @@ trackedFiles:
|
||||
pristine_git_object: ca4aaf9dd339a4c939bc50a3f5d48eb3642061b0
|
||||
docs/models/finalizelockresponse.md:
|
||||
id: 6c912a11f195
|
||||
last_write_checksum: sha1:24fad6be1b587d550d69d76547bd6647616ce7be
|
||||
pristine_git_object: 08a61e80ffd6f6c17caade17602049e3492420eb
|
||||
last_write_checksum: sha1:0b7e0d997d02ee7200708c953534b3895f8b2439
|
||||
pristine_git_object: f8139e4adf9f926941c5fe7a29289bc2a212006b
|
||||
docs/models/finalizelockresponsebody1.md:
|
||||
id: 9fc51a4a7450
|
||||
last_write_checksum: sha1:8b14246caf7e8a71b26f1eeccb92d3a7b6f98f41
|
||||
pristine_git_object: 55ef5595a50468b3e804572de617b4f1841f63df
|
||||
docs/models/finalizelockresponsebody2.md:
|
||||
id: 1f63ce3c16b7
|
||||
last_write_checksum: sha1:50a966546322be9fe9ff69501475ab5bcf3a8fd5
|
||||
pristine_git_object: d9f353139f906484151b640e47bad5ea8ecf9973
|
||||
docs/models/flag1.md:
|
||||
id: 56f975d669ad
|
||||
last_write_checksum: sha1:ca496d470e0acdd8df83f3fcee95eca2837ad30c
|
||||
@@ -3209,8 +3217,8 @@ trackedFiles:
|
||||
pristine_git_object: af61685f99a494e0162b7b20f822b514788ac030
|
||||
src/autumn_sdk/balances.py:
|
||||
id: 0a15be654dad
|
||||
last_write_checksum: sha1:edc265ccebf34f6505a500dc0bdf19369d934367
|
||||
pristine_git_object: d78893a6866c975556c16fd01e348c9f423109c6
|
||||
last_write_checksum: sha1:a80cd6dff1eb264c51674962c6d459cf7d692211
|
||||
pristine_git_object: 930c70fbcf914339d9357542673c070deb45655c
|
||||
src/autumn_sdk/basesdk.py:
|
||||
id: 8c9c35fe744d
|
||||
last_write_checksum: sha1:5d6abacbd251bd806538b19ab9662994bbfc6e24
|
||||
@@ -3261,8 +3269,8 @@ trackedFiles:
|
||||
pristine_git_object: 89560b566073785535643e694c112bedbd3db13d
|
||||
src/autumn_sdk/models/__init__.py:
|
||||
id: bcf3802243ff
|
||||
last_write_checksum: sha1:58f56f39e8abefbb428fe99471201df322ec4c59
|
||||
pristine_git_object: 10c040b0097c3e535674e6a721c1c8e37ae6981e
|
||||
last_write_checksum: sha1:283dc100a4d02f2181cbbfbe59a2596648741797
|
||||
pristine_git_object: 07cdf6f58561dcb4bd13fbf45ca9aeff908f21cc
|
||||
src/autumn_sdk/models/aggregateeventsop.py:
|
||||
id: 01321099f2a5
|
||||
last_write_checksum: sha1:b564f4727862cbda1387876aa7f0d97a186bce61
|
||||
@@ -3333,8 +3341,8 @@ trackedFiles:
|
||||
pristine_git_object: 8d60176d44a69f0b5d4f152bd7acf52f0e43cfba
|
||||
src/autumn_sdk/models/finalizelockop.py:
|
||||
id: 8ae2484b0916
|
||||
last_write_checksum: sha1:732c896663074ddde0026cd9940c8c24635cfa00
|
||||
pristine_git_object: 7fe4a83808fec9903c805bb9a423e5d0322f726e
|
||||
last_write_checksum: sha1:da32fde7baec50040d07998a2d8ca5fe20cda754
|
||||
pristine_git_object: 173c11aa6e4b9d142a624d93a55e170f8cdbce4e
|
||||
src/autumn_sdk/models/getentityop.py:
|
||||
id: 6a624594b41f
|
||||
last_write_checksum: sha1:92033004473893f5771a262944119bdddc23d497
|
||||
@@ -4062,6 +4070,8 @@ examples:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"success": true}
|
||||
"202":
|
||||
application/json: {"success": true}
|
||||
updateEntity:
|
||||
speakeasy-default-update-entity:
|
||||
parameters:
|
||||
|
||||
@@ -778,7 +778,9 @@ class Balances(BaseSDK):
|
||||
)
|
||||
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(models.FinalizeLockResponse, http_res)
|
||||
return unmarshal_json_response(models.FinalizeLockResponseBody1, http_res)
|
||||
if utils.match_response(http_res, "202", "application/json"):
|
||||
return unmarshal_json_response(models.FinalizeLockResponseBody2, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = utils.stream_to_text(http_res)
|
||||
raise errors.AutumnDefaultError(
|
||||
@@ -877,7 +879,9 @@ class Balances(BaseSDK):
|
||||
)
|
||||
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(models.FinalizeLockResponse, http_res)
|
||||
return unmarshal_json_response(models.FinalizeLockResponseBody1, http_res)
|
||||
if utils.match_response(http_res, "202", "application/json"):
|
||||
return unmarshal_json_response(models.FinalizeLockResponseBody2, http_res)
|
||||
if utils.match_response(http_res, "4XX", "*"):
|
||||
http_res_text = await utils.stream_to_text_async(http_res)
|
||||
raise errors.AutumnDefaultError(
|
||||
|
||||
@@ -527,6 +527,10 @@ if TYPE_CHECKING:
|
||||
FinalizeLockGlobals,
|
||||
FinalizeLockGlobalsTypedDict,
|
||||
FinalizeLockResponse,
|
||||
FinalizeLockResponseBody1,
|
||||
FinalizeLockResponseBody1TypedDict,
|
||||
FinalizeLockResponseBody2,
|
||||
FinalizeLockResponseBody2TypedDict,
|
||||
FinalizeLockResponseTypedDict,
|
||||
)
|
||||
from .getentityop import (
|
||||
@@ -1811,6 +1815,10 @@ __all__ = [
|
||||
"FinalizeLockGlobals",
|
||||
"FinalizeLockGlobalsTypedDict",
|
||||
"FinalizeLockResponse",
|
||||
"FinalizeLockResponseBody1",
|
||||
"FinalizeLockResponseBody1TypedDict",
|
||||
"FinalizeLockResponseBody2",
|
||||
"FinalizeLockResponseBody2TypedDict",
|
||||
"FinalizeLockResponseTypedDict",
|
||||
"Flag1",
|
||||
"Flag1TypedDict",
|
||||
@@ -3172,6 +3180,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"FinalizeLockGlobals": ".finalizelockop",
|
||||
"FinalizeLockGlobalsTypedDict": ".finalizelockop",
|
||||
"FinalizeLockResponse": ".finalizelockop",
|
||||
"FinalizeLockResponseBody1": ".finalizelockop",
|
||||
"FinalizeLockResponseBody1TypedDict": ".finalizelockop",
|
||||
"FinalizeLockResponseBody2": ".finalizelockop",
|
||||
"FinalizeLockResponseBody2TypedDict": ".finalizelockop",
|
||||
"FinalizeLockResponseTypedDict": ".finalizelockop",
|
||||
"GetEntityBillingControls": ".getentityop",
|
||||
"GetEntityBillingControlsTypedDict": ".getentityop",
|
||||
|
||||
@@ -5,8 +5,8 @@ from autumn_sdk.types import BaseModel, UNSET_SENTINEL
|
||||
from autumn_sdk.utils import FieldMetadata, HeaderMetadata
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Any, Dict, Literal, Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
from typing import Any, Dict, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class FinalizeLockGlobalsTypedDict(TypedDict):
|
||||
@@ -85,13 +85,36 @@ class FinalizeBalanceParams(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
class FinalizeLockResponseTypedDict(TypedDict):
|
||||
class FinalizeLockResponseBody2TypedDict(TypedDict):
|
||||
r"""Accepted. Autumn is experiencing degraded service from a downstream provider, so the finalize request was allowed fail-open."""
|
||||
|
||||
success: bool
|
||||
|
||||
|
||||
class FinalizeLockResponseBody2(BaseModel):
|
||||
r"""Accepted. Autumn is experiencing degraded service from a downstream provider, so the finalize request was allowed fail-open."""
|
||||
|
||||
success: bool
|
||||
|
||||
|
||||
class FinalizeLockResponseBody1TypedDict(TypedDict):
|
||||
r"""OK"""
|
||||
|
||||
success: bool
|
||||
|
||||
|
||||
class FinalizeLockResponse(BaseModel):
|
||||
class FinalizeLockResponseBody1(BaseModel):
|
||||
r"""OK"""
|
||||
|
||||
success: bool
|
||||
|
||||
|
||||
FinalizeLockResponseTypedDict = TypeAliasType(
|
||||
"FinalizeLockResponseTypedDict",
|
||||
Union[FinalizeLockResponseBody1TypedDict, FinalizeLockResponseBody2TypedDict],
|
||||
)
|
||||
|
||||
|
||||
FinalizeLockResponse = TypeAliasType(
|
||||
"FinalizeLockResponse", Union[FinalizeLockResponseBody1, FinalizeLockResponseBody2]
|
||||
)
|
||||
|
||||
@@ -10935,6 +10935,18 @@ paths:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
"202":
|
||||
description: Accepted. Autumn is experiencing degraded service from a downstream
|
||||
provider, so the finalize request was allowed fail-open.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
x-speakeasy-name-override: finalize
|
||||
parameters:
|
||||
- *a5
|
||||
|
||||
@@ -11625,6 +11625,18 @@ paths:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
"202":
|
||||
description: Accepted. Autumn is experiencing degraded service from a downstream
|
||||
provider, so the finalize request was allowed fail-open.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
x-speakeasy-name-override: finalize
|
||||
parameters:
|
||||
- *a1
|
||||
|
||||
@@ -16,24 +16,38 @@ import {
|
||||
balancesTrackJsDoc,
|
||||
} from "../jsDocs/balancesJsDocs";
|
||||
|
||||
type SpecWithResponses = {
|
||||
responses?: Record<string, object | undefined>;
|
||||
};
|
||||
|
||||
const withAcceptedResponse = <TSpec extends SpecWithResponses>(
|
||||
spec: TSpec,
|
||||
nameOverride: string,
|
||||
description: string,
|
||||
) => ({
|
||||
...spec,
|
||||
"x-speakeasy-name-override": nameOverride,
|
||||
responses: {
|
||||
...spec.responses,
|
||||
202: {
|
||||
...spec.responses?.["200"],
|
||||
description,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const balancesCheckContract = oc
|
||||
.route({
|
||||
method: "POST",
|
||||
path: "/v1/balances.check",
|
||||
operationId: "check",
|
||||
description: balancesCheckJsDoc,
|
||||
spec: (spec) => ({
|
||||
...spec,
|
||||
"x-speakeasy-name-override": "check",
|
||||
responses: {
|
||||
...spec.responses,
|
||||
202: {
|
||||
...spec.responses?.["200"],
|
||||
description:
|
||||
"Accepted. Autumn is experiencing degraded service from a downstream provider, so access was allowed fail-open.",
|
||||
},
|
||||
},
|
||||
}),
|
||||
spec: (spec) =>
|
||||
withAcceptedResponse(
|
||||
spec,
|
||||
"check",
|
||||
"Accepted. Autumn is experiencing degraded service from a downstream provider, so access was allowed fail-open.",
|
||||
),
|
||||
})
|
||||
.input(
|
||||
ExtCheckParamsSchema.meta({
|
||||
@@ -72,18 +86,12 @@ export const balancesTrackContract = oc
|
||||
path: "/v1/balances.track",
|
||||
operationId: "track",
|
||||
description: balancesTrackJsDoc,
|
||||
spec: (spec) => ({
|
||||
...spec,
|
||||
"x-speakeasy-name-override": "track",
|
||||
responses: {
|
||||
...spec.responses,
|
||||
202: {
|
||||
...spec.responses?.["200"],
|
||||
description:
|
||||
"Accepted. Autumn is experiencing degraded service from a downstream provider, so the event was accepted for replay and will be tracked as soon as the service is restored.",
|
||||
},
|
||||
},
|
||||
}),
|
||||
spec: (spec) =>
|
||||
withAcceptedResponse(
|
||||
spec,
|
||||
"track",
|
||||
"Accepted. Autumn is experiencing degraded service from a downstream provider, so the event was accepted for replay and will be tracked as soon as the service is restored.",
|
||||
),
|
||||
})
|
||||
.input(
|
||||
TrackParamsSchema.meta({
|
||||
@@ -172,10 +180,12 @@ export const balancesFinalizeContract = oc
|
||||
tags: ["balances"],
|
||||
description:
|
||||
"Finalize a previously locked balance. Use 'confirm' to commit the deduction, or 'release' to return the held balance.",
|
||||
spec: (spec) => ({
|
||||
...spec,
|
||||
"x-speakeasy-name-override": "finalize",
|
||||
}),
|
||||
spec: (spec) =>
|
||||
withAcceptedResponse(
|
||||
spec,
|
||||
"finalize",
|
||||
"Accepted. Autumn is experiencing degraded service from a downstream provider, so the finalize request was allowed fail-open.",
|
||||
),
|
||||
})
|
||||
.input(
|
||||
FinalizeLockParamsV0Schema.meta({
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 7b300647-cd76-49e9-bf77-7d1bf5446d66
|
||||
management:
|
||||
docChecksum: 7b041db250cc83cf3e1c834d9f7371f7
|
||||
docChecksum: f77f5b270eb05aabdf92746cfc1c8a1c
|
||||
docVersion: 2.2.0
|
||||
speakeasyVersion: 1.718.0
|
||||
generationVersion: 2.824.1
|
||||
releaseVersion: 0.10.17
|
||||
configChecksum: c6b2bd1231da8dc3af5be7430f3cfbac
|
||||
persistentEdits:
|
||||
generation_id: e8060a07-3993-40fa-8a98-a82f0bf74bb1
|
||||
pristine_commit_hash: a7083484a7071b5087318add6bdeda67285dd0c6
|
||||
pristine_tree_hash: 01836ee29b7ddcf1f471e6e21f35f9d65f5c0ba0
|
||||
generation_id: 9196abe4-3f28-4ec5-9b77-953542676af8
|
||||
pristine_commit_hash: bcfb9f63775d52b1d9b0554611cfdc099a64aa08
|
||||
pristine_tree_hash: df8d840d49d8e9ddec459f9fd029b92beaa6be7f
|
||||
features:
|
||||
typescript:
|
||||
additionalDependencies: 0.1.0
|
||||
@@ -1094,10 +1094,18 @@ trackedFiles:
|
||||
id: 9e46b2266879
|
||||
last_write_checksum: sha1:71ca1201534ec6648233b162a2182853e22c5bf3
|
||||
pristine_git_object: f9b057e603470bb3b10559db649d12276ca9441f
|
||||
docs/models/finalize-lock-response-body1.md:
|
||||
id: a26657e9fc9b
|
||||
last_write_checksum: sha1:3ec646f95ff32c26aabe5344be76ba1fd20141a2
|
||||
pristine_git_object: 1ecb12ad7b1f4295d92707205dfd15a638f04c43
|
||||
docs/models/finalize-lock-response-body2.md:
|
||||
id: b6c64f1548c8
|
||||
last_write_checksum: sha1:8cd028fcf2ae8e01308deb5f4f6aa521fb6e5c12
|
||||
pristine_git_object: d8e92965780a197fb88d8d7ffab88683fe6c038c
|
||||
docs/models/finalize-lock-response.md:
|
||||
id: 1d3e59ed6f9f
|
||||
last_write_checksum: sha1:2cb76104cdcfc8523df0b1bee455803d92d1a03d
|
||||
pristine_git_object: 73e853665d84c32272456719c739e803c14f8494
|
||||
last_write_checksum: sha1:228fb911552a0230572611e839dd1d88a67e2f0a
|
||||
pristine_git_object: 1245c94d0e602d8ef227c2b8b806fcb182b038c6
|
||||
docs/models/flag-display1.md:
|
||||
id: 795088cca79e
|
||||
last_write_checksum: sha1:434ec2ae0dac8c5387d8a9d605603fe88000d25f
|
||||
@@ -3228,8 +3236,8 @@ trackedFiles:
|
||||
pristine_git_object: 35150249724d4013c7a9bab5043914c68e294790
|
||||
src/funcs/balances-finalize.ts:
|
||||
id: 0cadf4150802
|
||||
last_write_checksum: sha1:77127694ddec8674a3ba9a52cd67def01e4e28eb
|
||||
pristine_git_object: 3f90ce62bddced2b9a1bde942534a394be7edb33
|
||||
last_write_checksum: sha1:96d985206081d494a4f031b5a225bebc1e8b75d9
|
||||
pristine_git_object: dc348d3d1eaca950c5feda453c43c3d66bb3a0d5
|
||||
src/funcs/balances-update.ts:
|
||||
id: a4d3bafe74f2
|
||||
last_write_checksum: sha1:c179574469056b82c8ab32eb9f8bf64c3c647114
|
||||
@@ -3520,8 +3528,8 @@ trackedFiles:
|
||||
pristine_git_object: fe9f3ba6325264cd07c3735c675e401a5d91a78e
|
||||
src/models/finalize-lock-op.ts:
|
||||
id: 8b7c7048d1dd
|
||||
last_write_checksum: sha1:8f356c8c314ec0f7eda45c765c63393f61b19247
|
||||
pristine_git_object: e32f582176649899148ca6afba2175c75dc7abdf
|
||||
last_write_checksum: sha1:1b4b9e92bcd8ef4c059768b239c8c74c47403abd
|
||||
pristine_git_object: 1bd8afff1e3e103eaa4c4779bc2b6c4142eb9e02
|
||||
src/models/get-entity-op.ts:
|
||||
id: 7932a3cea5c1
|
||||
last_write_checksum: sha1:c53be8c587568ad3abffb5f5ce9276d83b373bfe
|
||||
@@ -4520,6 +4528,8 @@ examples:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"success": true}
|
||||
"202":
|
||||
application/json: {"success": true}
|
||||
updateEntity:
|
||||
speakeasy-default-update-entity:
|
||||
parameters:
|
||||
|
||||
@@ -10669,6 +10669,17 @@ paths:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
"202":
|
||||
description: Accepted. Autumn is experiencing degraded service from a downstream provider, so the finalize request was allowed fail-open.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
required:
|
||||
- success
|
||||
x-speakeasy-name-override: finalize
|
||||
parameters:
|
||||
- *a1
|
||||
|
||||
@@ -2,8 +2,8 @@ speakeasyVersion: 1.718.0
|
||||
sources:
|
||||
Autumn API:
|
||||
sourceNamespace: autumn-api
|
||||
sourceRevisionDigest: sha256:48d0d29f5d454f92a932ab5b2038e24e12d1c67de6373802d1e371d4553c63f0
|
||||
sourceBlobDigest: sha256:7019c1735364681528d8a9d51224980dfd8194c1df00d8d201a9554e5a6b3f82
|
||||
sourceRevisionDigest: sha256:d3d26ba6ab7db3f5a3661985d71d8697e1e812c0848b0f62a1cb7ae4e3c7037f
|
||||
sourceBlobDigest: sha256:dcc11a057d047411aebf667a59812453b3c8dd193d38690a4f17effa0387f8a2
|
||||
tags:
|
||||
- latest
|
||||
- 2.2.0
|
||||
@@ -18,10 +18,10 @@ targets:
|
||||
autumn:
|
||||
source: Autumn API
|
||||
sourceNamespace: autumn-api
|
||||
sourceRevisionDigest: sha256:48d0d29f5d454f92a932ab5b2038e24e12d1c67de6373802d1e371d4553c63f0
|
||||
sourceBlobDigest: sha256:7019c1735364681528d8a9d51224980dfd8194c1df00d8d201a9554e5a6b3f82
|
||||
sourceRevisionDigest: sha256:d3d26ba6ab7db3f5a3661985d71d8697e1e812c0848b0f62a1cb7ae4e3c7037f
|
||||
sourceBlobDigest: sha256:dcc11a057d047411aebf667a59812453b3c8dd193d38690a4f17effa0387f8a2
|
||||
codeSamplesNamespace: autumn-api-typescript-code-samples
|
||||
codeSamplesRevisionDigest: sha256:ed725e6d550745811ba55b8f9abcfd47782d47cfe73d09757a4bbf56b240b6a4
|
||||
codeSamplesRevisionDigest: sha256:b4b23713e8acd5ecf966b63f041b3abfff9dc065afcdeed714c10008bd592ac6
|
||||
autumn-python:
|
||||
source: Autumn API Stripped
|
||||
sourceNamespace: autumn-api-stripped
|
||||
|
||||
@@ -152,6 +152,7 @@ async function $do(
|
||||
| SDKValidationError
|
||||
>(
|
||||
M.json(200, models.FinalizeLockResponse$inboundSchema),
|
||||
M.json(202, models.FinalizeLockResponse$inboundSchema),
|
||||
M.fail("4XX"),
|
||||
M.fail("5XX"),
|
||||
)(response, req);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { safeParse } from "../lib/schemas.js";
|
||||
import { ClosedEnum } from "../types/enums.js";
|
||||
import { Result as SafeParseResult } from "../types/fp.js";
|
||||
import * as types from "../types/primitives.js";
|
||||
import { smartUnion } from "../types/smart-union.js";
|
||||
import { SDKValidationError } from "./sdk-validation-error.js";
|
||||
|
||||
export type FinalizeLockGlobals = {
|
||||
@@ -46,12 +47,23 @@ export type FinalizeBalanceParams = {
|
||||
};
|
||||
|
||||
/**
|
||||
* OK
|
||||
* Accepted. Autumn is experiencing degraded service from a downstream provider, so the finalize request was allowed fail-open.
|
||||
*/
|
||||
export type FinalizeLockResponse = {
|
||||
export type FinalizeLockResponseBody2 = {
|
||||
success: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* OK
|
||||
*/
|
||||
export type FinalizeLockResponseBody1 = {
|
||||
success: boolean;
|
||||
};
|
||||
|
||||
export type FinalizeLockResponse =
|
||||
| FinalizeLockResponseBody1
|
||||
| FinalizeLockResponseBody2;
|
||||
|
||||
/** @internal */
|
||||
export const Action$outboundSchema: z.ZodMiniEnum<typeof Action> = z.enum(
|
||||
Action,
|
||||
@@ -93,13 +105,50 @@ export function finalizeBalanceParamsToJSON(
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const FinalizeLockResponse$inboundSchema: z.ZodMiniType<
|
||||
FinalizeLockResponse,
|
||||
export const FinalizeLockResponseBody2$inboundSchema: z.ZodMiniType<
|
||||
FinalizeLockResponseBody2,
|
||||
unknown
|
||||
> = z.object({
|
||||
success: types.boolean(),
|
||||
});
|
||||
|
||||
export function finalizeLockResponseBody2FromJSON(
|
||||
jsonString: string,
|
||||
): SafeParseResult<FinalizeLockResponseBody2, SDKValidationError> {
|
||||
return safeParse(
|
||||
jsonString,
|
||||
(x) => FinalizeLockResponseBody2$inboundSchema.parse(JSON.parse(x)),
|
||||
`Failed to parse 'FinalizeLockResponseBody2' from JSON`,
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const FinalizeLockResponseBody1$inboundSchema: z.ZodMiniType<
|
||||
FinalizeLockResponseBody1,
|
||||
unknown
|
||||
> = z.object({
|
||||
success: types.boolean(),
|
||||
});
|
||||
|
||||
export function finalizeLockResponseBody1FromJSON(
|
||||
jsonString: string,
|
||||
): SafeParseResult<FinalizeLockResponseBody1, SDKValidationError> {
|
||||
return safeParse(
|
||||
jsonString,
|
||||
(x) => FinalizeLockResponseBody1$inboundSchema.parse(JSON.parse(x)),
|
||||
`Failed to parse 'FinalizeLockResponseBody1' from JSON`,
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export const FinalizeLockResponse$inboundSchema: z.ZodMiniType<
|
||||
FinalizeLockResponse,
|
||||
unknown
|
||||
> = smartUnion([
|
||||
z.lazy(() => FinalizeLockResponseBody1$inboundSchema),
|
||||
z.lazy(() => FinalizeLockResponseBody2$inboundSchema),
|
||||
]);
|
||||
|
||||
export function finalizeLockResponseFromJSON(
|
||||
jsonString: string,
|
||||
): SafeParseResult<FinalizeLockResponse, SDKValidationError> {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { claimLockReceipt } from "@/internal/balances/utils/lock/claimLockReceip
|
||||
import { deleteLockReceipt } from "@/internal/balances/utils/lock/deleteLockReceipt.js";
|
||||
import { fetchLockReceipt } from "@/internal/balances/utils/lock/fetchLockReceipt.js";
|
||||
import { isFullSubjectRolloutEnabled } from "@/internal/misc/rollouts/fullSubjectRolloutUtils.js";
|
||||
import { addToExtraLogs } from "@/utils/logging/addToExtraLogs.js";
|
||||
import { buildFinalizeLockContext } from "./buildFinalizeLockContext.js";
|
||||
import { runFinalizeLockV2 } from "./runFinalizeLockV2.js";
|
||||
import { runRedisFinalizeLock } from "./runRedisFinalizeLock.js";
|
||||
@@ -24,7 +25,13 @@ export const runFinalizeLock = async (args: RunFinalizeLockArgs) => {
|
||||
return withRedisFailOpen({
|
||||
source: "runFinalizeLock",
|
||||
run: () => runFinalizeLockInner(args),
|
||||
fallback: () => ({ success: true }),
|
||||
fallback: () => {
|
||||
addToExtraLogs({
|
||||
ctx: args.ctx,
|
||||
extras: { finalizeLockFailedOpen: true },
|
||||
});
|
||||
return { success: true };
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@ export const handleFinalizeLock = createRoute({
|
||||
const ctx = c.get("ctx");
|
||||
const params = c.req.valid("json");
|
||||
|
||||
return c.json(
|
||||
await runFinalizeLock({
|
||||
ctx,
|
||||
params,
|
||||
}),
|
||||
);
|
||||
const response = await runFinalizeLock({ ctx, params });
|
||||
const status = ctx.extraLogs.finalizeLockFailedOpen ? 202 : 200;
|
||||
|
||||
return c.json(response, status);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import type { ApiCustomerV3 } from "@autumn/shared";
|
||||
import { type ApiCustomerV3, FreeTrialDuration } from "@autumn/shared";
|
||||
import { expectCustomerFeatureCorrect } from "@tests/integration/billing/utils/expectCustomerFeatureCorrect";
|
||||
import { expectCustomerInvoiceCorrect } from "@tests/integration/billing/utils/expectCustomerInvoiceCorrect";
|
||||
import { TestFeature } from "@tests/setup/v2Features";
|
||||
@@ -7,7 +7,6 @@ import { items } from "@tests/utils/fixtures/items";
|
||||
import { products } from "@tests/utils/fixtures/products";
|
||||
import { advanceTestClock } from "@tests/utils/stripeUtils";
|
||||
import { initScenario, s } from "@tests/utils/testInitUtils/initScenario";
|
||||
import { FreeTrialDuration } from "autumn-js";
|
||||
import chalk from "chalk";
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user