@unchainedshop/plugins 4.6.2 → 4.7.2
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/README.md +0 -2
- package/lib/events/node-event-emitter.d.ts +3 -1
- package/lib/events/node-event-emitter.js +3 -3
- package/lib/files/gridfs/adapter.d.ts +2 -2
- package/lib/files/gridfs/adapter.js +2 -5
- package/lib/files/gridfs/index.d.ts +5 -4
- package/lib/files/gridfs/index.js +30 -3
- package/lib/files/minio/index.d.ts +4 -5
- package/lib/files/minio/index.js +18 -157
- package/lib/payment/apple-iap/adapter.d.ts +2 -1
- package/lib/payment/apple-iap/adapter.js +2 -3
- package/lib/payment/apple-iap/index.d.ts +6 -4
- package/lib/payment/apple-iap/index.js +28 -3
- package/lib/payment/cryptopay/index.d.ts +5 -4
- package/lib/payment/cryptopay/index.js +31 -3
- package/lib/payment/datatrans-v2/index.d.ts +4 -1
- package/lib/payment/datatrans-v2/index.js +17 -400
- package/lib/payment/payrexx/index.d.ts +4 -1
- package/lib/payment/payrexx/index.js +19 -158
- package/lib/payment/postfinance-checkout/index.d.ts +5 -0
- package/lib/payment/postfinance-checkout/index.js +25 -186
- package/lib/payment/saferpay/adapter.js +1 -2
- package/lib/payment/saferpay/index.d.ts +5 -4
- package/lib/payment/saferpay/index.js +29 -3
- package/lib/payment/stripe/index.d.ts +4 -1
- package/lib/payment/stripe/index.js +22 -116
- package/lib/payment/stripe/stripe.js +2 -5
- package/lib/presets/all.d.ts +1 -70
- package/lib/presets/all.js +41 -27
- package/lib/presets/base.d.ts +1 -25
- package/lib/presets/base.js +56 -25
- package/lib/presets/countries/ch.d.ts +1 -2
- package/lib/presets/countries/ch.js +7 -2
- package/lib/presets/crypto.d.ts +3 -7
- package/lib/presets/crypto.js +18 -7
- package/package.json +15 -10
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/post.js +0 -23
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/send-message.js +0 -40
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/delivery/stores.js +0 -43
- package/lib/enrollments/licensed.d.ts +0 -4
- package/lib/enrollments/licensed.js +0 -52
- package/lib/files/gridfs/handler-express.d.ts +0 -9
- package/lib/files/gridfs/handler-express.js +0 -110
- package/lib/files/gridfs/handler-fastify.d.ts +0 -3
- package/lib/files/gridfs/handler-fastify.js +0 -138
- package/lib/files/minio/handler-express.d.ts +0 -2
- package/lib/files/minio/handler-express.js +0 -36
- package/lib/files/minio/handler-fastify.d.ts +0 -3
- package/lib/files/minio/handler-fastify.js +0 -40
- package/lib/filters/local-search.d.ts +0 -3
- package/lib/filters/local-search.js +0 -66
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/filters/strict-equal.js +0 -24
- package/lib/payment/apple-iap/handler-express.d.ts +0 -2
- package/lib/payment/apple-iap/handler-express.js +0 -103
- package/lib/payment/apple-iap/handler-fastify.d.ts +0 -3
- package/lib/payment/apple-iap/handler-fastify.js +0 -102
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -138
- package/lib/payment/cryptopay/handler-express.d.ts +0 -2
- package/lib/payment/cryptopay/handler-express.js +0 -19
- package/lib/payment/cryptopay/handler-fastify.d.ts +0 -3
- package/lib/payment/cryptopay/handler-fastify.js +0 -17
- package/lib/payment/cryptopay/plugin.d.ts +0 -3
- package/lib/payment/cryptopay/plugin.js +0 -159
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +0 -71
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +0 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +0 -71
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice-prepaid.js +0 -30
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/invoice.js +0 -27
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -87
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -85
- package/lib/payment/payrexx/handler-fastify.d.ts +0 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -91
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +0 -37
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +0 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +0 -40
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +0 -59
- package/lib/payment/saferpay/handler-fastify.d.ts +0 -2
- package/lib/payment/saferpay/handler-fastify.js +0 -62
- package/lib/payment/stripe/handler-express.d.ts +0 -5
- package/lib/payment/stripe/handler-express.js +0 -121
- package/lib/payment/stripe/handler-fastify.d.ts +0 -6
- package/lib/payment/stripe/handler-fastify.js +0 -131
- package/lib/presets/all-express.d.ts +0 -6
- package/lib/presets/all-express.js +0 -26
- package/lib/presets/all-fastify.d.ts +0 -6
- package/lib/presets/all-fastify.js +0 -49
- package/lib/presets/base-express.d.ts +0 -2
- package/lib/presets/base-express.js +0 -5
- package/lib/presets/base-fastify.d.ts +0 -3
- package/lib/presets/base-fastify.js +0 -16
- package/lib/presets/crypto-express.d.ts +0 -3
- package/lib/presets/crypto-express.js +0 -8
- package/lib/presets/crypto-fastify.d.ts +0 -3
- package/lib/presets/crypto-fastify.js +0 -11
- package/lib/pricing/delivery-swiss-tax.d.ts +0 -2
- package/lib/pricing/delivery-swiss-tax.js +0 -62
- package/lib/pricing/discount-100-off.d.ts +0 -2
- package/lib/pricing/discount-100-off.js +0 -30
- package/lib/pricing/discount-half-price-manual.d.ts +0 -2
- package/lib/pricing/discount-half-price-manual.js +0 -30
- package/lib/pricing/discount-half-price.d.ts +0 -2
- package/lib/pricing/discount-half-price.js +0 -33
- package/lib/pricing/free-delivery.d.ts +0 -2
- package/lib/pricing/free-delivery.js +0 -27
- package/lib/pricing/free-payment.d.ts +0 -2
- package/lib/pricing/free-payment.js +0 -27
- package/lib/pricing/order-delivery.d.ts +0 -2
- package/lib/pricing/order-delivery.js +0 -33
- package/lib/pricing/order-discount.d.ts +0 -2
- package/lib/pricing/order-discount.js +0 -74
- package/lib/pricing/order-items-discount.d.ts +0 -2
- package/lib/pricing/order-items-discount.js +0 -50
- package/lib/pricing/order-items.d.ts +0 -2
- package/lib/pricing/order-items.js +0 -43
- package/lib/pricing/order-payment.d.ts +0 -2
- package/lib/pricing/order-payment.js +0 -33
- package/lib/pricing/order-round.d.ts +0 -10
- package/lib/pricing/order-round.js +0 -135
- package/lib/pricing/product-catalog-price-options.d.ts +0 -2
- package/lib/pricing/product-catalog-price-options.js +0 -51
- package/lib/pricing/product-catalog-price.d.ts +0 -2
- package/lib/pricing/product-catalog-price.js +0 -60
- package/lib/pricing/product-discount.d.ts +0 -2
- package/lib/pricing/product-discount.js +0 -69
- package/lib/pricing/product-price-rateconversion.d.ts +0 -2
- package/lib/pricing/product-price-rateconversion.js +0 -53
- package/lib/pricing/product-round.d.ts +0 -10
- package/lib/pricing/product-round.js +0 -44
- package/lib/pricing/product-swiss-tax.d.ts +0 -2
- package/lib/pricing/product-swiss-tax.js +0 -76
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/quotations/manual.js +0 -20
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/eth-minter.js +0 -120
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/warehousing/store.js +0 -34
- package/lib/worker/budgetsms.d.ts +0 -9
- package/lib/worker/budgetsms.js +0 -169
- package/lib/worker/bulk-export.d.ts +0 -2
- package/lib/worker/bulk-export.js +0 -64
- package/lib/worker/bulk-import.d.ts +0 -2
- package/lib/worker/bulk-import.js +0 -65
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/bulkgate.js +0 -91
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/email.js +0 -136
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.js +0 -77
- package/lib/worker/error-notifications.d.ts +0 -9
- package/lib/worker/error-notifications.js +0 -61
- package/lib/worker/export-token.d.ts +0 -4
- package/lib/worker/export-token.js +0 -26
- package/lib/worker/external.d.ts +0 -2
- package/lib/worker/external.js +0 -13
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/heartbeat.js +0 -26
- package/lib/worker/http-request.d.ts +0 -8
- package/lib/worker/http-request.js +0 -56
- package/lib/worker/message.d.ts +0 -10
- package/lib/worker/message.js +0 -42
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/push-notification.js +0 -87
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/twilio.js +0 -59
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.js +0 -59
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.js +0 -92
- package/lib/worker/update-token-ownership.d.ts +0 -3
- package/lib/worker/update-token-ownership.js +0 -57
- package/lib/worker/zombie-killer.d.ts +0 -13
- package/lib/worker/zombie-killer.js +0 -91
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
|
|
2
|
-
export const ZombieKillerWorker = {
|
|
3
|
-
...WorkerAdapter,
|
|
4
|
-
key: 'shop.unchained.worker-plugin.zombie-killer',
|
|
5
|
-
label: 'Zombie Killer',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
type: 'ZOMBIE_KILLER',
|
|
8
|
-
doWork: async ({ bulkImportMaxAgeInDays } = { bulkImportMaxAgeInDays: 5 }, unchainedAPI) => {
|
|
9
|
-
const { modules, services } = unchainedAPI;
|
|
10
|
-
try {
|
|
11
|
-
const error = false;
|
|
12
|
-
const filters = await modules.filters.findFilters({ includeInactive: true }, { projection: { _id: 1 } });
|
|
13
|
-
const filterIds = filters.map((a) => a._id);
|
|
14
|
-
const deletedFilterTextsCount = await modules.filters.texts.deleteMany({
|
|
15
|
-
excludedFilterIds: filterIds,
|
|
16
|
-
});
|
|
17
|
-
const assortments = await modules.assortments.findAssortments({
|
|
18
|
-
includeInactive: true,
|
|
19
|
-
includeLeaves: true,
|
|
20
|
-
});
|
|
21
|
-
const assortmentIds = assortments.map((a) => a._id);
|
|
22
|
-
const deletedAssortmentTextsCount = await modules.assortments.texts.deleteMany({
|
|
23
|
-
excludedAssortmentIds: assortmentIds,
|
|
24
|
-
});
|
|
25
|
-
const deletedAssortmentMediaCount = await modules.assortments.media.deleteMediaFiles({
|
|
26
|
-
excludedAssortmentIds: assortmentIds,
|
|
27
|
-
});
|
|
28
|
-
const productIds = await modules.products.findProductIds({ includeDrafts: true });
|
|
29
|
-
const deletedProductTextsCount = await modules.products.texts.deleteMany({
|
|
30
|
-
excludedProductIds: productIds,
|
|
31
|
-
});
|
|
32
|
-
const deletedProductVariationsCount = await modules.products.variations.deleteVariations({
|
|
33
|
-
excludedProductIds: productIds,
|
|
34
|
-
});
|
|
35
|
-
const deletedProductMediaCount = await modules.products.media.deleteMediaFiles({
|
|
36
|
-
excludedProductIds: productIds,
|
|
37
|
-
});
|
|
38
|
-
const productMedia = await modules.products.media.findProductMedias({}, { projection: { mediaId: 1 } });
|
|
39
|
-
const assortmentMedia = await modules.assortments.media.findAssortmentMedias({}, { projection: { mediaId: 1 } });
|
|
40
|
-
const allFileIdsLinked = [...productMedia, ...assortmentMedia].map((l) => l?.mediaId);
|
|
41
|
-
const allFileIdsRelevant = (await modules.files.findFiles({ paths: ['product-media', 'assortment-media'] }, { projection: { _id: 1 } })).map((a) => a._id);
|
|
42
|
-
const fileIdsToRemove = allFileIdsRelevant.filter((fileId) => {
|
|
43
|
-
return !allFileIdsLinked.includes(fileId);
|
|
44
|
-
}) || [];
|
|
45
|
-
const bulkImportMedia = await await modules.files.findFiles({
|
|
46
|
-
path: 'bulk-import-streams',
|
|
47
|
-
createdBefore: new Date(Date.now() - 1000 * 60 * 60 * 24 * bulkImportMaxAgeInDays),
|
|
48
|
-
});
|
|
49
|
-
bulkImportMedia.forEach(async (media) => {
|
|
50
|
-
fileIdsToRemove.push(media._id);
|
|
51
|
-
});
|
|
52
|
-
const deletedFilesCount = fileIdsToRemove.length > 0
|
|
53
|
-
? await services.files.removeFiles({
|
|
54
|
-
fileIds: fileIdsToRemove,
|
|
55
|
-
})
|
|
56
|
-
: 0;
|
|
57
|
-
const result = {
|
|
58
|
-
deletedFilterTextsCount,
|
|
59
|
-
deletedProductMediaCount,
|
|
60
|
-
deletedProductTextsCount,
|
|
61
|
-
deletedProductVariationsCount,
|
|
62
|
-
deletedAssortmentMediaCount,
|
|
63
|
-
deletedAssortmentTextsCount,
|
|
64
|
-
deletedFilesCount,
|
|
65
|
-
};
|
|
66
|
-
if (error) {
|
|
67
|
-
return {
|
|
68
|
-
success: false,
|
|
69
|
-
result,
|
|
70
|
-
error,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
success: true,
|
|
75
|
-
result,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
return {
|
|
80
|
-
success: false,
|
|
81
|
-
error: {
|
|
82
|
-
name: err.name,
|
|
83
|
-
message: err.message,
|
|
84
|
-
stack: err.stack,
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
export default ZombieKillerWorker;
|
|
91
|
-
WorkerDirector.registerAdapter(ZombieKillerWorker);
|