@unchainedshop/core-quotations 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.
Files changed (47) hide show
  1. package/.npm/package/README +7 -0
  2. package/.npm/package/npm-shrinkwrap.json +190 -0
  3. package/.versions +55 -0
  4. package/README.md +5 -0
  5. package/lib/db/QuotationStatus.d.ts +7 -0
  6. package/lib/db/QuotationStatus.js +9 -0
  7. package/lib/db/QuotationStatus.js.map +1 -0
  8. package/lib/db/QuotationsCollection.d.ts +3 -0
  9. package/lib/db/QuotationsCollection.js +33 -0
  10. package/lib/db/QuotationsCollection.js.map +1 -0
  11. package/lib/db/QuotationsSchema.d.ts +1 -0
  12. package/lib/db/QuotationsSchema.js +31 -0
  13. package/lib/db/QuotationsSchema.js.map +1 -0
  14. package/lib/director/QuotationAdapter.d.ts +2 -0
  15. package/lib/director/QuotationAdapter.js +40 -0
  16. package/lib/director/QuotationAdapter.js.map +1 -0
  17. package/lib/director/QuotationDirector.d.ts +2 -0
  18. package/lib/director/QuotationDirector.js +86 -0
  19. package/lib/director/QuotationDirector.js.map +1 -0
  20. package/lib/director/QuotationError.d.ts +6 -0
  21. package/lib/director/QuotationError.js +8 -0
  22. package/lib/director/QuotationError.js.map +1 -0
  23. package/lib/module/configureQuotationsModule.d.ts +3 -0
  24. package/lib/module/configureQuotationsModule.js +263 -0
  25. package/lib/module/configureQuotationsModule.js.map +1 -0
  26. package/lib/quotations-index.d.ts +5 -0
  27. package/lib/quotations-index.js +6 -0
  28. package/lib/quotations-index.js.map +1 -0
  29. package/lib/quotations-settings.d.ts +10 -0
  30. package/lib/quotations-settings.js +8 -0
  31. package/lib/quotations-settings.js.map +1 -0
  32. package/package.js +34 -0
  33. package/package.json +44 -0
  34. package/plugins/manual.ts +27 -0
  35. package/quotations.js +15 -0
  36. package/src/db/QuotationStatus.ts +7 -0
  37. package/src/db/QuotationsCollection.ts +37 -0
  38. package/src/db/QuotationsSchema.js +35 -0
  39. package/src/director/QuotationAdapter.ts +52 -0
  40. package/src/director/QuotationDirector.ts +100 -0
  41. package/src/director/QuotationError.ts +6 -0
  42. package/src/module/configureQuotationsModule.ts +386 -0
  43. package/src/quotations-index.ts +8 -0
  44. package/src/quotations-settings.js +9 -0
  45. package/tests/quotations-index.test.ts +73 -0
  46. package/tsconfig.build.json +26 -0
  47. package/tsconfig.json +8 -0
