ffi-bindings 1.0.1 → 1.0.3

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.
@@ -14,11 +14,13 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
14
14
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
15
  // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
16
16
  // Trust me, you don't want to mess with it!
17
+
17
18
  /* tslint:disable */
18
19
  /* eslint-disable */
19
20
  // @ts-nocheck
20
21
  import * as wasmBundle from "./wasm-bindgen/index.js";
21
22
  import { AbstractFfiConverterByteArray, FfiConverterDuration, FfiConverterInt32, FfiConverterOptional, FfiConverterUInt64, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString, uniffiCreateRecord } from "uniffi-bindgen-react-native";
23
+
22
24
  // Get converters from the other files, if any.
23
25
  var nativeModule = function nativeModule() {
24
26
  return wasmBundle;
@@ -31,6 +33,14 @@ var uniffiIsDebug =
31
33
  (typeof process === "undefined" ? "undefined" : _typeof(process)) !== "object" ||
32
34
  // @ts-ignore -- The process global might not be defined
33
35
  ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.NODE_ENV) !== "production" || false;
36
+ // Public interface members begin here.
37
+
38
+ /**
39
+ * The retention policy for media content used by the [`MediaStore`].
40
+ *
41
+ * [`EventCacheStore`]: crate::event_cache::store::EventCacheStore
42
+ */
43
+
34
44
  /**
35
45
  * Generated factory for {@link MediaRetentionPolicy} record objects.
36
46
  */
@@ -42,19 +52,8 @@ export var MediaRetentionPolicy = function () {
42
52
  return uniffiCreateRecord(_defaults);
43
53
  }();
