@scrabble-solver/scrabble-solver 2.8.5 → 2.8.7
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +9 -9
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/413.js +183 -94
- package/.next/server/chunks/{206.js → 429.js} +2 -4137
- package/.next/server/chunks/515.js +111 -78
- package/.next/server/chunks/{907.js → 911.js} +134 -367
- package/.next/server/chunks/939.js +218 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js +3 -2
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +33 -17
- package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +404 -58
- package/.next/server/pages/api/solve.js.nft.json +1 -1
- package/.next/server/pages/api/visit.js +3 -2
- package/.next/server/pages/api/visit.js.nft.json +1 -1
- package/.next/server/pages/index.html +3 -7
- package/.next/server/pages/index.js +12 -14
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/static/chunks/56-cf37c430261bbea5.js +1 -0
- package/.next/static/chunks/pages/_app-0b12a65bea70a0df.js +1 -0
- package/.next/static/chunks/pages/index-fcb69802550afb81.js +1 -0
- package/.next/static/css/1f39b55d50f5b30b.css +1 -0
- package/.next/static/css/751e8a14776d05d8.css +1 -0
- package/.next/static/z_0_lqfmiI_ISokr6NNRq/_buildManifest.js +1 -0
- package/.next/static/{TzKQ3IntkvaYmHBkWpfoi → z_0_lqfmiI_ISokr6NNRq}/_ssgManifest.js +0 -0
- package/.next/trace +40 -42
- package/package.json +9 -9
- package/src/api/index.ts +3 -9
- package/src/api/isBoardValid.ts +43 -0
- package/src/api/isCellValid.ts +26 -0
- package/src/api/isRowValid.ts +19 -0
- package/src/components/Board/Board.tsx +3 -1
- package/src/components/Board/BoardPure.tsx +4 -1
- package/src/components/Board/components/Cell/Cell.module.scss +28 -11
- package/src/components/Board/components/Cell/Cell.tsx +12 -1
- package/src/components/Board/components/Cell/CellPure.tsx +3 -1
- package/src/components/Board/components/Cell/lib.ts +10 -2
- package/src/components/Dictionary/Dictionary.module.scss +20 -0
- package/src/components/Dictionary/Dictionary.tsx +40 -29
- package/src/components/Results/Cell.tsx +3 -2
- package/src/components/Results/Result.tsx +16 -6
- package/src/components/ResultsInput/ResultsInput.tsx +11 -3
- package/src/hooks/useIsTablet.ts +2 -2
- package/src/lib/getRemainingTiles.ts +1 -1
- package/src/lib/index.ts +2 -1
- package/src/lib/isRegExp.ts +11 -0
- package/src/lib/isStringArray.ts +5 -0
- package/src/lib/sortResults.ts +5 -5
- package/src/pages/_app.tsx +6 -3
- package/src/pages/api/dictionary/[locale]/[word].ts +35 -11
- package/src/pages/api/solve.ts +39 -19
- package/src/pages/api/visit.ts +1 -0
- package/src/pages/index.module.scss +5 -11
- package/src/pages/index.tsx +5 -5
- package/src/sdk/{findWordDefinition.ts → findWordDefinitions.ts} +3 -3
- package/src/sdk/index.ts +1 -1
- package/src/state/sagas.ts +11 -11
- package/src/state/selectors.ts +6 -2
- package/src/state/slices/dictionaryInitialState.ts +3 -3
- package/src/state/slices/dictionarySlice.ts +4 -10
- package/.next/static/TzKQ3IntkvaYmHBkWpfoi/_buildManifest.js +0 -1
- package/.next/static/chunks/56-2d34867599a0ac66.js +0 -1
- package/.next/static/chunks/pages/_app-6ffa2ab900772b67.js +0 -1
- package/.next/static/chunks/pages/index-13ea7770a65c69ee.js +0 -1
- package/.next/static/css/3159cfe62ff742a3.css +0 -1
- package/.next/static/css/551d09cac435debb.css +0 -1
- package/src/api/validateBoard.ts +0 -45
- package/src/api/validateCell.ts +0 -40
- package/src/api/validateCharacter.ts +0 -14
- package/src/api/validateCharacters.ts +0 -24
- package/src/api/validateConfigId.ts +0 -9
- package/src/api/validateLocale.ts +0 -15
- package/src/api/validateRow.ts +0 -17
- package/src/api/validateTile.ts +0 -21
- package/src/api/validateWord.ts +0 -11
- package/src/lib/isLocale.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"files":["../webpack-runtime.js","../../package.json","../../../node_modules/next/dist/shared/lib/head.js","../../../node_modules/next/dist/shared/lib/head-manager-context.js","../../../node_modules/next/dist/shared/lib/utils.js","../../../node_modules/next/package.json","../../../node_modules/react/package.json","../../../node_modules/react/index.js","../../../node_modules/react/cjs/react.
|
|
1
|
+
{"version":1,"files":["../webpack-runtime.js","../../package.json","../../../node_modules/next/dist/shared/lib/head.js","../../../node_modules/next/dist/shared/lib/head-manager-context.js","../../../node_modules/next/dist/shared/lib/utils.js","../../../node_modules/next/package.json","../../../node_modules/react/package.json","../../../node_modules/react/index.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/@swc/helpers/lib/_extends.js","../../../node_modules/@swc/helpers/lib/_interop_require_default.js","../../../node_modules/@swc/helpers/lib/_interop_require_wildcard.js","../../../node_modules/@swc/helpers/lib/_async_to_generator.js","../../../node_modules/@swc/helpers/package.json","../../../node_modules/next/dist/shared/lib/amp-context.js","../../../node_modules/next/dist/shared/lib/side-effect.js","../../../node_modules/next/dist/shared/lib/amp-mode.js","../../../package.json"]}
|
|
@@ -110,30 +110,37 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
110
110
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
111
111
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
112
112
|
/* harmony export */ });
|
|
113
|
-
/* harmony import */ var
|
|
114
|
-
/* harmony import */ var
|
|
115
|
-
/* harmony import */ var
|
|
116
|
-
/* harmony import */ var
|
|
117
|
-
/* harmony import */ var
|
|
113
|
+
/* harmony import */ var _scrabble_solver_configs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27911);
|
|
114
|
+
/* harmony import */ var _scrabble_solver_configs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_scrabble_solver_configs__WEBPACK_IMPORTED_MODULE_0__);
|
|
115
|
+
/* harmony import */ var _scrabble_solver_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52954);
|
|
116
|
+
/* harmony import */ var _scrabble_solver_logger__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_scrabble_solver_logger__WEBPACK_IMPORTED_MODULE_1__);
|
|
117
|
+
/* harmony import */ var _scrabble_solver_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46452);
|
|
118
|
+
/* harmony import */ var _scrabble_solver_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_scrabble_solver_types__WEBPACK_IMPORTED_MODULE_2__);
|
|
119
|
+
/* harmony import */ var _scrabble_solver_word_definitions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98173);
|
|
120
|
+
/* harmony import */ var _scrabble_solver_word_definitions__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_scrabble_solver_word_definitions__WEBPACK_IMPORTED_MODULE_3__);
|
|
121
|
+
/* harmony import */ var api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(81025);
|
|
118
122
|
|
|
119
123
|
|
|
120
124
|
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
const MAXIMUM_WORDS_COUNT = _scrabble_solver_configs__WEBPACK_IMPORTED_MODULE_0__.scrabble["en-US"].maximumCharactersCount;
|
|
121
128
|
const dictionary = async (request, response)=>{
|
|
122
|
-
const meta = (0,
|
|
129
|
+
const meta = (0,api__WEBPACK_IMPORTED_MODULE_4__/* .getServerLoggingData */ .X8)(request);
|
|
123
130
|
try {
|
|
124
|
-
const { locale ,
|
|
125
|
-
|
|
131
|
+
const { locale , words } = parseRequest(request);
|
|
132
|
+
_scrabble_solver_logger__WEBPACK_IMPORTED_MODULE_1___default().info("dictionary - request", {
|
|
126
133
|
meta,
|
|
127
134
|
payload: {
|
|
128
135
|
locale,
|
|
129
|
-
|
|
136
|
+
words
|
|
130
137
|
}
|
|
131
138
|
});
|
|
132
|
-
const
|
|
133
|
-
response.status(200).send(result.toJson());
|
|
139
|
+
const results = await Promise.all(words.map((word)=>(0,_scrabble_solver_word_definitions__WEBPACK_IMPORTED_MODULE_3__.getWordDefinition)(locale, word)));
|
|
140
|
+
response.status(200).send(results.map((result)=>result.toJson()));
|
|
134
141
|
} catch (error) {
|
|
135
142
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
136
|
-
|
|
143
|
+
_scrabble_solver_logger__WEBPACK_IMPORTED_MODULE_1___default().error("dictionary - error", {
|
|
137
144
|
error,
|
|
138
145
|
meta
|
|
139
146
|
});
|
|
@@ -141,15 +148,24 @@ const dictionary = async (request, response)=>{
|
|
|
141
148
|
error: "Server error",
|
|
142
149
|
message
|
|
143
150
|
});
|
|
151
|
+
throw error;
|
|
144
152
|
}
|
|
145
153
|
};
|
|
146
154
|
const parseRequest = (request)=>{
|
|
147
155
|
const { locale , word } = request.query;
|
|
148
|
-
(0,
|
|
149
|
-
|
|
156
|
+
if (!(0,_scrabble_solver_types__WEBPACK_IMPORTED_MODULE_2__.isLocale)(locale)) {
|
|
157
|
+
throw new Error('Invalid "locale" parameter');
|
|
158
|
+
}
|
|
159
|
+
if (typeof word !== "string" || word.length === 0) {
|
|
160
|
+
throw new Error('Invalid "word" parameter');
|
|
161
|
+
}
|
|
162
|
+
const words = Array.from(new Set(word.split(",").map((part)=>part.trim()).filter(Boolean)));
|
|
163
|
+
if (words.length > MAXIMUM_WORDS_COUNT) {
|
|
164
|
+
throw new Error('Invalid "word" parameter');
|
|
165
|
+
}
|
|
150
166
|
return {
|
|
151
|
-
locale
|
|
152
|
-
|
|
167
|
+
locale,
|
|
168
|
+
words
|
|
153
169
|
};
|
|
154
170
|
};
|
|
155
171
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (dictionary);
|
|
@@ -669,7 +685,7 @@ exports["default"] = parseSpanish;
|
|
|
669
685
|
var __webpack_require__ = require("../../../../webpack-api-runtime.js");
|
|
670
686
|
__webpack_require__.C(exports);
|
|
671
687
|
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
|
672
|
-
var __webpack_exports__ = __webpack_require__.X(0, [50,865,
|
|
688
|
+
var __webpack_exports__ = __webpack_require__.X(0, [50,865,939,911], () => (__webpack_exec__(15548)));
|
|
673
689
|
module.exports = __webpack_exports__;
|
|
674
690
|
|
|
675
691
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"files":["../../../../webpack-api-runtime.js","../../../../chunks/50.js","../../../../chunks/865.js","../../../../chunks/
|
|
1
|
+
{"version":1,"files":["../../../../webpack-api-runtime.js","../../../../chunks/50.js","../../../../chunks/865.js","../../../../chunks/939.js","../../../../chunks/911.js","../../../../../package.json"]}
|