@@ -0,0 +1,7 @@
1
+ This directory and the files immediately inside it are automatically generated
2
+ when you change this package's NPM dependencies. Commit the files in this
3
+ directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
4
+ so that others run the same versions of sub-dependencies.
5
+
6
+ You should NOT check in the node_modules directory that Meteor automatically
7
+ creates; if you are using git, the .gitignore file tells git to ignore it.
@@ -0,0 +1,190 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "dependencies": {
4
+ "@colors/colors": {
5
+ "version": "1.5.0",
6
+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
7
+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="
8
+ },
9
+ "@dabh/diagnostics": {
10
+ "version": "2.0.3",
11
+ "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz",
12
+ "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA=="
13
+ },
14
+ "@unchainedshop/logger": {
15
+ "version": "1.1.0",
16
+ "resolved": "https://registry.npmjs.org/@unchainedshop/logger/-/logger-1.1.0.tgz",
17
+ "integrity": "sha512-PwS2wtlwzRo1RlfRbKQN6cLCz7XEp2dGmVbXCQ1E49O9VvAYNh5mdTg2BNoWYZ1Sl7KWpLkANNYispb+X/Y4jw=="
18
+ },
19
+ "async": {
20
+ "version": "3.2.4",
21
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
22
+ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
23
+ },
24
+ "clone": {
25
+ "version": "2.1.2",
26
+ "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
27
+ "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w=="
28
+ },
29
+ "color": {
30
+ "version": "3.2.1",
31
+ "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
32
+ "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA=="
33
+ },
34
+ "color-convert": {
35
+ "version": "1.9.3",
36
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
37
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="
38
+ },
39
+ "color-name": {
40
+ "version": "1.1.3",
41
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
42
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
43
+ },
44
+ "color-string": {
45
+ "version": "1.9.1",
46
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
47
+ "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg=="
48
+ },
49
+ "colorspace": {
50
+ "version": "1.1.4",
51
+ "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz",
52
+ "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w=="
53
+ },
54
+ "enabled": {
55
+ "version": "2.0.0",
56
+ "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz",
57
+ "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
58
+ },
59
+ "fecha": {
60
+ "version": "4.2.3",
61
+ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
62
+ "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw=="
63
+ },
64
+ "fn.name": {
65
+ "version": "1.1.0",
66
+ "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz",
67
+ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
68
+ },
69
+ "inherits": {
70
+ "version": "2.0.4",
71
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
72
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
73
+ },
74
+ "is-arrayish": {
75
+ "version": "0.3.2",
76
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
77
+ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="
78
+ },
79
+ "is-stream": {
80
+ "version": "2.0.1",
81
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
82
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
83
+ },
84
+ "kuler": {
85
+ "version": "2.0.0",
86
+ "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
87
+ "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="
88
+ },
89
+ "lodash._reinterpolate": {
90
+ "version": "3.0.0",
91
+ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
92
+ "integrity": "sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA=="
93
+ },
94
+ "lodash.template": {
95
+ "version": "4.5.0",
96
+ "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz",
97
+ "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A=="
98
+ },
99
+ "lodash.templatesettings": {
100
+ "version": "4.2.0",
101
+ "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz",
102
+ "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ=="
103
+ },
104
+ "logform": {
105
+ "version": "2.4.0",
106
+ "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.0.tgz",
107
+ "integrity": "sha512-CPSJw4ftjf517EhXZGGvTHHkYobo7ZCc0kvwUoOYcjfR2UVrI66RHj8MCrfAdEitdmFqbu2BYdYs8FHHZSb6iw=="
108
+ },
109
+ "message-box": {
110
+ "version": "0.2.7",
111
+ "resolved": "https://registry.npmjs.org/message-box/-/message-box-0.2.7.tgz",
112
+ "integrity": "sha512-C4ccA5nHb58kTS+pLrgF/JWtr7fAIkHxRDceH7tdy5fMA783nUfbYwZ7H2XLvSeYfcnWIYCig5dWW+icK9X/Ag=="
113
+ },
114
+ "mongo-object": {
115
+ "version": "0.1.4",
116
+ "resolved": "https://registry.npmjs.org/mongo-object/-/mongo-object-0.1.4.tgz",
117
+ "integrity": "sha512-QtYk0gupWEn2+iB+DDRt1L+WbcNYvJRaHdih/dcqthOa1DbnREUGSs2WGcW478GNYpElflo/yybZXu0sTiRXHg=="
118
+ },
119
+ "ms": {
120
+ "version": "2.1.3",
121
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
122
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
123
+ },
124
+ "one-time": {
125
+ "version": "1.0.0",
126
+ "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz",
127
+ "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g=="
128
+ },
129
+ "readable-stream": {
130
+ "version": "3.6.0",
131
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
132
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA=="
133
+ },
134
+ "safe-buffer": {
135
+ "version": "5.2.1",
136
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
137
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
138
+ },
139
+ "safe-stable-stringify": {
140
+ "version": "2.3.1",
141
+ "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz",
142
+ "integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg=="
143
+ },
144
+ "simpl-schema": {
145
+ "version": "1.12.0",
146
+ "resolved": "https://registry.npmjs.org/simpl-schema/-/simpl-schema-1.12.0.tgz",
147
+ "integrity": "sha512-lzXC3L8jJbPhNXGR3cjlyIauqqrC5WUJS4O34Ym/wLIvb8K3ZieK+1OfTzs4mBpDc3Y8u53gQFAr1X37DmTcEg=="
148
+ },
149
+ "simple-swizzle": {
150
+ "version": "0.2.2",
151
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
152
+ "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg=="
153
+ },
154
+ "stack-trace": {
155
+ "version": "0.0.10",
156
+ "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
157
+ "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg=="
158
+ },
159
+ "string_decoder": {
160
+ "version": "1.3.0",
161
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
162
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="
163
+ },
164
+ "text-hex": {
165
+ "version": "1.0.0",
166
+ "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
167
+ "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="
168
+ },
169
+ "triple-beam": {
170
+ "version": "1.3.0",
171
+ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
172
+ "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
173
+ },
174
+ "util-deprecate": {
175
+ "version": "1.0.2",
176
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
177
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
178
+ },
179
+ "winston": {
180
+ "version": "3.7.2",
181
+ "resolved": "https://registry.npmjs.org/winston/-/winston-3.7.2.tgz",
182
+ "integrity": "sha512-QziIqtojHBoyzUOdQvQiar1DH0Xp9nF1A1y7NVy2DGEsz82SBDtOalS0ulTRGVT14xPX3WRWkCsdcJKqNflKng=="
183
+ },
184
+ "winston-transport": {
185
+ "version": "4.5.0",
186
+ "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.5.0.tgz",
187
+ "integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q=="
188
+ }
189
+ }
190
+ }
package/.versions ADDED
@@ -0,0 +1,55 @@
1
+ allow-deny@1.1.1
2
+ babel-compiler@7.9.0
3
+ babel-runtime@1.5.1
4
+ base64@1.0.12
5
+ binary-heap@1.0.11
6
+ boilerplate-generator@1.7.1
7
+ callback-hook@1.4.0
8
+ check@1.3.1
9
+ ddp@1.4.0
10
+ ddp-client@2.5.0
11
+ ddp-common@1.4.0
12
+ ddp-server@2.5.0
13
+ diff-sequence@1.1.1
14
+ dynamic-import@0.7.2
15
+ ecmascript@0.16.2
16
+ ecmascript-runtime@0.8.0
17
+ ecmascript-runtime-client@0.12.1
18
+ ecmascript-runtime-server@0.11.0
19
+ ejson@1.1.2
20
+ fetch@0.1.1
21
+ geojson-utils@1.0.10
22
+ id-map@1.1.1
23
+ inter-process-messaging@0.1.1
24
+ local-test:unchained:core-quotations@1.1.1
25
+ logging@1.3.1
26
+ meteor@1.10.0
27
+ meteortesting:browser-tests@0.1.2
28
+ meteortesting:mocha@0.4.4
29
+ minimongo@1.8.0
30
+ modern-browsers@0.1.8
31
+ modules@0.18.0
32
+ modules-runtime@0.13.0
33
+ mongo@1.15.0
34
+ mongo-decimal@0.1.3
35
+ mongo-dev-server@1.1.0
36
+ mongo-id@1.0.8
37
+ npm-mongo@4.3.1
38
+ ordered-dict@1.1.0
39
+ practicalmeteor:mocha-core@1.0.1
40
+ promise@0.12.0
41
+ random@1.2.0
42
+ react-fast-refresh@0.2.3
43
+ reload@1.3.1
44
+ retry@1.1.0
45
+ routepolicy@1.1.1
46
+ socket-stream-client@0.5.0
47
+ tracker@1.2.0
48
+ typescript@4.5.4
49
+ unchained:core-quotations@1.1.1
50
+ unchained:core-users@1.0.0-beta16
51
+
52
+ unchained:mongodb@1.0.0
53
+ underscore@1.0.10
54
+ webapp@1.13.1
55
+ webapp-hashing@1.1.0
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Quotations (Unchained Engine)
2
+
3
+ This package contains business logic and database abstraction for quotations in Unchained.
4
+
5
+ Find documentation of available [settings](https://docs.unchained.shop/config/quotations/) here
@@ -0,0 +1,7 @@
1
+ export declare enum QuotationStatus {
2
+ REQUESTED = "REQUESTED",
3
+ PROCESSING = "PROCESSING",
4
+ PROPOSED = "PROPOSED",
5
+ FULLFILLED = "FULLFILLED",
6
+ REJECTED = "REJECTED"
7
+ }
@@ -0,0 +1,9 @@
1
+ export var QuotationStatus;
2
+ (function (QuotationStatus) {
3
+ QuotationStatus["REQUESTED"] = "REQUESTED";
4
+ QuotationStatus["PROCESSING"] = "PROCESSING";
5
+ QuotationStatus["PROPOSED"] = "PROPOSED";
6
+ QuotationStatus["FULLFILLED"] = "FULLFILLED";
7
+ QuotationStatus["REJECTED"] = "REJECTED";
8
+ })(QuotationStatus || (QuotationStatus = {}));
9
+ //# sourceMappingURL=QuotationStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationStatus.js","sourceRoot":"","sources":["../../src/db/QuotationStatus.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;AACvB,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B"}
@@ -0,0 +1,3 @@
1
+ import { Db } from '@unchainedshop/types/common';
2
+ import { Quotation } from '@unchainedshop/types/quotations';
3
+ export declare const QuotationsCollection: (db: Db) => Promise<import("mongodb").Collection<Quotation>>;
@@ -0,0 +1,33 @@
1
+ import { buildDbIndexes } from '@unchainedshop/utils';
2
+ export const QuotationsCollection = async (db) => {
3
+ const Quotations = db.collection('quotations');
4
+ // Quotation Indexes
5
+ await buildDbIndexes(Quotations, [
6
+ { index: { userId: 1 } },
7
+ { index: { productId: 1 } },
8
+ { index: { status: 1 } },
9
+ {
10
+ index: {
11
+ _id: 'text',
12
+ userId: 'text',
13
+ quotationNumber: 'text',
14
+ status: 'text',
15
+ 'contact.telNumber': 'text',
16
+ 'contact.emailAddress': 'text',
17
+ },
18
+ options: {
19
+ weights: {
20
+ _id: 8,
21
+ userId: 3,
22
+ quotationNumber: 6,
23
+ 'contact.telNumber': 5,
24
+ 'contact.emailAddress': 4,
25
+ status: 1,
26
+ },
27
+ name: 'quotation_fulltext_search',
28
+ },
29
+ },
30
+ ]);
31
+ return Quotations;
32
+ };
33
+ //# sourceMappingURL=QuotationsCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationsCollection.js","sourceRoot":"","sources":["../../src/db/QuotationsCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EAAM,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAY,YAAY,CAAC,CAAC;IAE1D,oBAAoB;IACpB,MAAM,cAAc,CAAY,UAAU,EAAE;QAC1C,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;QACxB,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE;QAC3B,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;QACxB;YACE,KAAK,EAAE;gBACL,GAAG,EAAE,MAAM;gBACX,MAAM,EAAE,MAAM;gBACd,eAAe,EAAE,MAAM;gBACvB,MAAM,EAAE,MAAM;gBACd,mBAAmB,EAAE,MAAM;gBAC3B,sBAAsB,EAAE,MAAM;aAC/B;YACD,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,GAAG,EAAE,CAAC;oBACN,MAAM,EAAE,CAAC;oBACT,eAAe,EAAE,CAAC;oBAClB,mBAAmB,EAAE,CAAC;oBACtB,sBAAsB,EAAE,CAAC;oBACzB,MAAM,EAAE,CAAC;iBACV;gBACD,IAAI,EAAE,2BAA2B;aAClC;SACF;KACF,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export const QuotationsSchema: any;
@@ -0,0 +1,31 @@
1
+ import { Schemas } from '@unchainedshop/utils';
2
+ import SimpleSchema from 'simpl-schema';
3
+ export const QuotationsSchema = new SimpleSchema({
4
+ userId: { type: String, required: true },
5
+ productId: { type: String, required: true },
6
+ status: { type: String, required: true },
7
+ quotationNumber: String,
8
+ price: String,
9
+ expires: Date,
10
+ rejected: Date,
11
+ meta: { type: Object, blackbox: true },
12
+ fullfilled: Date,
13
+ context: { type: Object, blackbox: true },
14
+ currency: String,
15
+ countryCode: String,
16
+ configuration: Array,
17
+ 'configuration.$': {
18
+ type: Object,
19
+ required: true,
20
+ },
21
+ 'configuration.$.key': {
22
+ type: String,
23
+ required: true,
24
+ },
25
+ 'configuration.$.value': {
26
+ type: String,
27
+ },
28
+ ...Schemas.logFields,
29
+ ...Schemas.timestampFields,
30
+ }, { requiredByDefault: false });
31
+ //# sourceMappingURL=QuotationsSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationsSchema.js","sourceRoot":"","sources":["../../src/db/QuotationsSchema.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,YAAY,CAC9C;IACE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,eAAe,EAAE,MAAM;IACvB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,MAAM;IACnB,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE;QACjB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,MAAM;KACb;IAED,GAAG,OAAO,CAAC,SAAS;IACpB,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IQuotationAdapter } from '@unchainedshop/types/quotations';
2
+ export declare const QuotationAdapter: Omit<IQuotationAdapter, 'key' | 'label' | 'version'>;
@@ -0,0 +1,40 @@
1
+ import { log, LogLevel } from '@unchainedshop/logger';
2
+ import { QuotationError } from './QuotationError';
3
+ export const QuotationAdapter = {
4
+ orderIndex: 0,
5
+ isActivatedFor: () => {
6
+ return false;
7
+ },
8
+ actions: () => {
9
+ return {
10
+ configurationError: () => {
11
+ return QuotationError.NOT_IMPLEMENTED;
12
+ },
13
+ isManualRequestVerificationRequired: async () => {
14
+ return true;
15
+ },
16
+ isManualProposalRequired: async () => {
17
+ return true;
18
+ },
19
+ quote: async () => {
20
+ return {};
21
+ },
22
+ rejectRequest: async () => {
23
+ return true;
24
+ },
25
+ submitRequest: async () => {
26
+ return true;
27
+ },
28
+ verifyRequest: async () => {
29
+ return true;
30
+ },
31
+ transformItemConfiguration: async ({ quantity, configuration }) => {
32
+ return { quantity, configuration };
33
+ },
34
+ };
35
+ },
36
+ log(message, { level = LogLevel.Debug, ...options } = {}) {
37
+ return log(message, { level, ...options });
38
+ },
39
+ };
40
+ //# sourceMappingURL=QuotationAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationAdapter.js","sourceRoot":"","sources":["../../src/director/QuotationAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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ector: IQuotationDirector;
@@ -0,0 +1,86 @@
1
+ import { LogLevel, log } from '@unchainedshop/logger';
2
+ import { BaseDirector } from '@unchainedshop/utils';
3
+ import { QuotationError } from './QuotationError';
4
+ const baseDirector = BaseDirector('QuotationDirector', {
5
+ adapterSortKey: 'orderIndex',
6
+ });
7
+ const findAppropriateAdapters = (quotationContext, requestContext) => baseDirector.getAdapters({
8
+ adapterFilter: (Adapter) => {
9
+ const activated = Adapter.isActivatedFor(quotationContext, requestContext);
10
+ if (!activated) {
11
+ log(`Quotation Director -> ${Adapter.key} (${Adapter.version}) skipped`, {
12
+ level: LogLevel.Warning,
13
+ });
14
+ }
15
+ return activated;
16
+ },
17
+ });
18
+ export const QuotationDirector = {
19
+ ...baseDirector,
20
+ actions: (quotationContext, requestContext) => {
21
+ const context = { ...quotationContext, ...requestContext };
22
+ const Adapter = findAppropriateAdapters(quotationContext, requestContext)?.shift();
23
+ if (!Adapter) {
24
+ throw new Error('No suitable quotation plugin available for this context');
25
+ }
26
+ const adapter = Adapter.actions(context);
27
+ return {
28
+ configurationError: () => {
29
+ try {
30
+ return adapter.configurationError();
31
+ }
32
+ catch (error) {
33
+ log('QuotationDirector -> Error while checking for configurationError', {
34
+ level: LogLevel.Warning,
35
+ ...error,
36
+ });
37
+ return QuotationError.ADAPTER_NOT_FOUND;
38
+ }
39
+ },
40
+ isManualRequestVerificationRequired: async () => {
41
+ try {
42
+ return adapter.isManualRequestVerificationRequired();
43
+ }
44
+ catch (error) {
45
+ log('QuotationDirector -> Error while checking if is manual request verification required', {
46
+ level: LogLevel.Error,
47
+ ...error,
48
+ });
49
+ return null;
50
+ }
51
+ },
52
+ isManualProposalRequired: async () => {
53
+ try {
54
+ return adapter.isManualProposalRequired();
55
+ }
56
+ catch (error) {
57
+ log('QuotationDirector -> Error while checking if is manual proposal required', {
58
+ level: LogLevel.Error,
59
+ ...error,
60
+ });
61
+ return null;
62
+ }
63
+ },
64
+ quote: adapter.quote,
65
+ rejectRequest: adapter.rejectRequest,
66
+ submitRequest: adapter.submitRequest,
67
+ verifyRequest: adapter.verifyRequest,
68
+ transformItemConfiguration: async ({ quantity, configuration }) => {
69
+ try {
70
+ return adapter.transformItemConfiguration({
71
+ quantity,
72
+ configuration,
73
+ });
74
+ }
75
+ catch (error) {
76
+ log('QuotationDirector -> Error while transforming item configuration', {
77
+ level: LogLevel.Error,
78
+ ...error,
79
+ });
80
+ return null;
81
+ }
82
+ },
83
+ };
84
+ },
85
+ };
86
+ //# sourceMappingURL=QuotationDirector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationDirector.js","sourceRoot":"","sources":["../../src/director/QuotationDirector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAMtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,YAAY,GAAG,YAAY,CAAoB,mBAAmB,EAAE;IACxE,cAAc,EAAE,YAAY;CAC7B,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,gBAAkC,EAAE,cAAuB,EAAE,EAAE,CAC9F,YAAY,CAAC,WAAW,CAAC;IACvB,aAAa,EAAE,CAAC,OAA0B,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAC3E,IAAI,CAAC,SAAS,EAAE;YACd,GAAG,CAAC,yBAAyB,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,OAAO,WAAW,EAAE;gBACvE,KAAK,EAAE,QAAQ,CAAC,OAAO;aACxB,CAAC,CAAC;SACJ;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,GAAG,YAAY;IAEf,OAAO,EAAE,CAAC,gBAAgB,EAAE,cAA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,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,aAAa,EAAE,OAAO,CAAC,aAAa;YAEpC,0BAA0B,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE;gBAChE,IAAI;oBACF,OAAO,OAAO,CAAC,0BAA0B,CAAC;wBACxC,QAAQ;wBACR,aAAa;qBACd,CAAC,CAAC;iBACJ;gBAAC,OAAO,KAAK,EAAE;oBACd,GAAG,CAAC,kEAAkE,EAAE;wBACtE,KAAK,EAAE,QAAQ,CAAC,KAAK;wBACrB,GAAG,KAAK;qBACT,CAAC,CAAC;oBACH,OAAO,IAAI,CAAC;iBACb;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum QuotationError {
2
+ ADAPTER_NOT_FOUND = "ADAPTER_NOT_FOUND",
3
+ NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
4
+ INCOMPLETE_CONFIGURATION = "INCOMPLETE_CONFIGURATION",
5
+ WRONG_CREDENTIALS = "WRONG_CREDENTIALS"
6
+ }
@@ -0,0 +1,8 @@
1
+ export var QuotationError;
2
+ (function (QuotationError) {
3
+ QuotationError["ADAPTER_NOT_FOUND"] = "ADAPTER_NOT_FOUND";
4
+ QuotationError["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
5
+ QuotationError["INCOMPLETE_CONFIGURATION"] = "INCOMPLETE_CONFIGURATION";
6
+ QuotationError["WRONG_CREDENTIALS"] = "WRONG_CREDENTIALS";
7
+ })(QuotationError || (QuotationError = {}));
8
+ //# sourceMappingURL=QuotationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotationError.js","sourceRoot":"","sources":["../../src/director/QuotationError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,yDAAuC,CAAA;IACvC,qDAAmC,CAAA;IACnC,uEAAqD,CAAA;IACrD,yDAAuC,CAAA;AACzC,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}
@@ -0,0 +1,3 @@
1
+ import { ModuleInput } from '@unchainedshop/types/common';
2
+ import { QuotationsModule, QuotationsSettingsOptions } from '@unchainedshop/types/quotations';
3
+ export declare const configureQuotationsModule: ({ db, options: quotationsOptions, }: ModuleInput<QuotationsSettingsOptions>) => Promise<QuotationsModule>;