44
54
  return Object.freeze({
45
- /**
46
- * Create a frozen instance of {@link MediaRetentionPolicy}, with defaults specified
47
- * in Rust, in the {@link matrix_sdk_base} crate.
48
- */
49
55
  create: create,
50
- /**
51
- * Create a frozen instance of {@link MediaRetentionPolicy}, with defaults specified
52
- * in Rust, in the {@link matrix_sdk_base} crate.
53
- */
54
56
  "new": create,
55
- /**
56
- * Defaults specified in the {@link matrix_sdk_base} crate.
57
- */
58
57
  defaults: function defaults() {
59
58
  return Object.freeze(_defaults());
60
59
  }
@@ -111,11 +110,11 @@ var stringConverter = function () {
111
110
  };
112
111
  }();
113
112
  var FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
113
+
114
114
  /**
115
115
  * Represents the state of a room encryption.
116
116
  */
117
- export var EncryptionState;
118
- (function (EncryptionState) {
117
+ export var EncryptionState = /*#__PURE__*/function (EncryptionState) {
119
118
  /**
120
119
  * The room is encrypted.
121
120
  */
@@ -129,7 +128,8 @@ export var EncryptionState;
129
128
  * `/sync` did not provide all data needed to decide.
130
129
  */
131
130
  EncryptionState[EncryptionState["Unknown"] = 2] = "Unknown";
132
- })(EncryptionState || (EncryptionState = {}));
131
+ return EncryptionState;
132
+ }({});
133
133
  var FfiConverterTypeEncryptionState = function () {
134
134
  var ordinalConverter = FfiConverterInt32;
135
135
  var FFIConverter = /*#__PURE__*/function (_AbstractFfiConverter2) {
@@ -173,10 +173,13 @@ var FfiConverterTypeEncryptionState = function () {
173
173
  }(AbstractFfiConverterByteArray);
174
174
  return new FFIConverter();
175
175
  }();
176
+
176
177
  // FfiConverter for UniffiDuration | undefined
177
178
  var FfiConverterOptionalDuration = new FfiConverterOptional(FfiConverterDuration);
179
+
178
180
  // FfiConverter for /*u64*/bigint | undefined
179
181
  var FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
182
+
180
183
  /**
181
184
  * This should be called before anything else.
182
185
  *
@@ -189,7 +192,7 @@ var FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
189
192
  */
190
193
  function uniffiEnsureInitialized() {
191
194
  // Get the bindings contract version from our ComponentInterface
192
- var bindingsContractVersion = 29;
195
+ var bindingsContractVersion = 30;
193
196
  // Get the scaffolding contract version by calling the into the dylib
194
197
  var scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_base_uniffi_contract_version();
195
198
  if (bindingsContractVersion !== scaffoldingContractVersion) {
@@ -2,8 +2,6 @@ var _process;
2
2
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
3
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
4
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
5
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
6
  function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
9
7
  function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
@@ -11,14 +9,19 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
11
9
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
12
10
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
13
11
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
15
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
16
  // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
16
17
  // Trust me, you don't want to mess with it!
18
+
17
19
  /* tslint:disable */
18
20
  /* eslint-disable */
19
21
  // @ts-nocheck
20
22
  import * as wasmBundle from "./wasm-bindgen/index.js";
21
- import { AbstractFfiConverterByteArray, FfiConverterInt32, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString } from "uniffi-bindgen-react-native";
23
+ import { AbstractFfiConverterByteArray, FfiConverterInt32, FfiConverterOptional, UniffiEnum, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
24
+
22
25
  // Get converters from the other files, if any.
23
26
  var nativeModule = function nativeModule() {
24
27
  return wasmBundle;
@@ -32,6 +35,7 @@ var uniffiIsDebug =
32
35
  // @ts-ignore -- The process global might not be defined
33
36
  ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.NODE_ENV) !== "production" || false;
34
37
  // Public interface members begin here.
38
+
35
39
  var stringConverter = function () {
36
40
  var encoder = new TextEncoder();
37
41
  var decoder = new TextDecoder();
@@ -48,11 +52,217 @@ var stringConverter = function () {
48
52
  };
49
53
  }();
50
54
  var FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
55
+
56
+ // Enum: BackgroundTaskFailureReason
57
+ export var BackgroundTaskFailureReason_Tags = /*#__PURE__*/function (BackgroundTaskFailureReason_Tags) {
58
+ BackgroundTaskFailureReason_Tags["Panic"] = "Panic";
59
+ BackgroundTaskFailureReason_Tags["Error"] = "Error";
60
+ BackgroundTaskFailureReason_Tags["EarlyTermination"] = "EarlyTermination";
61
+ return BackgroundTaskFailureReason_Tags;
62
+ }({});
63
+ /**
64
+ * Reason why a background task failed.
65
+ */
66
+ export var BackgroundTaskFailureReason = function () {
67
+ /**
68
+ * The task panicked.
69
+ */
70
+ var Panic_ = /*#__PURE__*/function (_UniffiEnum) {
71
+ function Panic_(inner) {
72
+ var _this;
73
+ _classCallCheck(this, Panic_);
74
+ _this = _callSuper(this, Panic_, ["BackgroundTaskFailureReason", "Panic"]);
75
+ /**
76
+ * @private
77
+ * This field is private and should not be used, use `tag` instead.
78
+ */
79
+ _defineProperty(_this, uniffiTypeNameSymbol, "BackgroundTaskFailureReason");
80
+ _defineProperty(_this, "tag", BackgroundTaskFailureReason_Tags.Panic);
81
+ _defineProperty(_this, "inner", void 0);
82
+ _this.inner = Object.freeze(inner);
83
+ return _this;
84
+ }
85
+ _inherits(Panic_, _UniffiEnum);
86
+ return _createClass(Panic_, null, [{
87
+ key: "new",
88
+ value: function _new(inner) {
89
+ return new Panic_(inner);
90
+ }
91
+ }, {
92
+ key: "instanceOf",
93
+ value: function instanceOf(obj) {
94
+ return obj.tag === BackgroundTaskFailureReason_Tags.Panic;
95
+ }
96
+ }]);
97
+ }(UniffiEnum);
98
+ /**
99
+ * The task returned an error.
100
+ */
101
+ var Error_ = /*#__PURE__*/function (_UniffiEnum2) {
102
+ function Error_(inner) {
103
+ var _this2;
104
+ _classCallCheck(this, Error_);
105
+ _this2 = _callSuper(this, Error_, ["BackgroundTaskFailureReason", "Error"]);
106
+ /**
107
+ * @private
108
+ * This field is private and should not be used, use `tag` instead.
109
+ */
110
+ _defineProperty(_this2, uniffiTypeNameSymbol, "BackgroundTaskFailureReason");
111
+ _defineProperty(_this2, "tag", BackgroundTaskFailureReason_Tags.Error);
112
+ _defineProperty(_this2, "inner", void 0);
113
+ _this2.inner = Object.freeze(inner);
114
+ return _this2;
115
+ }
116
+ _inherits(Error_, _UniffiEnum2);
117
+ return _createClass(Error_, null, [{
118
+ key: "new",
119
+ value: function _new(inner) {
120
+ return new Error_(inner);
121
+ }
122
+ }, {
123
+ key: "instanceOf",
124
+ value: function instanceOf(obj) {
125
+ return obj.tag === BackgroundTaskFailureReason_Tags.Error;
126
+ }
127
+ }]);
128
+ }(UniffiEnum);
129
+ /**
130
+ * The task ended unexpectedly (for tasks expected to run forever).
131
+ */
132
+ var EarlyTermination_ = /*#__PURE__*/function (_UniffiEnum3) {
133
+ function EarlyTermination_() {
134
+ var _this3;
135
+ _classCallCheck(this, EarlyTermination_);
136
+ _this3 = _callSuper(this, EarlyTermination_, ["BackgroundTaskFailureReason", "EarlyTermination"]);
137
+ /**
138
+ * @private
139
+ * This field is private and should not be used, use `tag` instead.
140
+ */
141
+ _defineProperty(_this3, uniffiTypeNameSymbol, "BackgroundTaskFailureReason");
142
+ _defineProperty(_this3, "tag", BackgroundTaskFailureReason_Tags.EarlyTermination);
143
+ return _this3;
144
+ }
145
+ _inherits(EarlyTermination_, _UniffiEnum3);
146
+ return _createClass(EarlyTermination_, null, [{
147
+ key: "new",
148
+ value: function _new() {
149
+ return new EarlyTermination_();
150
+ }
151
+ }, {
152
+ key: "instanceOf",
153
+ value: function instanceOf(obj) {
154
+ return obj.tag === BackgroundTaskFailureReason_Tags.EarlyTermination;
155
+ }
156
+ }]);
157
+ }(UniffiEnum);
158
+ function instanceOf(obj) {
159
+ return obj[uniffiTypeNameSymbol] === "BackgroundTaskFailureReason";
160
+ }
161
+ return Object.freeze({
162
+ instanceOf: instanceOf,
163
+ Panic: Panic_,
164
+ Error: Error_,
165
+ EarlyTermination: EarlyTermination_
166
+ });
167
+ }();
168
+
169
+ /**
170
+ * Reason why a background task failed.
171
+ */
172
+
173
+ // FfiConverter for enum BackgroundTaskFailureReason
174
+ var FfiConverterTypeBackgroundTaskFailureReason = function () {
175
+ var ordinalConverter = FfiConverterInt32;
176
+ var FFIConverter = /*#__PURE__*/function (_AbstractFfiConverter) {
177
+ function FFIConverter() {
178
+ _classCallCheck(this, FFIConverter);
179
+ return _callSuper(this, FFIConverter, arguments);
180
+ }
181
+ _inherits(FFIConverter, _AbstractFfiConverter);
182
+ return _createClass(FFIConverter, [{
183
+ key: "read",
184
+ value: function read(from) {
185
+ switch (ordinalConverter.read(from)) {
186
+ case 1:
187
+ return new BackgroundTaskFailureReason.Panic({
188
+ message: FfiConverterOptionalString.read(from),
189
+ panicBacktrace: FfiConverterOptionalString.read(from)
190
+ });
191
+ case 2:
192
+ return new BackgroundTaskFailureReason.Error({
193
+ error: FfiConverterString.read(from)
194
+ });
195
+ case 3:
196
+ return new BackgroundTaskFailureReason.EarlyTermination();
197
+ default:
198
+ throw new UniffiInternalError.UnexpectedEnumCase();
199
+ }
200
+ }
201
+ }, {
202
+ key: "write",
203
+ value: function write(value, into) {
204
+ switch (value.tag) {
205
+ case BackgroundTaskFailureReason_Tags.Panic:
206
+ {
207
+ ordinalConverter.write(1, into);
208
+ var inner = value.inner;
209
+ FfiConverterOptionalString.write(inner.message, into);
210
+ FfiConverterOptionalString.write(inner.panicBacktrace, into);
211
+ return;
212
+ }
213
+ case BackgroundTaskFailureReason_Tags.Error:
214
+ {
215
+ ordinalConverter.write(2, into);
216
+ var _inner = value.inner;
217
+ FfiConverterString.write(_inner.error, into);
218
+ return;
219
+ }
220
+ case BackgroundTaskFailureReason_Tags.EarlyTermination:
221
+ {
222
+ ordinalConverter.write(3, into);
223
+ return;
224
+ }
225
+ default:
226
+ // Throwing from here means that BackgroundTaskFailureReason_Tags hasn't matched an ordinal.
227
+ throw new UniffiInternalError.UnexpectedEnumCase();
228
+ }
229
+ }
230
+ }, {
231
+ key: "allocationSize",
232
+ value: function allocationSize(value) {
233
+ switch (value.tag) {
234
+ case BackgroundTaskFailureReason_Tags.Panic:
235
+ {
236
+ var inner = value.inner;
237
+ var size = ordinalConverter.allocationSize(1);
238
+ size += FfiConverterOptionalString.allocationSize(inner.message);
239
+ size += FfiConverterOptionalString.allocationSize(inner.panicBacktrace);
240
+ return size;
241
+ }
242
+ case BackgroundTaskFailureReason_Tags.Error:
243
+ {
244
+ var _inner2 = value.inner;
245
+ var _size = ordinalConverter.allocationSize(2);
246
+ _size += FfiConverterString.allocationSize(_inner2.error);
247
+ return _size;
248
+ }
249
+ case BackgroundTaskFailureReason_Tags.EarlyTermination:
250
+ {
251
+ return ordinalConverter.allocationSize(3);
252
+ }
253
+ default:
254
+ throw new UniffiInternalError.UnexpectedEnumCase();
255
+ }
256
+ }
257
+ }]);
258
+ }(AbstractFfiConverterByteArray);
259
+ return new FFIConverter();
260
+ }();
261
+
51
262
  /**
52
263
  * A machine-readable representation of the authenticity for a `ShieldState`.
53
264
  */
54
- export var ShieldStateCode;
55
- (function (ShieldStateCode) {
265
+ export var ShieldStateCode = /*#__PURE__*/function (ShieldStateCode) {
56
266
  /**
57
267
  * Not enough information available to check the authenticity.
58
268
  */
@@ -69,28 +279,25 @@ export var ShieldStateCode;
69
279
  * The sender hasn't been verified by the Client's user.
70
280
  */
71
281
  ShieldStateCode[ShieldStateCode["UnverifiedIdentity"] = 3] = "UnverifiedIdentity";
72
- /**
73
- * An unencrypted event in an encrypted room.
74
- */
75
- ShieldStateCode[ShieldStateCode["SentInClear"] = 4] = "SentInClear";
76
282
  /**
77
283
  * The sender was previously verified but changed their identity.
78
284
  */
79
- ShieldStateCode[ShieldStateCode["VerificationViolation"] = 5] = "VerificationViolation";
285
+ ShieldStateCode[ShieldStateCode["VerificationViolation"] = 4] = "VerificationViolation";
80
286
  /**
81
287
  * The `sender` field on the event does not match the owner of the device
82
288
  * that established the Megolm session.
83
289
  */
84
- ShieldStateCode[ShieldStateCode["MismatchedSender"] = 6] = "MismatchedSender";
85
- })(ShieldStateCode || (ShieldStateCode = {}));
290
+ ShieldStateCode[ShieldStateCode["MismatchedSender"] = 5] = "MismatchedSender";
291
+ return ShieldStateCode;
292
+ }({});
86
293
  var FfiConverterTypeShieldStateCode = function () {
87
294
  var ordinalConverter = FfiConverterInt32;
88
- var FFIConverter = /*#__PURE__*/function (_AbstractFfiConverter) {
295
+ var FFIConverter = /*#__PURE__*/function (_AbstractFfiConverter2) {
89
296
  function FFIConverter() {
90
297
  _classCallCheck(this, FFIConverter);
91
298
  return _callSuper(this, FFIConverter, arguments);
92
299
  }
93
- _inherits(FFIConverter, _AbstractFfiConverter);
300
+ _inherits(FFIConverter, _AbstractFfiConverter2);
94
301
  return _createClass(FFIConverter, [{
95
302
  key: "read",
96
303
  value: function read(from) {
@@ -104,10 +311,8 @@ var FfiConverterTypeShieldStateCode = function () {
104
311
  case 4:
105
312
  return ShieldStateCode.UnverifiedIdentity;
106
313
  case 5:
107
- return ShieldStateCode.SentInClear;
108
- case 6:
109
314
  return ShieldStateCode.VerificationViolation;
110
- case 7:
315
+ case 6:
111
316
  return ShieldStateCode.MismatchedSender;
112
317
  default:
113
318
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -125,12 +330,10 @@ var FfiConverterTypeShieldStateCode = function () {
125
330
  return ordinalConverter.write(3, into);
126
331
  case ShieldStateCode.UnverifiedIdentity:
127
332
  return ordinalConverter.write(4, into);
128
- case ShieldStateCode.SentInClear:
129
- return ordinalConverter.write(5, into);
130
333
  case ShieldStateCode.VerificationViolation:
131
- return ordinalConverter.write(6, into);
334
+ return ordinalConverter.write(5, into);
132
335
  case ShieldStateCode.MismatchedSender:
133
- return ordinalConverter.write(7, into);
336
+ return ordinalConverter.write(6, into);
134
337
  }
135
338
  }
136
339
  }, {
@@ -142,6 +345,10 @@ var FfiConverterTypeShieldStateCode = function () {
142
345
  }(AbstractFfiConverterByteArray);
143
346
  return new FFIConverter();
144
347
  }();
348
+
349
+ // FfiConverter for string | undefined
350
+ var FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
351
+
145
352
  /**
146
353
  * This should be called before anything else.
147
354
  *
@@ -154,7 +361,7 @@ var FfiConverterTypeShieldStateCode = function () {
154
361
  */
155
362
  function uniffiEnsureInitialized() {
156
363
  // Get the bindings contract version from our ComponentInterface
157
- var bindingsContractVersion = 29;
364
+ var bindingsContractVersion = 30;
158
365
  // Get the scaffolding contract version by calling the into the dylib
159
366
  var scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_common_uniffi_contract_version();
160
367
  if (bindingsContractVersion !== scaffoldingContractVersion) {
@@ -164,6 +371,7 @@ function uniffiEnsureInitialized() {
164
371
  export default Object.freeze({
165
372
  initialize: uniffiEnsureInitialized,
166
373
  converters: {
374
+ FfiConverterTypeBackgroundTaskFailureReason: FfiConverterTypeBackgroundTaskFailureReason,
167
375
  FfiConverterTypeShieldStateCode: FfiConverterTypeShieldStateCode
168
376
  }
169
377
  });