ntfy-reverse-proxy 2.3.0 → 2.5.0
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/README.md +4 -1
- package/build/cli/commands/config-io.d.ts.map +1 -0
- package/build/cli/commands/config-io.js.map +1 -0
- package/build/{src/cli → cli}/commands/context.d.ts +3 -2
- package/build/cli/commands/context.d.ts.map +1 -0
- package/build/{src/cli → cli}/commands/context.js +4 -1
- package/build/cli/commands/context.js.map +1 -0
- package/build/cli/commands/deploy.d.ts +5 -0
- package/build/cli/commands/deploy.d.ts.map +1 -0
- package/build/{src/cli → cli}/commands/deploy.js +63 -244
- package/build/cli/commands/deploy.js.map +1 -0
- package/build/cli/commands/generate.d.ts.map +1 -0
- package/build/cli/commands/generate.js.map +1 -0
- package/build/cli/commands/server.d.ts.map +1 -0
- package/build/cli/commands/server.js.map +1 -0
- package/build/cli/commands/settings.d.ts.map +1 -0
- package/build/cli/commands/settings.js.map +1 -0
- package/build/cli/commands/validate.d.ts.map +1 -0
- package/build/cli/commands/validate.js.map +1 -0
- package/build/cli/index.d.ts.map +1 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/menu/interactive.d.ts.map +1 -0
- package/build/{src/cli → cli}/menu/interactive.js +60 -13
- package/build/cli/menu/interactive.js.map +1 -0
- package/build/config.sample.json +4 -1
- package/build/lib/cloudflare.d.ts +16 -0
- package/build/lib/cloudflare.d.ts.map +1 -0
- package/build/lib/cloudflare.js +184 -0
- package/build/lib/cloudflare.js.map +1 -0
- package/build/lib/item.d.ts.map +1 -0
- package/build/lib/item.js.map +1 -0
- package/build/lib/package-runtime.d.ts.map +1 -0
- package/build/lib/package-runtime.js.map +1 -0
- package/build/lib/public-dns.d.ts +9 -0
- package/build/lib/public-dns.d.ts.map +1 -0
- package/build/lib/public-dns.js +67 -0
- package/build/lib/public-dns.js.map +1 -0
- package/build/{src/lib → lib}/regex.d.ts +2 -1
- package/build/lib/regex.d.ts.map +1 -0
- package/build/{src/lib → lib}/regex.js +2 -1
- package/build/lib/regex.js.map +1 -0
- package/build/{src/lib → lib}/schema.d.ts +75 -1
- package/build/lib/schema.d.ts.map +1 -0
- package/build/{src/lib → lib}/schema.js +61 -2
- package/build/lib/schema.js.map +1 -0
- package/build/lib/utility.d.ts.map +1 -0
- package/build/lib/utility.js.map +1 -0
- package/build/{src/types → types}/cli/commands/context.d.ts +7 -0
- package/build/types/cli/commands/deploy.d.ts +318 -0
- package/build/{src/types → types}/cli/menu/interactive.d.ts +11 -3
- package/build/types/lib/cloudflare.d.ts +245 -0
- package/build/types/lib/public-dns.d.ts +96 -0
- package/build/{src/types → types}/lib/schema.d.ts +145 -1
- package/build/types/shared.d.ts +219 -0
- package/build/{src/types → types}/tests/cli/commands/context.test.d.ts +18 -0
- package/build/types/tests/cli/commands/deploy.test.d.ts +33 -0
- package/build/types/tests/lib/cloudflare.test.d.ts +64 -0
- package/build/types/tests/lib/public-dns.test.d.ts +68 -0
- package/build/{src/types → types}/tests/lib/schema.test.d.ts +39 -0
- package/build/types/tests/worker/durable-objects/delivery-outbox.test.d.ts +413 -0
- package/build/{src/types → types}/tests/worker/index.test.d.ts +56 -0
- package/build/types/tests/worker/interpreters/mailmask.test.d.ts +103 -0
- package/build/{src/types → types}/tests/worker/landing/page.test.d.ts +11 -0
- package/build/types/tests/worker/ntfy-client.test.d.ts +54 -0
- package/build/{src/types → types}/tests/worker/pipeline/deliver.test.d.ts +2 -2
- package/build/types/tests/worker/pipeline/drain-fifo.test.d.ts +202 -0
- package/build/{src/types → types}/tests/worker/pipeline/format.test.d.ts +10 -37
- package/build/{src/types → types}/tests/worker/pipeline/interpret.test.d.ts +2 -0
- package/build/{src/types → types}/tests/worker/pipeline/send.test.d.ts +2 -2
- package/build/types/tests/worker/pipeline/session.test.d.ts +140 -0
- package/build/{src/types → types}/tests/worker/pipeline/split.test.d.ts +1 -1
- package/build/types/worker/durable-objects/delivery-outbox.d.ts +778 -0
- package/build/{src/types → types}/worker/handlers.d.ts +11 -1
- package/build/{src/types → types}/worker/interpreters/app-payload.d.ts +10 -1
- package/build/types/worker/interpreters/mailmask.d.ts +91 -0
- package/build/types/worker/ntfy-client.d.ts +104 -0
- package/build/{src/types → types}/worker/pipeline/deliver.d.ts +23 -4
- package/build/{src/types → types}/worker/pipeline/drain-fifo.d.ts +29 -5
- package/build/{src/types → types}/worker/pipeline/format.d.ts +2 -16
- package/build/{src/types → types}/worker/pipeline/send.d.ts +8 -20
- package/build/types/worker/pipeline/session.d.ts +228 -0
- package/build/{src/types → types}/worker/pipeline/split.d.ts +5 -12
- package/build/worker/durable-objects/delivery-outbox.d.ts +11 -0
- package/build/worker/durable-objects/delivery-outbox.d.ts.map +1 -0
- package/build/worker/durable-objects/delivery-outbox.js +399 -0
- package/build/worker/durable-objects/delivery-outbox.js.map +1 -0
- package/build/worker/handlers.d.ts.map +1 -0
- package/build/{src/worker → worker}/handlers.js +59 -7
- package/build/worker/handlers.js.map +1 -0
- package/build/worker/index.d.ts.map +1 -0
- package/build/worker/index.js.map +1 -0
- package/build/worker/interpreters/app-payload.d.ts.map +1 -0
- package/build/{src/worker → worker}/interpreters/app-payload.js +6 -1
- package/build/worker/interpreters/app-payload.js.map +1 -0
- package/build/worker/interpreters/discord-stonker-bot.d.ts.map +1 -0
- package/build/worker/interpreters/discord-stonker-bot.js.map +1 -0
- package/build/worker/interpreters/mailmask.d.ts +4 -0
- package/build/worker/interpreters/mailmask.d.ts.map +1 -0
- package/build/worker/interpreters/mailmask.js +49 -0
- package/build/worker/interpreters/mailmask.js.map +1 -0
- package/build/worker/interpreters/ntfy-json.d.ts.map +1 -0
- package/build/worker/interpreters/ntfy-json.js.map +1 -0
- package/build/worker/interpreters/outpost.d.ts.map +1 -0
- package/build/worker/interpreters/outpost.js.map +1 -0
- package/build/worker/interpreters/pfsense-actions.d.ts.map +1 -0
- package/build/worker/interpreters/pfsense-actions.js.map +1 -0
- package/build/worker/interpreters/pfsense.d.ts.map +1 -0
- package/build/worker/interpreters/pfsense.js.map +1 -0
- package/build/worker/interpreters/plain-text.d.ts.map +1 -0
- package/build/worker/interpreters/plain-text.js.map +1 -0
- package/build/worker/interpreters/seerr.d.ts.map +1 -0
- package/build/worker/interpreters/seerr.js.map +1 -0
- package/build/worker/interpreters/statuspage.d.ts.map +1 -0
- package/build/worker/interpreters/statuspage.js.map +1 -0
- package/build/worker/interpreters/synology.d.ts.map +1 -0
- package/build/worker/interpreters/synology.js.map +1 -0
- package/build/worker/interpreters/transmission-vpn.d.ts.map +1 -0
- package/build/worker/interpreters/transmission-vpn.js.map +1 -0
- package/build/worker/interpreters/unifi.d.ts.map +1 -0
- package/build/worker/interpreters/unifi.js.map +1 -0
- package/build/worker/landing/page.d.ts.map +1 -0
- package/build/worker/landing/page.js +305 -0
- package/build/worker/landing/page.js.map +1 -0
- package/build/worker/ntfy-client.d.ts +9 -0
- package/build/worker/ntfy-client.d.ts.map +1 -0
- package/build/worker/ntfy-client.js +102 -0
- package/build/worker/ntfy-client.js.map +1 -0
- package/build/worker/pipeline/accumulate.d.ts.map +1 -0
- package/build/worker/pipeline/accumulate.js.map +1 -0
- package/build/worker/pipeline/authenticate.d.ts.map +1 -0
- package/build/worker/pipeline/authenticate.js.map +1 -0
- package/build/worker/pipeline/deliver.d.ts.map +1 -0
- package/build/{src/worker → worker}/pipeline/deliver.js +4 -1
- package/build/worker/pipeline/deliver.js.map +1 -0
- package/build/worker/pipeline/drain-fifo.d.ts.map +1 -0
- package/build/worker/pipeline/drain-fifo.js +51 -0
- package/build/worker/pipeline/drain-fifo.js.map +1 -0
- package/build/worker/pipeline/email.d.ts.map +1 -0
- package/build/worker/pipeline/email.js.map +1 -0
- package/build/worker/pipeline/format.d.ts.map +1 -0
- package/build/{src/worker → worker}/pipeline/format.js +8 -26
- package/build/worker/pipeline/format.js.map +1 -0
- package/build/worker/pipeline/interpret.d.ts.map +1 -0
- package/build/{src/worker → worker}/pipeline/interpret.js +2 -0
- package/build/worker/pipeline/interpret.js.map +1 -0
- package/build/worker/pipeline/parse.d.ts.map +1 -0
- package/build/worker/pipeline/parse.js.map +1 -0
- package/build/worker/pipeline/receive.d.ts.map +1 -0
- package/build/worker/pipeline/receive.js.map +1 -0
- package/build/worker/pipeline/respond.d.ts.map +1 -0
- package/build/worker/pipeline/respond.js.map +1 -0
- package/build/worker/pipeline/route.d.ts.map +1 -0
- package/build/worker/pipeline/route.js.map +1 -0
- package/build/worker/pipeline/send.d.ts.map +1 -0
- package/build/{src/worker → worker}/pipeline/send.js +21 -51
- package/build/worker/pipeline/send.js.map +1 -0
- package/build/worker/pipeline/session.d.ts +6 -0
- package/build/worker/pipeline/session.d.ts.map +1 -0
- package/build/worker/pipeline/session.js +192 -0
- package/build/worker/pipeline/session.js.map +1 -0
- package/build/worker/pipeline/split.d.ts +4 -0
- package/build/worker/pipeline/split.d.ts.map +1 -0
- package/build/{src/worker → worker}/pipeline/split.js +9 -16
- package/build/worker/pipeline/split.js.map +1 -0
- package/package.json +11 -9
- package/build/src/cli/commands/config-io.d.ts.map +0 -1
- package/build/src/cli/commands/config-io.js.map +0 -1
- package/build/src/cli/commands/context.d.ts.map +0 -1
- package/build/src/cli/commands/context.js.map +0 -1
- package/build/src/cli/commands/deploy.d.ts +0 -4
- package/build/src/cli/commands/deploy.d.ts.map +0 -1
- package/build/src/cli/commands/deploy.js.map +0 -1
- package/build/src/cli/commands/generate.d.ts.map +0 -1
- package/build/src/cli/commands/generate.js.map +0 -1
- package/build/src/cli/commands/server.d.ts.map +0 -1
- package/build/src/cli/commands/server.js.map +0 -1
- package/build/src/cli/commands/settings.d.ts.map +0 -1
- package/build/src/cli/commands/settings.js.map +0 -1
- package/build/src/cli/commands/validate.d.ts.map +0 -1
- package/build/src/cli/commands/validate.js.map +0 -1
- package/build/src/cli/index.d.ts.map +0 -1
- package/build/src/cli/index.js.map +0 -1
- package/build/src/cli/menu/interactive.d.ts.map +0 -1
- package/build/src/cli/menu/interactive.js.map +0 -1
- package/build/src/lib/item.d.ts.map +0 -1
- package/build/src/lib/item.js.map +0 -1
- package/build/src/lib/package-runtime.d.ts.map +0 -1
- package/build/src/lib/package-runtime.js.map +0 -1
- package/build/src/lib/regex.d.ts.map +0 -1
- package/build/src/lib/regex.js.map +0 -1
- package/build/src/lib/schema.d.ts.map +0 -1
- package/build/src/lib/schema.js.map +0 -1
- package/build/src/lib/utility.d.ts.map +0 -1
- package/build/src/lib/utility.js.map +0 -1
- package/build/src/types/cli/commands/deploy.d.ts +0 -659
- package/build/src/types/shared.d.ts +0 -85
- package/build/src/types/tests/worker/pipeline/drain-fifo.test.d.ts +0 -58
- package/build/src/types/worker/durable-objects/delivery-outbox.d.ts +0 -398
- package/build/src/worker/durable-objects/delivery-outbox.d.ts +0 -10
- package/build/src/worker/durable-objects/delivery-outbox.d.ts.map +0 -1
- package/build/src/worker/durable-objects/delivery-outbox.js +0 -204
- package/build/src/worker/durable-objects/delivery-outbox.js.map +0 -1
- package/build/src/worker/handlers.d.ts.map +0 -1
- package/build/src/worker/handlers.js.map +0 -1
- package/build/src/worker/index.d.ts.map +0 -1
- package/build/src/worker/index.js.map +0 -1
- package/build/src/worker/interpreters/app-payload.d.ts.map +0 -1
- package/build/src/worker/interpreters/app-payload.js.map +0 -1
- package/build/src/worker/interpreters/discord-stonker-bot.d.ts.map +0 -1
- package/build/src/worker/interpreters/discord-stonker-bot.js.map +0 -1
- package/build/src/worker/interpreters/ntfy-json.d.ts.map +0 -1
- package/build/src/worker/interpreters/ntfy-json.js.map +0 -1
- package/build/src/worker/interpreters/outpost.d.ts.map +0 -1
- package/build/src/worker/interpreters/outpost.js.map +0 -1
- package/build/src/worker/interpreters/pfsense-actions.d.ts.map +0 -1
- package/build/src/worker/interpreters/pfsense-actions.js.map +0 -1
- package/build/src/worker/interpreters/pfsense.d.ts.map +0 -1
- package/build/src/worker/interpreters/pfsense.js.map +0 -1
- package/build/src/worker/interpreters/plain-text.d.ts.map +0 -1
- package/build/src/worker/interpreters/plain-text.js.map +0 -1
- package/build/src/worker/interpreters/seerr.d.ts.map +0 -1
- package/build/src/worker/interpreters/seerr.js.map +0 -1
- package/build/src/worker/interpreters/statuspage.d.ts.map +0 -1
- package/build/src/worker/interpreters/statuspage.js.map +0 -1
- package/build/src/worker/interpreters/synology.d.ts.map +0 -1
- package/build/src/worker/interpreters/synology.js.map +0 -1
- package/build/src/worker/interpreters/transmission-vpn.d.ts.map +0 -1
- package/build/src/worker/interpreters/transmission-vpn.js.map +0 -1
- package/build/src/worker/interpreters/unifi.d.ts.map +0 -1
- package/build/src/worker/interpreters/unifi.js.map +0 -1
- package/build/src/worker/landing/page.d.ts.map +0 -1
- package/build/src/worker/landing/page.js +0 -261
- package/build/src/worker/landing/page.js.map +0 -1
- package/build/src/worker/pipeline/accumulate.d.ts.map +0 -1
- package/build/src/worker/pipeline/accumulate.js.map +0 -1
- package/build/src/worker/pipeline/authenticate.d.ts.map +0 -1
- package/build/src/worker/pipeline/authenticate.js.map +0 -1
- package/build/src/worker/pipeline/deliver.d.ts.map +0 -1
- package/build/src/worker/pipeline/deliver.js.map +0 -1
- package/build/src/worker/pipeline/drain-fifo.d.ts.map +0 -1
- package/build/src/worker/pipeline/drain-fifo.js +0 -25
- package/build/src/worker/pipeline/drain-fifo.js.map +0 -1
- package/build/src/worker/pipeline/email.d.ts.map +0 -1
- package/build/src/worker/pipeline/email.js.map +0 -1
- package/build/src/worker/pipeline/format.d.ts.map +0 -1
- package/build/src/worker/pipeline/format.js.map +0 -1
- package/build/src/worker/pipeline/interpret.d.ts.map +0 -1
- package/build/src/worker/pipeline/interpret.js.map +0 -1
- package/build/src/worker/pipeline/parse.d.ts.map +0 -1
- package/build/src/worker/pipeline/parse.js.map +0 -1
- package/build/src/worker/pipeline/receive.d.ts.map +0 -1
- package/build/src/worker/pipeline/receive.js.map +0 -1
- package/build/src/worker/pipeline/respond.d.ts.map +0 -1
- package/build/src/worker/pipeline/respond.js.map +0 -1
- package/build/src/worker/pipeline/route.d.ts.map +0 -1
- package/build/src/worker/pipeline/route.js.map +0 -1
- package/build/src/worker/pipeline/send.d.ts.map +0 -1
- package/build/src/worker/pipeline/send.js.map +0 -1
- package/build/src/worker/pipeline/split.d.ts +0 -4
- package/build/src/worker/pipeline/split.d.ts.map +0 -1
- package/build/src/worker/pipeline/split.js.map +0 -1
- /package/build/{src/cli → cli}/commands/config-io.d.ts +0 -0
- /package/build/{src/cli → cli}/commands/config-io.js +0 -0
- /package/build/{src/cli → cli}/commands/generate.d.ts +0 -0
- /package/build/{src/cli → cli}/commands/generate.js +0 -0
- /package/build/{src/cli → cli}/commands/server.d.ts +0 -0
- /package/build/{src/cli → cli}/commands/server.js +0 -0
- /package/build/{src/cli → cli}/commands/settings.d.ts +0 -0
- /package/build/{src/cli → cli}/commands/settings.js +0 -0
- /package/build/{src/cli → cli}/commands/validate.d.ts +0 -0
- /package/build/{src/cli → cli}/commands/validate.js +0 -0
- /package/build/{src/cli → cli}/index.d.ts +0 -0
- /package/build/{src/cli → cli}/index.js +0 -0
- /package/build/{src/cli → cli}/menu/interactive.d.ts +0 -0
- /package/build/{src/lib → lib}/item.d.ts +0 -0
- /package/build/{src/lib → lib}/item.js +0 -0
- /package/build/{src/lib → lib}/package-runtime.d.ts +0 -0
- /package/build/{src/lib → lib}/package-runtime.js +0 -0
- /package/build/{src/lib → lib}/utility.d.ts +0 -0
- /package/build/{src/lib → lib}/utility.js +0 -0
- /package/build/{src/types → types}/cli/commands/config-io.d.ts +0 -0
- /package/build/{src/types → types}/cli/commands/generate.d.ts +0 -0
- /package/build/{src/types → types}/cli/commands/server.d.ts +0 -0
- /package/build/{src/types → types}/cli/commands/settings.d.ts +0 -0
- /package/build/{src/types → types}/cli/commands/validate.d.ts +0 -0
- /package/build/{src/types → types}/cli/index.d.ts +0 -0
- /package/build/{src/types → types}/fetch-response.d.ts +0 -0
- /package/build/{src/types → types}/lib/package-runtime.d.ts +0 -0
- /package/build/{src/types → types}/lib/utility.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/commands/generate.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/commands/server.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/commands/settings.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/commands/validate.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/menu/interactive-integration.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/cli/menu/interactive.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/app-payload.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/discord-stonker-bot.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/ntfy-json.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/outpost.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/pfsense-actions.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/pfsense.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/plain-text.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/seerr.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/statuspage.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/synology.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/transmission-vpn.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/interpreters/unifi.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/accumulate.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/authenticate.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/email.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/parse.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/receive.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/respond.test.d.ts +0 -0
- /package/build/{src/types → types}/tests/worker/pipeline/route.test.d.ts +0 -0
- /package/build/{src/types → types}/worker/index.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/discord-stonker-bot.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/ntfy-json.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/outpost.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/pfsense-actions.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/pfsense.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/plain-text.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/seerr.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/statuspage.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/synology.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/transmission-vpn.d.ts +0 -0
- /package/build/{src/types → types}/worker/interpreters/unifi.d.ts +0 -0
- /package/build/{src/types → types}/worker/landing/page.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/accumulate.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/authenticate.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/email.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/interpret.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/parse.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/receive.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/respond.d.ts +0 -0
- /package/build/{src/types → types}/worker/pipeline/route.d.ts +0 -0
- /package/build/{src/worker → worker}/handlers.d.ts +0 -0
- /package/build/{src/worker → worker}/index.d.ts +0 -0
- /package/build/{src/worker → worker}/index.js +0 -0
- /package/build/{src/worker → worker}/interpreters/app-payload.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/discord-stonker-bot.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/discord-stonker-bot.js +0 -0
- /package/build/{src/worker → worker}/interpreters/ntfy-json.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/ntfy-json.js +0 -0
- /package/build/{src/worker → worker}/interpreters/outpost.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/outpost.js +0 -0
- /package/build/{src/worker → worker}/interpreters/pfsense-actions.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/pfsense-actions.js +0 -0
- /package/build/{src/worker → worker}/interpreters/pfsense.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/pfsense.js +0 -0
- /package/build/{src/worker → worker}/interpreters/plain-text.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/plain-text.js +0 -0
- /package/build/{src/worker → worker}/interpreters/seerr.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/seerr.js +0 -0
- /package/build/{src/worker → worker}/interpreters/statuspage.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/statuspage.js +0 -0
- /package/build/{src/worker → worker}/interpreters/synology.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/synology.js +0 -0
- /package/build/{src/worker → worker}/interpreters/transmission-vpn.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/transmission-vpn.js +0 -0
- /package/build/{src/worker → worker}/interpreters/unifi.d.ts +0 -0
- /package/build/{src/worker → worker}/interpreters/unifi.js +0 -0
- /package/build/{src/worker → worker}/landing/page.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/accumulate.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/accumulate.js +0 -0
- /package/build/{src/worker → worker}/pipeline/authenticate.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/authenticate.js +0 -0
- /package/build/{src/worker → worker}/pipeline/deliver.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/drain-fifo.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/email.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/email.js +0 -0
- /package/build/{src/worker → worker}/pipeline/format.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/interpret.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/parse.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/parse.js +0 -0
- /package/build/{src/worker → worker}/pipeline/receive.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/receive.js +0 -0
- /package/build/{src/worker → worker}/pipeline/respond.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/respond.js +0 -0
- /package/build/{src/worker → worker}/pipeline/route.d.ts +0 -0
- /package/build/{src/worker → worker}/pipeline/route.js +0 -0
- /package/build/{src/worker → worker}/pipeline/send.d.ts +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import type { Lib_Schema_SessionConfig } from '../../lib/schema.d.ts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Worker - Pipeline - Session - Decode Base64 URL.
|
|
7
|
+
*
|
|
8
|
+
* @since 2.4.0
|
|
9
|
+
*/
|
|
10
|
+
export type Worker_Pipeline_Session_DecodeBase64Url_Value = string;
|
|
11
|
+
|
|
12
|
+
export type Worker_Pipeline_Session_DecodeBase64Url_Returns = Uint8Array<ArrayBuffer> | null;
|
|
13
|
+
|
|
14
|
+
export type Worker_Pipeline_Session_DecodeBase64Url_Standard = string;
|
|
15
|
+
|
|
16
|
+
export type Worker_Pipeline_Session_DecodeBase64Url_Padded = string;
|
|
17
|
+
|
|
18
|
+
export type Worker_Pipeline_Session_DecodeBase64Url_Binary = string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Worker - Pipeline - Session - Encode Base64 URL.
|
|
22
|
+
*
|
|
23
|
+
* @since 2.4.0
|
|
24
|
+
*/
|
|
25
|
+
export type Worker_Pipeline_Session_EncodeBase64Url_Bytes = Uint8Array;
|
|
26
|
+
|
|
27
|
+
export type Worker_Pipeline_Session_EncodeBase64Url_Returns = string;
|
|
28
|
+
|
|
29
|
+
export type Worker_Pipeline_Session_EncodeBase64Url_Binary = string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Worker - Pipeline - Session - Import Key.
|
|
33
|
+
*
|
|
34
|
+
* @since 2.4.0
|
|
35
|
+
*/
|
|
36
|
+
export type Worker_Pipeline_Session_ImportKey_Secret = string;
|
|
37
|
+
|
|
38
|
+
export type Worker_Pipeline_Session_ImportKey_Returns = Promise<CryptoKey>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Worker - Pipeline - Session - Issue Session.
|
|
42
|
+
*
|
|
43
|
+
* @since 2.4.0
|
|
44
|
+
*/
|
|
45
|
+
export type Worker_Pipeline_Session_IssueSession_OptionsContextId = string;
|
|
46
|
+
|
|
47
|
+
export type Worker_Pipeline_Session_IssueSession_OptionsSession = Lib_Schema_SessionConfig;
|
|
48
|
+
|
|
49
|
+
export type Worker_Pipeline_Session_IssueSession_OptionsClientIp = string;
|
|
50
|
+
|
|
51
|
+
export type Worker_Pipeline_Session_IssueSession_OptionsKv = KVNamespace | undefined;
|
|
52
|
+
|
|
53
|
+
export type Worker_Pipeline_Session_IssueSession_Options = {
|
|
54
|
+
contextId: Worker_Pipeline_Session_IssueSession_OptionsContextId;
|
|
55
|
+
session: Worker_Pipeline_Session_IssueSession_OptionsSession;
|
|
56
|
+
clientIp: Worker_Pipeline_Session_IssueSession_OptionsClientIp;
|
|
57
|
+
kv: Worker_Pipeline_Session_IssueSession_OptionsKv;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsSuccessIssued = true;
|
|
61
|
+
|
|
62
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsSuccessToken = string;
|
|
63
|
+
|
|
64
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsSuccessExpiresIn = number;
|
|
65
|
+
|
|
66
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsSuccess = {
|
|
67
|
+
issued: Worker_Pipeline_Session_IssueSession_ReturnsSuccessIssued;
|
|
68
|
+
token: Worker_Pipeline_Session_IssueSession_ReturnsSuccessToken;
|
|
69
|
+
expiresIn: Worker_Pipeline_Session_IssueSession_ReturnsSuccessExpiresIn;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsFailureIssued = false;
|
|
73
|
+
|
|
74
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsFailureStatus = 429 | 503;
|
|
75
|
+
|
|
76
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsFailureReason = string;
|
|
77
|
+
|
|
78
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsFailure = {
|
|
79
|
+
issued: Worker_Pipeline_Session_IssueSession_ReturnsFailureIssued;
|
|
80
|
+
status: Worker_Pipeline_Session_IssueSession_ReturnsFailureStatus;
|
|
81
|
+
reason: Worker_Pipeline_Session_IssueSession_ReturnsFailureReason;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type Worker_Pipeline_Session_IssueSession_ReturnsResult = Worker_Pipeline_Session_IssueSession_ReturnsSuccess | Worker_Pipeline_Session_IssueSession_ReturnsFailure;
|
|
85
|
+
|
|
86
|
+
export type Worker_Pipeline_Session_IssueSession_Returns = Promise<Worker_Pipeline_Session_IssueSession_ReturnsResult>;
|
|
87
|
+
|
|
88
|
+
export type Worker_Pipeline_Session_IssueSession_TtlSeconds = number;
|
|
89
|
+
|
|
90
|
+
export type Worker_Pipeline_Session_IssueSession_MaxPerHour = number;
|
|
91
|
+
|
|
92
|
+
export type Worker_Pipeline_Session_IssueSession_IssuedAt = number;
|
|
93
|
+
|
|
94
|
+
export type Worker_Pipeline_Session_IssueSession_HourBucket = number;
|
|
95
|
+
|
|
96
|
+
export type Worker_Pipeline_Session_IssueSession_RateKey = string;
|
|
97
|
+
|
|
98
|
+
export type Worker_Pipeline_Session_IssueSession_RawCount = string | null;
|
|
99
|
+
|
|
100
|
+
export type Worker_Pipeline_Session_IssueSession_Count = number;
|
|
101
|
+
|
|
102
|
+
export type Worker_Pipeline_Session_IssueSession_ExpiresAt = number;
|
|
103
|
+
|
|
104
|
+
export type Worker_Pipeline_Session_IssueSession_PayloadAud = string;
|
|
105
|
+
|
|
106
|
+
export type Worker_Pipeline_Session_IssueSession_PayloadIp = string;
|
|
107
|
+
|
|
108
|
+
export type Worker_Pipeline_Session_IssueSession_PayloadJti = string;
|
|
109
|
+
|
|
110
|
+
export type Worker_Pipeline_Session_IssueSession_PayloadIat = number;
|
|
111
|
+
|
|
112
|
+
export type Worker_Pipeline_Session_IssueSession_PayloadExp = number;
|
|
113
|
+
|
|
114
|
+
export type Worker_Pipeline_Session_IssueSession_Payload = {
|
|
115
|
+
aud: Worker_Pipeline_Session_IssueSession_PayloadAud;
|
|
116
|
+
ip: Worker_Pipeline_Session_IssueSession_PayloadIp;
|
|
117
|
+
jti: Worker_Pipeline_Session_IssueSession_PayloadJti;
|
|
118
|
+
iat: Worker_Pipeline_Session_IssueSession_PayloadIat;
|
|
119
|
+
exp: Worker_Pipeline_Session_IssueSession_PayloadExp;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type Worker_Pipeline_Session_IssueSession_EncodedHeader = string;
|
|
123
|
+
|
|
124
|
+
export type Worker_Pipeline_Session_IssueSession_EncodedPayload = string;
|
|
125
|
+
|
|
126
|
+
export type Worker_Pipeline_Session_IssueSession_SigningInput = string;
|
|
127
|
+
|
|
128
|
+
export type Worker_Pipeline_Session_IssueSession_Key = CryptoKey;
|
|
129
|
+
|
|
130
|
+
export type Worker_Pipeline_Session_IssueSession_Signature = ArrayBuffer;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Worker - Pipeline - Session - Verify Session.
|
|
134
|
+
*
|
|
135
|
+
* @since 2.4.0
|
|
136
|
+
*/
|
|
137
|
+
export type Worker_Pipeline_Session_VerifySession_OptionsContextId = string;
|
|
138
|
+
|
|
139
|
+
export type Worker_Pipeline_Session_VerifySession_OptionsSession = Lib_Schema_SessionConfig;
|
|
140
|
+
|
|
141
|
+
export type Worker_Pipeline_Session_VerifySession_OptionsAuthorization = string | undefined;
|
|
142
|
+
|
|
143
|
+
export type Worker_Pipeline_Session_VerifySession_OptionsClientIp = string;
|
|
144
|
+
|
|
145
|
+
export type Worker_Pipeline_Session_VerifySession_OptionsKv = KVNamespace | undefined;
|
|
146
|
+
|
|
147
|
+
export type Worker_Pipeline_Session_VerifySession_Options = {
|
|
148
|
+
contextId: Worker_Pipeline_Session_VerifySession_OptionsContextId;
|
|
149
|
+
session: Worker_Pipeline_Session_VerifySession_OptionsSession;
|
|
150
|
+
authorization: Worker_Pipeline_Session_VerifySession_OptionsAuthorization;
|
|
151
|
+
clientIp: Worker_Pipeline_Session_VerifySession_OptionsClientIp;
|
|
152
|
+
kv: Worker_Pipeline_Session_VerifySession_OptionsKv;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsSuccessAuthenticated = true;
|
|
156
|
+
|
|
157
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsSuccess = {
|
|
158
|
+
authenticated: Worker_Pipeline_Session_VerifySession_ReturnsSuccessAuthenticated;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsFailureAuthenticated = false;
|
|
162
|
+
|
|
163
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsFailureReason = string;
|
|
164
|
+
|
|
165
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsFailure = {
|
|
166
|
+
authenticated: Worker_Pipeline_Session_VerifySession_ReturnsFailureAuthenticated;
|
|
167
|
+
reason: Worker_Pipeline_Session_VerifySession_ReturnsFailureReason;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type Worker_Pipeline_Session_VerifySession_ReturnsResult = Worker_Pipeline_Session_VerifySession_ReturnsSuccess | Worker_Pipeline_Session_VerifySession_ReturnsFailure;
|
|
171
|
+
|
|
172
|
+
export type Worker_Pipeline_Session_VerifySession_Returns = Promise<Worker_Pipeline_Session_VerifySession_ReturnsResult>;
|
|
173
|
+
|
|
174
|
+
export type Worker_Pipeline_Session_VerifySession_Authorization = string | undefined;
|
|
175
|
+
|
|
176
|
+
export type Worker_Pipeline_Session_VerifySession_Token = string;
|
|
177
|
+
|
|
178
|
+
export type Worker_Pipeline_Session_VerifySession_Parts = string[];
|
|
179
|
+
|
|
180
|
+
export type Worker_Pipeline_Session_VerifySession_EncodedHeader = string | undefined;
|
|
181
|
+
|
|
182
|
+
export type Worker_Pipeline_Session_VerifySession_EncodedPayload = string | undefined;
|
|
183
|
+
|
|
184
|
+
export type Worker_Pipeline_Session_VerifySession_EncodedSignature = string | undefined;
|
|
185
|
+
|
|
186
|
+
export type Worker_Pipeline_Session_VerifySession_DecodedHeader = Uint8Array<ArrayBuffer> | null;
|
|
187
|
+
|
|
188
|
+
export type Worker_Pipeline_Session_VerifySession_DecodedPayload = Uint8Array<ArrayBuffer> | null;
|
|
189
|
+
|
|
190
|
+
export type Worker_Pipeline_Session_VerifySession_DecodedSignature = Uint8Array<ArrayBuffer> | null;
|
|
191
|
+
|
|
192
|
+
export type Worker_Pipeline_Session_VerifySession_HeaderJson = unknown;
|
|
193
|
+
|
|
194
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadJson = unknown;
|
|
195
|
+
|
|
196
|
+
export type Worker_Pipeline_Session_VerifySession_SigningInput = string;
|
|
197
|
+
|
|
198
|
+
export type Worker_Pipeline_Session_VerifySession_Key = CryptoKey;
|
|
199
|
+
|
|
200
|
+
export type Worker_Pipeline_Session_VerifySession_IsValidSignature = boolean;
|
|
201
|
+
|
|
202
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadResult = z.ZodSafeParseResult<Worker_Pipeline_Session_VerifySession_Payload>;
|
|
203
|
+
|
|
204
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadAud = string;
|
|
205
|
+
|
|
206
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadIp = string;
|
|
207
|
+
|
|
208
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadJti = string;
|
|
209
|
+
|
|
210
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadIat = number;
|
|
211
|
+
|
|
212
|
+
export type Worker_Pipeline_Session_VerifySession_PayloadExp = number;
|
|
213
|
+
|
|
214
|
+
export type Worker_Pipeline_Session_VerifySession_Payload = {
|
|
215
|
+
aud: Worker_Pipeline_Session_VerifySession_PayloadAud;
|
|
216
|
+
ip: Worker_Pipeline_Session_VerifySession_PayloadIp;
|
|
217
|
+
jti: Worker_Pipeline_Session_VerifySession_PayloadJti;
|
|
218
|
+
iat: Worker_Pipeline_Session_VerifySession_PayloadIat;
|
|
219
|
+
exp: Worker_Pipeline_Session_VerifySession_PayloadExp;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type Worker_Pipeline_Session_VerifySession_Now = number;
|
|
223
|
+
|
|
224
|
+
export type Worker_Pipeline_Session_VerifySession_UsedKey = string;
|
|
225
|
+
|
|
226
|
+
export type Worker_Pipeline_Session_VerifySession_WasUsed = string | null;
|
|
227
|
+
|
|
228
|
+
export type Worker_Pipeline_Session_VerifySession_UsedTtl = number;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
import type { Shared_NtfyMessage } from '../../shared.d.ts';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Worker - Pipeline - Split.
|
|
3
5
|
*
|
|
4
6
|
* @since 2.0.0
|
|
5
7
|
*/
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
export type Worker_Pipeline_Split_MessagePartHeaders = Record<string, string>;
|
|
9
|
-
|
|
10
|
-
export type Worker_Pipeline_Split_MessagePart = {
|
|
11
|
-
body: Worker_Pipeline_Split_MessagePartBody;
|
|
12
|
-
headers: Worker_Pipeline_Split_MessagePartHeaders;
|
|
13
|
-
};
|
|
8
|
+
export type Worker_Pipeline_Split_MessagePart = Shared_NtfyMessage;
|
|
14
9
|
|
|
15
10
|
export type Worker_Pipeline_Split_Returns = Worker_Pipeline_Split_MessagePart[];
|
|
16
11
|
|
|
@@ -19,9 +14,9 @@ export type Worker_Pipeline_Split_Returns = Worker_Pipeline_Split_MessagePart[];
|
|
|
19
14
|
*
|
|
20
15
|
* @since 2.0.0
|
|
21
16
|
*/
|
|
22
|
-
export type
|
|
17
|
+
export type Worker_Pipeline_Split_Split_Message = Shared_NtfyMessage;
|
|
23
18
|
|
|
24
|
-
export type
|
|
19
|
+
export type Worker_Pipeline_Split_Split_Body = string;
|
|
25
20
|
|
|
26
21
|
export type Worker_Pipeline_Split_Split_Encoder = TextEncoder;
|
|
27
22
|
|
|
@@ -36,5 +31,3 @@ export type Worker_Pipeline_Split_Split_CharBytes = number;
|
|
|
36
31
|
export type Worker_Pipeline_Split_Split_Total = number;
|
|
37
32
|
|
|
38
33
|
export type Worker_Pipeline_Split_Split_BaseTitle = string;
|
|
39
|
-
|
|
40
|
-
export type Worker_Pipeline_Split_Split_PartHeaders = Record<string, string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
2
|
+
import type { Worker_DurableObjects_DeliveryOutbox_Runner_Alarm_Returns, Worker_DurableObjects_DeliveryOutbox_Runner_Constructor_Ctx, Worker_DurableObjects_DeliveryOutbox_Runner_Constructor_Env, Worker_DurableObjects_DeliveryOutbox_Runner_Enqueue_Options, Worker_DurableObjects_DeliveryOutbox_Runner_Enqueue_Returns, Worker_DurableObjects_DeliveryOutbox_Runner_Env, Worker_DurableObjects_DeliveryOutbox_SetConfiguredServers_Returns, Worker_DurableObjects_DeliveryOutbox_SetConfiguredServers_Servers } from '../../types/worker/durable-objects/delivery-outbox.d.ts';
|
|
3
|
+
declare class Runner extends DurableObject<Worker_DurableObjects_DeliveryOutbox_Runner_Env> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(ctx: Worker_DurableObjects_DeliveryOutbox_Runner_Constructor_Ctx, env: Worker_DurableObjects_DeliveryOutbox_Runner_Constructor_Env);
|
|
6
|
+
alarm(): Worker_DurableObjects_DeliveryOutbox_Runner_Alarm_Returns;
|
|
7
|
+
enqueue(options: Worker_DurableObjects_DeliveryOutbox_Runner_Enqueue_Options): Worker_DurableObjects_DeliveryOutbox_Runner_Enqueue_Returns;
|
|
8
|
+
}
|
|
9
|
+
declare function setConfiguredServers(servers: Worker_DurableObjects_DeliveryOutbox_SetConfiguredServers_Servers): Worker_DurableObjects_DeliveryOutbox_SetConfiguredServers_Returns;
|
|
10
|
+
export { Runner, setConfiguredServers, };
|
|
11
|
+
//# sourceMappingURL=delivery-outbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-outbox.d.ts","sourceRoot":"","sources":["../../../src/worker/durable-objects/delivery-outbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,OAAO,KAAK,EAYV,yDAAyD,EAczD,2DAA2D,EAE3D,2DAA2D,EAmB3D,2DAA2D,EAK3D,2DAA2D,EAI3D,+CAA+C,EA6E/C,iEAAiE,EACjE,iEAAiE,EAClE,MAAM,yDAAyD,CAAC;AAqGjE,cAAM,MAAO,SAAQ,aAAa,CAAC,+CAA+C,CAAC;;gBAqB9D,GAAG,EAAE,2DAA2D,EAAE,GAAG,EAAE,2DAA2D;IA2D/H,KAAK,IAAI,yDAAyD;IAoC3E,OAAO,CAAC,OAAO,EAAE,2DAA2D,GAAG,2DAA2D;CAupBxJ;AAcD,iBAAS,oBAAoB,CAAC,OAAO,EAAE,iEAAiE,GAAG,iEAAiE,CAI3K;AAED,OAAO,EACL,MAAM,EACN,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
2
|
+
import { Runner as NtfyClient } from '../ntfy-client.js';
|
|
3
|
+
import { drainFifo } from '../pipeline/drain-fifo.js';
|
|
4
|
+
import { send } from '../pipeline/send.js';
|
|
5
|
+
const deliveryAttemptMinimum = 3;
|
|
6
|
+
const deliveryFailureMaxAgeMilliseconds = 24 * 60 * 60 * 1000;
|
|
7
|
+
const deliveryRetryBaseMilliseconds = 60 * 1000;
|
|
8
|
+
const deliveryRetryMaxMilliseconds = 60 * 60 * 1000;
|
|
9
|
+
const missingServerErrorName = 'DeliveryOutboxMissingServerError';
|
|
10
|
+
const attachmentChunkBytes = 1024 * 1024;
|
|
11
|
+
let configuredServers = [];
|
|
12
|
+
function deliverySucceeded(mode, sendResult) {
|
|
13
|
+
if (mode === 'send-all') {
|
|
14
|
+
return sendResult['results'].length > 0 && sendResult['results'].every((result) => result['success'] === true);
|
|
15
|
+
}
|
|
16
|
+
return sendResult['results'].some((result) => result['success'] === true);
|
|
17
|
+
}
|
|
18
|
+
class Runner extends DurableObject {
|
|
19
|
+
#drainPromise;
|
|
20
|
+
constructor(ctx, env) {
|
|
21
|
+
super(ctx, env);
|
|
22
|
+
this.#drainPromise = undefined;
|
|
23
|
+
this['ctx']['storage']['sql'].exec([
|
|
24
|
+
'CREATE TABLE IF NOT EXISTS notifications (',
|
|
25
|
+
'position INTEGER PRIMARY KEY AUTOINCREMENT,',
|
|
26
|
+
'delivery_id TEXT UNIQUE NOT NULL,',
|
|
27
|
+
'payload TEXT NOT NULL,',
|
|
28
|
+
'attempt_count INTEGER NOT NULL DEFAULT 0,',
|
|
29
|
+
'diagnostic_config TEXT,',
|
|
30
|
+
'created_at INTEGER NOT NULL',
|
|
31
|
+
')',
|
|
32
|
+
].join('\n'));
|
|
33
|
+
const notificationColumns = this['ctx']['storage']['sql'].exec('PRAGMA table_info(notifications)').toArray();
|
|
34
|
+
const attemptCountColumn = notificationColumns.find((notificationColumn) => notificationColumn['name'] === 'attempt_count');
|
|
35
|
+
const diagnosticConfigColumn = notificationColumns.find((notificationColumn) => notificationColumn['name'] === 'diagnostic_config');
|
|
36
|
+
if (attemptCountColumn === undefined) {
|
|
37
|
+
this['ctx']['storage']['sql'].exec('ALTER TABLE notifications ADD COLUMN attempt_count INTEGER NOT NULL DEFAULT 0');
|
|
38
|
+
}
|
|
39
|
+
if (diagnosticConfigColumn === undefined) {
|
|
40
|
+
this['ctx']['storage']['sql'].exec('ALTER TABLE notifications ADD COLUMN diagnostic_config TEXT');
|
|
41
|
+
}
|
|
42
|
+
this['ctx']['storage']['sql'].exec([
|
|
43
|
+
'CREATE TABLE IF NOT EXISTS attachment_chunks (',
|
|
44
|
+
'delivery_id TEXT NOT NULL,',
|
|
45
|
+
'chunk_index INTEGER NOT NULL,',
|
|
46
|
+
'content BLOB NOT NULL,',
|
|
47
|
+
'PRIMARY KEY (delivery_id, chunk_index)',
|
|
48
|
+
')',
|
|
49
|
+
].join('\n'));
|
|
50
|
+
this['ctx']['storage']['sql'].exec([
|
|
51
|
+
'CREATE TABLE IF NOT EXISTS delivery_progress (',
|
|
52
|
+
'delivery_id TEXT NOT NULL,',
|
|
53
|
+
'server_name TEXT NOT NULL,',
|
|
54
|
+
'stage TEXT NOT NULL,',
|
|
55
|
+
'PRIMARY KEY (delivery_id, server_name, stage)',
|
|
56
|
+
')',
|
|
57
|
+
].join('\n'));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
async alarm() {
|
|
61
|
+
const activeDrain = this.#drainPromise;
|
|
62
|
+
if (activeDrain !== undefined) {
|
|
63
|
+
await activeDrain;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const startedDrain = this.#drain();
|
|
67
|
+
this.#drainPromise = startedDrain;
|
|
68
|
+
try {
|
|
69
|
+
await startedDrain;
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
if (this.#drainPromise === startedDrain) {
|
|
73
|
+
this.#drainPromise = undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
async enqueue(options) {
|
|
79
|
+
const deliveryId = crypto.randomUUID();
|
|
80
|
+
const diagnosticConfig = {
|
|
81
|
+
serverNames: options['serverNames'],
|
|
82
|
+
primaryServerName: options['primaryServerName'],
|
|
83
|
+
mode: options['mode'],
|
|
84
|
+
contextName: options['contextName'],
|
|
85
|
+
interpreterName: options['interpreterName'],
|
|
86
|
+
...((options['errorTopic'] !== undefined) ? { errorTopic: options['errorTopic'] } : {}),
|
|
87
|
+
};
|
|
88
|
+
const diagnosticConfigJson = JSON.stringify(diagnosticConfig);
|
|
89
|
+
const payload = {
|
|
90
|
+
messages: options['messages'],
|
|
91
|
+
serverNames: options['serverNames'],
|
|
92
|
+
primaryServerName: options['primaryServerName'],
|
|
93
|
+
topic: options['topic'],
|
|
94
|
+
mode: options['mode'],
|
|
95
|
+
...((options['visitorIp'] !== undefined) ? { visitorIp: options['visitorIp'] } : {}),
|
|
96
|
+
...((options['filename'] !== undefined) ? { filename: options['filename'] } : {}),
|
|
97
|
+
...((options['attachmentTitle'] !== undefined) ? { attachmentTitle: options['attachmentTitle'] } : {}),
|
|
98
|
+
hasAttachment: options['attachment'] !== undefined,
|
|
99
|
+
};
|
|
100
|
+
const payloadJson = JSON.stringify(payload);
|
|
101
|
+
const attachmentBytes = (options['attachment'] === undefined) ? undefined : new Uint8Array(options['attachment']);
|
|
102
|
+
this['ctx']['storage'].transactionSync(() => {
|
|
103
|
+
this['ctx']['storage']['sql'].exec('INSERT INTO notifications (delivery_id, payload, diagnostic_config, created_at) VALUES (?, ?, ?, ?)', deliveryId, payloadJson, diagnosticConfigJson, Date.now());
|
|
104
|
+
if (attachmentBytes !== undefined) {
|
|
105
|
+
let chunkIndex = 0;
|
|
106
|
+
for (let offset = 0; offset < attachmentBytes.length; offset += attachmentChunkBytes) {
|
|
107
|
+
const chunk = attachmentBytes.slice(offset, offset + attachmentChunkBytes).buffer;
|
|
108
|
+
this['ctx']['storage']['sql'].exec('INSERT INTO attachment_chunks (delivery_id, chunk_index, content) VALUES (?, ?, ?)', deliveryId, chunkIndex, chunk);
|
|
109
|
+
chunkIndex += 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
});
|
|
114
|
+
const startedDrain = (this.#drainPromise === undefined) ? this.#drain() : this.#drainPromise.then(this.#continueDrain.bind(this));
|
|
115
|
+
this.#drainPromise = startedDrain;
|
|
116
|
+
try {
|
|
117
|
+
const attemptResults = await startedDrain;
|
|
118
|
+
const pendingRow = this['ctx']['storage']['sql'].exec('SELECT COUNT(*) AS pending FROM notifications').one();
|
|
119
|
+
const queuedRow = this['ctx']['storage']['sql'].exec('SELECT COUNT(*) AS queued FROM notifications WHERE delivery_id = ?', deliveryId).one();
|
|
120
|
+
const sendResult = attemptResults['results'].get(deliveryId);
|
|
121
|
+
let state = 'delivered';
|
|
122
|
+
if (queuedRow['queued'] > 0) {
|
|
123
|
+
state = 'queued';
|
|
124
|
+
}
|
|
125
|
+
else if (attemptResults['discardedIds'].has(deliveryId) === true) {
|
|
126
|
+
state = 'discarded';
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
deliveryId,
|
|
130
|
+
state,
|
|
131
|
+
pending: pendingRow['pending'],
|
|
132
|
+
...((sendResult !== undefined) ? { sendResult } : {}),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
if (this.#drainPromise === startedDrain) {
|
|
137
|
+
this.#drainPromise = undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async #continueDrain(previousDrain) {
|
|
142
|
+
const currentDrain = await this.#drain();
|
|
143
|
+
for (const resultEntry of currentDrain['results']) {
|
|
144
|
+
previousDrain['results'].set(resultEntry[0], resultEntry[1]);
|
|
145
|
+
}
|
|
146
|
+
for (const discardedId of currentDrain['discardedIds']) {
|
|
147
|
+
previousDrain['discardedIds'].add(discardedId);
|
|
148
|
+
}
|
|
149
|
+
return previousDrain;
|
|
150
|
+
}
|
|
151
|
+
#readAttachment(deliveryId, hasAttachment) {
|
|
152
|
+
if (hasAttachment === false) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
const rows = this['ctx']['storage']['sql'].exec('SELECT content FROM attachment_chunks WHERE delivery_id = ? ORDER BY chunk_index ASC', deliveryId).toArray();
|
|
156
|
+
const totalBytes = rows.reduce((total, row) => total + row['content'].byteLength, 0);
|
|
157
|
+
const bytes = new Uint8Array(totalBytes);
|
|
158
|
+
let offset = 0;
|
|
159
|
+
for (const row of rows) {
|
|
160
|
+
const chunkBytes = new Uint8Array(row['content']);
|
|
161
|
+
bytes.set(chunkBytes, offset);
|
|
162
|
+
offset += chunkBytes.length;
|
|
163
|
+
}
|
|
164
|
+
return bytes.buffer;
|
|
165
|
+
}
|
|
166
|
+
#readCompletedStages(deliveryId) {
|
|
167
|
+
const rows = this['ctx']['storage']['sql'].exec('SELECT server_name, stage FROM delivery_progress WHERE delivery_id = ? ORDER BY server_name ASC, stage ASC', deliveryId).toArray();
|
|
168
|
+
const completedStages = {};
|
|
169
|
+
for (const row of rows) {
|
|
170
|
+
const serverStages = completedStages[row['server_name']] ?? [];
|
|
171
|
+
serverStages.push(row['stage']);
|
|
172
|
+
Reflect.set(completedStages, row['server_name'], serverStages);
|
|
173
|
+
}
|
|
174
|
+
return completedStages;
|
|
175
|
+
}
|
|
176
|
+
#resolveServers(payload) {
|
|
177
|
+
const resolvedServers = payload['serverNames'].map((serverName) => {
|
|
178
|
+
const server = configuredServers.find((configuredServer) => configuredServer['name'] === serverName);
|
|
179
|
+
if (server === undefined) {
|
|
180
|
+
const serverError = new Error(`Configured ntfy server "${serverName}" is unavailable`);
|
|
181
|
+
serverError.name = missingServerErrorName;
|
|
182
|
+
throw serverError;
|
|
183
|
+
}
|
|
184
|
+
return server;
|
|
185
|
+
});
|
|
186
|
+
const primaryServer = resolvedServers.find((server) => server['name'] === payload['primaryServerName']);
|
|
187
|
+
if (primaryServer === undefined) {
|
|
188
|
+
const primaryServerError = new Error(`Primary ntfy server "${payload['primaryServerName']}" is unavailable`);
|
|
189
|
+
primaryServerError.name = missingServerErrorName;
|
|
190
|
+
throw primaryServerError;
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
servers: resolvedServers,
|
|
194
|
+
primaryServer,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
#checkpoint(deliveryId, serverName, stage) {
|
|
198
|
+
this['ctx']['storage']['sql'].exec('INSERT OR IGNORE INTO delivery_progress (delivery_id, server_name, stage) VALUES (?, ?, ?)', deliveryId, serverName, stage);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
#delete(deliveryId) {
|
|
202
|
+
this['ctx']['storage'].transactionSync(() => {
|
|
203
|
+
this['ctx']['storage']['sql'].exec('DELETE FROM delivery_progress WHERE delivery_id = ?', deliveryId);
|
|
204
|
+
this['ctx']['storage']['sql'].exec('DELETE FROM attachment_chunks WHERE delivery_id = ?', deliveryId);
|
|
205
|
+
this['ctx']['storage']['sql'].exec('DELETE FROM notifications WHERE delivery_id = ?', deliveryId);
|
|
206
|
+
return;
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
#peek() {
|
|
211
|
+
const rows = this['ctx']['storage']['sql'].exec('SELECT position, delivery_id AS deliveryId, payload, attempt_count AS attemptCount, diagnostic_config AS diagnosticConfig, created_at AS createdAt FROM notifications ORDER BY position ASC LIMIT 1').toArray();
|
|
212
|
+
return rows[0];
|
|
213
|
+
}
|
|
214
|
+
async #recordFailure(notification, classification, reason, httpStatus) {
|
|
215
|
+
const currentTime = Date.now();
|
|
216
|
+
const attemptCount = notification['attemptCount'] + 1;
|
|
217
|
+
const ageMilliseconds = Math.max(0, currentTime - notification['createdAt']);
|
|
218
|
+
this['ctx']['storage']['sql'].exec('UPDATE notifications SET attempt_count = ? WHERE delivery_id = ?', attemptCount, notification['deliveryId']);
|
|
219
|
+
const discarded = classification === 'permanent' || (attemptCount >= deliveryAttemptMinimum
|
|
220
|
+
&& ageMilliseconds >= deliveryFailureMaxAgeMilliseconds);
|
|
221
|
+
const debug = (discarded === true) ? 'delivery_outbox_discarded' : 'delivery_outbox_retry';
|
|
222
|
+
console.info(JSON.stringify({
|
|
223
|
+
debug,
|
|
224
|
+
deliveryId: notification['deliveryId'],
|
|
225
|
+
classification,
|
|
226
|
+
reason,
|
|
227
|
+
httpStatus,
|
|
228
|
+
attemptCount,
|
|
229
|
+
ageMilliseconds,
|
|
230
|
+
}));
|
|
231
|
+
if (discarded === true) {
|
|
232
|
+
await this.#sendDiscardDiagnostic(notification, reason, httpStatus, attemptCount, ageMilliseconds);
|
|
233
|
+
return 'discard';
|
|
234
|
+
}
|
|
235
|
+
await this.#scheduleRetry(attemptCount);
|
|
236
|
+
return 'retry';
|
|
237
|
+
}
|
|
238
|
+
async #attempt(notification) {
|
|
239
|
+
const payload = JSON.parse(notification['payload']);
|
|
240
|
+
const attachment = this.#readAttachment(notification['deliveryId'], payload['hasAttachment']);
|
|
241
|
+
const completedStages = this.#readCompletedStages(notification['deliveryId']);
|
|
242
|
+
const resolved = this.#resolveServers(payload);
|
|
243
|
+
const attachmentTitle = NtfyClient.readStoredTitle(payload['attachmentTitle'], payload['attachmentHeaders']);
|
|
244
|
+
return await send({
|
|
245
|
+
messages: payload['messages'].map((storedMessage) => NtfyClient.readStoredMessage(storedMessage)),
|
|
246
|
+
servers: resolved['servers'],
|
|
247
|
+
primaryServer: resolved['primaryServer'],
|
|
248
|
+
topic: payload['topic'],
|
|
249
|
+
mode: payload['mode'],
|
|
250
|
+
...((payload['visitorIp'] !== undefined) ? { visitorIp: payload['visitorIp'] } : {}),
|
|
251
|
+
...((attachment !== undefined) ? { attachment } : {}),
|
|
252
|
+
...((payload['filename'] !== undefined) ? { filename: payload['filename'] } : {}),
|
|
253
|
+
...((attachmentTitle !== undefined) ? { attachmentTitle } : {}),
|
|
254
|
+
deliveryId: notification['deliveryId'],
|
|
255
|
+
completedStages,
|
|
256
|
+
onStageSuccess: (serverName, stage) => {
|
|
257
|
+
this.#checkpoint(notification['deliveryId'], serverName, stage);
|
|
258
|
+
return;
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
#succeeded(notification, sendResult) {
|
|
263
|
+
const payload = JSON.parse(notification['payload']);
|
|
264
|
+
return deliverySucceeded(payload['mode'], sendResult);
|
|
265
|
+
}
|
|
266
|
+
#remove(notification) {
|
|
267
|
+
this.#delete(notification['deliveryId']);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
async #handleFailure(notification, sendResult) {
|
|
271
|
+
let selectedResult = undefined;
|
|
272
|
+
let classification = 'permanent';
|
|
273
|
+
for (const result of sendResult['results']) {
|
|
274
|
+
if (result['success'] === true) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const status = result['status'];
|
|
278
|
+
const transient = status === 0
|
|
279
|
+
|| status === 408
|
|
280
|
+
|| status === 429
|
|
281
|
+
|| status >= 500;
|
|
282
|
+
const permanent = status >= 400
|
|
283
|
+
&& status < 500
|
|
284
|
+
&& status !== 408
|
|
285
|
+
&& status !== 429;
|
|
286
|
+
if (transient === true
|
|
287
|
+
|| permanent === false) {
|
|
288
|
+
selectedResult = result;
|
|
289
|
+
classification = 'transient';
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
if (selectedResult === undefined) {
|
|
293
|
+
selectedResult = result;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (selectedResult === undefined) {
|
|
297
|
+
const missingResultReason = 'No ntfy server result was returned';
|
|
298
|
+
return await this.#recordFailure(notification, 'transient', missingResultReason, null);
|
|
299
|
+
}
|
|
300
|
+
const httpStatus = selectedResult['status'];
|
|
301
|
+
const reason = selectedResult['error'] ?? `HTTP ${String(httpStatus)}`;
|
|
302
|
+
return await this.#recordFailure(notification, classification, reason, httpStatus);
|
|
303
|
+
}
|
|
304
|
+
async #handleError(notification, err) {
|
|
305
|
+
const classification = (err instanceof SyntaxError
|
|
306
|
+
|| (err instanceof Error
|
|
307
|
+
&& err.name === missingServerErrorName)) ? 'permanent' : 'transient';
|
|
308
|
+
let reason = 'Unknown delivery outbox error';
|
|
309
|
+
if (err instanceof SyntaxError) {
|
|
310
|
+
reason = 'Queued notification payload is invalid JSON';
|
|
311
|
+
}
|
|
312
|
+
else if (err instanceof Error) {
|
|
313
|
+
reason = err.message;
|
|
314
|
+
}
|
|
315
|
+
return await this.#recordFailure(notification, classification, reason, null);
|
|
316
|
+
}
|
|
317
|
+
async #scheduleRetry(attemptCount) {
|
|
318
|
+
const existingAlarm = await this['ctx']['storage'].getAlarm();
|
|
319
|
+
if (existingAlarm !== null) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const exponent = Math.max(0, attemptCount - 1);
|
|
323
|
+
const delay = Math.min(deliveryRetryBaseMilliseconds * Math.pow(2, exponent), deliveryRetryMaxMilliseconds);
|
|
324
|
+
const scheduledTime = Date.now() + delay;
|
|
325
|
+
await this['ctx']['storage'].setAlarm(scheduledTime);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
async #sendDiscardDiagnostic(notification, reason, httpStatus, attemptCount, ageMilliseconds) {
|
|
329
|
+
if (notification['diagnosticConfig'] === null) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
try {
|
|
333
|
+
const diagnosticConfig = JSON.parse(notification['diagnosticConfig']);
|
|
334
|
+
if (diagnosticConfig['errorTopic'] === undefined) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const resolvedServers = [];
|
|
338
|
+
for (const serverName of diagnosticConfig['serverNames']) {
|
|
339
|
+
const server = configuredServers.find((configuredServer) => configuredServer['name'] === serverName);
|
|
340
|
+
if (server !== undefined) {
|
|
341
|
+
resolvedServers.push(server);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const primaryServer = resolvedServers.find((server) => server['name'] === diagnosticConfig['primaryServerName']) ?? resolvedServers[0];
|
|
345
|
+
if (primaryServer === undefined) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const attachmentData = {
|
|
349
|
+
timestamp: new Date().toISOString(),
|
|
350
|
+
context: {
|
|
351
|
+
name: diagnosticConfig['contextName'],
|
|
352
|
+
interpreter: diagnosticConfig['interpreterName'],
|
|
353
|
+
stage: 'delivery',
|
|
354
|
+
},
|
|
355
|
+
delivery_id: notification['deliveryId'],
|
|
356
|
+
reason,
|
|
357
|
+
http_status: httpStatus,
|
|
358
|
+
attempt_count: attemptCount,
|
|
359
|
+
age_ms: ageMilliseconds,
|
|
360
|
+
};
|
|
361
|
+
const attachmentJson = JSON.stringify(attachmentData, null, 2);
|
|
362
|
+
const attachment = new TextEncoder().encode(attachmentJson).buffer;
|
|
363
|
+
await send({
|
|
364
|
+
messages: [],
|
|
365
|
+
servers: resolvedServers,
|
|
366
|
+
primaryServer,
|
|
367
|
+
topic: diagnosticConfig['errorTopic'],
|
|
368
|
+
mode: diagnosticConfig['mode'],
|
|
369
|
+
attachment,
|
|
370
|
+
filename: 'error-debug.json',
|
|
371
|
+
attachmentTitle: 'Durable Delivery Discarded',
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
catch {
|
|
375
|
+
}
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
async #drain() {
|
|
379
|
+
const drainResult = await drainFifo({
|
|
380
|
+
peek: this.#peek.bind(this),
|
|
381
|
+
attempt: this.#attempt.bind(this),
|
|
382
|
+
succeeded: this.#succeeded.bind(this),
|
|
383
|
+
remove: this.#remove.bind(this),
|
|
384
|
+
onFailure: this.#handleFailure.bind(this),
|
|
385
|
+
onError: this.#handleError.bind(this),
|
|
386
|
+
});
|
|
387
|
+
const pendingNotification = this.#peek();
|
|
388
|
+
if (pendingNotification === undefined) {
|
|
389
|
+
await this['ctx']['storage'].deleteAlarm();
|
|
390
|
+
}
|
|
391
|
+
return drainResult;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function setConfiguredServers(servers) {
|
|
395
|
+
configuredServers = servers;
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
export { Runner, setConfiguredServers, };
|
|
399
|
+
//# sourceMappingURL=delivery-outbox.js.map
|