peachsim 0.1.1667 → 0.1.1673

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.
Files changed (178) hide show
  1. package/README.md +1 -1
  2. package/cli/bridge-flow-runner.ts +4 -1
  3. package/cli/commands/coverage-swift.ts +291 -0
  4. package/cli/commands/coverage.ts +168 -24
  5. package/cli/commands/diagnose.ts +1 -19
  6. package/cli/commands/react.ts +3 -18
  7. package/cli/commands/screenshot.ts +1 -1
  8. package/cli/commands/screenshots-capture.ts +1 -1
  9. package/cli/drivers/playwright-provisioning.ts +1 -4
  10. package/cli/drivers/playwright.ts +15 -1
  11. package/cli/scene-video.ts +1 -1
  12. package/cli/ui.ts +20 -0
  13. package/cli/ws-bridge.ts +7 -36
  14. package/detox/frame-identity.cjs +21 -0
  15. package/detox/frame-identity.d.cts +6 -0
  16. package/detox/index.ts +39 -33
  17. package/detox/jest-environment.cjs +4 -1
  18. package/detox/jest-setup-after-env.cjs +0 -4
  19. package/detox/navigation-lifecycle.ts +2 -2
  20. package/detox/proof-observer.ts +126 -0
  21. package/dist-lib/agent-daemon-client.cjs +29 -1
  22. package/dist-lib/agent-events.cjs +1 -1
  23. package/dist-lib/attached-projects.cjs +10 -1
  24. package/dist-lib/auth/shared-session.cjs +1 -1
  25. package/dist-lib/backend-origin.cjs +1 -1
  26. package/dist-lib/beta.cjs +1 -1
  27. package/dist-lib/beta.mjs +1 -1
  28. package/dist-lib/bridge-constants.cjs +1 -1
  29. package/dist-lib/bridge-contract-input.cjs +1 -1
  30. package/dist-lib/bridge-contract-input.mjs +1 -1
  31. package/dist-lib/bridge-contract.cjs +1 -1
  32. package/dist-lib/bridge-contract.mjs +1 -1
  33. package/dist-lib/bundle-channel.cjs +530 -154
  34. package/dist-lib/capture-contract.cjs +1 -1
  35. package/dist-lib/capture-contract.mjs +1 -1
  36. package/dist-lib/cloud-contract.cjs +1 -1
  37. package/dist-lib/cloud-contract.mjs +1 -1
  38. package/dist-lib/cloud-test-args.cjs +1 -1
  39. package/dist-lib/cloud-test-args.mjs +1 -1
  40. package/dist-lib/cloud.cjs +1 -1
  41. package/dist-lib/cloud.mjs +1 -1
  42. package/dist-lib/config.cjs +1 -1
  43. package/dist-lib/config.mjs +1 -1
  44. package/dist-lib/detox/index.cjs +5074 -7353
  45. package/dist-lib/detox/jest-environment.cjs +4 -1
  46. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  47. package/dist-lib/expo-swift-bundle.cjs +578 -151
  48. package/dist-lib/expo-swift-metadata.cjs +1 -1
  49. package/dist-lib/expo-swift-metadata.mjs +1 -1
  50. package/dist-lib/home-paths.cjs +1 -1
  51. package/dist-lib/host/bridge-host.cjs +660 -192
  52. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  53. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  54. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  55. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  56. package/dist-lib/host/websocket-proxy.cjs +1 -1
  57. package/dist-lib/index.cjs +206 -6
  58. package/dist-lib/jump-to-source-babel.cjs +1 -1
  59. package/dist-lib/jump-to-source-native.cjs +1 -1
  60. package/dist-lib/kotlin-host.cjs +1 -1
  61. package/dist-lib/menu.cjs +1 -1
  62. package/dist-lib/menu.mjs +1 -1
  63. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  64. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  65. package/dist-lib/metro-production-bundle.cjs +10 -1
  66. package/dist-lib/metro-production-bundle.mjs +12 -1
  67. package/dist-lib/metro.cjs +155 -5
  68. package/dist-lib/native-app-identity-project.cjs +43 -5
  69. package/dist-lib/native-app-identity-project.mjs +43 -5
  70. package/dist-lib/native-app-identity.cjs +1 -1
  71. package/dist-lib/native-app-identity.mjs +1 -1
  72. package/dist-lib/native-firebase-metadata.cjs +1 -1
  73. package/dist-lib/native-firebase-metadata.mjs +1 -1
  74. package/dist-lib/plist.cjs +1 -1
  75. package/dist-lib/plist.mjs +1 -1
  76. package/dist-lib/profiles.cjs +21 -1
  77. package/dist-lib/public-brand.cjs +1 -1
  78. package/dist-lib/public-origins-lib-esm.json +73 -27
  79. package/dist-lib/public-origins-lib-static.json +1 -1
  80. package/dist-lib/public-origins-lib.json +563 -183
  81. package/dist-lib/react-native-host-modules.cjs +1 -1
  82. package/dist-lib/react-native-host-modules.mjs +1 -1
  83. package/dist-lib/reap-browser.cjs +964 -0
  84. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  85. package/dist-lib/sdk.cjs +1 -1
  86. package/dist-lib/sdk.mjs +1 -1
  87. package/dist-lib/skills.cjs +963 -521
  88. package/dist-lib/swift-compile.cjs +276 -86
  89. package/dist-lib/swift-compile.mjs +276 -86
  90. package/dist-lib/swift-package.cjs +34 -4
  91. package/dist-lib/swift-package.mjs +33 -4
  92. package/dist-lib/swift-submit.cjs +2 -2
  93. package/dist-lib/swift-submit.mjs +2 -2
  94. package/dist-lib/swift-toolchain.cjs +25 -44
  95. package/dist-lib/swift.cjs +1 -1
  96. package/dist-lib/vite-swift.cjs +579 -113
  97. package/dist-lib/vite.cjs +61 -2
  98. package/dist-lib/worklet-executable.cjs +1 -1
  99. package/dist-lib/worklet-executable.mjs +1 -1
  100. package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
  101. package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
  102. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
  103. package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
  104. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
  105. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
  106. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
  107. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
  108. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
  109. package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
  110. package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
  111. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  112. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
  113. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  114. package/package.json +1 -1
  115. package/runtime-companion.json +1 -1
  116. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
  117. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +36 -0
  118. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
  119. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
  120. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
  121. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
  122. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
  123. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
  124. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
  125. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
  126. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
  127. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
  128. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
  129. package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
  130. package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
  131. package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
  132. package/src/bridge-contract.ts +42 -0
  133. package/src/chromium-admission.ts +196 -0
  134. package/src/host/bridge-host.ts +6 -43
  135. package/src/launch-deadline.ts +74 -0
  136. package/src/nitro-adapter.lock.json +3 -3
  137. package/src/profiles.ts +21 -0
  138. package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
  139. package/src/react-native-coverage/capability-source-references.ts +1296 -0
  140. package/src/react-native-coverage/native-typescript-parser.ts +74 -0
  141. package/src/react-native-coverage/project-aliases.ts +207 -0
  142. package/src/react-native-coverage/verified-reach.ts +47 -0
  143. package/src/reap-browser.ts +1019 -0
  144. package/src/skills/builtin/a11y-review.ts +1 -1
  145. package/src/skills/builtin/perf-profile.ts +1 -1
  146. package/src/skills/builtin/screenshot-all.ts +1 -1
  147. package/src/skills/builtin/visual-diff.ts +1 -1
  148. package/src/swift-compile.ts +107 -56
  149. package/src/swift-coverage/indexdump.ts +80 -0
  150. package/src/swift-coverage/indexing.ts +147 -0
  151. package/src/swift-coverage/package.ts +230 -0
  152. package/src/swift-coverage/provenance.ts +47 -0
  153. package/src/swift-coverage/reader.ts +81 -0
  154. package/src/swift-coverage/source.ts +252 -0
  155. package/src/swift-coverage/types.ts +58 -0
  156. package/src/swift-coverage/xcode-assets.ts +175 -0
  157. package/src/swift-coverage/xcode-bridging.ts +160 -0
  158. package/src/swift-coverage/xcode-packages.ts +251 -0
  159. package/src/swift-coverage/xcode-strings.ts +78 -0
  160. package/src/swift-coverage/xcode.ts +656 -0
  161. package/src/swift-distribution.lock.json +8 -8
  162. package/src/swift-host.ts +21 -1
  163. package/src/swift-objc-import.ts +191 -27
  164. package/src/swift-objc-standin.ts +4 -2
  165. package/src/swift-package-manifest.ts +134 -13
  166. package/src/swift-package.ts +46 -4
  167. package/src/swift-submit.ts +2 -1
  168. package/src/swift-toolchain.ts +36 -61
  169. package/src/worker-system-chunks.ts +3 -10
  170. package/src/xcode-project.ts +5 -5
  171. package/detox/attempt-events.cjs +0 -914
  172. package/detox/attempt-events.d.cts +0 -113
  173. package/detox/motion-change.cjs +0 -524
  174. package/detox/motion-change.d.cts +0 -140
  175. package/detox/motion-leg-starts.cjs +0 -20
  176. package/detox/motion-leg-starts.d.cts +0 -8
  177. package/detox/proof-frame.cjs +0 -190
  178. package/detox/record-block-execution.cjs +0 -78
