Minor fixes
This commit is contained in:
parent
d072a07004
commit
23050f5a22
22
package-lock.json
generated
22
package-lock.json
generated
@ -2047,18 +2047,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
|
||||||
"version": "22.13.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz",
|
|
||||||
"integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"undici-types": "~6.20.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vitest/expect": {
|
"node_modules/@vitest/expect": {
|
||||||
"version": "2.1.9",
|
"version": "2.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.9.tgz",
|
||||||
@ -2121,6 +2109,7 @@
|
|||||||
"integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==",
|
"integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/utils": "2.1.9",
|
"@vitest/utils": "2.1.9",
|
||||||
"pathe": "^1.1.2"
|
"pathe": "^1.1.2"
|
||||||
@ -2135,6 +2124,7 @@
|
|||||||
"integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==",
|
"integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/pretty-format": "2.1.9",
|
"@vitest/pretty-format": "2.1.9",
|
||||||
"magic-string": "^0.30.12",
|
"magic-string": "^0.30.12",
|
||||||
@ -3049,6 +3039,7 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"esbuild": "bin/esbuild"
|
"esbuild": "bin/esbuild"
|
||||||
},
|
},
|
||||||
@ -4878,8 +4869,7 @@
|
|||||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/unenv": {
|
"node_modules/unenv": {
|
||||||
"version": "2.0.0-rc.1",
|
"version": "2.0.0-rc.1",
|
||||||
@ -5016,6 +5006,7 @@
|
|||||||
"integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==",
|
"integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.21.3",
|
"esbuild": "^0.21.3",
|
||||||
"postcss": "^8.4.43",
|
"postcss": "^8.4.43",
|
||||||
@ -5512,6 +5503,7 @@
|
|||||||
"integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==",
|
"integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/expect": "2.1.9",
|
"@vitest/expect": "2.1.9",
|
||||||
"@vitest/mocker": "2.1.9",
|
"@vitest/mocker": "2.1.9",
|
||||||
@ -6732,6 +6724,7 @@
|
|||||||
"integrity": "sha512-Wj7/AMtE9MRnAXa6Su3Lk0LNCfqDYgfwVjwRFVum9U7wsto1imuHqk4kTm7Jni+5A0Hn7dttL6O/zjvUvoo+8A==",
|
"integrity": "sha512-Wj7/AMtE9MRnAXa6Su3Lk0LNCfqDYgfwVjwRFVum9U7wsto1imuHqk4kTm7Jni+5A0Hn7dttL6O/zjvUvoo+8A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"defu": "^6.1.4",
|
"defu": "^6.1.4",
|
||||||
"exsolve": "^1.0.7",
|
"exsolve": "^1.0.7",
|
||||||
@ -6747,6 +6740,7 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"workerd": "bin/workerd"
|
"workerd": "bin/workerd"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -92,7 +92,11 @@ export async function importSmoobuBookings(env) {
|
|||||||
.filter((booking) => booking !== null);
|
.filter((booking) => booking !== null);
|
||||||
|
|
||||||
// Get the current cache (source of truth)
|
// Get the current cache (source of truth)
|
||||||
const cachedBookings = (await getBookingsCache(env)) || [];
|
const cachedBookings =
|
||||||
|
(await getBookingsCache(env)).filter(
|
||||||
|
(booking) =>
|
||||||
|
booking.status !== "cancelled" && booking.status !== "complete"
|
||||||
|
) || [];
|
||||||
// Diff Smoobu bookings with cache
|
// Diff Smoobu bookings with cache
|
||||||
const { toAdd, toUpdate, toDelete } = diffBookings(
|
const { toAdd, toUpdate, toDelete } = diffBookings(
|
||||||
smoobuBookings,
|
smoobuBookings,
|
||||||
|
|||||||
@ -13,7 +13,12 @@ export async function getCachedContent(env) {
|
|||||||
|
|
||||||
const noProperties = cachedContent.properties?.length === 0;
|
const noProperties = cachedContent.properties?.length === 0;
|
||||||
const noPages = cachedContent.pages?.length === 0;
|
const noPages = cachedContent.pages?.length === 0;
|
||||||
const noSettings = cachedContent.settings == {};
|
const noSettings =
|
||||||
|
!cachedContent.settings || Object.keys(cachedContent.settings).length === 0;
|
||||||
|
|
||||||
|
if (noSettings) {
|
||||||
|
cachedContent.settings = await importNotionSettings(env);
|
||||||
|
}
|
||||||
|
|
||||||
if (noProperties || noPages || noSettings) {
|
if (noProperties || noPages || noSettings) {
|
||||||
await importNotionNavigation(env);
|
await importNotionNavigation(env);
|
||||||
@ -29,10 +34,6 @@ export async function getCachedContent(env) {
|
|||||||
cachedContent.images = await importImages(env);
|
cachedContent.images = await importImages(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noSettings) {
|
|
||||||
cachedContent.settings = await importNotionSettings(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cachedContent) {
|
if (cachedContent) {
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user