chore(plugin-stripe): enable TypeScript strict (#12303)
This commit is contained in:
@@ -61,7 +61,7 @@ export const createNewInStripe: CollectionBeforeValidateHookWithArgs = async (ar
|
||||
syncedFields = deepen(syncedFields)
|
||||
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(pluginConfig.stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
const stripe = new Stripe(pluginConfig?.stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
|
||||
if (operation === 'update') {
|
||||
if (logs) {
|
||||
|
||||
@@ -40,7 +40,7 @@ export const deleteFromStripe: CollectionAfterDeleteHookWithArgs = async (args)
|
||||
if (syncConfig) {
|
||||
try {
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(pluginConfig.stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
const stripe = new Stripe(pluginConfig?.stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
|
||||
const found = await stripe?.[syncConfig.stripeResourceType]?.retrieve(doc.stripeID)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ export const syncExistingWithStripe: CollectionBeforeChangeHookWithArgs = async
|
||||
|
||||
try {
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(pluginConfig.stripeSecretKey || '', {
|
||||
const stripe = new Stripe(pluginConfig?.stripeSecretKey || '', {
|
||||
apiVersion: '2022-08-01',
|
||||
})
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export const stripePlugin =
|
||||
})
|
||||
}
|
||||
|
||||
for (const collection of collections) {
|
||||
for (const collection of collections!) {
|
||||
const { hooks: existingHooks } = collection
|
||||
|
||||
const syncConfig = pluginConfig.sync?.find((sync) => sync.collection === collection.slug)
|
||||
|
||||
@@ -18,15 +18,7 @@ export const stripeREST = async (args: {
|
||||
await addDataAndFileToRequest(req)
|
||||
|
||||
const requestWithData = req
|
||||
|
||||
const {
|
||||
data: {
|
||||
stripeArgs, // example: ['cus_MGgt3Tuj3D66f2'] or [{ limit: 100 }, { stripeAccount: 'acct_1J9Z4pKZ4Z4Z4Z4Z' }]
|
||||
stripeMethod, // example: 'subscriptions.list',
|
||||
},
|
||||
payload,
|
||||
user,
|
||||
} = requestWithData
|
||||
const { data, payload, user } = requestWithData
|
||||
|
||||
const { stripeSecretKey } = pluginConfig
|
||||
|
||||
@@ -37,8 +29,8 @@ export const stripeREST = async (args: {
|
||||
}
|
||||
|
||||
responseJSON = await stripeProxy({
|
||||
stripeArgs,
|
||||
stripeMethod,
|
||||
stripeArgs: data?.stripeArgs, // example: ['cus_MGgt3Tuj3D66f2'] or [{ limit: 100 }, { stripeAccount: 'acct_1J9Z4pKZ4Z4Z4Z4Z' }]
|
||||
stripeMethod: data?.stripeMethod, // example: 'subscriptions.list',
|
||||
stripeSecretKey,
|
||||
})
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export const stripeWebhooks = async (args: {
|
||||
},
|
||||
})
|
||||
|
||||
const body = await req.text()
|
||||
const body = await req.text!()
|
||||
const stripeSignature = req.headers.get('stripe-signature')
|
||||
|
||||
if (stripeSignature) {
|
||||
@@ -41,7 +41,7 @@ export const stripeWebhooks = async (args: {
|
||||
}
|
||||
|
||||
if (event) {
|
||||
handleWebhooks({
|
||||
void handleWebhooks({
|
||||
config,
|
||||
event,
|
||||
payload: req.payload,
|
||||
@@ -52,7 +52,7 @@ export const stripeWebhooks = async (args: {
|
||||
|
||||
// Fire external webhook handlers if they exist
|
||||
if (typeof webhooks === 'function') {
|
||||
webhooks({
|
||||
void webhooks({
|
||||
config,
|
||||
event,
|
||||
payload: req.payload,
|
||||
@@ -65,7 +65,7 @@ export const stripeWebhooks = async (args: {
|
||||
if (typeof webhooks === 'object') {
|
||||
const webhookEventHandler = webhooks[event.type]
|
||||
if (typeof webhookEventHandler === 'function') {
|
||||
webhookEventHandler({
|
||||
void webhookEventHandler({
|
||||
config,
|
||||
event,
|
||||
payload: req.payload,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
/* TODO: remove the following lines */
|
||||
"strict": false,
|
||||
},
|
||||
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user