@beechcms/api 0.6.0-preview.3 → 0.6.0-preview.4
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/assets/dashboard/BeechLogo.svg +18 -18
- package/assets/dashboard/BeechLogoLIght.svg +48 -48
- package/assets/dashboard/assets/chart-BwlCt-IA.js +39 -0
- package/assets/dashboard/assets/{index-CrW-zhkA.js → index-BcVN-DNy.js} +4 -4
- package/assets/dashboard/assets/index-Cf1yRCqG.css +1 -0
- package/assets/dashboard/assets/pie-chart-recharts-BMWpjFzf.js +1 -0
- package/assets/dashboard/assets/timeseries-chart-recharts-8_GwAFR0.js +1 -0
- package/assets/dashboard/beechLogoDark.svg +48 -48
- package/assets/dashboard/index.html +18 -18
- package/assets/dashboard/noResult.svg +42 -42
- package/assets/dashboard/sol.svg +3 -3
- package/assets/dashboard/undraw_enter_nwx3.svg +36 -36
- package/dist/factory.d.ts +7 -1
- package/dist/features/automations/automations.schema.d.ts +11 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +86 -20
- package/dist/middleware/queue.middleware.d.ts +11 -0
- package/dist/shared/cloudflare-queue-service.d.ts +11 -0
- package/dist/shared/in-memory-queue-service.d.ts +16 -0
- package/dist/shared/queue-consumer.d.ts +9 -0
- package/dist/types.d.ts +3 -1
- package/migrations/0000_v040_base.sql +265 -265
- package/migrations/0029_automations.sql +14 -14
- package/migrations/0030_test_seeds.sql +125 -125
- package/package.json +3 -2
- package/assets/dashboard/assets/chart-Cws4Yj6K.js +0 -39
- package/assets/dashboard/assets/index-BjPpppHe.css +0 -1
- package/assets/dashboard/assets/pie-chart-recharts-CAxoDQp2.js +0 -1
- package/assets/dashboard/assets/timeseries-chart-recharts-CixDW-LM.js +0 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<svg width="784" height="869" viewBox="0 0 784 869" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_1_2)">
|
|
3
|
-
<path d="M533.24 538.196C960.679 824.193 821.76 930.762 266.62 833.7C121.57 808.34 0 701.399 0 538.196C0 374.994 119.37 242.692 266.62 242.692C413.87 242.692 397.6 447.44 533.24 538.196Z" fill="#3F3D56"/>
|
|
4
|
-
<path opacity="0.1" d="M571.456 816.814C664.715 816.814 740.315 810.05 740.315 801.706C740.315 793.362 664.715 786.597 571.456 786.597C478.197 786.597 402.597 793.362 402.597 801.706C402.597 810.05 478.197 816.814 571.456 816.814Z" fill="black"/>
|
|
5
|
-
<path opacity="0.1" d="M238.428 318.814C287.857 318.814 327.928 312.05 327.928 303.706C327.928 295.362 287.857 288.598 238.428 288.598C188.998 288.598 148.928 295.362 148.928 303.706C148.928 312.05 188.998 318.814 238.428 318.814Z" fill="black"/>
|
|
6
|
-
<path opacity="0.1" d="M233.737 340.899C195.335 340.891 157.715 351.748 125.221 372.214C92.7278 392.68 66.687 421.921 50.1069 456.559C69.1658 435.504 92.43 418.681 118.396 407.178C144.363 395.675 172.454 389.748 200.854 389.779C313.252 389.779 404.374 480.901 404.374 593.3C404.42 623.708 397.622 653.736 384.484 681.16C418.509 643.754 437.33 594.985 437.257 544.419C437.257 432.021 346.135 340.899 233.737 340.899Z" fill="black"/>
|
|
7
|
-
<path opacity="0.3" d="M404.374 592.411C404.42 622.819 397.622 652.848 384.484 680.271C365.425 701.326 342.161 718.149 316.195 729.652C290.228 741.155 262.137 747.082 233.737 747.051C121.339 747.051 30.217 655.929 30.217 543.53C30.1711 513.122 36.969 483.094 50.1069 455.67C69.1658 434.615 92.43 417.792 118.396 406.289C144.363 394.786 172.454 388.859 200.854 388.891C313.252 388.891 404.374 480.013 404.374 592.411Z" fill="#D5A889"/>
|
|
8
|
-
<path d="M233.737 748.05C120.964 748.05 29.2168 656.303 29.2168 543.531C29.1348 512.969 35.9682 482.784 49.2051 455.238C65.8668 420.43 92.0355 391.045 124.689 370.479C157.342 349.912 195.147 339.003 233.737 339.01C346.51 339.01 438.257 430.758 438.257 543.531C438.259 570.389 432.97 596.985 422.693 621.799C412.415 646.613 397.35 669.16 378.359 688.152C359.367 707.144 336.82 722.208 312.006 732.486C287.191 742.763 260.596 748.052 233.737 748.05ZM233.737 341.01C156.248 341.01 84.5224 386.187 51.0088 456.103C37.9014 483.38 31.1352 513.268 31.2168 543.531C31.2168 655.201 122.067 746.05 233.737 746.05C260.333 746.052 286.669 740.815 311.24 730.638C335.812 720.461 358.139 705.544 376.945 686.738C395.751 667.932 410.668 645.606 420.845 621.034C431.022 596.462 436.259 570.127 436.257 543.531C436.257 431.86 345.407 341.01 233.737 341.01Z" fill="white"/>
|
|
9
|
-
<path d="M699.356 750.635C684.574 769.966 686.264 796.093 686.264 796.093C686.264 796.093 711.92 790.876 726.702 771.544C741.484 752.213 739.793 726.086 739.793 726.086C739.793 726.086 714.137 731.303 699.356 750.635Z" fill="#D0CDE1"/>
|
|
10
|
-
<path d="M709.042 754.976C706.174 779.142 686.756 796.703 686.756 796.703C686.756 796.703 671.99 775.084 674.858 750.919C677.727 726.753 697.144 709.191 697.144 709.191C697.144 709.191 711.911 730.811 709.042 754.976Z" fill="#D5A889"/>
|
|
11
|
-
<path d="M354.901 190.533C354.942 274.417 305.088 303.727 243.578 303.756C242.149 303.757 240.727 303.742 239.312 303.711C236.461 303.651 233.64 303.522 230.849 303.325C175.332 299.421 132.182 268.653 132.144 190.641C132.105 109.908 235.238 7.97471 242.972 0.4377C242.979 0.4377 242.979 0.437699 242.986 0.430849C243.28 0.143599 243.43 0 243.43 0C243.43 0 354.861 106.655 354.901 190.533Z" fill="#D5A889"/>
|
|
12
|
-
<path d="M239.518 290.927L280.226 233.991L239.418 297.175L239.312 303.711C236.461 303.651 233.64 303.522 230.849 303.325L235.197 219.405L235.162 218.755L235.237 218.632L235.651 210.702L194.679 147.4L235.771 204.762L235.874 206.443L239.159 143.038L204.079 77.6211L239.584 131.895L242.972 0.437694L242.986 0.000213623L242.986 0.430842L242.462 104.099L277.326 62.9838L242.316 113.027L241.421 169.8L273.981 115.301L241.295 178.147L240.798 209.715L288.052 133.854L240.618 220.728L239.518 290.927Z" fill="#3F3D56"/>
|
|
13
|
-
<path d="M572.956 238.594C562.281 220.557 541.162 219.716 541.162 219.716C541.162 219.716 520.583 217.085 507.382 244.555C495.077 270.159 478.095 294.881 504.648 300.875L509.444 285.947L512.414 301.986C516.195 302.258 519.988 302.323 523.775 302.181C552.211 301.263 579.292 302.449 578.42 292.245C577.261 278.68 583.227 255.949 572.956 238.594Z" fill="#2F2E41"/>
|
|
14
|
-
<path d="M525.862 407.843L528.608 435.301L592.22 428.437L593.593 407.843H525.862Z" fill="#A0616A"/>
|
|
15
|
-
<path d="M518.998 422.945L517.167 438.962C517.167 438.962 496.116 468.251 497.946 518.592C499.777 568.933 469.115 792.72 491.081 794.55C513.048 796.381 552.405 799.127 554.236 792.262C556.067 785.398 559.728 524.999 559.728 524.999C559.728 524.999 569.338 792.587 585.813 793.502C602.289 794.418 657.663 796.248 657.663 789.384C657.663 782.519 609.153 476.031 609.153 476.031L601.373 450.403L593.593 418.826C593.593 418.826 545.083 427.064 531.812 423.86C518.54 420.657 518.998 422.945 518.998 422.945Z" fill="#2F2E41"/>
|
|
16
|
-
<path d="M540.964 296.178C557.14 296.178 570.254 283.065 570.254 266.889C570.254 250.713 557.14 237.6 540.964 237.6C524.789 237.6 511.675 250.713 511.675 266.889C511.675 283.065 524.789 296.178 540.964 296.178Z" fill="#A0616A"/>
|
|
17
|
-
<path d="M592.22 315.399L586.66 323.49L583.1 328.666L577.118 337.366L547.371 339.654C547.371 339.654 540.145 337.32 531.807 333.911C528.727 332.648 525.492 331.238 522.416 329.742C510.485 323.948 500.912 316.877 511.675 312.195C513.587 311.375 515.423 310.389 517.162 309.248C518.745 308.214 520.219 307.021 521.56 305.688C524.318 302.925 526.359 299.531 527.508 295.8C528.656 292.069 528.877 288.115 528.15 284.279L556.982 280.161C556.144 287.474 563.416 295.45 571.567 301.963C574.244 304.109 577.022 306.091 579.635 307.839C586.486 312.424 592.22 315.399 592.22 315.399Z" fill="#A0616A"/>
|
|
18
|
-
<path d="M552.863 324.094C552.863 324.094 524.718 319.289 518.311 309.221C518.311 309.221 490.624 312.653 492.912 327.298C495.2 341.942 518.082 422.03 518.082 422.03C518.082 422.03 575.288 411.046 596.339 419.284L609.153 317.23C609.153 317.23 604.577 307.161 595.882 309.907C587.186 312.653 583.754 310.136 583.754 310.136C583.754 310.136 573.915 324.094 552.863 324.094Z" fill="#D0CDE1"/>
|
|
19
|
-
<path d="M578.491 484.727C578.491 484.727 598.17 506.693 587.186 510.355C576.203 514.016 562.931 495.71 562.931 495.71L578.491 484.727Z" fill="#A0616A"/>
|
|
20
|
-
<path d="M584.898 486.557C584.898 486.557 568.881 497.541 574.83 504.863C580.779 512.185 601.373 498.456 601.373 495.71C601.373 492.964 584.898 486.557 584.898 486.557Z" fill="#A0616A"/>
|
|
21
|
-
<path d="M545.541 427.064L532.269 429.352L523.574 364.824C524.076 353.118 523.689 341.39 522.416 329.742C521.446 321.962 519.826 314.484 517.162 309.248C518.745 308.214 520.219 307.021 521.56 305.688C524.746 310.736 530.558 321.426 531.807 333.911C532.134 337.037 532.135 340.189 531.812 343.315C529.523 364.824 529.981 368.943 529.981 368.943L545.541 427.064Z" fill="#2F2E41"/>
|
|
22
|
-
<path d="M514.879 313.111C514.879 313.111 493.37 307.161 491.539 319.975C489.709 332.789 491.997 365.74 497.031 378.096C502.065 390.452 519.455 430.725 519.455 430.725C519.455 430.725 551.033 470.997 552.406 480.608C553.778 490.218 560.643 500.286 560.643 500.286L582.61 486.1L539.591 413.334L520.828 362.994C520.828 362.994 528.608 317.23 514.879 313.111Z" fill="#D0CDE1"/>
|
|
23
|
-
<path d="M599.085 314.941L609.153 317.23C609.153 317.23 618.306 356.587 614.645 377.638C610.984 398.69 610.526 406.012 610.526 406.012L607.323 465.963C607.323 465.963 608.238 504.405 601.831 498.456C595.424 492.507 582.61 489.761 582.61 489.761C582.61 489.761 583.983 472.828 589.017 468.709C589.017 468.709 594.966 437.132 591.305 423.403C587.644 409.673 599.085 314.941 599.085 314.941Z" fill="#D0CDE1"/>
|
|
24
|
-
<path d="M602.746 359.333L591.076 426.835L583.983 423.86L596.339 359.333L583.1 328.666L571.567 301.963C574.244 304.109 577.022 306.091 579.635 307.839L586.66 323.49L602.746 359.333Z" fill="#2F2E41"/>
|
|
25
|
-
<path d="M568.236 236.855L547.372 225.926L518.559 230.397L512.598 256.726L527.437 256.155L531.583 246.482V255.996L538.43 255.732L542.404 240.332L544.888 256.726L569.23 256.229L568.236 236.855Z" fill="#2F2E41"/>
|
|
26
|
-
<path d="M527.019 801.706C534.873 801.706 541.239 799.319 541.239 796.374C541.239 793.429 534.873 791.041 527.019 791.041C519.166 791.041 512.8 793.429 512.8 796.374C512.8 799.319 519.166 801.706 527.019 801.706Z" fill="#2F2E41"/>
|
|
27
|
-
<path d="M623.003 801.706C630.856 801.706 637.222 799.319 637.222 796.374C637.222 793.429 630.856 791.041 623.003 791.041C615.149 791.041 608.783 793.429 608.783 796.374C608.783 799.319 615.149 801.706 623.003 801.706Z" fill="#2F2E41"/>
|
|
28
|
-
<path d="M263.546 648.795C249 658.26 232.238 663.769 214.913 664.778C197.589 665.788 180.3 662.262 164.754 654.549L166.955 650.059C185.694 659.265 206.933 662.076 227.422 658.063C247.91 654.049 266.519 643.433 280.399 627.838C294.28 612.242 302.668 592.528 304.279 571.713C305.89 550.897 300.635 530.127 289.319 512.582C278.003 495.037 261.249 481.683 241.623 474.566C221.996 467.448 200.577 466.958 180.645 473.17C160.713 479.383 143.366 491.956 131.259 508.966C119.153 525.975 112.954 546.483 113.611 567.35L108.613 567.503C108.059 549.946 112.117 532.549 120.382 517.048C128.648 501.548 140.831 488.484 155.719 479.159C170.606 469.835 187.678 464.575 205.231 463.905C222.785 463.234 240.208 467.176 255.764 475.338C271.319 483.5 284.464 495.596 293.887 510.421C303.311 525.246 308.684 542.282 309.471 559.831C310.258 577.38 306.432 594.829 298.374 610.439C290.316 626.048 278.308 639.273 263.546 648.795Z" fill="white"/>
|
|
29
|
-
<path d="M218.318 558.375C203.532 561.648 183.855 563.642 169.517 561.56L187.516 575.266L137.128 607.765L139.838 611.967L190.226 579.468L195.292 601.522C199.308 587.602 209.241 570.499 218.318 558.375Z" fill="white"/>
|
|
30
|
-
</g>
|
|
31
|
-
<defs>
|
|
32
|
-
<clipPath id="clip0_1_2">
|
|
33
|
-
<rect width="783.928" height="868.734" fill="white"/>
|
|
34
|
-
</clipPath>
|
|
35
|
-
</defs>
|
|
36
|
-
</svg>
|
|
1
|
+
<svg width="784" height="869" viewBox="0 0 784 869" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1_2)">
|
|
3
|
+
<path d="M533.24 538.196C960.679 824.193 821.76 930.762 266.62 833.7C121.57 808.34 0 701.399 0 538.196C0 374.994 119.37 242.692 266.62 242.692C413.87 242.692 397.6 447.44 533.24 538.196Z" fill="#3F3D56"/>
|
|
4
|
+
<path opacity="0.1" d="M571.456 816.814C664.715 816.814 740.315 810.05 740.315 801.706C740.315 793.362 664.715 786.597 571.456 786.597C478.197 786.597 402.597 793.362 402.597 801.706C402.597 810.05 478.197 816.814 571.456 816.814Z" fill="black"/>
|
|
5
|
+
<path opacity="0.1" d="M238.428 318.814C287.857 318.814 327.928 312.05 327.928 303.706C327.928 295.362 287.857 288.598 238.428 288.598C188.998 288.598 148.928 295.362 148.928 303.706C148.928 312.05 188.998 318.814 238.428 318.814Z" fill="black"/>
|
|
6
|
+
<path opacity="0.1" d="M233.737 340.899C195.335 340.891 157.715 351.748 125.221 372.214C92.7278 392.68 66.687 421.921 50.1069 456.559C69.1658 435.504 92.43 418.681 118.396 407.178C144.363 395.675 172.454 389.748 200.854 389.779C313.252 389.779 404.374 480.901 404.374 593.3C404.42 623.708 397.622 653.736 384.484 681.16C418.509 643.754 437.33 594.985 437.257 544.419C437.257 432.021 346.135 340.899 233.737 340.899Z" fill="black"/>
|
|
7
|
+
<path opacity="0.3" d="M404.374 592.411C404.42 622.819 397.622 652.848 384.484 680.271C365.425 701.326 342.161 718.149 316.195 729.652C290.228 741.155 262.137 747.082 233.737 747.051C121.339 747.051 30.217 655.929 30.217 543.53C30.1711 513.122 36.969 483.094 50.1069 455.67C69.1658 434.615 92.43 417.792 118.396 406.289C144.363 394.786 172.454 388.859 200.854 388.891C313.252 388.891 404.374 480.013 404.374 592.411Z" fill="#D5A889"/>
|
|
8
|
+
<path d="M233.737 748.05C120.964 748.05 29.2168 656.303 29.2168 543.531C29.1348 512.969 35.9682 482.784 49.2051 455.238C65.8668 420.43 92.0355 391.045 124.689 370.479C157.342 349.912 195.147 339.003 233.737 339.01C346.51 339.01 438.257 430.758 438.257 543.531C438.259 570.389 432.97 596.985 422.693 621.799C412.415 646.613 397.35 669.16 378.359 688.152C359.367 707.144 336.82 722.208 312.006 732.486C287.191 742.763 260.596 748.052 233.737 748.05ZM233.737 341.01C156.248 341.01 84.5224 386.187 51.0088 456.103C37.9014 483.38 31.1352 513.268 31.2168 543.531C31.2168 655.201 122.067 746.05 233.737 746.05C260.333 746.052 286.669 740.815 311.24 730.638C335.812 720.461 358.139 705.544 376.945 686.738C395.751 667.932 410.668 645.606 420.845 621.034C431.022 596.462 436.259 570.127 436.257 543.531C436.257 431.86 345.407 341.01 233.737 341.01Z" fill="white"/>
|
|
9
|
+
<path d="M699.356 750.635C684.574 769.966 686.264 796.093 686.264 796.093C686.264 796.093 711.92 790.876 726.702 771.544C741.484 752.213 739.793 726.086 739.793 726.086C739.793 726.086 714.137 731.303 699.356 750.635Z" fill="#D0CDE1"/>
|
|
10
|
+
<path d="M709.042 754.976C706.174 779.142 686.756 796.703 686.756 796.703C686.756 796.703 671.99 775.084 674.858 750.919C677.727 726.753 697.144 709.191 697.144 709.191C697.144 709.191 711.911 730.811 709.042 754.976Z" fill="#D5A889"/>
|
|
11
|
+
<path d="M354.901 190.533C354.942 274.417 305.088 303.727 243.578 303.756C242.149 303.757 240.727 303.742 239.312 303.711C236.461 303.651 233.64 303.522 230.849 303.325C175.332 299.421 132.182 268.653 132.144 190.641C132.105 109.908 235.238 7.97471 242.972 0.4377C242.979 0.4377 242.979 0.437699 242.986 0.430849C243.28 0.143599 243.43 0 243.43 0C243.43 0 354.861 106.655 354.901 190.533Z" fill="#D5A889"/>
|
|
12
|
+
<path d="M239.518 290.927L280.226 233.991L239.418 297.175L239.312 303.711C236.461 303.651 233.64 303.522 230.849 303.325L235.197 219.405L235.162 218.755L235.237 218.632L235.651 210.702L194.679 147.4L235.771 204.762L235.874 206.443L239.159 143.038L204.079 77.6211L239.584 131.895L242.972 0.437694L242.986 0.000213623L242.986 0.430842L242.462 104.099L277.326 62.9838L242.316 113.027L241.421 169.8L273.981 115.301L241.295 178.147L240.798 209.715L288.052 133.854L240.618 220.728L239.518 290.927Z" fill="#3F3D56"/>
|
|
13
|
+
<path d="M572.956 238.594C562.281 220.557 541.162 219.716 541.162 219.716C541.162 219.716 520.583 217.085 507.382 244.555C495.077 270.159 478.095 294.881 504.648 300.875L509.444 285.947L512.414 301.986C516.195 302.258 519.988 302.323 523.775 302.181C552.211 301.263 579.292 302.449 578.42 292.245C577.261 278.68 583.227 255.949 572.956 238.594Z" fill="#2F2E41"/>
|
|
14
|
+
<path d="M525.862 407.843L528.608 435.301L592.22 428.437L593.593 407.843H525.862Z" fill="#A0616A"/>
|
|
15
|
+
<path d="M518.998 422.945L517.167 438.962C517.167 438.962 496.116 468.251 497.946 518.592C499.777 568.933 469.115 792.72 491.081 794.55C513.048 796.381 552.405 799.127 554.236 792.262C556.067 785.398 559.728 524.999 559.728 524.999C559.728 524.999 569.338 792.587 585.813 793.502C602.289 794.418 657.663 796.248 657.663 789.384C657.663 782.519 609.153 476.031 609.153 476.031L601.373 450.403L593.593 418.826C593.593 418.826 545.083 427.064 531.812 423.86C518.54 420.657 518.998 422.945 518.998 422.945Z" fill="#2F2E41"/>
|
|
16
|
+
<path d="M540.964 296.178C557.14 296.178 570.254 283.065 570.254 266.889C570.254 250.713 557.14 237.6 540.964 237.6C524.789 237.6 511.675 250.713 511.675 266.889C511.675 283.065 524.789 296.178 540.964 296.178Z" fill="#A0616A"/>
|
|
17
|
+
<path d="M592.22 315.399L586.66 323.49L583.1 328.666L577.118 337.366L547.371 339.654C547.371 339.654 540.145 337.32 531.807 333.911C528.727 332.648 525.492 331.238 522.416 329.742C510.485 323.948 500.912 316.877 511.675 312.195C513.587 311.375 515.423 310.389 517.162 309.248C518.745 308.214 520.219 307.021 521.56 305.688C524.318 302.925 526.359 299.531 527.508 295.8C528.656 292.069 528.877 288.115 528.15 284.279L556.982 280.161C556.144 287.474 563.416 295.45 571.567 301.963C574.244 304.109 577.022 306.091 579.635 307.839C586.486 312.424 592.22 315.399 592.22 315.399Z" fill="#A0616A"/>
|
|
18
|
+
<path d="M552.863 324.094C552.863 324.094 524.718 319.289 518.311 309.221C518.311 309.221 490.624 312.653 492.912 327.298C495.2 341.942 518.082 422.03 518.082 422.03C518.082 422.03 575.288 411.046 596.339 419.284L609.153 317.23C609.153 317.23 604.577 307.161 595.882 309.907C587.186 312.653 583.754 310.136 583.754 310.136C583.754 310.136 573.915 324.094 552.863 324.094Z" fill="#D0CDE1"/>
|
|
19
|
+
<path d="M578.491 484.727C578.491 484.727 598.17 506.693 587.186 510.355C576.203 514.016 562.931 495.71 562.931 495.71L578.491 484.727Z" fill="#A0616A"/>
|
|
20
|
+
<path d="M584.898 486.557C584.898 486.557 568.881 497.541 574.83 504.863C580.779 512.185 601.373 498.456 601.373 495.71C601.373 492.964 584.898 486.557 584.898 486.557Z" fill="#A0616A"/>
|
|
21
|
+
<path d="M545.541 427.064L532.269 429.352L523.574 364.824C524.076 353.118 523.689 341.39 522.416 329.742C521.446 321.962 519.826 314.484 517.162 309.248C518.745 308.214 520.219 307.021 521.56 305.688C524.746 310.736 530.558 321.426 531.807 333.911C532.134 337.037 532.135 340.189 531.812 343.315C529.523 364.824 529.981 368.943 529.981 368.943L545.541 427.064Z" fill="#2F2E41"/>
|
|
22
|
+
<path d="M514.879 313.111C514.879 313.111 493.37 307.161 491.539 319.975C489.709 332.789 491.997 365.74 497.031 378.096C502.065 390.452 519.455 430.725 519.455 430.725C519.455 430.725 551.033 470.997 552.406 480.608C553.778 490.218 560.643 500.286 560.643 500.286L582.61 486.1L539.591 413.334L520.828 362.994C520.828 362.994 528.608 317.23 514.879 313.111Z" fill="#D0CDE1"/>
|
|
23
|
+
<path d="M599.085 314.941L609.153 317.23C609.153 317.23 618.306 356.587 614.645 377.638C610.984 398.69 610.526 406.012 610.526 406.012L607.323 465.963C607.323 465.963 608.238 504.405 601.831 498.456C595.424 492.507 582.61 489.761 582.61 489.761C582.61 489.761 583.983 472.828 589.017 468.709C589.017 468.709 594.966 437.132 591.305 423.403C587.644 409.673 599.085 314.941 599.085 314.941Z" fill="#D0CDE1"/>
|
|
24
|
+
<path d="M602.746 359.333L591.076 426.835L583.983 423.86L596.339 359.333L583.1 328.666L571.567 301.963C574.244 304.109 577.022 306.091 579.635 307.839L586.66 323.49L602.746 359.333Z" fill="#2F2E41"/>
|
|
25
|
+
<path d="M568.236 236.855L547.372 225.926L518.559 230.397L512.598 256.726L527.437 256.155L531.583 246.482V255.996L538.43 255.732L542.404 240.332L544.888 256.726L569.23 256.229L568.236 236.855Z" fill="#2F2E41"/>
|
|
26
|
+
<path d="M527.019 801.706C534.873 801.706 541.239 799.319 541.239 796.374C541.239 793.429 534.873 791.041 527.019 791.041C519.166 791.041 512.8 793.429 512.8 796.374C512.8 799.319 519.166 801.706 527.019 801.706Z" fill="#2F2E41"/>
|
|
27
|
+
<path d="M623.003 801.706C630.856 801.706 637.222 799.319 637.222 796.374C637.222 793.429 630.856 791.041 623.003 791.041C615.149 791.041 608.783 793.429 608.783 796.374C608.783 799.319 615.149 801.706 623.003 801.706Z" fill="#2F2E41"/>
|
|
28
|
+
<path d="M263.546 648.795C249 658.26 232.238 663.769 214.913 664.778C197.589 665.788 180.3 662.262 164.754 654.549L166.955 650.059C185.694 659.265 206.933 662.076 227.422 658.063C247.91 654.049 266.519 643.433 280.399 627.838C294.28 612.242 302.668 592.528 304.279 571.713C305.89 550.897 300.635 530.127 289.319 512.582C278.003 495.037 261.249 481.683 241.623 474.566C221.996 467.448 200.577 466.958 180.645 473.17C160.713 479.383 143.366 491.956 131.259 508.966C119.153 525.975 112.954 546.483 113.611 567.35L108.613 567.503C108.059 549.946 112.117 532.549 120.382 517.048C128.648 501.548 140.831 488.484 155.719 479.159C170.606 469.835 187.678 464.575 205.231 463.905C222.785 463.234 240.208 467.176 255.764 475.338C271.319 483.5 284.464 495.596 293.887 510.421C303.311 525.246 308.684 542.282 309.471 559.831C310.258 577.38 306.432 594.829 298.374 610.439C290.316 626.048 278.308 639.273 263.546 648.795Z" fill="white"/>
|
|
29
|
+
<path d="M218.318 558.375C203.532 561.648 183.855 563.642 169.517 561.56L187.516 575.266L137.128 607.765L139.838 611.967L190.226 579.468L195.292 601.522C199.308 587.602 209.241 570.499 218.318 558.375Z" fill="white"/>
|
|
30
|
+
</g>
|
|
31
|
+
<defs>
|
|
32
|
+
<clipPath id="clip0_1_2">
|
|
33
|
+
<rect width="783.928" height="868.734" fill="white"/>
|
|
34
|
+
</clipPath>
|
|
35
|
+
</defs>
|
|
36
|
+
</svg>
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import type { Seed, ContentRepository, IdempotencyRepository, BeechBucket, MediaRepository, SystemStatsRepository, BeechHooks } from '@beechcms/core';
|
|
2
|
+
import type { Seed, ContentRepository, IdempotencyRepository, BeechBucket, MediaRepository, SystemStatsRepository, BeechHooks, JobRegistry } from '@beechcms/core';
|
|
3
3
|
import type { Env, Variables, AppEnv } from './types';
|
|
4
4
|
export type { Env, Variables, AppEnv } from './types';
|
|
5
5
|
import type { ISeedRepository } from '@beechcms/core';
|
|
@@ -27,6 +27,12 @@ export interface BeechConfig {
|
|
|
27
27
|
publicRouter: Hono<AppEnv>;
|
|
28
28
|
protectedRouter: Hono<AppEnv>;
|
|
29
29
|
}) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Background job handlers, keyed by job name. Enqueue from custom routes via
|
|
32
|
+
* `c.get('queue').enqueue(name, payload)`; consumed by the worker `queue()`
|
|
33
|
+
* export. Handlers receive an engine-mediated JobContext — never raw D1.
|
|
34
|
+
*/
|
|
35
|
+
jobs?: JobRegistry;
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
38
|
* Builds a fully configured Hono app. Seeds are hydrated from D1 at runtime via
|
|
@@ -10,10 +10,10 @@ export declare const automationActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
10
10
|
field: z.ZodString;
|
|
11
11
|
op: z.ZodEnum<{
|
|
12
12
|
eq: "eq";
|
|
13
|
+
neq: "neq";
|
|
14
|
+
contains: "contains";
|
|
13
15
|
gt: "gt";
|
|
14
16
|
lt: "lt";
|
|
15
|
-
contains: "contains";
|
|
16
|
-
neq: "neq";
|
|
17
17
|
isempty: "isempty";
|
|
18
18
|
isnotempty: "isnotempty";
|
|
19
19
|
}>;
|
|
@@ -32,9 +32,9 @@ export declare const automationActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
32
32
|
type: z.ZodLiteral<"webhook">;
|
|
33
33
|
url: z.ZodString;
|
|
34
34
|
method: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
GET: "GET";
|
|
35
36
|
POST: "POST";
|
|
36
37
|
PUT: "PUT";
|
|
37
|
-
GET: "GET";
|
|
38
38
|
}>>;
|
|
39
39
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
40
40
|
body_template: z.ZodPreprocess<z.ZodString>;
|
|
@@ -57,9 +57,9 @@ export declare const createAutomationSchema: z.ZodObject<{
|
|
|
57
57
|
name: z.ZodString;
|
|
58
58
|
triggers: z.ZodArray<z.ZodObject<{
|
|
59
59
|
event: z.ZodEnum<{
|
|
60
|
+
delete: "delete";
|
|
60
61
|
create: "create";
|
|
61
62
|
update: "update";
|
|
62
|
-
delete: "delete";
|
|
63
63
|
cron: "cron";
|
|
64
64
|
}>;
|
|
65
65
|
cron: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -75,10 +75,10 @@ export declare const createAutomationSchema: z.ZodObject<{
|
|
|
75
75
|
field: z.ZodString;
|
|
76
76
|
op: z.ZodEnum<{
|
|
77
77
|
eq: "eq";
|
|
78
|
+
neq: "neq";
|
|
79
|
+
contains: "contains";
|
|
78
80
|
gt: "gt";
|
|
79
81
|
lt: "lt";
|
|
80
|
-
contains: "contains";
|
|
81
|
-
neq: "neq";
|
|
82
82
|
isempty: "isempty";
|
|
83
83
|
isnotempty: "isnotempty";
|
|
84
84
|
}>;
|
|
@@ -97,9 +97,9 @@ export declare const createAutomationSchema: z.ZodObject<{
|
|
|
97
97
|
type: z.ZodLiteral<"webhook">;
|
|
98
98
|
url: z.ZodString;
|
|
99
99
|
method: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
GET: "GET";
|
|
100
101
|
POST: "POST";
|
|
101
102
|
PUT: "PUT";
|
|
102
|
-
GET: "GET";
|
|
103
103
|
}>>;
|
|
104
104
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
105
105
|
body_template: z.ZodPreprocess<z.ZodString>;
|
|
@@ -123,9 +123,9 @@ export declare const updateAutomationSchema: z.ZodObject<{
|
|
|
123
123
|
name: z.ZodOptional<z.ZodString>;
|
|
124
124
|
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
125
|
event: z.ZodEnum<{
|
|
126
|
+
delete: "delete";
|
|
126
127
|
create: "create";
|
|
127
128
|
update: "update";
|
|
128
|
-
delete: "delete";
|
|
129
129
|
cron: "cron";
|
|
130
130
|
}>;
|
|
131
131
|
cron: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -141,10 +141,10 @@ export declare const updateAutomationSchema: z.ZodObject<{
|
|
|
141
141
|
field: z.ZodString;
|
|
142
142
|
op: z.ZodEnum<{
|
|
143
143
|
eq: "eq";
|
|
144
|
+
neq: "neq";
|
|
145
|
+
contains: "contains";
|
|
144
146
|
gt: "gt";
|
|
145
147
|
lt: "lt";
|
|
146
|
-
contains: "contains";
|
|
147
|
-
neq: "neq";
|
|
148
148
|
isempty: "isempty";
|
|
149
149
|
isnotempty: "isnotempty";
|
|
150
150
|
}>;
|
|
@@ -163,9 +163,9 @@ export declare const updateAutomationSchema: z.ZodObject<{
|
|
|
163
163
|
type: z.ZodLiteral<"webhook">;
|
|
164
164
|
url: z.ZodString;
|
|
165
165
|
method: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
GET: "GET";
|
|
166
167
|
POST: "POST";
|
|
167
168
|
PUT: "PUT";
|
|
168
|
-
GET: "GET";
|
|
169
169
|
}>>;
|
|
170
170
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
171
171
|
body_template: z.ZodPreprocess<z.ZodString>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Env } from './types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
fetch(request: Request, env: Env, ctx: ExecutionContext): Response | Promise<Response>;
|
|
4
|
+
queue(batch: MessageBatch<unknown>, env: Env, ctx: ExecutionContext): Promise<void>;
|
|
4
5
|
scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext): Promise<void>;
|
|
5
6
|
};
|
|
6
7
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Hono as Hono19 } from "hono";
|
|
3
3
|
import { cors } from "hono/cors";
|
|
4
4
|
import { getCookie, setCookie, deleteCookie } from "hono/cookie";
|
|
5
|
-
import { sha256hex as sha256hex7, SystemClock as
|
|
5
|
+
import { sha256hex as sha256hex7, SystemClock as SystemClock6, SystemIdGenerator as SystemIdGenerator4 } from "@beechcms/core";
|
|
6
6
|
|
|
7
7
|
// src/shared/request-utils.ts
|
|
8
8
|
var CLOUDFLARE_CLIENT_IP_HEADER = "cf-connecting-ip";
|
|
@@ -751,7 +751,7 @@ async function updateHandler(context) {
|
|
|
751
751
|
detail: "Missing required field: slug"
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
|
-
|
|
754
|
+
const mergedData = {};
|
|
755
755
|
if (Object.keys(bodyForData).length > 0) {
|
|
756
756
|
const sensitiveAliases = Object.keys(bodyForData).filter((alias) => {
|
|
757
757
|
const branch = seed.branches.find((b) => b.alias === alias);
|
|
@@ -3667,26 +3667,15 @@ async function resolveAutomationContext(_automation, triggerEntry, batchEntries)
|
|
|
3667
3667
|
}
|
|
3668
3668
|
|
|
3669
3669
|
// src/features/automations/action-executors/webhook.executor.ts
|
|
3670
|
+
import { signWebhookBody } from "@beechcms/core/webhook-crypto";
|
|
3670
3671
|
var WEBHOOK_TIMEOUT_MS = 8e3;
|
|
3671
3672
|
var warnedNoSecret = false;
|
|
3672
|
-
async function signBody(body, secret) {
|
|
3673
|
-
const encoder = new TextEncoder();
|
|
3674
|
-
const key = await crypto.subtle.importKey(
|
|
3675
|
-
"raw",
|
|
3676
|
-
encoder.encode(secret),
|
|
3677
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
3678
|
-
false,
|
|
3679
|
-
["sign"]
|
|
3680
|
-
);
|
|
3681
|
-
const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(body));
|
|
3682
|
-
return "sha256=" + Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3683
|
-
}
|
|
3684
3673
|
async function executeWebhook(action, context, env) {
|
|
3685
3674
|
const body = interpolate(action.body_template ?? "{}", context);
|
|
3686
3675
|
const secret = env.WEBHOOK_SECRET;
|
|
3687
3676
|
let signatureHeader = {};
|
|
3688
3677
|
if (secret) {
|
|
3689
|
-
signatureHeader = { "X-BeechCMS-Signature": await
|
|
3678
|
+
signatureHeader = { "X-BeechCMS-Signature": await signWebhookBody(body, secret) };
|
|
3690
3679
|
} else if (!warnedNoSecret) {
|
|
3691
3680
|
warnedNoSecret = true;
|
|
3692
3681
|
console.warn("[webhook] WEBHOOK_SECRET not set \u2014 outgoing webhooks are unsigned");
|
|
@@ -9412,6 +9401,82 @@ var observabilityMiddleware = (overrides) => {
|
|
|
9412
9401
|
});
|
|
9413
9402
|
};
|
|
9414
9403
|
|
|
9404
|
+
// src/middleware/queue.middleware.ts
|
|
9405
|
+
import { createMiddleware as createMiddleware8 } from "hono/factory";
|
|
9406
|
+
import { SystemClock as SystemClock5, SystemIdGenerator as SystemIdGenerator3 } from "@beechcms/core";
|
|
9407
|
+
|
|
9408
|
+
// src/shared/cloudflare-queue-service.ts
|
|
9409
|
+
var CloudflareQueueService = class {
|
|
9410
|
+
constructor(queue) {
|
|
9411
|
+
this.queue = queue;
|
|
9412
|
+
}
|
|
9413
|
+
queue;
|
|
9414
|
+
async enqueue(name, payload) {
|
|
9415
|
+
try {
|
|
9416
|
+
await this.queue.send({ name, payload });
|
|
9417
|
+
} catch (error) {
|
|
9418
|
+
console.error(`CloudflareQueueService: failed to enqueue "${name}"`, error);
|
|
9419
|
+
}
|
|
9420
|
+
}
|
|
9421
|
+
};
|
|
9422
|
+
|
|
9423
|
+
// src/shared/in-memory-queue-service.ts
|
|
9424
|
+
var InMemoryQueueService = class {
|
|
9425
|
+
constructor(jobs, context, scheduleBackgroundTask) {
|
|
9426
|
+
this.jobs = jobs;
|
|
9427
|
+
this.context = context;
|
|
9428
|
+
this.scheduleBackgroundTask = scheduleBackgroundTask;
|
|
9429
|
+
}
|
|
9430
|
+
jobs;
|
|
9431
|
+
context;
|
|
9432
|
+
scheduleBackgroundTask;
|
|
9433
|
+
async enqueue(name, payload) {
|
|
9434
|
+
const handler = this.jobs[name];
|
|
9435
|
+
if (!handler) {
|
|
9436
|
+
console.error(`InMemoryQueueService: no handler registered for "${name}"`);
|
|
9437
|
+
return;
|
|
9438
|
+
}
|
|
9439
|
+
const run = handler(payload, this.context).catch((error) => {
|
|
9440
|
+
console.error(`InMemoryQueueService: job "${name}" failed`, error);
|
|
9441
|
+
});
|
|
9442
|
+
if (this.scheduleBackgroundTask) {
|
|
9443
|
+
this.scheduleBackgroundTask(run);
|
|
9444
|
+
return;
|
|
9445
|
+
}
|
|
9446
|
+
await run;
|
|
9447
|
+
}
|
|
9448
|
+
};
|
|
9449
|
+
|
|
9450
|
+
// src/middleware/queue.middleware.ts
|
|
9451
|
+
var queueMiddleware = (jobs = {}, overrides) => {
|
|
9452
|
+
return createMiddleware8(async (context, next) => {
|
|
9453
|
+
let scheduleBackgroundTask;
|
|
9454
|
+
try {
|
|
9455
|
+
const executionContext = context.executionCtx;
|
|
9456
|
+
scheduleBackgroundTask = executionContext.waitUntil.bind(executionContext);
|
|
9457
|
+
} catch {
|
|
9458
|
+
scheduleBackgroundTask = void 0;
|
|
9459
|
+
}
|
|
9460
|
+
let queue;
|
|
9461
|
+
if (overrides?.queue) {
|
|
9462
|
+
queue = overrides.queue;
|
|
9463
|
+
} else if (context.env.QUEUE) {
|
|
9464
|
+
queue = new CloudflareQueueService(context.env.QUEUE);
|
|
9465
|
+
} else {
|
|
9466
|
+
const jobContext = {
|
|
9467
|
+
repository: context.get("repository"),
|
|
9468
|
+
bucket: context.get("bucket"),
|
|
9469
|
+
clock: SystemClock5,
|
|
9470
|
+
idGenerator: SystemIdGenerator3,
|
|
9471
|
+
env: context.env
|
|
9472
|
+
};
|
|
9473
|
+
queue = new InMemoryQueueService(jobs, jobContext, scheduleBackgroundTask);
|
|
9474
|
+
}
|
|
9475
|
+
context.set("queue", queue);
|
|
9476
|
+
await next();
|
|
9477
|
+
});
|
|
9478
|
+
};
|
|
9479
|
+
|
|
9415
9480
|
// src/factory.ts
|
|
9416
9481
|
var REFRESH_TOKEN_EXPIRY_DAYS = 7;
|
|
9417
9482
|
var SECONDS_PER_DAY3 = 24 * 60 * 60;
|
|
@@ -9461,6 +9526,7 @@ function createBeechApp(config) {
|
|
|
9461
9526
|
app.use("*", storageMiddleware({
|
|
9462
9527
|
bucket: config.bucket
|
|
9463
9528
|
}));
|
|
9529
|
+
app.use("*", queueMiddleware(config.jobs ?? {}));
|
|
9464
9530
|
app.use("*", authProvidersMiddleware());
|
|
9465
9531
|
app.use("*", rateLimiterMiddleware());
|
|
9466
9532
|
app.use("*", observabilityMiddleware());
|
|
@@ -9543,9 +9609,9 @@ function createBeechApp(config) {
|
|
|
9543
9609
|
const accessToken = await context.get("tokenService").issue({ sub: user.id, email: user.email, name: user.name ?? void 0, surname: user.surname ?? void 0, role: user.role });
|
|
9544
9610
|
const refreshToken = generateRefreshToken();
|
|
9545
9611
|
const refreshTokenHash = await sha256hex7(refreshToken);
|
|
9546
|
-
const nowSeconds =
|
|
9612
|
+
const nowSeconds = SystemClock6.nowSeconds();
|
|
9547
9613
|
await context.get("sessionRepository").saveRefreshToken({
|
|
9548
|
-
id:
|
|
9614
|
+
id: SystemIdGenerator4.uuid(),
|
|
9549
9615
|
userId: user.id,
|
|
9550
9616
|
tokenHash: refreshTokenHash,
|
|
9551
9617
|
expiresAt: nowSeconds + REFRESH_TOKEN_EXPIRY_DAYS * SECONDS_PER_DAY3
|
|
@@ -9563,7 +9629,7 @@ function createBeechApp(config) {
|
|
|
9563
9629
|
if (!refreshRateLimit.isAllowed) return context.json({ error: AUTH_ERRORS.RATE_LIMIT_EXCEEDED }, 429);
|
|
9564
9630
|
const refreshToken = getCookie(context, "refresh_token");
|
|
9565
9631
|
if (!refreshToken) return context.json({ error: "Refresh token missing" }, 401);
|
|
9566
|
-
const nowSeconds =
|
|
9632
|
+
const nowSeconds = SystemClock6.nowSeconds();
|
|
9567
9633
|
const tokenHash = await sha256hex7(refreshToken);
|
|
9568
9634
|
const activeSession = await context.get("sessionRepository").findActiveByHash(tokenHash, nowSeconds);
|
|
9569
9635
|
if (!activeSession) return context.json({ error: "Invalid refresh token" }, 401);
|
|
@@ -9576,7 +9642,7 @@ function createBeechApp(config) {
|
|
|
9576
9642
|
const newRefreshToken = generateRefreshToken();
|
|
9577
9643
|
const newRefreshTokenHash = await sha256hex7(newRefreshToken);
|
|
9578
9644
|
await context.get("sessionRepository").saveRefreshToken({
|
|
9579
|
-
id:
|
|
9645
|
+
id: SystemIdGenerator4.uuid(),
|
|
9580
9646
|
userId: user.id,
|
|
9581
9647
|
tokenHash: newRefreshTokenHash,
|
|
9582
9648
|
expiresAt: nowSeconds + REFRESH_TOKEN_EXPIRY_DAYS * SECONDS_PER_DAY3
|
|
@@ -9593,7 +9659,7 @@ function createBeechApp(config) {
|
|
|
9593
9659
|
try {
|
|
9594
9660
|
const refreshToken = getCookie(context, "refresh_token");
|
|
9595
9661
|
if (refreshToken) {
|
|
9596
|
-
const nowSeconds =
|
|
9662
|
+
const nowSeconds = SystemClock6.nowSeconds();
|
|
9597
9663
|
const tokenHash = await sha256hex7(refreshToken);
|
|
9598
9664
|
await context.get("sessionRepository").revokeByHash(tokenHash, nowSeconds);
|
|
9599
9665
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IQueueService, JobRegistry } from '@beechcms/core';
|
|
2
|
+
import type { AppEnv } from '../types';
|
|
3
|
+
export interface QueueOverrides {
|
|
4
|
+
queue?: IQueueService;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Injects `queue` into context. Must run AFTER repositoryMiddleware and
|
|
8
|
+
* storageMiddleware: the in-memory fallback builds a JobContext from
|
|
9
|
+
* `repository` + `bucket` already present in context.
|
|
10
|
+
*/
|
|
11
|
+
export declare const queueMiddleware: (jobs?: JobRegistry, overrides?: QueueOverrides) => import("hono").MiddlewareHandler<AppEnv, string, {}, Response>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IQueueService, QueueMessage } from '@beechcms/core';
|
|
2
|
+
/**
|
|
3
|
+
* Production producer. Sends a QueueMessage envelope onto the Cloudflare Queue
|
|
4
|
+
* binding. Cloudflare guarantees at-least-once delivery + retries on the
|
|
5
|
+
* consumer side, so enqueue only needs to hand off the message.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CloudflareQueueService implements IQueueService {
|
|
8
|
+
private readonly queue;
|
|
9
|
+
constructor(queue: Queue<QueueMessage>);
|
|
10
|
+
enqueue<T>(name: string, payload: T): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IQueueService, JobRegistry, JobContext } from '@beechcms/core';
|
|
2
|
+
type ScheduleBackgroundTask = (task: Promise<unknown>) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Dev/offline + test fallback used when the QUEUE binding is absent. Runs the
|
|
5
|
+
* matching handler in-process. In production this is never selected. Uses
|
|
6
|
+
* executionCtx.waitUntil when available so enqueue stays non-blocking; falls
|
|
7
|
+
* back to awaiting inline (tests) otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InMemoryQueueService implements IQueueService {
|
|
10
|
+
private readonly jobs;
|
|
11
|
+
private readonly context;
|
|
12
|
+
private readonly scheduleBackgroundTask?;
|
|
13
|
+
constructor(jobs: JobRegistry, context: JobContext, scheduleBackgroundTask?: ScheduleBackgroundTask | undefined);
|
|
14
|
+
enqueue<T>(name: string, payload: T): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JobRegistry, QueueMessage } from '@beechcms/core';
|
|
2
|
+
import type { Env } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Consumer-side dispatch. Mirrors index.ts `scheduled()`: builds an
|
|
5
|
+
* engine-mediated JobContext from bindings (NEVER exposes env.DB to jobs) and
|
|
6
|
+
* routes each message to its handler. ack() on success/unknown-name (drop),
|
|
7
|
+
* retry() on throw so Cloudflare re-delivers.
|
|
8
|
+
*/
|
|
9
|
+
export declare function dispatchQueueBatch(batch: MessageBatch<QueueMessage>, env: Env, _ctx: ExecutionContext, jobs: JobRegistry): Promise<void>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Seed, ContentRepository, IdempotencyRepository, BeechBucket, MediaRepository, SystemStatsRepository, IHashProvider, ITokenService, IUserRepository, ISessionRepository, IPasswordResetTokenRepository, IActivityLogger, IActivityLogRepository, INotificationRepository, INotificationService, IWidgetRepository, ISearchRepository, IAnalyticsRepository, IContentScanRepository, ISeedRegistry, IClock, IIdGenerator, IAutomationRunner, IAutomationRepository, IScheduler, BackrefMap, ISiteSettingsRepository, IDemoDataRepository, JwtClaims, ISeedLayoutRepository, ISeedRepository, ISchemaMutator, IDashboardLayoutRepository } from '@beechcms/core';
|
|
1
|
+
import type { Seed, ContentRepository, IdempotencyRepository, BeechBucket, MediaRepository, SystemStatsRepository, IHashProvider, ITokenService, IUserRepository, ISessionRepository, IPasswordResetTokenRepository, IActivityLogger, IActivityLogRepository, INotificationRepository, INotificationService, IWidgetRepository, ISearchRepository, IAnalyticsRepository, IContentScanRepository, ISeedRegistry, IClock, IIdGenerator, IAutomationRunner, IAutomationRepository, IScheduler, BackrefMap, ISiteSettingsRepository, IDemoDataRepository, JwtClaims, ISeedLayoutRepository, ISeedRepository, ISchemaMutator, IDashboardLayoutRepository, IQueueService } from '@beechcms/core';
|
|
2
2
|
import type { IRateLimiterRegistry } from './middleware/rate-limit.middleware';
|
|
3
3
|
import type { ISetupChecklistRepository } from './shared/d1-setup-checklist.repository';
|
|
4
4
|
export interface Env {
|
|
@@ -35,6 +35,7 @@ export interface Env {
|
|
|
35
35
|
ENV?: string;
|
|
36
36
|
DATE_FORMAT?: string;
|
|
37
37
|
ASSETS?: Fetcher;
|
|
38
|
+
QUEUE?: Queue;
|
|
38
39
|
QSTASH_TOKEN?: string;
|
|
39
40
|
QSTASH_URL?: string;
|
|
40
41
|
/** Public base URL the worker is reachable at, used by QStash to call back the webhook (e.g. an ngrok tunnel in dev). Falls back to APP_URL. */
|
|
@@ -70,6 +71,7 @@ export interface Variables {
|
|
|
70
71
|
automationRepository: IAutomationRepository;
|
|
71
72
|
automationRunner: IAutomationRunner;
|
|
72
73
|
scheduler: IScheduler;
|
|
74
|
+
queue: IQueueService;
|
|
73
75
|
backrefMap: BackrefMap;
|
|
74
76
|
siteSettingsRepository: ISiteSettingsRepository;
|
|
75
77
|
demoDataRepository: IDemoDataRepository;
|