scandit-react-native-datacapture-core 8.7.0-beta.1 → 8.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/dist/core.js.flow CHANGED
@@ -1895,7 +1895,7 @@ declare class CoreProxyAdapter {
1895
1895
  }): Promise<void>;
1896
1896
  }
1897
1897
  /**
1898
- * [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1898
+ * [object Object],[object Object],[object Object],[object Object],[object Object]
1899
1899
  * @since 8.7.0
1900
1900
  */
1901
1901
 
@@ -1919,7 +1919,7 @@ declare var LogCategory: {|
1919
1919
  +Listener: 4, // 4
1920
1920
  +Events: 8, // 8
1921
1921
  |};
1922
- declare var DEFAULT_CATEGORIES: number;
1922
+
1923
1923
  /**
1924
1924
  * [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1925
1925
  * @since 8.7.0
@@ -1956,7 +1956,7 @@ declare interface LogRecord {
1956
1956
  message: string;
1957
1957
 
1958
1958
  /**
1959
- * [object Object],[object Object],[object Object],[object Object],[object Object]
1959
+ * Additional key/value context, such as the identifiers of the mode or view involved, and the arguments of the call. Arguments are redacted against a fixed floor.
1960
1960
  * @since 8.7.0
1961
1961
  */
1962
1962
  fields?: { [key: string]: mixed, ... };
