| 318 | } |
| 319 | |
| 320 | static validatePagesOptions(pages) { |
| 321 | if (Object.prototype.toString.call(pages) !== '[object Object]') { |
| 322 | throw 'Parse Server option pages must be an object.'; |
| 323 | } |
| 324 | if (pages.enableLocalization === undefined) { |
| 325 | pages.enableLocalization = PagesOptions.enableLocalization.default; |
| 326 | } else if (!isBoolean(pages.enableLocalization)) { |
| 327 | throw 'Parse Server option pages.enableLocalization must be a boolean.'; |
| 328 | } |
| 329 | if (pages.localizationJsonPath === undefined) { |
| 330 | pages.localizationJsonPath = PagesOptions.localizationJsonPath.default; |
| 331 | } else if (!isString(pages.localizationJsonPath)) { |
| 332 | throw 'Parse Server option pages.localizationJsonPath must be a string.'; |
| 333 | } |
| 334 | if (pages.localizationFallbackLocale === undefined) { |
| 335 | pages.localizationFallbackLocale = PagesOptions.localizationFallbackLocale.default; |
| 336 | } else if (!isString(pages.localizationFallbackLocale)) { |
| 337 | throw 'Parse Server option pages.localizationFallbackLocale must be a string.'; |
| 338 | } |
| 339 | if (pages.placeholders === undefined) { |
| 340 | pages.placeholders = PagesOptions.placeholders.default; |
| 341 | } else if ( |
| 342 | Object.prototype.toString.call(pages.placeholders) !== '[object Object]' && |
| 343 | typeof pages.placeholders !== 'function' |
| 344 | ) { |
| 345 | throw 'Parse Server option pages.placeholders must be an object or a function.'; |
| 346 | } |
| 347 | if (pages.forceRedirect === undefined) { |
| 348 | pages.forceRedirect = PagesOptions.forceRedirect.default; |
| 349 | } else if (!isBoolean(pages.forceRedirect)) { |
| 350 | throw 'Parse Server option pages.forceRedirect must be a boolean.'; |
| 351 | } |
| 352 | if (pages.pagesPath !== undefined && !isString(pages.pagesPath)) { |
| 353 | throw 'Parse Server option pages.pagesPath must be a string.'; |
| 354 | } |
| 355 | if (pages.pagesEndpoint === undefined) { |
| 356 | pages.pagesEndpoint = PagesOptions.pagesEndpoint.default; |
| 357 | } else if (!isString(pages.pagesEndpoint)) { |
| 358 | throw 'Parse Server option pages.pagesEndpoint must be a string.'; |
| 359 | } |
| 360 | if (pages.customUrls === undefined) { |
| 361 | pages.customUrls = PagesOptions.customUrls.default; |
| 362 | } else if (Object.prototype.toString.call(pages.customUrls) !== '[object Object]') { |
| 363 | throw 'Parse Server option pages.customUrls must be an object.'; |
| 364 | } |
| 365 | if (pages.customRoutes === undefined) { |
| 366 | pages.customRoutes = PagesOptions.customRoutes.default; |
| 367 | } else if (!Array.isArray(pages.customRoutes)) { |
| 368 | throw 'Parse Server option pages.customRoutes must be an array.'; |
| 369 | } |
| 370 | if (pages.encodePageParamHeaders === undefined) { |
| 371 | pages.encodePageParamHeaders = PagesOptions.encodePageParamHeaders.default; |
| 372 | } else if (!isBoolean(pages.encodePageParamHeaders)) { |
| 373 | throw 'Parse Server option pages.encodePageParamHeaders must be a boolean.'; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | static validateIdempotencyOptions(idempotencyOptions) { |