-
Notifications
You must be signed in to change notification settings - Fork 4
/
registerPlugins.override.js
171 lines (149 loc) · 6.03 KB
/
registerPlugins.override.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* npm package imports */
import registerAuthenticationPlugin from "@reactioncommerce/plugin-authentication";
import registerSimpleAuthorizationPlugin from "@reactioncommerce/plugin-simple-authorization";
import registerSystemInformationPlugin from "@reactioncommerce/plugin-system-information";
/* node-app imports */
/* core-services */
import registerAccountsPlugin from "./core-services/account/index.js";
import registerAddressPlugin from "./core-services/address/index.js";
import registerCatalogPlugin from "./core-services/catalog/index.js";
import registerCartPlugin from "./core-services/cart/index.js";
import registerDiscountsPlugin from "./core-services/discounts/index.js";
import registerEmailPlugin from "./core-services/email/index.js";
import registerI18nPlugin from "./core-services/i18n/index.js";
import registerInventoryPlugin from "./core-services/inventory/index.js";
import registerProductPlugin from "./core-services/product/index.js";
import registerSettingsPlugin from "./core-services/settings/index.js";
import registerOrdersPlugin from "./core-services/orders/index.js";
import registerPaymentsPlugin from "./core-services/payments/index.js";
import registerShippingPlugin from "./core-services/shipping/index.js";
import registerShopPlugin from "./core-services/shop/index.js";
import registerTagsPlugin from "./core-services/tags/index.js";
import registerTaxesPlugin from "./core-services/taxes/index.js";
/* plugins */
import registerDiscountCodesPlugin from "./plugins/discount-codes/index.js";
import registerEmailTemplatesPlugin from "./plugins/email-templates/index.js";
import registerExamplePaymentsPlugin from "./plugins/payments-example/index.js";
import registerJobQueuePlugin from "./plugins/job-queue/index.js";
import registerNavigationPlugin from "./plugins/navigation/index.js";
import registerNotificationsPlugin from "./plugins/notifications/index.js";
import registerShippingRatesPlugin from "./plugins/shipping-rates/index.js";
import registerSimpleInventoryPlugin from "./plugins/simple-inventory/index.js";
import registerSimplePricingPlugin from "./plugins/simple-pricing/index.js";
import registerSimpleSchemaPlugin from "./plugins/simple-schema/index.js";
import registerSitemapGeneratorPlugin from "./plugins/sitemap-generator/index.js";
import registerSMTPEmailPlugin from "./plugins/email-smtp/index.js";
import registerStripePaymentsPlugin from "./plugins/payments-stripe/index.js";
import registerSurchargesPlugin from "./plugins/surcharges/index.js";
import registerTaxesRatesPlugin from "./plugins/taxes-rates/index.js";
import registerTestAddressValidationPlugin from "./plugins/address-validation-test/index.js";
import registerTranslationsPlugin from "./plugins/translations/index.js";
import registerAccTextImportPlugin from "./plugins/custom/acc-text-import/index.js";
/**
* @summary A function in which you should call `register` function for each API plugin,
* in the order in which you want to register them.
* @param {ReactionAPI} app The ReactionAPI instance
* @returns {Promise<null>} Null
*/
export default async function registerPlugins(app) {
/**
* CORE
*/
await registerSimpleSchemaPlugin(app); // REQUIRED
await registerJobQueuePlugin(app); // REQUIRED
// We don't register the files plugin when running integration tests
// because there are some problems with the way MongoDB closes change
// stream watchers, which end up causing a lot of errors. This doesn't
// happen when running the app because we don't constantly connect and
// disconnect to different Mongo databases.
//
// Note: The import must stay here, too. If the package is imported at
// the top of this file, then side effects will happen and cause problems.
if (!process.env.REACTION_DISABLE_FILES_PLUGIN) {
const { default: registerFilesPlugin } = await import("./core-services/files/index.js");
await registerFilesPlugin(app);
}
await registerShopPlugin(app); // REQUIRED
await registerSettingsPlugin(app); // REQUIRED
await registerI18nPlugin(app); // REQUIRED
await registerEmailPlugin(app); // REQUIRED
await registerAddressPlugin(app); // REQUIRED
await registerTranslationsPlugin(app); // OPTIONAL
await registerSystemInformationPlugin(app); // OPTIONAL
/**
* Email
*/
await registerEmailTemplatesPlugin(app); // OPTIONAL
await registerSMTPEmailPlugin(app); // OPTIONAL
/**
* Accounts
*/
await registerAccountsPlugin(app); // REQUIRED
/**
* Authentication and Authorization
*/
await registerAuthenticationPlugin(app); // REQUIRED
await registerSimpleAuthorizationPlugin(app); // REQUIRED
/**
* Catalog
*/
await registerProductPlugin(app); // REQUIRED
await registerCatalogPlugin(app); // REQUIRED
await registerTagsPlugin(app); // REQUIRED
/**
* Pricing
*/
await registerSimplePricingPlugin(app); // OPTIONAL
/**
* Inventory
*/
await registerInventoryPlugin(app); // REQUIRED
await registerSimpleInventoryPlugin(app); // OPTIONAL
/**
* Cart
*/
await registerCartPlugin(app); // REQUIRED
/**
* Orders
*/
await registerOrdersPlugin(app); // REQUIRED
/**
* Payments
*/
await registerPaymentsPlugin(app); // REQUIRED
await registerExamplePaymentsPlugin(app); // OPTIONAL
await registerStripePaymentsPlugin(app); // OPTIONAL
/**
* Discounts
*/
await registerDiscountsPlugin(app); // REQUIRED
await registerDiscountCodesPlugin(app); // OPTIONAL
/**
* Surcharges
*/
await registerSurchargesPlugin(app); // OPTIONAL
/**
* Shipping
*/
await registerShippingPlugin(app); // REQUIRED
await registerShippingRatesPlugin(app); // OPTIONAL
/**
* Taxes
*/
await registerTaxesPlugin(app); // REQUIRED
await registerTaxesRatesPlugin(app); // OPTIONAL
/**
* Navigation
*/
await registerNavigationPlugin(app); // OPTIONAL
await registerSitemapGeneratorPlugin(app); // OPTIONAL
/**
* Miscellaneous
*/
await registerNotificationsPlugin(app); // OPTIONAL
await registerTestAddressValidationPlugin(app); // OPTIONAL
/**
* Custom
*/
await registerAccTextImportPlugin(app);
}