@@ -1991,7 +1991,7 @@ declare interface LogRecordError {
1991
1991
  message: string;
1992
1992
 
1993
1993
  /**
1994
- * [object Object],[object Object],[object Object]
1994
+ * Stack trace. Never set on a record the SDK stores, because it can contain file paths from your own application binary.
1995
1995
  * @since 8.7.0
1996
1996
  */
1997
1997
  stack?: string;
@@ -1999,28 +1999,33 @@ declare interface LogRecordError {
1999
1999
  declare type Subscriber = (record: LogRecord) => void;
2000
2000
  declare interface LogConfig {
2001
2001
  level: $Values<typeof LogLevel>;
2002
- categories: number;
2003
- bufferSize: number;
2004
2002
  }
2005
2003
  declare type ConfigListener = (config: LogConfig) => void;
2004
+ /**
2005
+ * Receives records queued for native storage; `installNativeLogReceiver` registers it.
2006
+ */
2007
+ declare interface NativeSink {
2008
+ onQueued(): void;
2009
+ flush(): Promise<void>;
2010
+ }
2006
2011
  /**
2007
2012
  * Per-method override metadata consumed by the centralized bridge
2008
2013
  * interceptor (`instrumentBridgeCall`). Populated by code generation — each
2009
2014
  * platform package's `generated/<Interface>LogMetadata.ts` auto-registers
2010
2015
  * its map at module load via `ScanditLogger.registerMethodMetadata`.
2011
2016
  *
2012
- * `category` re-routes the method's `LogRecord` into a different
2013
- * `LogCategory` than the wrapper's default. Most notably, marking a
2014
- * method as `LogCategory.Events` means it only emits at `LogLevel.Trace`
2015
- * since `Events` is excluded from the default category mask.
2017
+ * `level` is the level the method's success record is logged at (generated
2018
+ * metadata marks per-frame callbacks `Trace`); `category` labels the record.
2019
+ * Errors ignore both.
2016
2020
  */
2017
2021
  declare interface MethodLogMetadata {
2022
+ level?: $Values<typeof LogLevel>;
2018
2023
  category?: $Values<typeof LogCategory>;
2019
2024
  }
2020
2025
  declare var REDACTED_ARG_KEYS: $ReadOnlyArray<string>;
2021
2026
  declare var REDACTED_ARG_METHODS: $ReadOnlyArray<string>;
2022
2027
  /**
2023
- * [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2028
+ * [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2024
2029
  * @since 8.7.0
2025
2030
  */
2026
2031
  declare class ScanditLogger {
@@ -2039,52 +2044,10 @@ declare class ScanditLogger {
2039
2044
  */
2040
2045
  static getMethodMetadata(methodName: string): MethodLogMetadata | void;
2041
2046
 
2042
- /**
2043
- * Controls whether the arguments of each call are recorded. The default is `true`, with the redaction floor applied. Pass `false` to drop arguments entirely, keeping only the method name and the identifiers of the mode or view involved.
2044
- * @since 8.7.0
2045
- */
2046
- static setLogBridgeArgs(enabled: boolean): void;
2047
-
2048
- /**
2049
- * Returns whether call arguments are being recorded.
2050
- * @since 8.7.0
2051
- */
2052
- static getLogBridgeArgs(): boolean;
2053
-
2054
2047
  /**
2055
2048
  * [object Object],[object Object],[object Object]
2056
2049
  * @since 8.7.0
2057
2050
  */
2058
- static setLogErrorStacks(enabled: boolean): void;
2059
-
2060
- /**
2061
- * Returns whether error stack traces are being kept.
2062
- * @since 8.7.0
2063
- */
2064
- static getLogErrorStacks(): boolean;
2065
-
2066
- /**
2067
- * Adds argument keys to the redaction floor, replacing any previously added with this method. The floor itself cannot be removed from, so an empty list restores it rather than disabling redaction. Matching is recursive and also descends into JSON strings, so a key nested inside a serialized payload is caught.
2068
- * @since 8.7.0
2069
- */
2070
- static setAdditionalRedactedArgKeys(keys: Iterable<string>): void;
2071
-
2072
- /**
2073
- * Adds one key to the redaction floor, keeping the keys already added.
2074
- * @since 8.7.0
2075
- */
2076
- static addRedactedArgKey(key: string): void;
2077
-
2078
- /**
2079
- * Returns a copy of the keys currently redacted — the built-in floor plus anything added.
2080
- * @since 8.7.0
2081
- */
2082
- static getRedactedArgKeys(): Set<string>;
2083
-
2084
- /**
2085
- * [object Object],[object Object],[object Object],[object Object],[object Object]
2086
- * @since 8.7.0
2087
- */
2088
2051
  static setLevel(level: $Values<typeof LogLevel>): void;
2089
2052
 
2090
2053
  /**
@@ -2094,26 +2057,7 @@ declare class ScanditLogger {
2094
2057
  static getLevel(): $Values<typeof LogLevel>;
2095
2058
 
2096
2059
  /**
2097
- * [object Object],[object Object],[object Object]
2098
- * @since 8.7.0
2099
- */
2100
- static setCategories(mask: number): void;
2101
-
2102
- /**
2103
- * Returns the current category mask.
2104
- * @since 8.7.0
2105
- */
2106
- static getCategories(): number;
2107
-
2108
- /**
2109
- * Sets how many records the ring buffer holds, at least 1. The default is 1000. Resizing discards the records currently buffered.
2110
- * @since 8.7.0
2111
- */
2112
- static setBufferSize(size: number): void;
2113
-
2114
- /**
2115
- * Subscribe to configuration changes (`setLevel` / `setCategories` /
2116
- * `setBufferSize`). The callback fires immediately with the current
2060
+ * Subscribe to configuration changes (`setLevel`). The callback fires immediately with the current
2117
2061
  * configuration when attached, then again on every subsequent change.
2118
2062
  * Returns an unsubscribe function.
2119
2063
  *
@@ -2122,12 +2066,6 @@ declare class ScanditLogger {
2122
2066
  */
2123
2067
  static onConfigChange(cb: ConfigListener): () => void;
2124
2068
 
2125
- /**
2126
- * Returns the current buffer capacity.
2127
- * @since 8.7.0
2128
- */
2129
- static getBufferSize(): number;
2130
-
2131
2069
  /**
2132
2070
  * Returns the buffered records, oldest first. This is the call to use when attaching logs to a support ticket.
2133
2071
  * @since 8.7.0
@@ -2155,32 +2093,37 @@ declare class ScanditLogger {
2155
2093
 
2156
2094
  /**
2157
2095
  * Discards all buffered records.
2096
+ *
2097
+ * Also deletes the log files the SDK stored on the device while the level was above `Off`. The returned promise resolves once they are gone.
2158
2098
  * @since 8.7.0
2159
2099
  */
2160
- static clear(): void;
2100
+ static clear(): Promise<void>;
2161
2101
 
2162
2102
  /**
2163
- * Writes the buffered records as a redacted JSON-lines file to `path` and resolves with the
2164
- * absolute path written.
2165
- *
2166
- * An app can only write inside its own storage: pass a path under the app container on iOS
2167
- * (Documents, Library or the temporary directory) or under `Context.getFilesDir()` /
2168
- * `Context.getExternalFilesDir()` on Android. A relative `path` is resolved against the app's
2169
- * documents/files directory, which is the portable way to ask for a destination.
2170
- *
2171
- * Rejects when debug mode was never enabled, the buffer is empty, the SDK is not initialized
2172
- * yet, or the destination cannot be written.
2173
- *
2174
- * Serializes the buffered records to a redacted, human-readable JSON-lines file at `path` and returns the absolute path written. Missing parent directories are created, and a file already at `path` is replaced; nothing else in the destination directory is removed.
2175
- *
2176
- * An app can only write inside its own storage. Pass a path under the app container on iOS (Documents, Library or the temporary directory), or under `Context.getFilesDir()` or `Context.getExternalFilesDir()` on Android — anywhere else needs the Storage Access Framework or MediaStore on Android 10 and later. A relative `path` is resolved against the app’s documents/files directory, which is the portable way to name a destination.
2177
- *
2178
- * Rejects if debug mode was never enabled, the buffer is empty, the SDK is not initialized yet, or the destination cannot be written; the rejection carries a message saying which, except on Cordova iOS, where only the error code reaches the caller.
2179
- *
2180
- * Nothing is uploaded — the file is yours to keep, attach to a support mail to `support@scandit.com`, or hand to your own upload flow.
2103
+ * TS-emitted records not yet handed to native storage. Internal: used by `installNativeLogReceiver`.
2104
+ */
2105
+ static pendingNativeRecordCount(): number;
2106
+
2107
+ /**
2108
+ * Removes and returns every record waiting for native storage. Internal.
2109
+ */
2110
+ static takePendingNativeRecords(): LogRecord[];
2111
+
2112
+ /**
2113
+ * Registers (or, with `undefined`, removes) the sink that moves queued records to native storage. Internal.
2114
+ */
2115
+ static setNativeSink(sink: NativeSink | void): void;
2116
+
2117
+ /**
2118
+ * [object Object],[object Object],[object Object]
2181
2119
  * @since 8.7.0
2182
2120
  */
2183
- static writeLogs(path: string): Promise<string>;
2121
+ static writeLogs(path?: string): Promise<string>;
2122
+
2123
+ /**
2124
+ * Whether a record at `level` would be kept under the current level.
2125
+ */
2126
+ static isEnabled(level: $Values<typeof LogLevel>): boolean;
2184
2127
  static emit(
2185
2128
  level: $Values<typeof LogLevel>,
2186
2129
  category: $Values<typeof LogCategory>,
@@ -2194,19 +2137,12 @@ declare class ScanditLogger {
2194
2137
  /**
2195
2138
  * Insert a `LogRecord` produced by the native side into the local buffer.
2196
2139
  *
2197
- * Applies TS-side level + category gating so the customer's `setLevel` /
2198
- * `setCategories` is the single source of truth for what lands in the
2199
- * unified buffer, regardless of how the native side categorized the
2200
- * record. This matters because the native sides (Android/iOS) don't yet
2201
- * consume the generated `logCategory` metadata — they emit per-frame
2202
- * `finish*` records at `Bridge`, but the customer expects them under
2203
- * `Events` (default-masked-off). The override + gate here closes that
2204
- * gap until a native LogMetadata file exists.
2140
+ * Applies the TS-side level gate; native already applied its per-method override.
2205
2141
  *
2206
2142
  * Skips the platform-native console sink (the native side already wrote
2207
2143
  * to `android.util.Log` / `os_log` / etc.).
2208
2144
  *
2209
- * Best-effort correlation: when the (possibly-recategorized) incoming
2145
+ * Best-effort correlation: when the incoming
2210
2146
  * record has a `durationMs`, look back for the most recent unmatched
2211
2147
  * `ts.bridge` record with the same method name (last segment after the
2212
2148
  * dot) within a 10-second window and attach a derived
@@ -2270,30 +2206,6 @@ declare function createNativeProxy<PROXY>(nativeCaller: NativeCaller): PROXY;
2270
2206
  */
2271
2207
  declare function wrapNativeProxy(target: NativeProxy): void;
2272
2208
 
2273
- /**
2274
- * Method decorator that emits a `LogRecord` for each invocation of the
2275
- * annotated method, capturing its arguments under `fields.args`.
2276
- *
2277
- * `ScanditLogger.emit` redacts by argument **key name** and by method name. A
2278
- * positional scalar argument has neither, so it is logged as-is: a method whose
2279
- * sensitive data arrives as a bare string or number needs an entry in
2280
- * `REDACTED_ARG_METHODS`, or no annotation.
2281
- *
2282
- * `source` and `category` are **required**: they are taxonomy labels, and a
2283
- * default would silently mislabel every record from a module that forgot to
2284
- * pass one — e.g. a barcode class inheriting `'ts.core'` and being filed under
2285
- * the wrong subsystem, which is worse than a compile error. `level` does have a
2286
- * default (`LogLevel.Debug`) because it is a severity, not a label: an
2287
- * unintended `Debug` is visible and harmless. Failures always emit at
2288
- * `LogLevel.Error` with the error attached, regardless of `level`.
2289
- */
2290
- declare function LogValues(options: {
2291
- source: string,
2292
- category: $Values<typeof LogCategory>,
2293
- level?: $Values<typeof LogLevel>,
2294
- ...
2295
- }): MethodDecorator;
2296
-
2297
2209
  /**
2298
2210
  * Wire up the cross-bridge log channel: subscribe to the native-emitted
2299
2211
  * `ScanditLogger.batch` event and merge each incoming record into the local
@@ -2310,8 +2222,8 @@ declare function LogValues(options: {
2310
2222
  * Call this once per framework, immediately after the NativeProxy is bound
2311
2223
  * (typically in `init*Proxy.ts`).
2312
2224
  *
2313
- * Returns a teardown that detaches both the BATCH_EVENT handler and the config
2314
- * listener, so the receiver can be turned off again. Calling this function more
2225
+ * Returns a teardown that detaches the BATCH_EVENT handler, the config
2226
+ * listener and the `appendLogs` sink, so the receiver can be turned off again. Calling this function more
2315
2227
  * than once on the same proxy is safe: the previous registration is disposed
2316
2228
  * first. It is NOT safe to rely on the EventEmitter to de-duplicate — it does
2317
2229
  * not (see `previousTeardowns`).
@@ -2364,13 +2276,10 @@ declare function armNativeLogReceiver(
2364
2276
  declare function subscribeNativeLogChannel(proxy: BaseProxy): Promise<void>;
2365
2277
 
2366
2278
  /**
2367
- * Per-method `LogRecord` category overrides for the CoreProxy
2368
- * bridge surface. Consumed by the centralized `ScanditLogger` interceptor
2369
- * to pick a non-default category (e.g. `Events`) for specific methods so
2370
- * that high-frequency per-frame / per-scan callbacks fall outside the
2371
- * default category mask. Level and category gate independently: those
2372
- * records are emitted at `Debug` and stay hidden until the category is
2373
- * opted into, so raising the level does not reveal them.
2279
+ * Per-method `LogRecord` level and category overrides for the CoreProxy
2280
+ * bridge surface. Consumed by the centralized `ScanditLogger` interceptor:
2281
+ * per-frame / per-scan callbacks log at `Trace` under their category label, so
2282
+ * they only show once the level is raised to `Trace`.
2374
2283
  *
2375
2284
  * Auto-registered as a side effect of importing this module via the
2376
2285
  * generated `index.ts` barrel — no customer wiring required.
@@ -7063,7 +6972,6 @@ declare export {
7063
6972
  ColorFillOverlay,
7064
6973
  ControlImage,
7065
6974
  CoreProxyAdapter,
7066
- DEFAULT_CATEGORIES,
7067
6975
  DataCaptureContextEvents,
7068
6976
  DataCaptureContextSettings,
7069
6977
  DataCaptureViewEvents,
@@ -7089,7 +6997,6 @@ declare export {
7089
6997
  ListenerRegistry,
7090
6998
  LogCategory,
7091
6999
  LogLevel,
7092
- LogValues,
7093
7000
  MacroModeListenerEvents,
7094
7001
  MeasureUnit,
7095
7002
  ModeBase,