@logbrew/react-native 0.1.12 → 0.1.14

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.
@@ -3,7 +3,7 @@ import Foundation
3
3
  @objc(LBRNAppleNativeDiagnostics)
4
4
  public final class LBRNAppleNativeDiagnostics: NSObject, @unchecked Sendable {
5
5
  private static let shared = LBRNAppleNativeDiagnostics()
6
- private static let sdkVersion = "0.1.12"
6
+ private static let sdkVersion = "0.1.14"
7
7
 
8
8
  private let lock = NSLock()
9
9
  private let replayQueue = DispatchQueue(label: "co.logbrew.react-native.apple-diagnostics-replay")
@@ -277,6 +277,7 @@ private extension MetricAttributes {
277
277
  temporality: temporality,
278
278
  metadata: metadata,
279
279
  context: context,
280
+ description: description,
280
281
  )
281
282
  }
282
283
 
@@ -289,6 +290,7 @@ private extension MetricAttributes {
289
290
  temporality: temporality,
290
291
  metadata: correlationMetadata(metadata, context: context),
291
292
  context: context,
293
+ description: description,
292
294
  )
293
295
  }
294
296
  }
@@ -307,6 +307,7 @@ public struct ActionAttributes: Codable, Equatable, Sendable {
307
307
 
308
308
  public struct MetricAttributes: Codable, Equatable, Sendable {
309
309
  public let name: String
310
+ public let description: String?
310
311
  public let kind: MetricKind
311
312
  public let value: Double
312
313
  public let unit: String
@@ -322,8 +323,10 @@ public struct MetricAttributes: Codable, Equatable, Sendable {
322
323
  temporality: MetricTemporality,
323
324
  metadata: Metadata? = nil,
324
325
  context: TelemetryContext? = nil,
326
+ description: String? = nil,
325
327
  ) {
326
328
  self.name = name
329
+ self.description = description
327
330
  self.kind = kind
328
331
  self.value = value
329
332
  self.unit = unit
@@ -121,6 +121,7 @@ func validateMetric(_ attributes: MetricAttributes) throws -> MetricAttributes {
121
121
  }
122
122
  }
123
123
  try validateMetadata(attributes.metadata, label: "metric metadata")
124
+ let description = try attributes.description.map(normalizeMetricDescription)
124
125
  return try MetricAttributes(
125
126
  name: attributes.name,
126
127
  kind: attributes.kind,
@@ -129,9 +130,27 @@ func validateMetric(_ attributes: MetricAttributes) throws -> MetricAttributes {
129
130
  temporality: attributes.temporality,
130
131
  metadata: attributes.metadata,
131
132
  context: attributes.context.map { try validateTelemetryContext($0) },
133
+ description: description,
132
134
  )
133
135
  }
134
136
 
137
+ private func normalizeMetricDescription(_ value: String) throws -> String {
138
+ let normalized = value.trimmingCharacters(in: .whitespacesAndNewlines)
139
+ let invalidCharacter = normalized.unicodeScalars.contains { scalar in
140
+ scalar.value <= 0x1F
141
+ || (0x7F ... 0x9F).contains(scalar.value)
142
+ || scalar.value == 0x2028
143
+ || scalar.value == 0x2029
144
+ }
145
+ guard !normalized.isEmpty, normalized.unicodeScalars.count <= 1024, !invalidCharacter else {
146
+ throw SdkError(
147
+ code: "validation_error",
148
+ message: "metric description must be a non-blank string of at most 1024 non-control characters",
149
+ )
150
+ }
151
+ return normalized
152
+ }
153
+
135
154
  func requireNonEmpty(_ label: String, _ value: String) throws {
136
155
  if value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
137
156
  throw SdkError(code: "validation_error", message: "\(label) must be non-empty")
@@ -12,20 +12,20 @@
12
12
  "swift/logbrew-swift/Sources/LogBrew/EventEncoding.swift": "b88b6b2d17f7d0cee9ac1a1f34ef35b192cd33d213ef3c9e1c2d21cbcc304a97",
13
13
  "swift/logbrew-swift/Sources/LogBrew/IssueDiagnostics.swift": "797e6e25f203930e85f827bf211b58c73e6b10938b9f0943f2fe6f6757186ba9",
14
14
  "swift/logbrew-swift/Sources/LogBrew/LifecycleTrace.swift": "738cd3f129fac821a892404d1d42ee92bd806b6583d3dbb5379e88b14ab23c16",
15
- "swift/logbrew-swift/Sources/LogBrew/LogBrewClient.swift": "2e6dd7c9ef07f181a2798c36a820338e3f81369b1b9c7b85c5c3b6f44103732c",
15
+ "swift/logbrew-swift/Sources/LogBrew/LogBrewClient.swift": "84de0b8ca69c5da834be31ef103ed62755e2dddc3bae0e8fa476920623b17cbb",
16
16
  "swift/logbrew-swift/Sources/LogBrew/LogBrewLogger.swift": "d3266353a5f5139a2a1ca1a86bacce793518eb1489bf67ed9e3720b57b1c29b2",
17
17
  "swift/logbrew-swift/Sources/LogBrew/LogBrewTrace.swift": "f67edf4ca464e6a6eb1c7a22cd4997928cd27b6c2d07535855a18a053d8de924",
18
18
  "swift/logbrew-swift/Sources/LogBrew/Metadata.swift": "65840ebb3f3b79fbfc1f5faa3026c2583319e89ff26061676dc552c03ee15dbe",
19
19
  "swift/logbrew-swift/Sources/LogBrew/NativeStackFrame.swift": "ecbd418969ec4a31503d9916a8bf27f22e6863356c6fabe457c1e61027a8d805",
20
20
  "swift/logbrew-swift/Sources/LogBrew/ProductTimeline.swift": "209906aa0e8f096a347e35832840522710eadfb530053253cd73c748518e362d",
21
- "swift/logbrew-swift/Sources/LogBrew/PublicTypes.swift": "d64de009cd9f8f43fc059cd8fefc2a282c781ba8543be2f56cb48cb757dbe924",
21
+ "swift/logbrew-swift/Sources/LogBrew/PublicTypes.swift": "36e4d650e6375400acc8a9f0c0c92def55a519f1c1d7ea7456cb411952b564f3",
22
22
  "swift/logbrew-swift/Sources/LogBrew/TelemetryContext.swift": "ce3ac93a62a345f8c9a8f4c69ce84efc991bf02a688f49bad5e68edcff2f6e08",
23
23
  "swift/logbrew-swift/Sources/LogBrew/TelemetryContextValidation.swift": "f631beef20a8a86f975787b4092a9798fedbe2c9e3f0d2740f81831b4adef287",
24
24
  "swift/logbrew-swift/Sources/LogBrew/TraceEvidence.swift": "40aaa42976164c53d9f4d9e9e30d236534238da43bbe90832a673c8809ad54b6",
25
25
  "swift/logbrew-swift/Sources/LogBrew/Transport.swift": "73eec81aaebec4bc922b2a372429c88fcd3e85606a7862cd08e1795eb2a8e6cd",
26
26
  "swift/logbrew-swift/Sources/LogBrew/URLSessionTrace.swift": "d0076c72671716c41bd7498d0509e453b8182c418156e169196fee9f26fc66b1",
27
27
  "swift/logbrew-swift/Sources/LogBrew/URLSessionTracer.swift": "0cdf08f92d6111c0dc2883b87837b81f69b5c2f9a8e5501780a114c23a741af7",
28
- "swift/logbrew-swift/Sources/LogBrew/Validation.swift": "5551ee5237cbdf1c9ed4ee93025f95313e4dd84f31ce7cb774d1dc01175213c7",
28
+ "swift/logbrew-swift/Sources/LogBrew/Validation.swift": "07ff5c2daeb829b1df4f50edb0b79727f9a81b1c9b5cde5f995f5ad6ce660aa7",
29
29
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashEngine.swift": "7a46035fcaa72dd7504b4e274a92070d73dd1c45fe20e008474340d6d7c44ede",
30
30
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashReportSanitizer.swift": "a872ad63532999e74af1e9685a9382d0e02b93c6f9b942b371d47f56f8b961c0",
31
31
  "swift/logbrew-swift/Sources/LogBrewCrash/CrashStorageDirectory.swift": "7cd566703cbf704dc99155451ee93dcace12c35c805abc09a6dcf23975cf43f9",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logbrew/react-native",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "React Native offline delivery, Apple native diagnostics, screen, error, trace, action, and network timeline helpers for LogBrew.",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
@@ -240,7 +240,7 @@
240
240
  "url": "git+https://github.com/LogBrewCo/sdk.git"
241
241
  },
242
242
  "peerDependencies": {
243
- "@logbrew/sdk": "^0.1.5",
243
+ "@logbrew/sdk": "^0.1.7",
244
244
  "expo": ">=49",
245
245
  "react": ">=18",
246
246
  "react-native": ">=0.72"