stripe-experiment-sync 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -3
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -958,12 +958,12 @@ var StripeAutoSync = class {
|
|
|
958
958
|
);
|
|
959
959
|
this.webhookId = webhook.id;
|
|
960
960
|
this.webhookUuid = uuid;
|
|
961
|
+
app.use(this.getBodyParserMiddleware());
|
|
962
|
+
this.mountWebhook(app);
|
|
961
963
|
console.log("Starting initial backfill of all Stripe data...");
|
|
962
964
|
const backfillResult = await this.stripeSync.syncBackfill({ object: "all" });
|
|
963
965
|
const totalSynced = Object.values(backfillResult).reduce((sum, result) => sum + (result?.synced || 0), 0);
|
|
964
966
|
console.log(`\u2713 Backfill complete: ${totalSynced} objects synced`);
|
|
965
|
-
this.mountWebhook(app);
|
|
966
|
-
app.use(this.getBodyParserMiddleware());
|
|
967
967
|
return {
|
|
968
968
|
baseUrl,
|
|
969
969
|
webhookUrl: webhook.url,
|
|
@@ -1003,7 +1003,8 @@ var StripeAutoSync = class {
|
|
|
1003
1003
|
getBodyParserMiddleware() {
|
|
1004
1004
|
const webhookPath = this.options.webhookPath;
|
|
1005
1005
|
return (req, res, next) => {
|
|
1006
|
-
|
|
1006
|
+
const path2 = req.path || req.url;
|
|
1007
|
+
if (path2 && path2.startsWith(webhookPath)) {
|
|
1007
1008
|
return next();
|
|
1008
1009
|
}
|
|
1009
1010
|
import_express.default.json()(req, res, (err) => {
|
package/dist/index.js
CHANGED
|
@@ -916,12 +916,12 @@ var StripeAutoSync = class {
|
|
|
916
916
|
);
|
|
917
917
|
this.webhookId = webhook.id;
|
|
918
918
|
this.webhookUuid = uuid;
|
|
919
|
+
app.use(this.getBodyParserMiddleware());
|
|
920
|
+
this.mountWebhook(app);
|
|
919
921
|
console.log("Starting initial backfill of all Stripe data...");
|
|
920
922
|
const backfillResult = await this.stripeSync.syncBackfill({ object: "all" });
|
|
921
923
|
const totalSynced = Object.values(backfillResult).reduce((sum, result) => sum + (result?.synced || 0), 0);
|
|
922
924
|
console.log(`\u2713 Backfill complete: ${totalSynced} objects synced`);
|
|
923
|
-
this.mountWebhook(app);
|
|
924
|
-
app.use(this.getBodyParserMiddleware());
|
|
925
925
|
return {
|
|
926
926
|
baseUrl,
|
|
927
927
|
webhookUrl: webhook.url,
|
|
@@ -961,7 +961,8 @@ var StripeAutoSync = class {
|
|
|
961
961
|
getBodyParserMiddleware() {
|
|
962
962
|
const webhookPath = this.options.webhookPath;
|
|
963
963
|
return (req, res, next) => {
|
|
964
|
-
|
|
964
|
+
const path2 = req.path || req.url;
|
|
965
|
+
if (path2 && path2.startsWith(webhookPath)) {
|
|
965
966
|
return next();
|
|
966
967
|
}
|
|
967
968
|
express.json()(req, res, (err) => {
|