@@ -0,0 +1,473 @@
1
+ /*
2
+ * Copyright (c) 2000, 2001, 2003-2005, 2007-2010, 2015, 2017, 2018, 2021 Apple Inc. All rights reserved.
3
+ *
4
+ * @APPLE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://www.opensource.apple.com/apsl/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ *
21
+ * @APPLE_LICENSE_HEADER_END@
22
+ */
23
+
24
+ #ifndef _SCPREFERENCES_H
25
+ #define _SCPREFERENCES_H
26
+
27
+ #include <os/availability.h>
28
+ #include <TargetConditionals.h>
29
+ #include <sys/cdefs.h>
30
+ #include <dispatch/dispatch.h>
31
+ #include <CoreFoundation/CoreFoundation.h>
32
+ #include <SystemConfiguration/SCDynamicStore.h>
33
+
34
+ #if !TARGET_OS_IPHONE
35
+ #include <Security/Security.h>
36
+ #else // !TARGET_OS_IPHONE
37
+ typedef const struct AuthorizationOpaqueRef * AuthorizationRef;
38
+ #endif // !TARGET_OS_IPHONE
39
+
40
+ CF_IMPLICIT_BRIDGING_ENABLED
41
+ CF_ASSUME_NONNULL_BEGIN
42
+
43
+ /*!
44
+ @header SCPreferences
45
+ @discussion The SCPreferences API allows an application to load and
46
+ store XML configuration data in a controlled manner and provide
47
+ the necessary notifications to other applications that need to
48
+ be aware of configuration changes.
49
+
50
+ To access configuration preferences, you must first establish a
51
+ preferences session using the SCPreferencesCreate function.
52
+ To identify a specific set of preferences to access, you pass a
53
+ value in the prefsID parameter.
54
+ A NULL value indicates that the default system preferences are
55
+ to be accessed.
56
+ A string that starts with a leading "/" character specifies
57
+ the absolute path to the file containing the preferences to
58
+ be accessed.
59
+ A string that does not start with a leading "/" character
60
+ specifies a file relative to the default system preferences
61
+ directory.
62
+
63
+ When you are finished with the preferences session, use
64
+ CFRelease to close it.
65
+ */
66
+
67
+
68
+ /*!
69
+ @typedef SCPreferencesRef
70
+ @discussion This is the handle to an open preferences session for
71
+ accessing system configuration preferences.
72
+ */
73
+ typedef const struct CF_BRIDGED_TYPE(id) __SCPreferences * SCPreferencesRef;
74
+
75
+ /*!
76
+ @enum SCPreferencesNotification
77
+ @discussion Used with the SCPreferencesCallBack callback
78
+ to describe the type of notification.
79
+ @constant kSCPreferencesNotificationCommit Indicates when new
80
+ preferences have been saved.
81
+ @constant kSCPreferencesNotificationApply Key Indicates when a
82
+ request has been made to apply the currently saved
83
+ preferences to the active system configuration.
84
+ */
85
+ typedef CF_OPTIONS(uint32_t, SCPreferencesNotification) {
86
+ kSCPreferencesNotificationCommit
87
+ API_AVAILABLE(macos(10.4))
88
+ API_UNAVAILABLE(ios, tvos, watchos) = 1<<0,
89
+ kSCPreferencesNotificationApply
90
+ API_AVAILABLE(macos(10.4))
91
+ API_UNAVAILABLE(ios, tvos, watchos) = 1<<1
92
+ };
93
+
94
+ /*!
95
+ @typedef SCPreferencesContext
96
+ Structure containing user-specified data and callbacks for SCPreferences.
97
+ @field version The version number of the structure type being passed
98
+ in as a parameter to the SCPreferencesSetCallback function.
99
+ This structure is version 0.
100
+ @field info A C pointer to a user-specified block of data.
101
+ @field retain The callback used to add a retain for the info field.
102
+ If this parameter is not a pointer to a function of the correct
103
+ prototype, the behavior is undefined.
104
+ The value may be NULL.
105
+ @field release The calllback used to remove a retain previously added
106
+ for the info field.
107
+ If this parameter is not a pointer to a function of the
108
+ correct prototype, the behavior is undefined.
109
+ The value may be NULL.
110
+ @field copyDescription The callback used to provide a description of
111
+ the info field.
112
+ */
113
+ typedef struct {
114
+ CFIndex version;
115
+ void * __nullable info;
116
+ const void * __nonnull (* __nullable retain)(const void *info);
117
+ void (* __nullable release)(const void *info);
118
+ CFStringRef __nonnull (* __nullable copyDescription)(const void *info);
119
+ } SCPreferencesContext;
120
+
121
+ /*!
122
+ @typedef SCPreferencesCallBack
123
+ @discussion Type of the callback function used when the
124
+ preferences have been updated and/or applied.
125
+ @param prefs The preferences session.
126
+ @param notificationType The type of notification, such as changes
127
+ committed, changes applied, etc.
128
+ @param info A C pointer to a user-specified block of data.
129
+ */
130
+ typedef void (*SCPreferencesCallBack) (
131
+ SCPreferencesRef prefs,
132
+ SCPreferencesNotification notificationType,
133
+ void * __nullable info
134
+ );
135
+
136
+
137
+ __BEGIN_DECLS
138
+
139
+ /*!
140
+ @function SCPreferencesGetTypeID
141
+ @discussion Returns the type identifier of all SCPreferences instances.
142
+ */
143
+ CFTypeID
144
+ SCPreferencesGetTypeID (void) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
145
+
146
+ /*!
147
+ @function SCPreferencesCreate
148
+ @discussion Initiates access to the per-system set of configuration
149
+ preferences.
150
+ @param allocator The CFAllocator that should be used to allocate
151
+ memory for this preferences session.
152
+ This parameter may be NULL in which case the current
153
+ default CFAllocator is used.
154
+ If this reference is not a valid CFAllocator, the behavior
155
+ is undefined.
156
+ @param name A string that describes the name of the calling
157
+ process.
158
+ @param prefsID A string that identifies the name of the
159
+ group of preferences to be accessed or updated.
160
+ @result Returns a reference to the new SCPreferences.
161
+ You must release the returned value.
162
+ */
163
+ SCPreferencesRef __nullable
164
+ SCPreferencesCreate (
165
+ CFAllocatorRef __nullable allocator,
166
+ CFStringRef name,
167
+ CFStringRef __nullable prefsID
168
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
169
+
170
+
171
+ /*!
172
+ @function SCPreferencesCreateWithAuthorization
173
+ @discussion Initiates access to the per-system set of configuration
174
+ preferences.
175
+ @param allocator The CFAllocator that should be used to allocate
176
+ memory for this preferences session.
177
+ This parameter may be NULL in which case the current
178
+ default CFAllocator is used.
179
+ If this reference is not a valid CFAllocator, the behavior
180
+ is undefined.
181
+ @param name A string that describes the name of the calling
182
+ process.
183
+ @param prefsID A string that identifies the name of the
184
+ group of preferences to be accessed or updated.
185
+ @param authorization An authorization reference that is used to
186
+ authorize any access to the enhanced privileges needed
187
+ to manage the preferences session.
188
+ @result Returns a reference to the new SCPreferences.
189
+ You must release the returned value.
190
+ */
191
+ SCPreferencesRef __nullable
192
+ SCPreferencesCreateWithAuthorization (
193
+ CFAllocatorRef __nullable allocator,
194
+ CFStringRef name,
195
+ CFStringRef __nullable prefsID,
196
+ AuthorizationRef __nullable authorization
197
+ ) API_AVAILABLE(macos(10.5)) API_UNAVAILABLE(ios, tvos, watchos);
198
+
199
+ /*!
200
+ @function SCPreferencesLock
201
+ @discussion Locks access to the configuration preferences.
202
+
203
+ This function obtains exclusive access to the configuration
204
+ preferences. Clients attempting to obtain exclusive access
205
+ to the preferences will either receive a kSCStatusPrefsBusy
206
+ error or block waiting for the lock to be released.
207
+ @param prefs The preferences session.
208
+ @param wait A boolean flag indicating whether the calling process
209
+ should block waiting for another process to complete its update
210
+ operation and release its lock.
211
+ @result Returns TRUE if the lock was obtained;
212
+ FALSE if an error occurred.
213
+ */
214
+ Boolean
215
+ SCPreferencesLock (
216
+ SCPreferencesRef prefs,
217
+ Boolean wait
218
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
219
+
220
+ /*!
221
+ @function SCPreferencesCommitChanges
222
+ @discussion Commits changes made to the configuration preferences to
223
+ persistent storage.
224
+
225
+ This function commits any changes to permanent storage.
226
+ Implicit calls to the SCPreferencesLock and SCPreferencesUnlock
227
+ functions will be made if exclusive access has not already been
228
+ established.
229
+
230
+ Note: This routine commits changes to persistent storage.
231
+ Call the SCPreferencesApplyChanges function to apply the
232
+ changes to the running system.
233
+ @param prefs The preferences session.
234
+ @result Returns TRUE if the lock was obtained;
235
+ FALSE if an error occurred.
236
+ */
237
+ Boolean
238
+ SCPreferencesCommitChanges (
239
+ SCPreferencesRef prefs
240
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
241
+
242
+ /*!
243
+ @function SCPreferencesApplyChanges
244
+ @discussion Requests that the currently stored configuration
245
+ preferences be applied to the active configuration.
246
+ @param prefs The preferences session.
247
+ @result Returns TRUE if the lock was obtained;
248
+ FALSE if an error occurred.
249
+ */
250
+ Boolean
251
+ SCPreferencesApplyChanges (
252
+ SCPreferencesRef prefs
253
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
254
+
255
+ /*!
256
+ @function SCPreferencesUnlock
257
+ @discussion Releases exclusive access to the configuration preferences.
258
+
259
+ This function releases the exclusive access lock to the
260
+ preferences. Other clients will be now be able to establish
261
+ exclusive access to the preferences.
262
+ @param prefs The preferences session.
263
+ @result Returns TRUE if the lock was obtained;
264
+ FALSE if an error occurred.
265
+ */
266
+ Boolean
267
+ SCPreferencesUnlock (
268
+ SCPreferencesRef prefs
269
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
270
+
271
+ /*!
272
+ @function SCPreferencesGetSignature
273
+ @discussion Returns a sequence of bytes that can be used to determine
274
+ if the saved configuration preferences have changed.
275
+ @param prefs The preferences session.
276
+ @result Returns a CFDataRef that reflects the signature of the configuration
277
+ preferences at the time of the call to the SCPreferencesCreate function.
278
+ */
279
+ CFDataRef __nullable
280
+ SCPreferencesGetSignature (
281
+ SCPreferencesRef prefs
282
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
283
+
284
+ /*!
285
+ @function SCPreferencesCopyKeyList
286
+ @discussion Returns an array of currently defined preference keys.
287
+ @param prefs The preferences session.
288
+ @result Returns the list of keys.
289
+ You must release the returned value.
290
+ */
291
+ CFArrayRef __nullable
292
+ SCPreferencesCopyKeyList (
293
+ SCPreferencesRef prefs
294
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
295
+
296
+ /*!
297
+ @function SCPreferencesGetValue
298
+ @discussion Returns the data associated with a preference key.
299
+
300
+ This function retrieves data associated with the specified
301
+ key.
302
+
303
+ Note: To avoid inadvertantly reading stale data, first call
304
+ the SCPreferencesLock function.
305
+ @param prefs The preferences session.
306
+ @param key The preference key to be returned.
307
+ @result Returns the value associated with the specified preference key;
308
+ NULL if no value was located.
309
+ */
310
+ CFPropertyListRef __nullable
311
+ SCPreferencesGetValue (
312
+ SCPreferencesRef prefs,
313
+ CFStringRef key
314
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
315
+
316
+ /*!
317
+ @function SCPreferencesAddValue
318
+ @discussion Adds data for a preference key.
319
+
320
+ This function associates new data with the specified key.
321
+ To commit these changes to permanent storage, a call must
322
+ be made to the SCPreferencesCommitChanges function.
323
+ @param prefs The preferences session.
324
+ @param key The preference key to be updated.
325
+ @param value The CFPropertyListRef object containing the
326
+ value to be associated with the specified preference key.
327
+ @result Returns TRUE if the value was added;
328
+ FALSE if the key already exists or
329
+ if an error occurred.
330
+ */
331
+ Boolean
332
+ SCPreferencesAddValue (
333
+ SCPreferencesRef prefs,
334
+ CFStringRef key,
335
+ CFPropertyListRef value
336
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
337
+
338
+ /*!
339
+ @function SCPreferencesSetValue
340
+ @discussion Updates the data associated with a preference key.
341
+
342
+ This function adds or replaces the value associated with the
343
+ specified key. To commit these changes to permanent storage
344
+ a call must be made to the SCPreferencesCommitChanges function.
345
+ @param prefs The preferences session.
346
+ @param key The preference key to be updated.
347
+ @param value The CFPropertyListRef object containing the
348
+ data to be associated with the specified preference key.
349
+ @result Returns TRUE if the value was set;
350
+ FALSE if an error occurred.
351
+ */
352
+ Boolean
353
+ SCPreferencesSetValue (
354
+ SCPreferencesRef prefs,
355
+ CFStringRef key,
356
+ CFPropertyListRef value
357
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
358
+
359
+ /*!
360
+ @function SCPreferencesRemoveValue
361
+ @discussion Removes the data associated with a preference key.
362
+
363
+ This function removes the data associated with the specified
364
+ key. To commit these changes to permanent storage a call must
365
+ be made to the SCPreferencesCommitChanges function.
366
+ @param prefs The preferences session.
367
+ @param key The preference key to be removed.
368
+ @result Returns TRUE if the value was removed;
369
+ FALSE if the key did not exist or if an error occurred.
370
+ */
371
+ Boolean
372
+ SCPreferencesRemoveValue (
373
+ SCPreferencesRef prefs,
374
+ CFStringRef key
375
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
376
+
377
+ /*!
378
+ @function SCPreferencesSetCallback
379
+ @discussion Assigns a callback to a preferences session. The function
380
+ is called when the changes to the preferences have been
381
+ committed or applied.
382
+ @param prefs The preferences session.
383
+ @param callout The function to be called when the preferences have
384
+ been changed or applied.
385
+ If NULL, the current callback is removed.
386
+ @param context The SCPreferencesContext associated with
387
+ the callout.
388
+ @result Returns TRUE if the notification client was successfully set.
389
+ */
390
+ Boolean
391
+ SCPreferencesSetCallback (
392
+ SCPreferencesRef prefs,
393
+ SCPreferencesCallBack __nullable callout,
394
+ SCPreferencesContext * __nullable context
395
+ ) API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, tvos, watchos);
396
+
397
+ /*!
398
+ @function SCPreferencesScheduleWithRunLoop
399
+ @discussion Schedule commit and apply notifications for the specified
400
+ preferences session using the specified run loop and mode.
401
+ @param prefs The preferences session.
402
+ @param runLoop A reference to a run loop on which the notification
403
+ should be scheduled.
404
+ Must be non-NULL.
405
+ @param runLoopMode The mode on which to schedule the notification.
406
+ Must be non-NULL.
407
+ @result Returns TRUE if the notifications are successfully scheduled;
408
+ FALSE otherwise.
409
+ */
410
+ Boolean
411
+ SCPreferencesScheduleWithRunLoop (
412
+ SCPreferencesRef prefs,
413
+ CFRunLoopRef runLoop,
414
+ CFStringRef runLoopMode
415
+ ) API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, tvos, watchos);
416
+
417
+ /*!
418
+ @function SCPreferencesUnscheduleFromRunLoop
419
+ @discussion Unschedule commit and apply notifications for the specified
420
+ preferences session from the specified run loop and mode.
421
+ @param prefs The preferences session.
422
+ @param runLoop A reference to a run loop from which the notification
423
+ should be unscheduled.
424
+ Must be non-NULL.
425
+ @param runLoopMode The mode on which to unschedule the notification.
426
+ Must be non-NULL.
427
+ @result Returns TRUE if the notifications are successfully unscheduled;
428
+ FALSE otherwise.
429
+ */
430
+ Boolean
431
+ SCPreferencesUnscheduleFromRunLoop (
432
+ SCPreferencesRef prefs,
433
+ CFRunLoopRef runLoop,
434
+ CFStringRef runLoopMode
435
+ ) API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, tvos, watchos);
436
+
437
+ /*!
438
+ @function SCPreferencesSetDispatchQueue
439
+ @discussion Schedule commit and apply notifications for the specified
440
+ preferences session.
441
+ @param prefs The preferences session.
442
+ @param queue The dispatch queue to run the callback function on.
443
+ @result Returns TRUE if the notifications are successfully scheduled;
444
+ FALSE otherwise.
445
+ */
446
+ Boolean
447
+ SCPreferencesSetDispatchQueue (
448
+ SCPreferencesRef prefs,
449
+ dispatch_queue_t __nullable queue
450
+ ) API_AVAILABLE(macos(10.6)) API_UNAVAILABLE(ios, tvos, watchos);
451
+
452
+ /*!
453
+ @function SCPreferencesSynchronize
454
+ @discussion Synchronizes accessed preferences with committed changes.
455
+
456
+ Any references to preference values returned by calls to the
457
+ SCPreferencesGetValue function are no longer valid unless they
458
+ were explicitly retained or copied. Any preference values
459
+ that were updated (add, set, remove) but not committed will
460
+ be discarded.
461
+ @param prefs The preferences session.
462
+ */
463
+ void
464
+ SCPreferencesSynchronize (
465
+ SCPreferencesRef prefs
466
+ ) API_AVAILABLE(macos(10.4)) API_UNAVAILABLE(ios, tvos, watchos);
467
+
468
+ __END_DECLS
469
+
470
+ CF_ASSUME_NONNULL_END
471
+ CF_IMPLICIT_BRIDGING_DISABLED
472
+
473
+ #endif /* _SCPREFERENCES_H */
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Copyright (c) 2000, 2001, 2004, 2005, 2008, 2015, 2018 Apple Inc. All rights reserved.
3
+ *
4
+ * @APPLE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://www.opensource.apple.com/apsl/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ *
21
+ * @APPLE_LICENSE_HEADER_END@
22
+ */
23
+
24
+ #ifndef _SCPREFERENCESPATH_H
25
+ #define _SCPREFERENCESPATH_H
26
+
27
+ #include <os/availability.h>
28
+ #include <sys/cdefs.h>
29
+ #include <CoreFoundation/CoreFoundation.h>
30
+ #include <SystemConfiguration/SCPreferences.h>
31
+
32
+ CF_IMPLICIT_BRIDGING_ENABLED
33
+ CF_ASSUME_NONNULL_BEGIN
34
+
35
+ /*!
36
+ @header SCPreferencesPath
37
+ @discussion The SCPreferencesPath API allows an application to
38
+ load and store XML configuration data in a controlled
39
+ manner and provide the necessary notifications to other
40
+ applications that need to be aware of configuration
41
+ changes.
42
+
43
+ The functions in the SCPreferencesPath API make certain
44
+ assumptions about the layout of the preferences data.
45
+ These functions view the data as a collection of dictionaries
46
+ of key-value pairs and an associated path name.
47
+ The root path ("/") identifies the top-level dictionary.
48
+ Additional path components specify the keys for subdictionaries.
49
+
50
+ For example, the following dictionary can be accessed via
51
+ two paths. The root ("/") path would return a dictionary
52
+ with all keys and values. The path "/path1" would only
53
+ return the dictionary with the "key3" and "key4" properties.
54
+
55
+ <pre>
56
+ @textblock
57
+ <dict>
58
+ <key>key1</key>
59
+ <string>val1</string>
60
+ <key>key2</key>
61
+ <string>val2</string>
62
+ <key>path1</key>
63
+ <dict>
64
+ <key>key3</key>
65
+ <string>val3</string>
66
+ <key>key4</key>
67
+ <string>val4</string>
68
+ </dict>
69
+ </dict>
70
+ @/textblock
71
+ </pre>
72
+
73
+ Each dictionary can also include the kSCResvLink ("__LINK__") key.
74
+ The value associated with this key is interpreted as a link to
75
+ another path. If this key is present, a call to the
76
+ SCPreferencesPathGetValue function returns the dictionary
77
+ specified by the link.
78
+ */
79
+
80
+
81
+ __BEGIN_DECLS
82
+
83
+ /*!
84
+ @function SCPreferencesPathCreateUniqueChild
85
+ @discussion Creates a new path component within the dictionary
86
+ hierarchy.
87
+ @param prefs The preferences session.
88
+ @param prefix A string that represents the parent path.
89
+ @result Returns a string representing the new (unique) child path; NULL
90
+ if the specified path does not exist.
91
+ */
92
+ CFStringRef __nullable
93
+ SCPreferencesPathCreateUniqueChild (
94
+ SCPreferencesRef prefs,
95
+ CFStringRef prefix
96
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
97
+
98
+ /*!
99
+ @function SCPreferencesPathGetValue
100
+ @discussion Returns the dictionary associated with the specified
101
+ path.
102
+ @param prefs The preferences session.
103
+ @param path A string that represents the path to be returned.
104
+ @result Returns the dictionary associated with the specified path; NULL
105
+ if the path does not exist.
106
+ */
107
+ CFDictionaryRef __nullable
108
+ SCPreferencesPathGetValue (
109
+ SCPreferencesRef prefs,
110
+ CFStringRef path
111
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
112
+
113
+ /*!
114
+ @function SCPreferencesPathGetLink
115
+ @discussion Returns the link (if one exists) associated with the
116
+ specified path.
117
+ @param prefs The preferences session.
118
+ @param path A string that represents the path to be returned.
119
+ @result Returns the dictionary associated with the specified path; NULL
120
+ if the path is not a link or does not exist.
121
+ */
122
+ CFStringRef __nullable
123
+ SCPreferencesPathGetLink (
124
+ SCPreferencesRef prefs,
125
+ CFStringRef path
126
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
127
+
128
+ /*!
129
+ @function SCPreferencesPathSetValue
130
+ @discussion Associates a dictionary with the specified path.
131
+ @param prefs The preferences session.
132
+ @param path A string that represents the path to be updated.
133
+ @param value A dictionary that represents the data to be
134
+ stored at the specified path.
135
+ @result Returns TRUE if successful; FALSE otherwise.
136
+ */
137
+ Boolean
138
+ SCPreferencesPathSetValue (
139
+ SCPreferencesRef prefs,
140
+ CFStringRef path,
141
+ CFDictionaryRef value
142
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
143
+
144
+ /*!
145
+ @function SCPreferencesPathSetLink
146
+ @discussion Associates a link to a second dictionary at the
147
+ specified path.
148
+ @param prefs The preferences session.
149
+ @param path A string that represents the path to be updated.
150
+ @param link A string that represents the link to be stored
151
+ at the specified path.
152
+ @result Returns TRUE if successful; FALSE otherwise.
153
+ */
154
+ Boolean
155
+ SCPreferencesPathSetLink (
156
+ SCPreferencesRef prefs,
157
+ CFStringRef path,
158
+ CFStringRef link
159
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
160
+
161
+ /*!
162
+ @function SCPreferencesPathRemoveValue
163
+ @discussion Removes the data associated with the specified path.
164
+ @param prefs The preferences session.
165
+ @param path A string that represents the path to be returned.
166
+ @result Returns TRUE if successful; FALSE otherwise.
167
+ */
168
+ Boolean
169
+ SCPreferencesPathRemoveValue (
170
+ SCPreferencesRef prefs,
171
+ CFStringRef path
172
+ ) API_AVAILABLE(macos(10.1)) API_UNAVAILABLE(ios, tvos, watchos);
173
+
174
+ __END_DECLS
175
+
176
+ CF_ASSUME_NONNULL_END
177
+ CF_IMPLICIT_BRIDGING_DISABLED
178
+
179
+ #endif /* _SCPREFERENCESPATH_H */