@unbound-app/api 0.5.3 → 0.7.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/src/assets.d.ts CHANGED
@@ -47,3 +47,5 @@ export declare function getByName(name: string, type?: 'svg' | 'png'): UnboundAs
47
47
  */
48
48
  export declare function getIDByName(name: string, type?: 'svg' | 'png'): number | undefined;
49
49
  export { _default as default };
50
+
51
+ export {};
package/src/fs.d.ts CHANGED
@@ -50,3 +50,5 @@ export declare function write(
50
50
  export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
51
51
 
52
52
  export { _default as default };
53
+
54
+ export {};
package/src/global.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type {
4
+ ADDON_TYPES,
5
+ ActionSheetProps,
6
+ ActionSheetRowProps,
4
7
  Addon,
5
8
  AddonAuthor,
6
9
  AddonManifest,
7
10
  AddonResolveable,
11
+ AddonType,
12
+ AlertActionButtonProps,
13
+ AlertModalProps,
8
14
  AssetsModule,
9
15
  ButtonComponent,
10
16
  ButtonProps,
@@ -12,9 +18,12 @@ export type {
12
18
  ButtonVariant,
13
19
  CardProps,
14
20
  CheckboxProps,
21
+ ContextMenuItem,
22
+ ContextMenuProps,
15
23
  CreateStyles,
16
24
  DesignModule,
17
25
  DiscordAsset,
26
+ DiscordFunction,
18
27
  EnumLike,
19
28
  FloatingActionButtonProps,
20
29
  FontDescriptor,
@@ -27,15 +36,55 @@ export type {
27
36
  InputSize,
28
37
  InputStatus,
29
38
  InternalToastOptions,
39
+ NATIVE_PLUGIN_CAPABILITIES,
40
+ NativeAssociationKey,
41
+ NativeCallOptions,
42
+ NativeClassHandle,
43
+ NativeFFIBridge,
44
+ NativeFFISignature,
45
+ NativeFFIType,
46
+ NativeFFITypeName,
47
+ NativeFabricBridge,
48
+ NativeFabricFrame,
49
+ NativeFabricSize,
50
+ NativeFabricSurface,
51
+ NativeHandle,
52
+ NativeHookContext,
53
+ NativeHookHandlers,
54
+ NativeHookOptions,
55
+ NativeHookToken,
56
+ NativeObjCBridge,
57
+ NativeObjectHandle,
58
+ NativePlatformApp,
59
+ NativePlatformBridge,
60
+ NativePlatformDevice,
61
+ NativePluginBridge,
62
+ NativePluginCapability,
63
+ NativePluginError,
64
+ NativePluginErrorCode,
65
+ NativePointer,
66
+ NativeSerializable,
67
+ NativeSerializableObject,
68
+ NativeStruct,
69
+ NativeStructField,
70
+ NativeStructFields,
71
+ NativeThreadPolicy,
30
72
  Navigation,
73
+ NavigationOptions,
31
74
  Plugin,
75
+ PluginContext,
32
76
  PluginEntity,
33
77
  ResolvedStyles,
34
78
  RowButtonProps,
79
+ SegmentedControlItem,
80
+ SegmentedControlPagesProps,
35
81
  SegmentedControlProps,
36
82
  SegmentedControlState,
83
+ SegmentedControlStateOptions,
37
84
  SettingsEntry,
85
+ SettingsObject,
38
86
  SettingsScreen,
87
+ SettingsValue,
39
88
  SliderProps,
40
89
  SplitTextInputProps,
41
90
  StackProps,
@@ -68,131 +117,19 @@ export type {
68
117
  TransitionState,
69
118
  UnboundAsset,
70
119
  } from './_internal';
71
- import type { ColorString } from './utils';
120
+ import type { NativePlatformBridge } from './_internal';
121
+ import * as ReactModule from 'react';
122
+ import * as ReactNativeModule from 'react-native';
123
+
72
124
  declare global {
73
- /** A feature name published by the native module's capability table. */
74
- type UnboundNativeFeature =
75
- | 'device.info'
76
- | 'device.entitlements'
77
- | 'app.source'
78
- | 'notifications'
79
- | 'pip.video'
80
- | 'chat.avatar'
81
- | 'chat.messageBubbles'
82
- | 'toolbox.menu'
83
- | 'native.evaluateBytecode';
84
- /**
85
- * The lifecycle status of a native feature on the running build. `unknown` and `unavailable`
86
- * both mean "do not call"; only `supported` and `deprecated` are safe.
87
- */
88
- type UnboundNativeFeatureStatus =
89
- | 'unknown'
90
- | 'removed'
91
- | 'deprecated'
92
- | 'supported'
93
- | 'unavailable';
94
- /**
95
- * The full metadata record for a native feature. Everything but `name` and `known` is absent
96
- * when the feature is not in this build's table.
97
- */
98
- type UnboundNativeFeatureInfo = {
99
- name: string;
100
- known: boolean;
101
- status: UnboundNativeFeatureStatus;
102
- supported?: boolean;
103
- introducedIn?: string;
104
- deprecatedIn?: string;
105
- removedIn?: string;
106
- replacement?: UnboundNativeFeature;
107
- };
108
- /** Hardware, OS, and install-integrity details for the device Unbound is running on. */
109
- type UnboundNativeDevice = {
110
- getModel(): string;
111
- getiOSVersionString(): string;
112
- isJailbroken(): boolean;
113
- isSystemApp(): boolean;
114
- isVerifiedBuild(): boolean;
115
- getEntitlements(): Record<string, any>;
116
- getEntitlementsAsPlist(): string;
117
- };
118
- /** How this copy of the app was installed. */
119
- type UnboundNativeApp = {
120
- getSource(): string;
121
- };
122
- /** Local notification scheduling. */
123
- type UnboundNativeNotifications = {
124
- show(
125
- title?: string,
126
- body?: string,
127
- timeDelay?: number,
128
- soundEnabled?: boolean,
129
- identifier?: string,
130
- ): string;
131
- };
132
- /** Picture-in-picture video playback. */
133
- type UnboundNativePiP = {
134
- playVideo(url: string): string | null;
135
- };
136
- /**
137
- * Native chat appearance controls. The getters read synchronously; every setter hops to the
138
- * main queue and returns immediately, so a value read back on the next line may still be stale.
139
- */
140
- type UnboundNativeChat = {
141
- getAvatarCornerRadius(): number;
142
- setAvatarCornerRadius(radius?: number): void;
143
- resetAvatarCornerRadius(): void;
144
- getMessageBubblesEnabled(): boolean;
145
- getMessageBubbleLightColor(): ColorString;
146
- getMessageBubbleDarkColor(): ColorString;
147
- getMessageBubbleCornerRadius(): number;
148
- setMessageBubblesEnabled(
149
- enabled: boolean,
150
- lightColor?: ColorString,
151
- darkColor?: ColorString,
152
- ): void;
153
- setMessageBubbleColors(lightColor?: ColorString, darkColor?: ColorString): void;
154
- setMessageBubbleCornerRadius(radius?: number): void;
155
- resetMessageBubbles(): void;
156
- };
157
- /** The native toolbox menu, drawn natively so it survives a broken JS bundle. */
158
- type UnboundNativeToolbox = {
159
- showMenu(): void;
160
- };
161
- /** The raw `UnboundNative` JSI bridge the tweak installs directly on the JS global. */
162
- type UnboundNativeModule = {
163
- getNativeModuleVersion(): string;
164
- supportsFeature(name: UnboundNativeFeature): boolean;
165
- getFeatureInfo(name: UnboundNativeFeature): UnboundNativeFeatureInfo;
166
- isFeatureDeprecated(name: UnboundNativeFeature): boolean;
167
- isFeatureRemoved(name: UnboundNativeFeature): boolean;
168
- getSupportedFeatures(): UnboundNativeFeature[];
169
- getDeprecatedFeatures(): UnboundNativeFeature[];
170
- getRemovedFeatures(): UnboundNativeFeature[];
171
- /**
172
- * Runs Hermes bytecode in the app's JS runtime and returns whatever it evaluates to.
173
- * Throws when the buffer is not an `ArrayBuffer`, is empty, or is not Hermes bytecode;
174
- * anything the bytecode itself throws propagates too.
175
- */
176
- evaluateBytecode(bytecode: ArrayBuffer, tag?: string): any;
177
- device: UnboundNativeDevice;
178
- app: UnboundNativeApp;
179
- notifications: UnboundNativeNotifications;
180
- pip: UnboundNativePiP;
181
- chat: UnboundNativeChat;
182
- toolbox: UnboundNativeToolbox;
183
- };
184
125
  /**
185
- * Build-time token, replaced with a boolean literal by the build's `transform.define`. Folds at
186
- * the module-graph level so `if ($$DEV$$)` branches (and any imports inside them) are dead-code
187
- * eliminated from production bundles entirely. Use it (not a runtime check) to gate dev-only code.
126
+ * Build-time token replaced with a boolean literal, so `if ($$DEV$$)` branches (and their
127
+ * imports) are eliminated from production bundles. Use it, not a runtime check, for dev-only code.
188
128
  */
189
129
  var $$DEV$$: boolean;
190
- /** The raw `UnboundNative` JSI bridge, installed on the global by the platform loader. */
191
- var UnboundNative: UnboundNativeModule | undefined;
192
- var React: typeof import('react');
193
- var ReactNative: typeof import('react-native');
194
-
195
- interface Window {}
130
+ var NativePlatform: NativePlatformBridge | undefined;
131
+ var React: typeof ReactModule;
132
+ var ReactNative: typeof ReactNativeModule;
196
133
  }
197
134
 
198
135
  export interface UnboundGlobal {
package/src/i18n.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare function format(key: string, vars?: FormatVars): string;
31
31
  * @returns A promise that resolves once the initial locales have been ensured and the subscription is wired.
32
32
  */
33
33
  export declare function init(): Promise<void>;
34
- export type FormatVars = Record<string, unknown>;
34
+ export type FormatVars = Record<string, string | number | boolean | Date>;
35
35
  export type LocaleStrings = Record<string, string>;
36
36
  export type Localizations = {
37
37
  Messages: Record<string, string>;
@@ -40,3 +40,5 @@ export type Localizations = {
40
40
  export type StringStore = Record<string, LocaleStrings>;
41
41
 
42
42
  export { _default as default };
43
+
44
+ export {};
package/src/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ export * as assets from './assets';
4
+ export * as fs from './fs';
5
+ export * as i18n from './i18n';
3
6
  export * as metro from './metro/index';
4
- export * as settings from './settings';
7
+ export * as native from './native';
5
8
  export * as patcher from './patcher';
9
+ export * as settings from './settings';
6
10
  export * as storage from './storage';
7
- export * as assets from './assets';
8
- export * as native from './native';
9
11
  export * as toasts from './toasts';
10
- export * as i18n from './i18n';
11
- export * as fs from './fs';
@@ -5,3 +5,5 @@ export declare const Invites: any;
5
5
  export declare const Linking: any;
6
6
  export declare const Messages: any;
7
7
  export declare const Profiles: any;
8
+
9
+ export {};
@@ -21,3 +21,5 @@ export declare const Util: any;
21
21
  export declare const i18n: any;
22
22
 
23
23
  export { Clipboard$1 as Clipboard, React$1 as React, ReactNative$1 as ReactNative };
24
+
25
+ export {};
@@ -1,17 +1,19 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
3
  export type { DesignModule, SwitchProps } from '../_internal';
4
+ import type { DesignModule, SwitchProps } from '../_internal';
5
+ import * as ReactModule from 'react';
6
+ import { ComponentType, ReactNode } from 'react';
4
7
  import {
8
+ AccessibilityState,
5
9
  ImageStyle,
10
+ PressableProps,
6
11
  StyleProp,
7
12
  TextInputProps as RNTextInputProps,
8
13
  TextStyle,
9
14
  ViewProps,
10
15
  ViewStyle,
11
16
  } from 'react-native';
12
- import { ComponentType, ReactNode } from 'react';
13
-
14
- import type { DesignModule, SwitchProps } from '../_internal';
15
17
  export declare const BackdropFilters: any;
16
18
  export declare const Discord: DesignModule;
17
19
  export declare const FlashList: any;
@@ -20,4 +22,5 @@ export declare const HelpMessage: any;
20
22
  export declare const Media: any;
21
23
  export declare const Portal: any;
22
24
  export declare const SafeArea: any;
23
- export declare const Switch: ComponentType<SwitchProps>;
25
+ export declare const Switch: ReactModule.ComponentType<SwitchProps>;
26
+ export {};
@@ -21,7 +21,7 @@ export declare function byDisplayName(name: string): MetroFilter;
21
21
  * @param path The file path the module must have been imported from.
22
22
  * @returns A {@link MetroFilter} matching the module loaded from that file path.
23
23
  */
24
- export declare function byFilePath(path: string[]): MetroFilter;
24
+ export declare function byFilePath(path: string): MetroFilter;
25
25
  /**
26
26
  * @description Builds a filter matching a module whose `name` equals the given name.
27
27
  * @param name The `name` the module must have.
@@ -53,3 +53,5 @@ export type MetroFilter = ((mdl: any, id: number | string) => PredicateResult) &
53
53
  isRaw?: boolean;
54
54
  };
55
55
  export { _default as default };
56
+
57
+ export {};
@@ -1,16 +1,20 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
+ export type { DiscordFunction } from '../_internal';
4
+ import type { DiscordFunction } from '../_internal';
5
+ import type { PredicateResult } from '../utils';
6
+ import * as ReactModule from 'react';
7
+ import { ComponentType, ReactNode } from 'react';
3
8
  import {
9
+ AccessibilityState,
4
10
  ImageStyle,
11
+ PressableProps,
5
12
  StyleProp,
6
13
  TextInputProps as RNTextInputProps,
7
14
  TextStyle,
8
15
  ViewProps,
9
16
  ViewStyle,
10
17
  } from 'react-native';
11
- import { ComponentType, ReactNode } from 'react';
12
-
13
- import type { AnyProps, Fn, PredicateResult } from '../utils';
14
18
  /** @internal */
15
19
  declare const CACHE_KEY: unique symbol;
16
20
  export declare const off: typeof removeListener;
@@ -20,7 +24,7 @@ export declare const on: typeof addListener;
20
24
  * @param listener Callback receiving the module exports and its id.
21
25
  * @returns A function that removes the listener.
22
26
  */
23
- export declare function addListener(listener: (mdl: any, id: string) => void): () => boolean;
27
+ export declare function addListener(listener: (mdl: any, id: number) => void): () => boolean;
24
28
  /**
25
29
  * @description Runs several filters in a single registry pass, returning one result per item.
26
30
  * @param items The filters to resolve, each with its own per-item options.
@@ -108,23 +112,11 @@ export declare function initializeModule(id: number): boolean;
108
112
  * @description Removes a previously registered module listener.
109
113
  * @param listener The listener to remove.
110
114
  */
111
- export declare function removeListener(listener: (mdl: any, id: string) => void): void;
112
-
113
- /** A single entry in a {@link bulk} search: a filter plus its per-item options. */
114
- export interface MetroBulkItem extends Omit<MetroSearchOptions, 'initial' | 'cache'> {
115
- filter: MetroFilter;
116
- }
117
- /** Search options for {@link findLazy}, adding a `signal` that abandons the wait when aborted. */
118
- export interface MetroLazySearchOptions extends Omit<MetroSearchOptions, 'lazy' | 'all'> {
119
- signal?: AbortSignal;
120
- }
121
- /** Search options for {@link findStore}, adding the `short` name-matching toggle. */
122
- export interface MetroStoreOptions extends MetroSearchOptions {
123
- short?: boolean;
124
- }
125
-
115
+ export declare function removeListener(listener: (mdl: any, id: number) => void): void;
116
+ /** An object of shape `T` widened with an arbitrary property index. */
117
+ export type AnyProps<T = unknown> = T & Record<PropertyKey, MetroExport>;
126
118
  /** Widens a single result to an array when the search was made with `all: true`. */
127
- export type MetroAllValues<T extends Record<PropertyKey, any>, U extends unknown> = T extends {
119
+ export type MetroAllValues<T extends MetroSearchOptions, U> = T extends {
128
120
  all: true;
129
121
  }
130
122
  ? U[]
@@ -134,6 +126,10 @@ export type MetroBulkFind<T extends string> = [
134
126
  ...AnyProps<MetroParamsBag<T>>[],
135
127
  AnyProps<MetroBulkMarker>,
136
128
  ];
129
+ /** A single entry in a {@link bulk} search: a filter plus its per-item options. */
130
+ export type MetroBulkItem = {
131
+ filter: MetroFilter;
132
+ } & Omit<MetroSearchOptions, 'initial' | 'cache'>;
137
133
  /** The marker object distinguishing a bulk find from a single one. */
138
134
  export type MetroBulkMarker = {
139
135
  bulk: true;
@@ -144,9 +140,9 @@ export type MetroBulkModuleByName<T extends any[]> = {
144
140
  interop: false;
145
141
  }
146
142
  ? {
147
- default: Fn;
143
+ default: MetroFunction;
148
144
  }
149
- : Fn;
145
+ : MetroFunction;
150
146
  };
151
147
  /** Result shape of a bulk by-property search, one record per requested item. */
152
148
  export type MetroBulkModuleByProperty<T extends any[]> = {
@@ -157,6 +153,8 @@ export type MetroFilter = ((mdl: any, id: number | string) => PredicateResult) &
157
153
  [CACHE_KEY]?: string;
158
154
  isRaw?: boolean;
159
155
  };
156
+ /** A function or class exported by a Discord module, whose signature Discord does not document. */
157
+ export type MetroFunction = DiscordFunction & (new (...args: any[]) => any);
160
158
  /** Dispatches to the bulk or single by-name result shape based on the argument tuple. */
161
159
  export type MetroFunctionSignatureOrArray<T extends any[], U extends string> =
162
160
  T extends MetroBulkFind<U> ? MetroBulkModuleByName<T> : MetroSingleModuleByName<T>;
@@ -165,6 +163,10 @@ export type MetroInternalOptions = {
165
163
  bulk?: boolean;
166
164
  lazy?: boolean;
167
165
  };
166
+ /** Search options for {@link findLazy}, adding a `signal` that abandons the wait when aborted. */
167
+ export type MetroLazySearchOptions = {
168
+ signal?: AbortSignal;
169
+ } & Omit<MetroSearchOptions, 'lazy' | 'all'>;
168
170
  /** Convenience alias for a by-property result derived from a union of prop names. */
169
171
  export type MetroModule<TProps extends string> = MetroPropertyRecordOrArray<TProps[], TProps>;
170
172
  /** A bag carrying a `params` array of prop names. */
@@ -173,14 +175,14 @@ export type MetroParamsBag<T extends string> = {
173
175
  };
174
176
  /** A record keyed by the prop names listed in a single bulk item's `params`. */
175
177
  export type MetroParamsRecord<Params extends PropertyKey[]> = {
176
- [P in Params[number]]: any;
178
+ [P in Params[number]]: MetroExport;
177
179
  };
178
180
  /** Dispatches to the bulk or single by-property result shape based on the argument tuple. */
179
181
  export type MetroPropertyRecordOrArray<T extends any[], U extends string> =
180
182
  T extends MetroBulkFind<U> ? MetroBulkModuleByProperty<T> : MetroSingleModuleByProperty<T>;
181
183
  /** A record keyed by the non-options entries of a find argument tuple. */
182
184
  export type MetroPropsRecord<T extends any[]> = {
183
- [k in Exclude<T[number], Record<PropertyKey, any>>]: any;
185
+ [k in Exclude<T[number], object>]: MetroExport;
184
186
  };
185
187
  /** Public options accepted by {@link find} and the `findBy*` family. */
186
188
  export type MetroSearchOptions = {
@@ -191,6 +193,7 @@ export type MetroSearchOptions = {
191
193
  lazy?: boolean;
192
194
  raw?: boolean;
193
195
  all?: boolean;
196
+ cacheOnly?: boolean;
194
197
  initialize?: boolean;
195
198
  };
196
199
  /** Result shape of a by-name search: the matched function (or its default export). */
@@ -204,11 +207,11 @@ export type MetroSingleModuleByName<T extends any[]> = T extends [
204
207
  interop: false;
205
208
  }
206
209
  ? {
207
- default: Fn;
210
+ default: MetroFunction;
208
211
  }
209
- : Fn
212
+ : MetroFunction
210
213
  >
211
- : Fn;
214
+ : MetroFunction;
212
215
  /** Result shape of a by-property search: a record keyed by the requested props. */
213
216
  export type MetroSingleModuleByProperty<T extends any[]> = T extends [
214
217
  ...any,
@@ -216,13 +219,17 @@ export type MetroSingleModuleByProperty<T extends any[]> = T extends [
216
219
  ]
217
220
  ? MetroAllValues<O, AnyProps<MetroPropsRecord<T>>>
218
221
  : AnyProps<MetroPropsRecord<T>>;
222
+ /** Search options for {@link findStore}, adding the `short` name-matching toggle. */
223
+ export type MetroStoreOptions = {
224
+ short?: boolean;
225
+ } & MetroSearchOptions;
219
226
  /** Tuple of search terms followed by a trailing options object. */
220
227
  export type MetroStringFindWithOptions<T extends string, Options = MetroSearchOptions> = [
221
228
  ...T[],
222
229
  Options,
223
230
  ];
231
+ export * as api from './api';
232
+ export * as common from './common';
224
233
  export * as components from './components';
225
234
  export * as filters from './filters';
226
- export * as common from './common';
227
235
  export * as stores from './stores';
228
- export * as api from './api';
@@ -2,3 +2,5 @@
2
2
 
3
3
  export declare const Guilds: any;
4
4
  export declare const Users: any;
5
+
6
+ export {};
package/src/native.d.ts CHANGED
@@ -1,8 +1,55 @@
1
1
  // Auto-generated by generate-plugin-sdk.ts - DO NOT EDIT
2
2
 
3
- import type { Fn, PromiseFn } from './utils';
4
- /** The raw `UnboundNative` JSI bridge installed on the global by the platform loader. */
5
- declare const UnboundNative$1: UnboundNativeModule | undefined;
3
+ export type {
4
+ NativeAssociationKey,
5
+ NativeCallOptions,
6
+ NativeClassHandle,
7
+ NativeFFIBridge,
8
+ NativeFFISignature,
9
+ NativeFFIType,
10
+ NativeFFITypeName,
11
+ NativeFabricBridge,
12
+ NativeFabricFrame,
13
+ NativeFabricSize,
14
+ NativeFabricSurface,
15
+ NativeHandle,
16
+ NativeHookContext,
17
+ NativeHookHandlers,
18
+ NativeHookOptions,
19
+ NativeHookToken,
20
+ NativeObjCBridge,
21
+ NativeObjectHandle,
22
+ NativePlatformBridge,
23
+ NativePluginBridge,
24
+ NativePluginCapability,
25
+ NativePluginError,
26
+ NativePluginErrorCode,
27
+ NativePointer,
28
+ NativeStruct,
29
+ NativeThreadPolicy,
30
+ PluginContext,
31
+ } from './_internal';
32
+ import type { NativePlatformBridge, NativePluginCapability } from './_internal';
33
+ declare const NativePlatform$1: NativePlatformBridge | undefined;
34
+
35
+ export declare class NativePluginCapabilityError extends Error {
36
+ readonly code = 'NATIVE_PLUGIN_CAPABILITY_DENIED';
37
+ readonly capability: NativePluginCapability;
38
+ constructor(capability: NativePluginCapability);
39
+ }
40
+ export declare class NativePluginDisposedError extends Error {
41
+ readonly code = 'NATIVE_PLUGIN_SCOPE_DISPOSED';
42
+ constructor();
43
+ }
44
+ export declare class NativePluginUnavailableError extends Error {
45
+ readonly code = 'NATIVE_PLUGIN_UNAVAILABLE';
46
+ }
47
+ export declare class NativePluginVersionError extends Error {
48
+ readonly code = 'NATIVE_PLUGIN_API_VERSION_UNSUPPORTED';
49
+ readonly installedApi: string;
50
+ readonly requiredApi: string;
51
+ constructor(requiredApi: string, installedApi: string);
52
+ }
6
53
  /** The resolved native client info module, exposing build and release metadata. */
7
54
  export declare const BundleInfo: BundleInfoType;
8
55
  /** The resolved native bundle updater module, used to check for updates and reload the bundle. */
@@ -15,20 +62,18 @@ export declare const DeviceInfo: DeviceInfoType;
15
62
  * @param names The candidate native module names to look up, in priority order.
16
63
  * @returns The first matching native module.
17
64
  */
18
- export declare function getNativeModule<T = any>(...names: string[]): T;
65
+ export declare function getNativeModule<T>(...names: string[]): T;
19
66
  /**
20
67
  * @description Reads Hermes' runtime metadata, such as the bytecode version, GC, and build channel.
21
- * React Native types the global `HermesInternal` as `null | {}`, so this reads it via
22
- * `window.HermesInternal` where our own typing wins.
23
68
  * @returns The runtime property map, or an empty object when Hermes internals are unavailable.
24
69
  */
25
- export declare function getRuntimeProperties(): Record<string, any>;
70
+ export declare function getRuntimeProperties(): HermesRuntimeProperties;
26
71
  /**
27
72
  * @description Persists pending settings to storage, then reloads the native bundle.
28
73
  */
29
74
  export declare function reload(): Promise<void>;
30
75
  /** Build and release metadata reported by the native client info module. */
31
- export interface BundleInfoType {
76
+ export type BundleInfoType = {
32
77
  Version: string;
33
78
  ReleaseChannel: string;
34
79
  Manifest: string;
@@ -39,27 +84,29 @@ export interface BundleInfoType {
39
84
  SentryStaffDsn: string;
40
85
  Identifier: string;
41
86
  SentryAlphaBetaDsn: string;
42
- }
87
+ };
43
88
  /** The native `BundleUpdaterManager` module surface for OTA updates and reloading the bundle. */
44
- export interface DCDBundleManagerType {
45
- getInitialBundleDownloaded: PromiseFn;
46
- getInitialOtaUpdateChecked: PromiseFn;
47
- checkForUpdateAndReload: Fn;
48
- reload: Fn;
49
- getOtaRootPath: PromiseFn;
50
- getBuildOverrideCookieContents: PromiseFn;
51
- setBuildOverrideCookieHeader: PromiseFn;
52
- getManifestInfo: PromiseFn;
53
- addListener: Fn;
54
- removeListeners: Fn;
55
- }
89
+ export type DCDBundleManagerType = {
90
+ getInitialBundleDownloaded: UndocumentedNativeMethod;
91
+ getInitialOtaUpdateChecked: UndocumentedNativeMethod;
92
+ checkForUpdateAndReload(): void;
93
+ reload(): void;
94
+ getOtaRootPath: UndocumentedNativeMethod;
95
+ getBuildOverrideCookieContents: UndocumentedNativeMethod;
96
+ setBuildOverrideCookieHeader: UndocumentedNativeMethod;
97
+ getManifestInfo: UndocumentedNativeMethod;
98
+ addListener(eventName: string): void;
99
+ removeListeners(count: number): void;
100
+ };
56
101
  /** The constant directory paths exposed by the native `DCDFileManager`. */
57
- export interface DCDFileManagerConstants {
102
+ export type DCDFileManagerConstants = {
58
103
  CacheDirPath: string;
59
104
  DocumentsDirPath: string;
60
- }
105
+ };
106
+ /** The text encodings accepted by the native `DCDFileManager` read/write operations. */
107
+ export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
61
108
  /** The native `DCDFileManager` module surface for reading, writing, and inspecting files. */
62
- export interface DCDFileManagerType extends DCDFileManagerConstants {
109
+ export type DCDFileManagerType = {
63
110
  readFile(path: string, encoding: DCDFileManagerEncoding): Promise<string>;
64
111
  writeFile(
65
112
  type: 'documents' | 'cache',
@@ -67,16 +114,16 @@ export interface DCDFileManagerType extends DCDFileManagerConstants {
67
114
  data: string,
68
115
  encoding: DCDFileManagerEncoding,
69
116
  ): Promise<string>;
70
- removeFile(type: 'documents' | 'cache', path: string): Promise<any>;
71
- readAsset(): Promise<unknown>;
72
- getSize(): Promise<unknown>;
73
- getVideoDimensions(): Promise<unknown>;
117
+ removeFile(type: 'documents' | 'cache', path: string): Promise<boolean>;
118
+ readAsset: UndocumentedNativeMethod;
119
+ getSize: UndocumentedNativeMethod;
120
+ getVideoDimensions: UndocumentedNativeMethod;
74
121
  fileExists(path: string): Promise<boolean>;
75
- saveFileToGallery(): Promise<unknown>;
122
+ saveFileToGallery: UndocumentedNativeMethod;
76
123
  getConstants(): DCDFileManagerConstants;
77
- }
124
+ } & DCDFileManagerConstants;
78
125
  /** Hardware and OS details reported by the native device module. */
79
- export interface DeviceInfoType {
126
+ export type DeviceInfoType = {
80
127
  isTaskBarEnabled: boolean;
81
128
  maxCpuFreq: string;
82
129
  socName: string;
@@ -89,7 +136,10 @@ export interface DeviceInfoType {
89
136
  deviceBrand: string;
90
137
  ramSize: string;
91
138
  device: string;
92
- }
93
- /** The text encodings accepted by the native `DCDFileManager` read/write operations. */
94
- export type DCDFileManagerEncoding = 'utf-8' | 'utf8' | 'base64';
95
- export { UnboundNative$1 as UnboundNative };
139
+ };
140
+ export type HermesRuntimeProperties = ReturnType<HermesInternalObject['getRuntimeProperties']>;
141
+ export type UndocumentedNativeMethod = () => Promise<unknown>;
142
+
143
+ export { NativePlatform$1 as NativePlatform };
144
+
145
+ export {};
package/src/patcher.d.ts CHANGED
@@ -90,3 +90,5 @@ export type PatchParent = AnyFunction | AnyObject;
90
90
  export type PropOf<M> = {
91
91
  [K in keyof M]: M[K] extends AnyFunction | AnyConstructor ? Extract<K, string> : never;
92
92
  }[keyof M];
93
+
94
+ export {};