1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
use std::result::Result as StdResult;
use crate::Request as EdgeRequest;
use js_sys::JsString;
use wasm_bindgen::{closure::Closure, prelude::*};
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen (extends = ::js_sys::Object, js_name = DurableObjectId)]
pub type JsObjectId;
#[wasm_bindgen(method, js_class = "JsObjectId", js_name = toString)]
pub fn to_string(this: &JsObjectId) -> JsString;
#[wasm_bindgen (extends = ::js_sys::Object, js_name = DurableObject)]
pub type ObjectStub;
#[wasm_bindgen (extends = ::js_sys::Object, js_name = DurableObjectNamespace)]
pub type ObjectNamespace;
#[wasm_bindgen (extends = ::js_sys::Object, js_name = DurableObjectState)]
pub type ObjectState;
#[wasm_bindgen(method, getter, js_class = "DurableObjectState", js_name = id)]
pub fn id_internal(this: &ObjectState) -> JsObjectId;
#[wasm_bindgen(method, getter, js_class = "DurableObjectState", js_name = storage)]
pub fn storage_internal(this: &ObjectState) -> ObjectStorage;
#[wasm_bindgen (catch, method, js_class = "DurableObjectNamespace", js_name = idFromName)]
pub fn id_from_name_internal(
this: &ObjectNamespace,
name: &str,
) -> StdResult<JsObjectId, JsValue>;
#[wasm_bindgen (catch, method, js_class = "ObjectNamespace", js_name = idFromString)]
pub fn id_from_string_internal(
this: &ObjectNamespace,
string: &str,
) -> StdResult<JsObjectId, JsValue>;
#[wasm_bindgen (catch, method, js_class = "DurableObjectNamespace", js_name = newUniqueId)]
pub fn new_unique_id_internal(this: &ObjectNamespace) -> StdResult<JsObjectId, JsValue>;
#[wasm_bindgen (catch, method, js_class = "DurableObjectNamespace", js_name = newUniqueId)]
pub fn new_unique_id_with_options_internal(
this: &ObjectNamespace,
options: &JsValue,
) -> StdResult<JsObjectId, JsValue>;
#[wasm_bindgen (catch, method, js_class = "DurableObjectNamespace", js_name = get)]
pub fn get_internal(this: &ObjectNamespace, id: &JsObjectId) -> StdResult<ObjectStub, JsValue>;
#[wasm_bindgen (method, js_class = "DurableObject", js_name = fetch)]
pub fn fetch_with_request_internal(this: &ObjectStub, req: &EdgeRequest) -> ::js_sys::Promise;
#[wasm_bindgen (method, js_class = "DurableObject", js_name = fetch)]
pub fn fetch_with_str_internal(this: &ObjectStub, url: &str) -> ::js_sys::Promise;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen (extends = ::js_sys::Object, js_name = DurableObjectStorage)]
pub type ObjectStorage;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = get)]
pub fn get_internal(this: &ObjectStorage, key: &str) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = get)]
pub fn get_multiple_internal(
this: &ObjectStorage,
keys: Vec<JsValue>,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = put)]
pub fn put_internal(
this: &ObjectStorage,
key: &str,
value: JsValue,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = put)]
pub fn put_multiple_internal(
this: &ObjectStorage,
value: JsValue,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = delete)]
pub fn delete_internal(
this: &ObjectStorage,
key: &str,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = delete)]
pub fn delete_multiple_internal(
this: &ObjectStorage,
keys: Vec<JsValue>,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = deleteAll)]
pub fn delete_all_internal(this: &ObjectStorage) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = list)]
pub fn list_internal(this: &ObjectStorage) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = list)]
pub fn list_with_options_internal(
this: &ObjectStorage,
options: ::js_sys::Object,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = transaction)]
pub fn transaction_internal(
this: &ObjectStorage,
closure: &Closure<dyn FnMut(ObjectTransaction)>,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = getAlarm)]
pub fn get_alarm_internal(
this: &ObjectStorage,
options: ::js_sys::Object,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = setAlarm)]
pub fn set_alarm_internal(
this: &ObjectStorage,
scheduled_time: ::js_sys::Date,
options: ::js_sys::Object,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectStorage", js_name = deleteAlarm)]
pub fn delete_alarm_internal(
this: &ObjectStorage,
options: ::js_sys::Object,
) -> StdResult<::js_sys::Promise, JsValue>;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = ::js_sys::Object, js_name = DurableObjectTransaction)]
pub type ObjectTransaction;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = get)]
pub fn get_internal(
this: &ObjectTransaction,
key: &str,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = get)]
pub fn get_multiple_internal(
this: &ObjectTransaction,
keys: Vec<JsValue>,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = put)]
pub fn put_internal(
this: &ObjectTransaction,
key: &str,
value: JsValue,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = put)]
pub fn put_multiple_internal(
this: &ObjectTransaction,
value: JsValue,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = delete)]
pub fn delete_internal(
this: &ObjectTransaction,
key: &str,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = delete)]
pub fn delete_multiple_internal(
this: &ObjectTransaction,
keys: Vec<JsValue>,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = deleteAll)]
pub fn delete_all_internal(this: &ObjectTransaction) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = list)]
pub fn list_internal(this: &ObjectTransaction) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = list)]
pub fn list_with_options_internal(
this: &ObjectTransaction,
options: ::js_sys::Object,
) -> StdResult<::js_sys::Promise, JsValue>;
#[wasm_bindgen(catch, method, js_class = "DurableObjectTransaction", js_name = rollback)]
pub fn rollback_internal(this: &ObjectTransaction) -> StdResult<(), JsValue>;
}