@unchainedshop/core-enrollments 4.4.0 → 4.6.0
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.
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import later from '@breejs/later';
|
|
2
1
|
import type { Enrollment } from './db/EnrollmentsCollection.ts';
|
|
2
|
+
export interface ScheduleData {
|
|
3
|
+
schedules: {
|
|
4
|
+
s?: number[];
|
|
5
|
+
m?: number[];
|
|
6
|
+
h?: number[];
|
|
7
|
+
D?: number[];
|
|
8
|
+
M?: number[];
|
|
9
|
+
d?: number[];
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
3
12
|
export interface EnrollmentSettings {
|
|
4
|
-
autoSchedulingSchedule:
|
|
13
|
+
autoSchedulingSchedule: ScheduleData;
|
|
5
14
|
enrollmentNumberHashFn: (enrollment: Enrollment, index: number) => string;
|
|
6
15
|
configureSettings: (options?: EnrollmentsSettingsOptions) => void;
|
|
7
16
|
}
|
|
8
|
-
export type EnrollmentsSettingsOptions = Omit<Partial<
|
|
17
|
+
export type EnrollmentsSettingsOptions = Omit<Partial<EnrollmentSettings>, 'configureSettings'>;
|
|
9
18
|
export declare const enrollmentsSettings: EnrollmentSettings;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import later from '@breejs/later';
|
|
2
1
|
import { generateRandomHash } from '@unchainedshop/utils';
|
|
3
|
-
const everyHourSchedule =
|
|
2
|
+
const everyHourSchedule = {
|
|
3
|
+
schedules: [{ s: [0], m: [0, 59] }],
|
|
4
|
+
};
|
|
4
5
|
export const enrollmentsSettings = {
|
|
5
6
|
autoSchedulingSchedule: everyHourSchedule,
|
|
6
7
|
enrollmentNumberHashFn: generateRandomHash,
|
|
@@ -100,7 +100,7 @@ export const configureEnrollmentsModule = async ({ db, options: enrollmentOption
|
|
|
100
100
|
if ('enrollmentId' in params) {
|
|
101
101
|
return Enrollments.findOne(generateDbFilterById(params.enrollmentId), options);
|
|
102
102
|
}
|
|
103
|
-
return Enrollments.findOne({ 'periods.orderId': params.orderId, deleted:
|
|
103
|
+
return Enrollments.findOne({ 'periods.orderId': params.orderId, deleted: null }, options);
|
|
104
104
|
},
|
|
105
105
|
findEnrollments: async ({ limit, offset, sort, ...query }) => {
|
|
106
106
|
const defaultSortOption = [{ key: 'created', value: SortDirection.ASC }];
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-enrollments",
|
|
3
|
-
"
|
|
3
|
+
"description": "Subscription and recurring billing module for the Unchained Engine",
|
|
4
|
+
"version": "4.6.0",
|
|
4
5
|
"main": "lib/enrollments-index.js",
|
|
5
6
|
"types": "lib/enrollments-index.d.ts",
|
|
6
7
|
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"scripts": {
|
|
8
10
|
"clean": "tsc -b --clean",
|
|
9
11
|
"build": "tsc -b",
|
|
@@ -33,13 +35,11 @@
|
|
|
33
35
|
},
|
|
34
36
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@unchainedshop/
|
|
38
|
-
"@unchainedshop/
|
|
39
|
-
"@unchainedshop/utils": "^4.4.0"
|
|
38
|
+
"@unchainedshop/events": "^4.6.0",
|
|
39
|
+
"@unchainedshop/logger": "^4.6.0",
|
|
40
|
+
"@unchainedshop/utils": "^4.6.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@types/breejs__later": "^4.1.5",
|
|
43
43
|
"@types/node": "^25.0.0",
|
|
44
44
|
"typescript": "^5.8.3"
|
|
45
45
|
}
|