@pilser/backend-engine 0.1.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 ADDED
@@ -0,0 +1,126 @@
1
+ # @pilser/backend-engine
2
+
3
+ **Your backend that you never code (Backend as a dependency).** One install
4
+ gives your app a complete serverless backend engine: database tables, auth
5
+ keys + users, file storage, cron jobs, event automations (recipes), webhooks,
6
+ static hosting, AI proxy, MCP control plane. One Cloudflare Worker = one app.
7
+
8
+ **You don't write backend code.** No server files, no routes, no ORM, no
9
+ framework to learn. You declare behavior in JSON over HTTP — create a
10
+ table, submit a record, schedule a cron, wire an automation — all API
11
+ calls from your frontend or scripts. If you can `curl`, you can backend.
12
+
13
+ **Only focus on creativity, your features, and your frontend.** The backend
14
+ is already there — you configure it **while it runs** and go. Tables,
15
+ validation, automations, schedules are declared at runtime as JSON and take
16
+ effect immediately. No redeploy to change behavior.
17
+
18
+ **It's free.** MIT-licensed and runs on Cloudflare's free tier (Workers
19
+ + D1 + R2). No per-seat pricing, no hosted-backend bill, no vendor
20
+ lock-in — your Cloudflare account, your data, your limits. Fork it,
21
+ self-host it, it's yours.
22
+
23
+ ## Install
24
+
25
+ ```sh
26
+ npm i @pilser/backend-engine # bun add @pilser/backend-engine
27
+ ```
28
+
29
+ Copy `wrangler.example.toml` (in this package) to `wrangler.toml` in your
30
+ project and fill in your ids:
31
+
32
+ ```toml
33
+ name = "my-app"
34
+ main = "node_modules/@pilser/backend-engine/index.js"
35
+ compatibility_date = "2026-09-01"
36
+
37
+ [vars]
38
+ WORKER_URL = "https://my-app.<account>.workers.dev"
39
+
40
+ [[d1_databases]]
41
+ binding = "DB"
42
+ database_name = "my-app"
43
+ database_id = "<run: wrangler d1 create my-app>"
44
+
45
+ [[r2_buckets]]
46
+ binding = "STORE"
47
+ bucket_name = "my-app-store" # wrangler r2 bucket create my-app-store
48
+
49
+ [[durable_objects.bindings]]
50
+ name = "TENANT_DO"
51
+ class_name = "TenantDO"
52
+
53
+ [[migrations]]
54
+ tag = "v1"
55
+ new_sqlite_classes = ["TenantDO"]
56
+
57
+ [[queues.producers]]
58
+ queue = "my-app-deliveries" # wrangler queues create my-app-deliveries
59
+ binding = "WEBHOOKS"
60
+
61
+ [[queues.consumers]]
62
+ queue = "my-app-deliveries"
63
+ max_batch_size = 10
64
+ max_batch_timeout = 30
65
+
66
+ [triggers]
67
+ crons = ["*/5 * * * *"]
68
+ ```
69
+
70
+ Secrets (never in files):
71
+
72
+ ```sh
73
+ wrangler secret put SECRET_KEY # 32+ random bytes: at-rest encryption
74
+ wrangler secret put WORKER_KEY # admin bearer for /api + /mcp
75
+ wrangler deploy
76
+ ```
77
+
78
+ First calls (`Authorization: Bearer $WORKER_KEY`):
79
+
80
+ ```sh
81
+ curl $BASE/mcp # setup sheet
82
+ curl -H "$K" -X POST $BASE/api/tables -d '{"table":"notes"}'
83
+ curl -H "$K" -X POST $BASE/api/tables/notes/submit -d '{"body":"hi"}'
84
+ ```
85
+
86
+ ## Configure at runtime — terminal + MCP clients
87
+
88
+ The backend is already running — configure it live. One tool
89
+ (`manage_serverless_engine`) speaks CLI; three doors lead to it.
90
+
91
+ **Terminal (zero setup)** — same grammar over plain HTTP:
92
+
93
+ ```sh
94
+ curl "$BASE/mcp?command=--help"
95
+ curl "$BASE/mcp?command=records+list+notes"
96
+ curl -X POST $BASE/mcp -d '{"command":"records list notes"}'
97
+ ```
98
+
99
+ Locked deployments add auth (`Authorization: Bearer $WORKER_KEY` header,
100
+ or `?key=$WORKER_KEY` in the URL — browsers can only do the latter).
101
+
102
+ **MCP clients** — point at `https://<your-app>/mcp` (it serves MCP
103
+ JSON-RPC). Easiest start: open `GET /mcp` in a browser — it returns the
104
+ exact `mcpServers` snippet for your deployment, auth included:
105
+
106
+ - **Claude**: `claude mcp add --transport http backend-engine https://<app>/mcp`
107
+ (+ `--header "Authorization: Bearer $WORKER_KEY"` when locked), or
108
+ `.mcp.json`: `{"mcpServers": {"backend-engine": {"url": "...", "headers": {...}}}}}`
109
+ - **Codex** (`~/.codex/config.toml`):
110
+ ```toml
111
+ [mcp_servers.backend-engine]
112
+ url = "https://<app>/mcp"
113
+ http_headers = { "Authorization" = "Bearer $WORKER_KEY" } # when locked
114
+ ```
115
+ - **OpenCode** (`opencode.json`):
116
+ ```json
117
+ {"mcp": {"backend-engine": {"type": "remote", "url": "https://<app>/mcp",
118
+ "headers": {"Authorization": "Bearer $WORKER_KEY"}}}}
119
+ ```
120
+ (v2 config nests servers under `"mcp": {"servers": {...}}`)
121
+ - **Any standard client**: `POST /mcp` JSON-RPC `tools/call` with
122
+ `{"name": "manage_serverless_engine", "arguments": {"command": "..."}}`.
123
+ Start agents with command `--help`, then `<group> --help`.
124
+
125
+ Full route surface: `GET /mcp` on your deployment, or the `endpoints.list` MCP tool.
126
+ Source + guides: https://github.com/Pilser/backend-engine
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import{WorkerEntrypoint as Fe}from"cloudflare:workers";var K=globalThis.__worker_init_state={criticalError:!1,instanceId:0};import{connect as ae}from"cloudflare:sockets";import ee from"./index_bg.wasm";var E=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,me.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_containerstartupoptions_free(e,0)}catch(t){c(t)}}get enableInternet(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_containerstartupoptions_enableInternet(this.__wbg_ptr)}catch(t){c(t)}return e===16777215?void 0:e!==0}get entrypoint(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_containerstartupoptions_entrypoint(this.__wbg_ptr)}catch(n){c(n)}var t=xe(e[0],e[1]);return i.__wbindgen_free(e[0],e[1]*4,4),t}get env(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_containerstartupoptions_env(this.__wbg_ptr)}catch(t){c(t)}return e}set enableInternet(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_containerstartupoptions_enableInternet(this.__wbg_ptr,b(e)?16777215:e?1:0)}catch(t){c(t)}}set entrypoint(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t=oe(e,i.__wbindgen_malloc),n=g;o();try{i.__wbg_set_containerstartupoptions_entrypoint(this.__wbg_ptr,t,n)}catch(r){c(r)}}set env(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_containerstartupoptions_env(this.__wbg_ptr,e)}catch(t){c(t)}}};Symbol.dispose&&(E.prototype[Symbol.dispose]=E.prototype.free);var C=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ve.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_intounderlyingbytesource_free(e,0)}catch(t){c(t)}}get autoAllocateChunkSize(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)}catch(t){c(t)}return e>>>0}cancel(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e=this.__destroy_into_raw();o();try{i.intounderlyingbytesource_cancel(e)}catch(t){c(t)}}pull(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t;o();try{t=i.intounderlyingbytesource_pull(this.__wbg_ptr,e)}catch(n){c(n)}return t}start(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.intounderlyingbytesource_start(this.__wbg_ptr,e)}catch(t){c(t)}}get type(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.intounderlyingbytesource_type(this.__wbg_ptr)}catch(t){c(t)}return he[e]}};Symbol.dispose&&(C.prototype[Symbol.dispose]=C.prototype.free);var M=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ie.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_intounderlyingsink_free(e,0)}catch(t){c(t)}}abort(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t=this.__destroy_into_raw(),n;o();try{n=i.intounderlyingsink_abort(t,e)}catch(r){c(r)}return n}close(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e=this.__destroy_into_raw(),t;o();try{t=i.intounderlyingsink_close(e)}catch(n){c(n)}return t}write(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t;o();try{t=i.intounderlyingsink_write(this.__wbg_ptr,e)}catch(n){c(n)}return t}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);var O=class _{static __wrap(e){let t=Object.create(_.prototype);return t.__wbg_ptr=e,Object.defineProperty(t,"__wbg_inst",{value:a,writable:!0}),Q.register(t,{ptr:e,instance:a},t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Q.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_intounderlyingsource_free(e,0)}catch(t){c(t)}}cancel(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e=this.__destroy_into_raw();o();try{i.intounderlyingsource_cancel(e)}catch(t){c(t)}}pull(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t;o();try{t=i.intounderlyingsource_pull(this.__wbg_ptr,e)}catch(n){c(n)}return t}};Symbol.dispose&&(O.prototype[Symbol.dispose]=O.prototype.free);var v=class _{static __wrap(e){let t=Object.create(_.prototype);return t.__wbg_ptr=e,Object.defineProperty(t,"__wbg_inst",{value:a,writable:!0}),X.register(t,{ptr:e,instance:a},t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,X.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_minifyconfig_free(e,0)}catch(t){c(t)}}get css(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_minifyconfig_css(this.__wbg_ptr)}catch(t){c(t)}return e!==0}get html(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_minifyconfig_html(this.__wbg_ptr)}catch(t){c(t)}return e!==0}get js(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_minifyconfig_js(this.__wbg_ptr)}catch(t){c(t)}return e!==0}set css(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_minifyconfig_css(this.__wbg_ptr,e)}catch(t){c(t)}}set html(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_minifyconfig_html(this.__wbg_ptr,e)}catch(t){c(t)}}set js(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_minifyconfig_js(this.__wbg_ptr,e)}catch(t){c(t)}}};Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);var x=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ee.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_r2range_free(e,0)}catch(t){c(t)}}get length(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_r2range_length(this.__wbg_ptr)}catch(t){c(t)}return e[0]===0?void 0:e[1]}get offset(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_r2range_offset(this.__wbg_ptr)}catch(t){c(t)}return e[0]===0?void 0:e[1]}get suffix(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.__wbg_get_r2range_suffix(this.__wbg_ptr)}catch(t){c(t)}return e[0]===0?void 0:e[1]}set length(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_r2range_length(this.__wbg_ptr,!b(e),b(e)?0:e)}catch(t){c(t)}}set offset(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_r2range_offset(this.__wbg_ptr,!b(e),b(e)?0:e)}catch(t){c(t)}}set suffix(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");o();try{i.__wbg_set_r2range_suffix(this.__wbg_ptr,!b(e),b(e)?0:e)}catch(t){c(t)}}};Symbol.dispose&&(x.prototype[Symbol.dispose]=x.prototype.free);var R=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Y.unregister(this),e}free(){let e=this.__destroy_into_raw();o();try{i.__wbg_tenantdo_free(e,0)}catch(t){c(t)}}alarm(){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let e;o();try{e=i.tenantdo_alarm(this.__wbg_ptr)}catch(t){c(t)}return e}connect(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t;o();try{t=i.tenantdo_connect(this.__wbg_ptr,e)}catch(n){c(n)}return t}fetch(e){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let t;o();try{t=i.tenantdo_fetch(this.__wbg_ptr,e)}catch(n){c(n)}return t}constructor(e,t){let n;o();try{n=i.tenantdo_new(e,t)}catch(r){c(r)}return this.__wbg_ptr=n,Object.defineProperty(this,"__wbg_inst",{value:a,writable:!0}),Y.register(this,{ptr:n,instance:a},this),this}webSocketClose(e,t,n,r){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let s=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),f=g,u;o();try{u=i.tenantdo_webSocketClose(this.__wbg_ptr,e,t,s,f,r)}catch(l){c(l)}return u}webSocketError(e,t){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let n;o();try{n=i.tenantdo_webSocketError(this.__wbg_ptr,e,t)}catch(r){c(r)}return n}webSocketMessage(e,t){if(this.__wbg_inst!==void 0&&this.__wbg_inst!==a)throw new Error("Invalid stale object from previous Wasm instance");let n;o();try{n=i.tenantdo_webSocketMessage(this.__wbg_ptr,e,t)}catch(r){c(r)}return n}};Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);function P(){a++,m=null,S=null,W=null,typeof numBytesDecoded<"u"&&(numBytesDecoded=0),typeof g<"u"&&(g=0),N=!1,L=!1,J=new WebAssembly.Instance(ee,ie()),i=J.exports,i.__wbindgen_start()}function te(){let _;o();try{_=i.__worker_init_state()}catch(e){c(e)}return _}function ne(_,e,t){let n;o();try{n=i.fetch(_,e,t)}catch(r){c(r)}return n}function _e(_,e,t){let n;o();try{n=i.queue(_,e,t)}catch(r){c(r)}return n}function re(_,e,t){let n;o();try{n=i.scheduled(_,e,t)}catch(r){c(r)}return n}function ie(){return{__proto__:null,"./index_bg.js":{__proto__:null,__wbg_Error_30c8987f7c2ed4e2:function(e,t){return Error(w(e,t))},__wbg_Number_14af1003b8dd5ead:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=String(t),r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c:function(e,t){let n=t,r=typeof n=="bigint"?n:void 0;d().setBigInt64(e+8,b(r)?BigInt(0):r,!0),d().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_boolean_get_5b446f51afd21013:function(e){let t=e,n=typeof t=="boolean"?t:void 0;return b(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_4687d8d8c2017d52:function(e,t){let n=B(t),r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg___wbindgen_in_92f62ee1427d9e49:function(e,t){return e in t},__wbg___wbindgen_is_bigint_b123553bed3bb382:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_falsy_16bd49b68658263e:function(e){return!e},__wbg___wbindgen_is_function_1f9d30630b8b1d3d:function(e){return typeof e=="function"},__wbg___wbindgen_is_null_e343b7d08827ba72:function(e){return e===null},__wbg___wbindgen_is_null_or_undefined_f9435d56bdcc06df:function(e){return e==null},__wbg___wbindgen_is_object_3c45d4f2dde4e749:function(e){let t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_90b56bc79aad6f6c:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_02babf21faa37971:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_677f21e468d6b461:function(e,t){return e==t},__wbg___wbindgen_number_get_2e0e7dee9f701a71:function(e,t){let n=t,r=typeof n=="number"?n:void 0;d().setFloat64(e+8,b(r)?0:r,!0),d().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_reinit_3f79fdb34dee3ea9:function(){L=!0},__wbg___wbindgen_string_get_0380ccaa2f57f0d9:function(e,t){let n=t,r=typeof n=="string"?n:void 0;var s=b(r)?0:y(r,i.__wbindgen_malloc,i.__wbindgen_realloc),f=g;d().setInt32(e+4,f,!0),d().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,t){throw new WebAssembly.Exception(V,[new Error(w(e,t))])},__wbg__wbg_cb_unref_dcc1a90847f04c41:function(e){e._wbg_cb_unref()},__wbg_accept_22c0962bedc3a5e7:function(e){e.accept()},__wbg_ack_7b6b386461f37e32:function(e){e.ack()},__wbg_addEventListener_4d0db17c671ea324:function(e,t,n,r){e.addEventListener(w(t,n),r)},__wbg_append_1938ed58fb5613b8:function(e,t,n,r,s){e.append(w(t,n),w(r,s))},__wbg_arrayBuffer_7b8b2e9be0285525:function(e){return e.arrayBuffer()},__wbg_arrayBuffer_aa7cad37be6e6b29:function(e){return e.arrayBuffer()},__wbg_batch_6b58fc32d9c19d60:function(e,t){return e.batch(t)},__wbg_bind_1f842289d2018ed8:function(e,t){return e.bind(...t)},__wbg_body_4e088733babc630d:function(e){let t=e.body;return b(t)?0:h(t)},__wbg_body_7d841bc72644d2cb:function(e){return e.body},__wbg_buffer_56ec2905a66f58b9:function(e){return e.buffer},__wbg_byobRequest_54f7ce41d584549a:function(e){let t=e.byobRequest;return b(t)?0:h(t)},__wbg_byteLength_9f985b8373f1f3fe:function(e){return e.byteLength},__wbg_byteOffset_0bd5a6a03553639c:function(e){return e.byteOffset},__wbg_call_187d372bd5fdd4aa:function(e,t,n){return e.call(t,n)},__wbg_call_6137034ef55c9d0f:function(e,t){return e.call(t)},__wbg_cancel_7c2a08c8db4c73f3:function(e){return e.cancel()},__wbg_catch_92594c2d17f55f12:function(e,t){return e.catch(t)},__wbg_cause_19276d032a32d4bd:function(e){return e.cause},__wbg_cf_909bcfb212a8822c:function(e){let t=e.cf;return b(t)?0:h(t)},__wbg_cf_b47fe5ff6d015a0d:function(e){let t=e.cf;return b(t)?0:h(t)},__wbg_clearTimeout_d49a4afcd9b218b7:function(e,t){e.clearTimeout(t)},__wbg_close_150f701b1a60e0ac:function(e,t,n,r){e.close(t,w(n,r))},__wbg_close_185286988f30f252:function(e){e.close()},__wbg_close_748f26698dabe269:function(e){e.close()},__wbg_close_905cac8d4bb85f6f:function(e,t){e.close(t)},__wbg_close_d3ed56b5763be5ae:function(e){e.close()},__wbg_connect_0ab2304472062a80:function(e,t){return ae(e,t)},__wbg_constructor_076176ce0f386e16:function(e){return e.constructor},__wbg_cron_76b7eba30bc0443e:function(e,t){let n=t.cron,r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_cursor_1c9a92814964774c:function(e,t){let n=t.cursor;var r=b(n)?0:y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_data_522f7abc70721269:function(e){return e.data},__wbg_delete_4a8ee012c43b86c0:function(e,t,n){let r,s;try{return r=t,s=n,e.delete(w(t,n))}finally{o();try{i.__wbindgen_free(r,s,1)}catch(f){c(f)}}},__wbg_done_b41a1d26cdb37fb6:function(e){return e.done},__wbg_enqueue_4a01c128f9a0de16:function(e,t){e.enqueue(t)},__wbg_entries_fb6397112b1de25f:function(e){return Object.entries(e)},__wbg_error_00c89883480d27e0:function(e,t){let n=t.error;var r=b(n)?0:y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_error_0f79cf56f47899e2:function(e){return e.error},__wbg_error_a30e98d44009f1bb:function(e,t){console.error(e,t)},__wbg_error_c9cf3fc2064683a9:function(e){console.error(e)},__wbg_fetch_0e46da8cf7c730e4:function(e,t,n,r){return e.fetch(w(t,n),r)},__wbg_fetch_7b5de4f88137a4dc:function(e,t,n){return e.fetch(t,n)},__wbg_getRandomValues_436a51d0629d84e1:function(e,t){globalThis.crypto.getRandomValues(F(e,t))},__wbg_getRandomValues_e446ea5ffdd14ee5:function(e,t){globalThis.crypto.getRandomValues(F(e,t))},__wbg_getReader_bf34f92ee19c42b4:function(e){return e.getReader()},__wbg_getReader_e782bd33388a2c7b:function(e){return e.getReader()},__wbg_getTime_f5a55efff2585d5d:function(e){return e.getTime()},__wbg_getWriter_7994a8c7d4b75c01:function(e){return e.getWriter()},__wbg_get_31af05bd4842a84f:function(e,t){return Reflect.get(e,t)},__wbg_get_658f6698067d9515:function(e,t){return Reflect.get(e,t)},__wbg_get_6c896e0571ddae51:function(e,t){return e[t>>>0]},__wbg_get_806853698d9fc227:function(e,t){return Reflect.get(e,t>>>0)},__wbg_get_834ef2d65b3b5c73:function(e,t,n,r){let s,f;try{return s=t,f=n,e.get(w(t,n),r)}finally{o();try{i.__wbindgen_free(s,f,1)}catch(u){c(u)}}},__wbg_get_88983e33467eae60:function(e,t){let n=Reflect.get(e,t);return b(n)?0:h(n)},__wbg_get_da0dea0b4d117d30:function(e,t,n){return e.get(w(t,n))},__wbg_get_done_7020b91c987365c7:function(e){let t=e.done;return b(t)?16777215:t?1:0},__wbg_get_f75619e20cb68514:function(e,t,n,r){let s=t.get(w(n,r));var f=b(s)?0:y(s,i.__wbindgen_malloc,i.__wbindgen_realloc),u=g;d().setInt32(e+4,u,!0),d().setInt32(e+0,f,!0)},__wbg_get_unchecked_288889d017702237:function(e,t){return e[t>>>0]},__wbg_get_value_87fbd6ad1283f2e7:function(e){return e.value},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_head_6597ff62691625e1:function(e,t,n){let r,s;try{return r=t,s=n,e.head(w(t,n))}finally{o();try{i.__wbindgen_free(r,s,1)}catch(f){c(f)}}},__wbg_headers_6930a8bd09b630de:function(e){return e.headers},__wbg_headers_eba93595f8944c2f:function(e){return e.headers},__wbg_instanceId_9b67ff33ae8bef8a:function(e){return e.instanceId},__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Error_80a725f81f2e102d:function(e){let t;try{t=e instanceof Error}catch{t=!1}return t},__wbg_instanceof_Map_b2611749102d7ba3:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_ReadableStreamDefaultReader_15e3dd12c4ea16fd:function(e){let t;try{t=e instanceof ReadableStreamDefaultReader}catch{t=!1}return t},__wbg_instanceof_ReadableStream_e2d77912575119ab:function(e){let t;try{t=e instanceof ReadableStream}catch{t=!1}return t},__wbg_instanceof_Response_b8758567269c30b2:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_828cef2aaacafc31:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_e15a2ff68ffdbef2:function(e){return Array.isArray(e)},__wbg_isSafeInteger_717808ad6a54bd9e:function(e){return Number.isSafeInteger(e)},__wbg_iterator_e3c31c892080e444:function(){return Symbol.iterator},__wbg_json_62c1da850fdfa792:function(e){return e.json()},__wbg_key_84de5b594a30a514:function(e,t){let n=t.key,r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_keys_bac434c8972731d5:function(e){return e.keys()},__wbg_length_7f3c00c40364105e:function(e){return e.length},__wbg_length_d4bdea10311bd9cf:function(e){return e.length},__wbg_list_9f5101697159e282:function(e,t){return e.list(t)},__wbg_log_17c30ef363c61cf4:function(e){console.log(e)},__wbg_message_5f8387f0c32b90a7:function(e){return e.message},__wbg_messages_7842de91c486e343:function(e){return e.messages},__wbg_meta_594bb85654c055e4:function(e){return e.meta},__wbg_method_6d02ee0808a7de31:function(e,t){let n=t.method,r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_minifyconfig_new:function(e){return v.__wrap(e)},__wbg_name_e2eac7cdfa054f65:function(e){return e.name},__wbg_name_f9b814d78e8e299f:function(e){return e.name},__wbg_new_0_72d020f0c63443d4:function(){return new Date},__wbg_new_1dbf7428bba60a42:function(e){return new Uint8Array(e)},__wbg_new_28744009d011f847:function(){return new Map},__wbg_new_343a093a3c2ffb4e:function(e,t){return new Error(w(e,t))},__wbg_new_617a8cdb8bb1130e:function(){return new Object},__wbg_new_83ca405eae412a62:function(){return new Headers},__wbg_new_a319c03ad1458611:function(){return new WebSocketPair},__wbg_new_big_int_84cdc69174f81f5b:function(e){return new FixedLengthStream(e)},__wbg_new_ee2291f50781bf1d:function(){return new Array},__wbg_new_f569a2e335eed0bb:function(e){return new FixedLengthStream(e>>>0)},__wbg_new_from_slice_9a868026ffa4208a:function(e,t){return new Uint8Array(F(e,t))},__wbg_new_typed_b01cb72a8af741a3:function(e,t){try{var n={a:e,b:t},r=(f,u)=>{let l=n.a;n.a=0;try{return le(l,n.b,f,u)}finally{n.a=l}};return new Promise(r)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_2f5d7fc2a828b74d:function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},__wbg_new_with_headers_7eaf3e64bd3f0a23:function(e){return new Headers(e)},__wbg_new_with_into_underlying_source_a57cfcc7c705351c:function(e,t){return new ReadableStream(O.__wrap(e),t)},__wbg_new_with_length_3da0ad195f6f63ba:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_opt_buffer_source_and_init_c1b859a23c80afca:function(e,t){return new Response(e,t)},__wbg_new_with_opt_readable_stream_and_init_df114f2d364f216d:function(e,t){return new Response(e,t)},__wbg_new_with_opt_str_and_init_33bef1b272950372:function(e,t,n){return new Response(e===0?void 0:w(e,t),n)},__wbg_new_with_str_and_init_4618dee4e950224f:function(e,t,n){return new Request(w(e,t),n)},__wbg_next_33784799010f1bbe:function(e){return e.next},__wbg_next_f4aac29c42af995c:function(e){return e.next()},__wbg_objects_5b390b93a9ffcef3:function(e,t){let n=t.objects,r=oe(n,i.__wbindgen_malloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_pipeTo_ac05d32161ffb42c:function(e,t){return e.pipeTo(t)},__wbg_prepare_6fe68a8990920f81:function(e,t,n){return e.prepare(w(t,n))},__wbg_prototypesetcall_bc27214492979395:function(e,t,n){Uint8Array.prototype.set.call(F(e,t),n)},__wbg_push_2baf45db356cf468:function(e,t){return e.push(t)},__wbg_put_d364cb6c87efb8b4:function(e,t,n,r){return e.put(w(t,n),r)},__wbg_put_ece41e2507acd81b:function(e,t,n,r,s){let f,u;try{return f=t,u=n,e.put(w(t,n),r,s)}finally{o();try{i.__wbindgen_free(f,u,1)}catch(l){c(l)}}},__wbg_queueMicrotask_9833f9a49df95a49:function(e){return e.queueMicrotask},__wbg_queueMicrotask_a72f977e97f23c5f:function(e){queueMicrotask(e)},__wbg_read_2a943774344c9728:function(e){return e.read()},__wbg_readable_4d43535945ae9ca0:function(e){return e.readable},__wbg_readable_7c6bc793dd899969:function(e){return e.readable},__wbg_releaseLock_0948949015793a6d:function(e){e.releaseLock()},__wbg_releaseLock_eb64cd83aa9fcfe4:function(e){e.releaseLock()},__wbg_removeEventListener_6e68185345978771:function(e,t,n,r){e.removeEventListener(w(t,n),r)},__wbg_resolve_0076e10020304ede:function(e){return Promise.resolve(e)},__wbg_respond_c102fabcc79e5ef0:function(e,t){e.respond(t>>>0)},__wbg_results_a5533c886ed43a9a:function(e){let t=e.results;return b(t)?0:h(t)},__wbg_retry_9051b0b206a27925:function(e,t){e.retry(t)},__wbg_scheduledTime_d6f16c8277d5313d:function(e){return e.scheduledTime},__wbg_send_797960c7a6a0270d:function(e,t){e.send(t)},__wbg_send_9ec1ced4071b418f:function(e,t,n){return e.send(t,n)},__wbg_send_b5bdd806efe4baf6:function(e,t,n){e.send(w(t,n))},__wbg_setTimeout_7fb1e1fe294b6ad9:function(e,t,n){return e.setTimeout(t,n)},__wbg_set_145a351398b48c65:function(e,t,n){return Reflect.set(e,t,n)},__wbg_set_575d3ddb70fe831d:function(e,t,n){e.set(F(t,n))},__wbg_set_6ae97e73113c4f0b:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_af5932e3f78b5648:function(e,t,n,r,s){e.set(w(t,n),w(r,s))},__wbg_set_bea140a88be9b277:function(e,t,n){e[t>>>0]=n},__wbg_set_body_1fb0f1008bfc7df6:function(e,t){e.body=t},__wbg_set_cache_7507c4cc5938ccc7:function(e,t){e.cache=ye[t]},__wbg_set_criticalError_3904d60fe2a0b05b:function(e,t){e.criticalError=t!==0},__wbg_set_headers_40ad33dcf016613f:function(e,t){e.headers=t},__wbg_set_headers_69ef7c46a2e6c742:function(e,t){e.headers=t},__wbg_set_high_water_mark_3a96edf83df7e06c:function(e,t){e.highWaterMark=t},__wbg_set_instanceId_9ad5caac0a4e519c:function(e,t){e.instanceId=t>>>0},__wbg_set_method_dcb32343247ec427:function(e,t,n){e.method=w(t,n)},__wbg_set_redirect_cc128ab2411da334:function(e,t){e.redirect=pe[t]},__wbg_set_signal_2dbd377604627f26:function(e,t){e.signal=t},__wbg_set_status_678f122cbe435d95:function(e,t){e.status=t},__wbg_size_023ff299b19aa360:function(e){return e.size},__wbg_static_accessor_GLOBAL_266715b9d96ba635:function(){let e=typeof global>"u"?null:global;return b(e)?0:h(e)},__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179:function(){let e=typeof globalThis>"u"?null:globalThis;return b(e)?0:h(e)},__wbg_static_accessor_INIT_STATE_e3fce2ad8a08e94e:function(){return K},__wbg_static_accessor_SELF_0b583911f537483a:function(){let e=typeof self>"u"?null:self;return b(e)?0:h(e)},__wbg_static_accessor_WINDOW_d7f903d1508cbdc4:function(){let e=typeof window>"u"?null:window;return b(e)?0:h(e)},__wbg_status_ce0a98d3c57125f3:function(e){return e.status},__wbg_storage_dbf440e5000527fe:function(e){return e.storage},__wbg_success_3eeb449b7245d1ba:function(e){return e.success},__wbg_text_aaf360cc4f1c0167:function(e){return e.text()},__wbg_then_c949d5a25a4e78f8:function(e,t,n){return e.then(t,n)},__wbg_then_e71170d78fcf8954:function(e,t){return e.then(t)},__wbg_toString_83fab3d7c865ecd3:function(e){return e.toString()},__wbg_truncated_cc05a4223c013ee9:function(e){return e.truncated},__wbg_url_7bfada5c2297bc70:function(e,t){let n=t.url,r=y(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=g;d().setInt32(e+4,s,!0),d().setInt32(e+0,r,!0)},__wbg_value_f3c585ee8f5ba40c:function(e){return e.value},__wbg_view_9c570f33e8d6ab96:function(e){let t=e.view;return b(t)?0:h(t)},__wbg_waitUntil_c51e37673c596e00:function(e,t){e.waitUntil(t)},__wbg_webSocket_2b7e8e9549bed673:function(e){let t=e.webSocket;return b(t)?0:h(t)},__wbg_writable_44735d15a1cee85d:function(e){return e.writable},__wbg_writable_a897472079c09078:function(e){return e.writable},__wbg_write_bf07aa79dd36a472:function(e,t){return e.write(t)},__wbindgen_generic_0000000000000001:function(e,t){return I(e,t,ge)},__wbindgen_generic_0000000000000002:function(e,t){return I(e,t,be)},__wbindgen_generic_0000000000000003:function(e,t){return I(e,t,ue)},__wbindgen_generic_0000000000000004:function(e,t){return I(e,t,de)},__wbindgen_generic_0000000000000005:function(e,t){return I(e,t,we)},__wbindgen_generic_0000000000000006:function(e,t){return I(e,t,fe)},__wbindgen_generic_0000000000000007:function(e){return e},__wbindgen_generic_0000000000000008:function(e){return e},__wbindgen_generic_0000000000000009:function(e,t){return w(e,t)},__wbindgen_generic_000000000000000a:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},__wbindgen_jstag:WebAssembly.JSTag,__wbindgen_rethrow_critical:function(e){throw new Error("Critical error",{cause:e})}}}}var V=new WebAssembly.Tag({parameters:["externref"]}),D,N=!1;function ce(){N=!0;try{let _=$()[i.__abort_handler.value/4];_&&i.__wbindgen_export.get(_)()}catch{}}function c(_){throw _ instanceof WebAssembly.Exception&&_.is(V)?_.getArg(V,0):($()[D]=1,ce(),_)}function o(){if(D??=i.__instance_terminated.value/4,$()[D]){if(N||ce(),L){P();return}throw new Error("Module terminated")}else L&&P()}function fe(_,e){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke_______true_(_,e)}catch(t){c(t)}}function be(_,e,t){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___wasm_bindgen_faa15b688c6c7eb0___JsValue______true_(_,e,t)}catch(n){c(n)}}function ue(_,e,t){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___web_sys_139b6014101a5b59___features__gen_CloseEvent__CloseEvent______true_(_,e,t)}catch(n){c(n)}}function de(_,e,t){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___web_sys_139b6014101a5b59___features__gen_CloseEvent__CloseEvent______true__43(_,e,t)}catch(n){c(n)}}function we(_,e,t){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___web_sys_139b6014101a5b59___features__gen_CloseEvent__CloseEvent______true__44(_,e,t)}catch(n){c(n)}}function ge(_,e,t){let n;o();try{n=i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___wasm_bindgen_faa15b688c6c7eb0___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_faa15b688c6c7eb0___JsError___true_(_,e,t)}catch(r){c(r)}if(n[1])throw Re(n[0])}function le(_,e,t,n){o();try{i.wasm_bindgen_faa15b688c6c7eb0___convert__closures_____invoke___js_sys_cf42736153f8647f___Function_fn_wasm_bindgen_faa15b688c6c7eb0___JsValue_____wasm_bindgen_faa15b688c6c7eb0___sys__Undefined___js_sys_cf42736153f8647f___Function_fn_wasm_bindgen_faa15b688c6c7eb0___JsValue_____wasm_bindgen_faa15b688c6c7eb0___sys__Undefined_______true_(_,e,t,n)}catch(r){c(r)}}var he=["bytes"],ye=["default","no-store","reload","no-cache","force-cache","only-if-cached"],pe=["follow","error","manual"],a=0,me=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_containerstartupoptions_free(_,1)}),ve=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_intounderlyingbytesource_free(_,1)}),Ie=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_intounderlyingsink_free(_,1)}),Q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_intounderlyingsource_free(_,1)}),X=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_minifyconfig_free(_,1)}),Ee=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_r2range_free(_,1)}),Y=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(({ptr:_,instance:e})=>{e===a&&i.__wbg_tenantdo_free(_,1)});function h(_){let e=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(e,_),e}var Z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(_=>{_.instance===a&&i.__wbindgen_destroy_closure(_.a,_.b)});function B(_){let e=typeof _;if(e=="number"||e=="boolean"||_==null)return`${_}`;if(e=="string")return`"${_}"`;if(e=="symbol"){let r=_.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=_.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(_)){let r=_.length,s="[";r>0&&(s+=B(_[0]));for(let f=1;f<r;f++)s+=", "+B(_[f]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(_)),n;if(t&&t.length>1)n=t[1];else return toString.call(_);if(n=="Object")try{return"Object("+JSON.stringify(_)+")"}catch{return"Object"}return _ instanceof Error?`${_.name}: ${_.message}
2
+ ${_.stack}`:n}function xe(_,e){_=_>>>0;let t=d(),n=[];for(let r=_;r<_+4*e;r+=4)n.push(i.__wbindgen_externrefs.get(t.getUint32(r,!0)));return i.__externref_drop_slice(_,e),n}function F(_,e){return _=_>>>0,A().subarray(_/1,_/1+e)}var m=null;function d(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==i.memory.buffer)&&(m=new DataView(i.memory.buffer)),m}var S=null;function $(){return(S===null||S.byteLength===0)&&(S=new Int32Array(i.memory.buffer)),S}function w(_,e){return je(_>>>0,e)}var W=null;function A(){return(W===null||W.byteLength===0)&&(W=new Uint8Array(i.memory.buffer)),W}function b(_){return _==null}function I(_,e,t){let n={a:_,b:e,cnt:1,instance:a},r=(...s)=>{if(n.instance!==a)throw new Error("Cannot invoke closure from previous WASM instance");n.cnt++;let f=n.a;n.a=0;try{return t(f,n.b,...s)}finally{n.a=f,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(i.__wbindgen_destroy_closure(n.a,n.b),n.a=0,Z.unregister(n))},Z.register(r,n,n),r}function oe(_,e){let t=e(_.length*4,4)>>>0;for(let n=0;n<_.length;n++){let r=h(_[n]);d().setUint32(t+4*n,r,!0)}return g=_.length,t}function y(_,e,t){if(t===void 0){let u=T.encode(_),l=e(u.length,1)>>>0;return A().subarray(l,l+u.length).set(u),g=u.length,l}let n=_.length,r=e(n,1)>>>0,s=A(),f=0;for(;f<n;f++){let u=_.charCodeAt(f);if(u>127)break;s[r+f]=u}if(f!==n){f!==0&&(_=_.slice(f)),r=t(r,n,n=f+_.length*3,1)>>>0;let u=A().subarray(r+f,r+n),l=T.encodeInto(_,u);f+=l.written,r=t(r,n,f,1)>>>0}return g=f,r}var L=!1;function Re(_){let e=i.__wbindgen_externrefs.get(_);return i.__externref_table_dealloc(_),e}var se=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});se.decode();function je(_,e){return se.decode(A().subarray(_,_+e))}var T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(_,e){let t=T.encode(_);return e.set(t),{read:_.length,written:t.length}});var g=0,J=new WebAssembly.Instance(ee,ie()),i=J.exports;i.__wbindgen_start();Error.stackTraceLimit=100;var p=te();function H(){p.criticalError&&(console.log("Reinitializing Wasm application"),P(),p.criticalError=!1,p.instanceId++)}addEventListener("error",_=>{G(_.error)});function G(_){_ instanceof WebAssembly.RuntimeError&&(console.error("Critical",_),p.criticalError=!0)}var j=class extends Fe{};j.prototype.fetch=function(e){return ne.call(this,e,this.env,this.ctx)};j.prototype.queue=function(e){return _e.call(this,e,this.env,this.ctx)};j.prototype.scheduled=function(e){return re.call(this,e,this.env,this.ctx)};var Se={set:(_,e,t,n)=>Reflect.set(_.instance,e,t,n),has:(_,e)=>Reflect.has(_.instance,e),deleteProperty:(_,e)=>Reflect.deleteProperty(_.instance,e),apply:(_,e,t)=>Reflect.apply(_.instance,e,t),construct:(_,e,t)=>Reflect.construct(_.instance,e,t),getPrototypeOf:_=>Reflect.getPrototypeOf(_.instance),setPrototypeOf:(_,e)=>Reflect.setPrototypeOf(_.instance,e),isExtensible:_=>Reflect.isExtensible(_.instance),preventExtensions:_=>Reflect.preventExtensions(_.instance),getOwnPropertyDescriptor:(_,e)=>Reflect.getOwnPropertyDescriptor(_.instance,e),defineProperty:(_,e,t)=>Reflect.defineProperty(_.instance,e,t),ownKeys:_=>Reflect.ownKeys(_.instance)},z={construct(_,e,t){try{H();let n={instance:Reflect.construct(_,e,t),instanceId:p.instanceId,ctor:_,args:e,newTarget:t};return new Proxy(n,{...Se,get(r,s,f){r.instanceId!==p.instanceId&&(r.instance=Reflect.construct(r.ctor,r.args,r.newTarget),r.instanceId=p.instanceId);let u=Reflect.get(r.instance,s,f);return typeof u!="function"?u:u.constructor===Function?new Proxy(u,{apply(l,U,q){H();try{return l.apply(U,q)}catch(k){throw G(k),k}}}):new Proxy(u,{async apply(l,U,q){H();try{return await l.apply(U,q)}catch(k){throw G(k),k}}})}})}catch(n){throw p.criticalError=!0,n}}},Ce=new Proxy(j,z),Me=new Proxy(E,z),Pe=new Proxy(v,z),Le=new Proxy(x,z),Ue=new Proxy(R,z);export{Me as ContainerStartupOptions,Pe as MinifyConfig,Le as R2Range,Ue as TenantDO,Ce as default};
package/index_bg.wasm ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "files": [
3
+ "index_bg.wasm",
4
+ "index.js",
5
+ "index.d.ts",
6
+ "README.md",
7
+ "wrangler.example.toml"
8
+ ],
9
+ "main": "index.js",
10
+ "name": "@pilser/backend-engine",
11
+ "sideEffects": [
12
+ "./index.js"
13
+ ],
14
+ "type": "module",
15
+ "version": "0.1.0",
16
+ "description": "your backend that you never code (Backend as a dependency): tables, auth, files, cron, recipes, webhooks, AI proxy, MCP control plane on one Cloudflare Worker.",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/Pilser/backend-engine.git"
21
+ },
22
+ "keywords": [
23
+ "cloudflare",
24
+ "workers",
25
+ "backend",
26
+ "serverless",
27
+ "d1",
28
+ "r2",
29
+ "mcp"
30
+ ]
31
+ }
@@ -0,0 +1,57 @@
1
+ # Copy to wrangler.toml in your project and fill in the REPLACE_ME values.
2
+ # Pairs with: npm i @pilser/backend-engine (or: bun add @pilser/backend-engine)
3
+
4
+ name = "my-app"
5
+ main = "node_modules/@pilser/backend-engine/index.js"
6
+ compatibility_date = "2026-09-01"
7
+
8
+ [build]
9
+ command = "echo 'prebuilt binary — nothing to compile'"
10
+
11
+ [vars]
12
+ ENVIRONMENT = "production"
13
+ HTTP_TIMEOUT_MS = "15000"
14
+ WORKER_URL = "https://my-app.REPLACE_ME_ACCOUNT.workers.dev"
15
+ # AI assistant backend base URL (fallback when the AI_BASE_URL tenant
16
+ # secret is absent). Empty = unconfigured.
17
+ AI_TARGET = ""
18
+
19
+ # Storage = bindings, not URLs. Create once, paste ids here:
20
+ # wrangler d1 create my-app
21
+ # wrangler r2 bucket create my-app-store
22
+ # wrangler queues create my-app-deliveries
23
+ [[d1_databases]]
24
+ binding = "DB"
25
+ database_name = "my-app"
26
+ database_id = "REPLACE_ME_RUN_WRANGLER_D1_CREATE"
27
+
28
+ [[r2_buckets]]
29
+ binding = "STORE"
30
+ bucket_name = "my-app-store"
31
+
32
+ [[durable_objects.bindings]]
33
+ name = "TENANT_DO"
34
+ class_name = "TenantDO"
35
+
36
+ [[migrations]]
37
+ tag = "v1"
38
+ new_sqlite_classes = ["TenantDO"]
39
+
40
+ [[analytics_engine_datasets]]
41
+ binding = "USAGE"
42
+
43
+ [[queues.producers]]
44
+ queue = "my-app-deliveries"
45
+ binding = "WEBHOOKS"
46
+
47
+ [[queues.consumers]]
48
+ queue = "my-app-deliveries"
49
+ max_batch_size = 10
50
+ max_batch_timeout = 30
51
+
52
+ [triggers]
53
+ crons = ["*/5 * * * *"]
54
+
55
+ # Secrets (never in files):
56
+ # wrangler secret put SECRET_KEY # 32+ random bytes
57
+ # wrangler secret put WORKER_KEY # admin bearer