@unchainedshop/core 1.1.3
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/.versions +21 -0
- package/README.md +3 -0
- package/lib/core-index.d.ts +2 -0
- package/lib/core-index.js +154 -0
- package/lib/core-index.js.map +1 -0
- package/package.js +26 -0
- package/package.json +59 -0
- package/src/core-index.ts +167 -0
- package/test/core-index.tests.js +24 -0
- package/tsconfig.build.json +26 -0
- package/tsconfig.json +8 -0
package/.versions
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
babel-compiler@7.9.0
|
|
2
|
+
babel-runtime@1.5.1
|
|
3
|
+
dynamic-import@0.7.2
|
|
4
|
+
ecmascript@0.16.2
|
|
5
|
+
ecmascript-runtime@0.8.0
|
|
6
|
+
ecmascript-runtime-client@0.12.1
|
|
7
|
+
ecmascript-runtime-server@0.11.0
|
|
8
|
+
fetch@0.1.1
|
|
9
|
+
inter-process-messaging@0.1.1
|
|
10
|
+
local-test:unchained:core@1.1.1
|
|
11
|
+
meteor@1.10.0
|
|
12
|
+
meteortesting:browser-tests@0.1.2
|
|
13
|
+
meteortesting:mocha@0.4.4
|
|
14
|
+
modern-browsers@0.1.8
|
|
15
|
+
modules@0.18.0
|
|
16
|
+
modules-runtime@0.13.0
|
|
17
|
+
practicalmeteor:mocha-core@1.0.1
|
|
18
|
+
promise@0.12.0
|
|
19
|
+
react-fast-refresh@0.2.3
|
|
20
|
+
typescript@4.5.4
|
|
21
|
+
unchained:core@1.1.1
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { configureAccountsModule } from '@unchainedshop/core-accountsjs';
|
|
2
|
+
import { configureAssortmentsModule } from '@unchainedshop/core-assortments';
|
|
3
|
+
import { bookmarkServices, configureBookmarksModule } from '@unchainedshop/core-bookmarks';
|
|
4
|
+
import { configureCountriesModule, countryServices } from '@unchainedshop/core-countries';
|
|
5
|
+
import { configureCurrenciesModule } from '@unchainedshop/core-currencies';
|
|
6
|
+
import { configureDeliveryModule } from '@unchainedshop/core-delivery';
|
|
7
|
+
import { configureEnrollmentsModule } from '@unchainedshop/core-enrollments';
|
|
8
|
+
import { configureEventsModule } from '@unchainedshop/core-events';
|
|
9
|
+
import { configureFilesModule, fileServices } from '@unchainedshop/core-files';
|
|
10
|
+
import { configureFiltersModule } from '@unchainedshop/core-filters';
|
|
11
|
+
import { configureLanguagesModule } from '@unchainedshop/core-languages';
|
|
12
|
+
import { configureMessagingModule } from '@unchainedshop/core-messaging';
|
|
13
|
+
import { configureOrdersModule, orderServices } from '@unchainedshop/core-orders';
|
|
14
|
+
import { configurePaymentModule, paymentServices } from '@unchainedshop/core-payment';
|
|
15
|
+
import { configureProductsModule, productServices } from '@unchainedshop/core-products';
|
|
16
|
+
import { configureQuotationsModule } from '@unchainedshop/core-quotations';
|
|
17
|
+
import { configureUsersModule, userServices } from '@unchainedshop/core-users';
|
|
18
|
+
import { configureWarehousingModule } from '@unchainedshop/core-warehousing';
|
|
19
|
+
import { configureWorkerModule } from '@unchainedshop/core-worker';
|
|
20
|
+
export const initCore = async ({ db, migrationRepository, modules, services, bulkImporter, options = {}, }) => {
|
|
21
|
+
const accounts = await configureAccountsModule({
|
|
22
|
+
db,
|
|
23
|
+
options: options.accounts,
|
|
24
|
+
migrationRepository,
|
|
25
|
+
});
|
|
26
|
+
const assortments = await configureAssortmentsModule({
|
|
27
|
+
db,
|
|
28
|
+
options: options.assortments,
|
|
29
|
+
migrationRepository,
|
|
30
|
+
});
|
|
31
|
+
const bookmarks = await configureBookmarksModule({
|
|
32
|
+
db,
|
|
33
|
+
migrationRepository,
|
|
34
|
+
});
|
|
35
|
+
const countries = await configureCountriesModule({
|
|
36
|
+
db,
|
|
37
|
+
migrationRepository,
|
|
38
|
+
});
|
|
39
|
+
const currencies = await configureCurrenciesModule({
|
|
40
|
+
db,
|
|
41
|
+
migrationRepository,
|
|
42
|
+
});
|
|
43
|
+
const delivery = await configureDeliveryModule({
|
|
44
|
+
db,
|
|
45
|
+
options: options.delivery,
|
|
46
|
+
migrationRepository,
|
|
47
|
+
});
|
|
48
|
+
const enrollments = await configureEnrollmentsModule({
|
|
49
|
+
db,
|
|
50
|
+
options: options.enrollments,
|
|
51
|
+
migrationRepository,
|
|
52
|
+
});
|
|
53
|
+
const events = await configureEventsModule({
|
|
54
|
+
db,
|
|
55
|
+
migrationRepository,
|
|
56
|
+
});
|
|
57
|
+
const files = await configureFilesModule({
|
|
58
|
+
db,
|
|
59
|
+
options: options.files,
|
|
60
|
+
migrationRepository,
|
|
61
|
+
});
|
|
62
|
+
const filters = await configureFiltersModule({
|
|
63
|
+
db,
|
|
64
|
+
options: options.filters,
|
|
65
|
+
migrationRepository,
|
|
66
|
+
});
|
|
67
|
+
const languages = await configureLanguagesModule({
|
|
68
|
+
db,
|
|
69
|
+
migrationRepository,
|
|
70
|
+
});
|
|
71
|
+
const messaging = await configureMessagingModule({
|
|
72
|
+
db,
|
|
73
|
+
migrationRepository,
|
|
74
|
+
});
|
|
75
|
+
const orders = await configureOrdersModule({
|
|
76
|
+
db,
|
|
77
|
+
options: options.orders,
|
|
78
|
+
migrationRepository,
|
|
79
|
+
});
|
|
80
|
+
const payment = await configurePaymentModule({
|
|
81
|
+
db,
|
|
82
|
+
options: options.payment,
|
|
83
|
+
migrationRepository,
|
|
84
|
+
});
|
|
85
|
+
const products = await configureProductsModule({
|
|
86
|
+
db,
|
|
87
|
+
migrationRepository,
|
|
88
|
+
});
|
|
89
|
+
const quotations = await configureQuotationsModule({
|
|
90
|
+
db,
|
|
91
|
+
options: options.quotations,
|
|
92
|
+
migrationRepository,
|
|
93
|
+
});
|
|
94
|
+
const users = await configureUsersModule({
|
|
95
|
+
db,
|
|
96
|
+
migrationRepository,
|
|
97
|
+
});
|
|
98
|
+
const warehousing = await configureWarehousingModule({
|
|
99
|
+
db,
|
|
100
|
+
migrationRepository,
|
|
101
|
+
});
|
|
102
|
+
const worker = await configureWorkerModule({
|
|
103
|
+
db,
|
|
104
|
+
migrationRepository,
|
|
105
|
+
});
|
|
106
|
+
// Configure custom modules
|
|
107
|
+
const customModules = await Object.entries(modules).reduce(async (modulesPromise, [key, customModule]) => {
|
|
108
|
+
return {
|
|
109
|
+
...(await modulesPromise),
|
|
110
|
+
[key]: await customModule.configure({
|
|
111
|
+
db,
|
|
112
|
+
options: options?.[key],
|
|
113
|
+
migrationRepository,
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
}, Promise.resolve({}));
|
|
117
|
+
return {
|
|
118
|
+
modules: {
|
|
119
|
+
accounts,
|
|
120
|
+
assortments,
|
|
121
|
+
bookmarks,
|
|
122
|
+
countries,
|
|
123
|
+
currencies,
|
|
124
|
+
delivery,
|
|
125
|
+
enrollments,
|
|
126
|
+
events,
|
|
127
|
+
files,
|
|
128
|
+
filters,
|
|
129
|
+
languages,
|
|
130
|
+
messaging,
|
|
131
|
+
orders,
|
|
132
|
+
payment,
|
|
133
|
+
products,
|
|
134
|
+
quotations,
|
|
135
|
+
users,
|
|
136
|
+
warehousing,
|
|
137
|
+
worker,
|
|
138
|
+
...customModules,
|
|
139
|
+
},
|
|
140
|
+
services: {
|
|
141
|
+
bookmarks: bookmarkServices,
|
|
142
|
+
countries: countryServices,
|
|
143
|
+
files: fileServices,
|
|
144
|
+
orders: orderServices,
|
|
145
|
+
payment: paymentServices,
|
|
146
|
+
products: productServices,
|
|
147
|
+
users: userServices,
|
|
148
|
+
...services,
|
|
149
|
+
},
|
|
150
|
+
bulkImporter,
|
|
151
|
+
options,
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=core-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-index.js","sourceRoot":"","sources":["../src/core-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,O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KAAK;YACL,OAAO;YACP,SAAS;YACT,SAAS;YACT,MAAM;YACN,OAAO;YACP,QAAQ;YACR,UAAU;YACV,KAAK;YACL,WAAW;YACX,MAAM;YACN,GAAG,aAAa;SACjB;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,gBAAgB;YAC3B,SAAS,EAAE,eAAe;YAC1B,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE,eAAe;YACxB,QAAQ,EAAE,eAAe;YACzB,KAAK,EAAE,YAAY;YACnB,GAAG,QAAQ;SACZ;QACD,YAAY;QACZ,OAAO;KACR,CAAC;AACJ,CAAC,CAAC"}
|
package/package.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Package.describe({
|
|
2
|
+
name: 'unchained:core',
|
|
3
|
+
version: '1.1.3',
|
|
4
|
+
summary: 'Unchained Engine Core: Core Umbrella',
|
|
5
|
+
git: 'https://github.com/unchainedshop/unchained',
|
|
6
|
+
documentation: 'README.md',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
Package.onUse((api) => {
|
|
10
|
+
api.versionsFrom('2.7.3');
|
|
11
|
+
|
|
12
|
+
api.use('ecmascript');
|
|
13
|
+
api.use('typescript');
|
|
14
|
+
|
|
15
|
+
api.mainModule('src/core-index.ts', 'server');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Package.onTest((api) => {
|
|
19
|
+
api.use('meteortesting:mocha');
|
|
20
|
+
api.use('ecmascript');
|
|
21
|
+
api.use('typescript');
|
|
22
|
+
|
|
23
|
+
api.use('unchained:core@1.1.3');
|
|
24
|
+
|
|
25
|
+
api.mainModule('test/core-index.tests.js');
|
|
26
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unchainedshop/core",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"main": "lib/core-index.js",
|
|
5
|
+
"types": "lib/core-index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rm -rf lib",
|
|
9
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
10
|
+
"watch": "tsc --watch",
|
|
11
|
+
"link:core": "npm link @unchainedshop/types",
|
|
12
|
+
"test": "cross-env METEOR_PACKAGE_DIRS=../ TEST_CLIENT=0 TEST_WATCH=1 meteor test-packages ./ --driver-package meteortesting:mocha --port 4200"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/unchainedshop/unchained.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"unchained",
|
|
20
|
+
"ecommerce",
|
|
21
|
+
"core"
|
|
22
|
+
],
|
|
23
|
+
"author": "Joël Meiller",
|
|
24
|
+
"license": "EUPL-1.2",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/unchainedshop/unchained/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@unchainedshop/core-accountsjs": "^1.1.3",
|
|
31
|
+
"@unchainedshop/core-assortments": "^1.1.4",
|
|
32
|
+
"@unchainedshop/core-bookmarks": "^1.1.4",
|
|
33
|
+
"@unchainedshop/core-countries": "^1.1.3",
|
|
34
|
+
"@unchainedshop/core-currencies": "^1.1.3",
|
|
35
|
+
"@unchainedshop/core-delivery": "^1.1.3",
|
|
36
|
+
"@unchainedshop/core-enrollments": "^1.1.3",
|
|
37
|
+
"@unchainedshop/core-events": "^1.1.3",
|
|
38
|
+
"@unchainedshop/core-files": "^1.1.3",
|
|
39
|
+
"@unchainedshop/core-filters": "^1.1.3",
|
|
40
|
+
"@unchainedshop/core-languages": "^1.1.3",
|
|
41
|
+
"@unchainedshop/core-messaging": "^1.1.3",
|
|
42
|
+
"@unchainedshop/core-orders": "^1.1.3",
|
|
43
|
+
"@unchainedshop/core-payment": "^1.1.4",
|
|
44
|
+
"@unchainedshop/core-products": "^1.1.3",
|
|
45
|
+
"@unchainedshop/core-quotations": "^1.1.3",
|
|
46
|
+
"@unchainedshop/core-users": "^1.1.3",
|
|
47
|
+
"@unchainedshop/core-warehousing": "^1.1.3",
|
|
48
|
+
"@unchainedshop/core-worker": "^1.1.3",
|
|
49
|
+
"@unchainedshop/logger": "^1.1.3"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/chai": "^4.3.1",
|
|
53
|
+
"@types/mocha": "^9.1.1",
|
|
54
|
+
"@unchainedshop/types": "latest",
|
|
55
|
+
"chai": "^4.3.6",
|
|
56
|
+
"cross-env": "^7.0.3",
|
|
57
|
+
"typescript": "^4.7.4"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { UnchainedCore, UnchainedCoreOptions } from '@unchainedshop/types/core';
|
|
2
|
+
import { configureAccountsModule } from '@unchainedshop/core-accountsjs';
|
|
3
|
+
import { configureAssortmentsModule } from '@unchainedshop/core-assortments';
|
|
4
|
+
import { bookmarkServices, configureBookmarksModule } from '@unchainedshop/core-bookmarks';
|
|
5
|
+
import { configureCountriesModule, countryServices } from '@unchainedshop/core-countries';
|
|
6
|
+
import { configureCurrenciesModule } from '@unchainedshop/core-currencies';
|
|
7
|
+
import { configureDeliveryModule } from '@unchainedshop/core-delivery';
|
|
8
|
+
import { configureEnrollmentsModule } from '@unchainedshop/core-enrollments';
|
|
9
|
+
import { configureEventsModule } from '@unchainedshop/core-events';
|
|
10
|
+
import { configureFilesModule, fileServices } from '@unchainedshop/core-files';
|
|
11
|
+
import { configureFiltersModule } from '@unchainedshop/core-filters';
|
|
12
|
+
import { configureLanguagesModule } from '@unchainedshop/core-languages';
|
|
13
|
+
import { configureMessagingModule } from '@unchainedshop/core-messaging';
|
|
14
|
+
import { configureOrdersModule, orderServices } from '@unchainedshop/core-orders';
|
|
15
|
+
import { configurePaymentModule, paymentServices } from '@unchainedshop/core-payment';
|
|
16
|
+
import { configureProductsModule, productServices } from '@unchainedshop/core-products';
|
|
17
|
+
import { configureQuotationsModule } from '@unchainedshop/core-quotations';
|
|
18
|
+
import { configureUsersModule, userServices } from '@unchainedshop/core-users';
|
|
19
|
+
import { configureWarehousingModule } from '@unchainedshop/core-warehousing';
|
|
20
|
+
import { configureWorkerModule } from '@unchainedshop/core-worker';
|
|
21
|
+
|
|
22
|
+
export const initCore = async ({
|
|
23
|
+
db,
|
|
24
|
+
migrationRepository,
|
|
25
|
+
modules,
|
|
26
|
+
services,
|
|
27
|
+
bulkImporter,
|
|
28
|
+
options = {},
|
|
29
|
+
}: UnchainedCoreOptions): Promise<UnchainedCore> => {
|
|
30
|
+
const accounts = await configureAccountsModule({
|
|
31
|
+
db,
|
|
32
|
+
options: options.accounts,
|
|
33
|
+
migrationRepository,
|
|
34
|
+
});
|
|
35
|
+
const assortments = await configureAssortmentsModule({
|
|
36
|
+
db,
|
|
37
|
+
options: options.assortments,
|
|
38
|
+
migrationRepository,
|
|
39
|
+
});
|
|
40
|
+
const bookmarks = await configureBookmarksModule({
|
|
41
|
+
db,
|
|
42
|
+
migrationRepository,
|
|
43
|
+
});
|
|
44
|
+
const countries = await configureCountriesModule({
|
|
45
|
+
db,
|
|
46
|
+
migrationRepository,
|
|
47
|
+
});
|
|
48
|
+
const currencies = await configureCurrenciesModule({
|
|
49
|
+
db,
|
|
50
|
+
migrationRepository,
|
|
51
|
+
});
|
|
52
|
+
const delivery = await configureDeliveryModule({
|
|
53
|
+
db,
|
|
54
|
+
options: options.delivery,
|
|
55
|
+
migrationRepository,
|
|
56
|
+
});
|
|
57
|
+
const enrollments = await configureEnrollmentsModule({
|
|
58
|
+
db,
|
|
59
|
+
options: options.enrollments,
|
|
60
|
+
migrationRepository,
|
|
61
|
+
});
|
|
62
|
+
const events = await configureEventsModule({
|
|
63
|
+
db,
|
|
64
|
+
migrationRepository,
|
|
65
|
+
});
|
|
66
|
+
const files = await configureFilesModule({
|
|
67
|
+
db,
|
|
68
|
+
options: options.files,
|
|
69
|
+
migrationRepository,
|
|
70
|
+
});
|
|
71
|
+
const filters = await configureFiltersModule({
|
|
72
|
+
db,
|
|
73
|
+
options: options.filters,
|
|
74
|
+
migrationRepository,
|
|
75
|
+
});
|
|
76
|
+
const languages = await configureLanguagesModule({
|
|
77
|
+
db,
|
|
78
|
+
migrationRepository,
|
|
79
|
+
});
|
|
80
|
+
const messaging = await configureMessagingModule({
|
|
81
|
+
db,
|
|
82
|
+
migrationRepository,
|
|
83
|
+
});
|
|
84
|
+
const orders = await configureOrdersModule({
|
|
85
|
+
db,
|
|
86
|
+
options: options.orders,
|
|
87
|
+
migrationRepository,
|
|
88
|
+
});
|
|
89
|
+
const payment = await configurePaymentModule({
|
|
90
|
+
db,
|
|
91
|
+
options: options.payment,
|
|
92
|
+
migrationRepository,
|
|
93
|
+
});
|
|
94
|
+
const products = await configureProductsModule({
|
|
95
|
+
db,
|
|
96
|
+
migrationRepository,
|
|
97
|
+
});
|
|
98
|
+
const quotations = await configureQuotationsModule({
|
|
99
|
+
db,
|
|
100
|
+
options: options.quotations,
|
|
101
|
+
migrationRepository,
|
|
102
|
+
});
|
|
103
|
+
const users = await configureUsersModule({
|
|
104
|
+
db,
|
|
105
|
+
migrationRepository,
|
|
106
|
+
});
|
|
107
|
+
const warehousing = await configureWarehousingModule({
|
|
108
|
+
db,
|
|
109
|
+
migrationRepository,
|
|
110
|
+
});
|
|
111
|
+
const worker = await configureWorkerModule({
|
|
112
|
+
db,
|
|
113
|
+
migrationRepository,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Configure custom modules
|
|
117
|
+
const customModules = await Object.entries(modules).reduce(
|
|
118
|
+
async (modulesPromise, [key, customModule]: any) => {
|
|
119
|
+
return {
|
|
120
|
+
...(await modulesPromise),
|
|
121
|
+
[key]: await customModule.configure({
|
|
122
|
+
db,
|
|
123
|
+
options: options?.[key],
|
|
124
|
+
migrationRepository,
|
|
125
|
+
}),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
Promise.resolve({}),
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
modules: {
|
|
133
|
+
accounts,
|
|
134
|
+
assortments,
|
|
135
|
+
bookmarks,
|
|
136
|
+
countries,
|
|
137
|
+
currencies,
|
|
138
|
+
delivery,
|
|
139
|
+
enrollments,
|
|
140
|
+
events,
|
|
141
|
+
files,
|
|
142
|
+
filters,
|
|
143
|
+
languages,
|
|
144
|
+
messaging,
|
|
145
|
+
orders,
|
|
146
|
+
payment,
|
|
147
|
+
products,
|
|
148
|
+
quotations,
|
|
149
|
+
users,
|
|
150
|
+
warehousing,
|
|
151
|
+
worker,
|
|
152
|
+
...customModules,
|
|
153
|
+
},
|
|
154
|
+
services: {
|
|
155
|
+
bookmarks: bookmarkServices,
|
|
156
|
+
countries: countryServices,
|
|
157
|
+
files: fileServices,
|
|
158
|
+
orders: orderServices,
|
|
159
|
+
payment: paymentServices,
|
|
160
|
+
products: productServices,
|
|
161
|
+
users: userServices,
|
|
162
|
+
...services,
|
|
163
|
+
},
|
|
164
|
+
bulkImporter,
|
|
165
|
+
options,
|
|
166
|
+
};
|
|
167
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { assert } from "chai"
|
|
2
|
+
import { initCore } from "./src/core-index"
|
|
3
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
4
|
+
import { emit, registerEvents, EventDirector, EventAdapter } from '@unchainedshop/core-events'
|
|
5
|
+
|
|
6
|
+
describe('Initialisation', () => {
|
|
7
|
+
it('Init core without parameters', async () => {
|
|
8
|
+
const config = await initCore({});
|
|
9
|
+
|
|
10
|
+
assert.ok(config.modules)
|
|
11
|
+
assert.ok(config.services)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('Check global actions', async () => {
|
|
15
|
+
assert.isFunction(log);
|
|
16
|
+
log('Test message', { level: LogLevel.Warning })
|
|
17
|
+
|
|
18
|
+
assert.isFunction(emit);
|
|
19
|
+
assert.isFunction(registerEvents);
|
|
20
|
+
|
|
21
|
+
registerEvents(['TEST_EVENT'])
|
|
22
|
+
emit('TEST_EVENT')
|
|
23
|
+
});
|
|
24
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"lib": ["esnext"],
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noUnusedLocals": false,
|
|
14
|
+
"outDir": "lib",
|
|
15
|
+
"preserveWatchOutput": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"target": "esnext",
|
|
19
|
+
"types": ["node"],
|
|
20
|
+
"baseUrl": ".", // This must be specified if "paths" is.
|
|
21
|
+
"paths": {
|
|
22
|
+
"meteor/unchained:*": ["node_modules/@unchainedshop/types/index.d.ts"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": ["src"]
|
|
26
|
+
}
|