appwrite-cli 0.14.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.
Files changed (413) hide show
  1. package/.github/workflows/npm-publish.yml +41 -0
  2. package/Formula/appwrite.rb +19 -0
  3. package/LICENSE.md +12 -0
  4. package/README.md +102 -0
  5. package/docs/examples/account/create-anonymous-session.md +1 -0
  6. package/docs/examples/account/create-j-w-t.md +1 -0
  7. package/docs/examples/account/create-magic-u-r-l-session.md +4 -0
  8. package/docs/examples/account/create-o-auth2session.md +5 -0
  9. package/docs/examples/account/create-recovery.md +3 -0
  10. package/docs/examples/account/create-session.md +3 -0
  11. package/docs/examples/account/create-verification.md +2 -0
  12. package/docs/examples/account/create.md +5 -0
  13. package/docs/examples/account/delete-session.md +2 -0
  14. package/docs/examples/account/delete-sessions.md +1 -0
  15. package/docs/examples/account/delete.md +1 -0
  16. package/docs/examples/account/get-logs.md +3 -0
  17. package/docs/examples/account/get-prefs.md +1 -0
  18. package/docs/examples/account/get-session.md +2 -0
  19. package/docs/examples/account/get-sessions.md +1 -0
  20. package/docs/examples/account/get.md +1 -0
  21. package/docs/examples/account/update-email.md +3 -0
  22. package/docs/examples/account/update-magic-u-r-l-session.md +3 -0
  23. package/docs/examples/account/update-name.md +2 -0
  24. package/docs/examples/account/update-password.md +3 -0
  25. package/docs/examples/account/update-prefs.md +2 -0
  26. package/docs/examples/account/update-recovery.md +5 -0
  27. package/docs/examples/account/update-session.md +2 -0
  28. package/docs/examples/account/update-verification.md +3 -0
  29. package/docs/examples/avatars/get-browser.md +5 -0
  30. package/docs/examples/avatars/get-credit-card.md +5 -0
  31. package/docs/examples/avatars/get-favicon.md +2 -0
  32. package/docs/examples/avatars/get-flag.md +5 -0
  33. package/docs/examples/avatars/get-image.md +4 -0
  34. package/docs/examples/avatars/get-initials.md +6 -0
  35. package/docs/examples/avatars/get-q-r.md +5 -0
  36. package/docs/examples/database/create-boolean-attribute.md +6 -0
  37. package/docs/examples/database/create-collection.md +6 -0
  38. package/docs/examples/database/create-document.md +6 -0
  39. package/docs/examples/database/create-email-attribute.md +6 -0
  40. package/docs/examples/database/create-enum-attribute.md +7 -0
  41. package/docs/examples/database/create-float-attribute.md +8 -0
  42. package/docs/examples/database/create-index.md +6 -0
  43. package/docs/examples/database/create-integer-attribute.md +8 -0
  44. package/docs/examples/database/create-ip-attribute.md +6 -0
  45. package/docs/examples/database/create-string-attribute.md +7 -0
  46. package/docs/examples/database/create-url-attribute.md +6 -0
  47. package/docs/examples/database/delete-attribute.md +3 -0
  48. package/docs/examples/database/delete-collection.md +2 -0
  49. package/docs/examples/database/delete-document.md +3 -0
  50. package/docs/examples/database/delete-index.md +3 -0
  51. package/docs/examples/database/get-attribute.md +3 -0
  52. package/docs/examples/database/get-collection-usage.md +3 -0
  53. package/docs/examples/database/get-collection.md +2 -0
  54. package/docs/examples/database/get-document.md +3 -0
  55. package/docs/examples/database/get-index.md +3 -0
  56. package/docs/examples/database/get-usage.md +2 -0
  57. package/docs/examples/database/list-attributes.md +2 -0
  58. package/docs/examples/database/list-collection-logs.md +4 -0
  59. package/docs/examples/database/list-collections.md +7 -0
  60. package/docs/examples/database/list-document-logs.md +5 -0
  61. package/docs/examples/database/list-documents.md +9 -0
  62. package/docs/examples/database/list-indexes.md +2 -0
  63. package/docs/examples/database/update-collection.md +7 -0
  64. package/docs/examples/database/update-document.md +6 -0
  65. package/docs/examples/functions/create-deployment.md +5 -0
  66. package/docs/examples/functions/create-execution.md +4 -0
  67. package/docs/examples/functions/create.md +9 -0
  68. package/docs/examples/functions/delete-deployment.md +3 -0
  69. package/docs/examples/functions/delete.md +2 -0
  70. package/docs/examples/functions/get-deployment.md +3 -0
  71. package/docs/examples/functions/get-execution.md +3 -0
  72. package/docs/examples/functions/get-usage.md +3 -0
  73. package/docs/examples/functions/get.md +2 -0
  74. package/docs/examples/functions/list-deployments.md +8 -0
  75. package/docs/examples/functions/list-executions.md +7 -0
  76. package/docs/examples/functions/list-runtimes.md +1 -0
  77. package/docs/examples/functions/list.md +7 -0
  78. package/docs/examples/functions/retry-build.md +4 -0
  79. package/docs/examples/functions/update-deployment.md +3 -0
  80. package/docs/examples/functions/update.md +8 -0
  81. package/docs/examples/health/get-antivirus.md +1 -0
  82. package/docs/examples/health/get-cache.md +1 -0
  83. package/docs/examples/health/get-d-b.md +1 -0
  84. package/docs/examples/health/get-queue-certificates.md +1 -0
  85. package/docs/examples/health/get-queue-functions.md +1 -0
  86. package/docs/examples/health/get-queue-logs.md +1 -0
  87. package/docs/examples/health/get-queue-usage.md +1 -0
  88. package/docs/examples/health/get-queue-webhooks.md +1 -0
  89. package/docs/examples/health/get-storage-local.md +1 -0
  90. package/docs/examples/health/get-time.md +1 -0
  91. package/docs/examples/health/get.md +1 -0
  92. package/docs/examples/locale/get-continents.md +1 -0
  93. package/docs/examples/locale/get-countries-e-u.md +1 -0
  94. package/docs/examples/locale/get-countries-phones.md +1 -0
  95. package/docs/examples/locale/get-countries.md +1 -0
  96. package/docs/examples/locale/get-currencies.md +1 -0
  97. package/docs/examples/locale/get-languages.md +1 -0
  98. package/docs/examples/locale/get.md +1 -0
  99. package/docs/examples/projects/create-domain.md +3 -0
  100. package/docs/examples/projects/create-key.md +4 -0
  101. package/docs/examples/projects/create-platform.md +7 -0
  102. package/docs/examples/projects/create-webhook.md +8 -0
  103. package/docs/examples/projects/create.md +13 -0
  104. package/docs/examples/projects/delete-domain.md +3 -0
  105. package/docs/examples/projects/delete-key.md +3 -0
  106. package/docs/examples/projects/delete-platform.md +3 -0
  107. package/docs/examples/projects/delete-webhook.md +3 -0
  108. package/docs/examples/projects/delete.md +3 -0
  109. package/docs/examples/projects/get-domain.md +3 -0
  110. package/docs/examples/projects/get-key.md +3 -0
  111. package/docs/examples/projects/get-platform.md +3 -0
  112. package/docs/examples/projects/get-usage.md +3 -0
  113. package/docs/examples/projects/get-webhook.md +3 -0
  114. package/docs/examples/projects/get.md +2 -0
  115. package/docs/examples/projects/list-domains.md +2 -0
  116. package/docs/examples/projects/list-keys.md +2 -0
  117. package/docs/examples/projects/list-platforms.md +2 -0
  118. package/docs/examples/projects/list-webhooks.md +2 -0
  119. package/docs/examples/projects/list.md +7 -0
  120. package/docs/examples/projects/update-auth-limit.md +3 -0
  121. package/docs/examples/projects/update-auth-status.md +4 -0
  122. package/docs/examples/projects/update-domain-verification.md +3 -0
  123. package/docs/examples/projects/update-key.md +5 -0
  124. package/docs/examples/projects/update-o-auth2.md +5 -0
  125. package/docs/examples/projects/update-platform.md +7 -0
  126. package/docs/examples/projects/update-service-status.md +4 -0
  127. package/docs/examples/projects/update-webhook.md +9 -0
  128. package/docs/examples/projects/update.md +12 -0
  129. package/docs/examples/storage/create-bucket.md +11 -0
  130. package/docs/examples/storage/create-file.md +6 -0
  131. package/docs/examples/storage/delete-bucket.md +2 -0
  132. package/docs/examples/storage/delete-file.md +3 -0
  133. package/docs/examples/storage/get-bucket-usage.md +3 -0
  134. package/docs/examples/storage/get-bucket.md +2 -0
  135. package/docs/examples/storage/get-file-download.md +3 -0
  136. package/docs/examples/storage/get-file-preview.md +14 -0
  137. package/docs/examples/storage/get-file-view.md +3 -0
  138. package/docs/examples/storage/get-file.md +3 -0
  139. package/docs/examples/storage/get-usage.md +2 -0
  140. package/docs/examples/storage/list-buckets.md +7 -0
  141. package/docs/examples/storage/list-files.md +8 -0
  142. package/docs/examples/storage/update-bucket.md +11 -0
  143. package/docs/examples/storage/update-file.md +5 -0
  144. package/docs/examples/teams/create-membership.md +6 -0
  145. package/docs/examples/teams/create.md +4 -0
  146. package/docs/examples/teams/delete-membership.md +3 -0
  147. package/docs/examples/teams/delete.md +2 -0
  148. package/docs/examples/teams/get-membership.md +3 -0
  149. package/docs/examples/teams/get-memberships.md +8 -0
  150. package/docs/examples/teams/get.md +2 -0
  151. package/docs/examples/teams/list.md +7 -0
  152. package/docs/examples/teams/update-membership-roles.md +4 -0
  153. package/docs/examples/teams/update-membership-status.md +5 -0
  154. package/docs/examples/teams/update.md +3 -0
  155. package/docs/examples/users/create.md +5 -0
  156. package/docs/examples/users/delete-session.md +3 -0
  157. package/docs/examples/users/delete-sessions.md +2 -0
  158. package/docs/examples/users/delete.md +2 -0
  159. package/docs/examples/users/get-logs.md +4 -0
  160. package/docs/examples/users/get-prefs.md +2 -0
  161. package/docs/examples/users/get-sessions.md +2 -0
  162. package/docs/examples/users/get-usage.md +3 -0
  163. package/docs/examples/users/get.md +2 -0
  164. package/docs/examples/users/list.md +7 -0
  165. package/docs/examples/users/update-email.md +3 -0
  166. package/docs/examples/users/update-name.md +3 -0
  167. package/docs/examples/users/update-password.md +3 -0
  168. package/docs/examples/users/update-prefs.md +3 -0
  169. package/docs/examples/users/update-status.md +3 -0
  170. package/docs/examples/users/update-verification.md +3 -0
  171. package/index.js +49 -0
  172. package/install.sh +165 -0
  173. package/ldid/COPYING +661 -0
  174. package/ldid/Makefile +51 -0
  175. package/ldid/control +12 -0
  176. package/ldid/control.sh +5 -0
  177. package/ldid/deb.sh +10 -0
  178. package/ldid/ios.sh +2 -0
  179. package/ldid/ldid.cpp +3253 -0
  180. package/ldid/ldid.hpp +164 -0
  181. package/ldid/libplist/.github/workflows/build.yml +62 -0
  182. package/ldid/libplist/.github/workflows/codeql-analysis.yml +71 -0
  183. package/ldid/libplist/AUTHORS +28 -0
  184. package/ldid/libplist/COPYING +340 -0
  185. package/ldid/libplist/COPYING.LESSER +502 -0
  186. package/ldid/libplist/Makefile.am +20 -0
  187. package/ldid/libplist/NEWS +252 -0
  188. package/ldid/libplist/README.md +114 -0
  189. package/ldid/libplist/aclocal.m4 +1729 -0
  190. package/ldid/libplist/autogen.sh +26 -0
  191. package/ldid/libplist/configure.ac +292 -0
  192. package/ldid/libplist/cython/Makefile.am +53 -0
  193. package/ldid/libplist/cython/plist.pxd +78 -0
  194. package/ldid/libplist/cython/plist.pyx +947 -0
  195. package/ldid/libplist/cython/plist_util.c +40 -0
  196. package/ldid/libplist/cython/plist_util.h +5 -0
  197. package/ldid/libplist/docs/Makefile.am +3 -0
  198. package/ldid/libplist/docs/plistutil.1 +62 -0
  199. package/ldid/libplist/fuzz/Makefile.am +43 -0
  200. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-4766291097288704 +0 -0
  201. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-4930725262393344 +0 -0
  202. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-5421965105954816 +0 -0
  203. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-5556177727389696 +0 -0
  204. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-6557963011489792 +0 -0
  205. package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-6605859144597504 +0 -0
  206. package/ldid/libplist/fuzz/bplist-crashes/crash-0ce4dd483b645bc05ec45a97d285dcf1933ee840 +0 -0
  207. package/ldid/libplist/fuzz/bplist-crashes/crash-0d59cdcb5c3416c2790612b78a631ce9f5622800 +0 -0
  208. package/ldid/libplist/fuzz/bplist-crashes/crash-17d635ab460fef74df1ac7561f1253533a6359c5 +0 -0
  209. package/ldid/libplist/fuzz/bplist-crashes/crash-33a67313fa7864cd627ef92d12017a127d342f28 +0 -0
  210. package/ldid/libplist/fuzz/bplist-crashes/crash-39f1347115f8fe9ac25cdc9332e3fc5cd32c7f7b +0 -0
  211. package/ldid/libplist/fuzz/bplist-crashes/crash-4bd78175fe01d07c5ee90104fbc68d95dd092210 +0 -0
  212. package/ldid/libplist/fuzz/bplist-crashes/crash-4c5404453bb7425aef9b953a5f6f3f0afcc48392 +0 -0
  213. package/ldid/libplist/fuzz/bplist-crashes/crash-52775e25f6af20af351cd616834e602fc988a032 +0 -0
  214. package/ldid/libplist/fuzz/bplist-crashes/crash-6d1399685b745d3d49fadc91072fabcdde8d16fa +0 -0
  215. package/ldid/libplist/fuzz/bplist-crashes/crash-94b3725900d63c6258448fd757559c81002de9c9 +0 -0
  216. package/ldid/libplist/fuzz/bplist-crashes/crash-a47195acbabc3f5b2cda9c6ebda42f2afc1cc5af +0 -0
  217. package/ldid/libplist/fuzz/bplist-crashes/crash-ce852bae6aeeffc4698a93660236f1b995ce966e +0 -0
  218. package/ldid/libplist/fuzz/bplist-crashes/crash-daddb6e82e3d1ed76e20e4131462f5247a6fb131 +0 -0
  219. package/ldid/libplist/fuzz/bplist-crashes/crash-f21be4ebce7f9c337bf96b93cec7e252f5c75a21 +0 -0
  220. package/ldid/libplist/fuzz/bplist-crashes/crash-f779dafccc0164684d1a264976e56037188b40e2 +0 -0
  221. package/ldid/libplist/fuzz/bplist-leaks/leak-96fb453b3ba18d31e164831795a708183b5a0dac +0 -0
  222. package/ldid/libplist/fuzz/bplist-leaks/leak-acb3c00a83d7635638a476a4e70fc1f1caa1a5b1 +0 -0
  223. package/ldid/libplist/fuzz/bplist-leaks/leak-fe2cd4b1f67e0c9b21e6225a4fb4ca19eab80074 +0 -0
  224. package/ldid/libplist/fuzz/bplist.dict +1 -0
  225. package/ldid/libplist/fuzz/bplist_fuzzer.cc +32 -0
  226. package/ldid/libplist/fuzz/bplist_fuzzer.options +3 -0
  227. package/ldid/libplist/fuzz/fuzzers.test +8 -0
  228. package/ldid/libplist/fuzz/init-fuzzers.sh +23 -0
  229. package/ldid/libplist/fuzz/test-fuzzers.sh +33 -0
  230. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-4516959125241856 +0 -0
  231. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-4663876528373760 +5 -0
  232. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-5799076113154048 +45 -0
  233. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-5922404220010496 +0 -0
  234. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6015098361479168 +0 -0
  235. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6043836860071936 +0 -0
  236. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6047509906456576 +10050 -0
  237. package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6482601374121984 +0 -0
  238. package/ldid/libplist/fuzz/xplist-crashes/crash-09788d7acb46b4b177422f9c4ee54556a3ad1f17 +53 -0
  239. package/ldid/libplist/fuzz/xplist-crashes/crash-155c60d5c4b2778110fb4a633caa7d64eb9b99c1 +9 -0
  240. package/ldid/libplist/fuzz/xplist-crashes/crash-348c909a0b3532977185f551eb5d2ed04e694883 +11 -0
  241. package/ldid/libplist/fuzz/xplist-crashes/crash-7bc172e27a2b1d4fcaf031f59d1f08fb83081e4a +8 -0
  242. package/ldid/libplist/fuzz/xplist-crashes/crash-80c28b0e2a446665e68927dd4441c10c9a68e64e +0 -0
  243. package/ldid/libplist/fuzz/xplist-crashes/crash-8acf177da60ecf13c36d0da1b8e25de891980ea6 +5 -0
  244. package/ldid/libplist/fuzz/xplist-crashes/crash-94276cf69a50e78dd6cdf079c208cb80f357cd33 +0 -0
  245. package/ldid/libplist/fuzz/xplist-crashes/crash-9ddb891a0ec42401eb4629e6b99e01aef7909eb9 +0 -0
  246. package/ldid/libplist/fuzz/xplist-crashes/crash-a8b44e1f5be4f75f00a937016ec5405bce77a0f9 +0 -0
  247. package/ldid/libplist/fuzz/xplist-crashes/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709 +0 -0
  248. package/ldid/libplist/fuzz/xplist-crashes/crash-f03c680ee1c4d84c28e731752df77a61e213a24d +72 -0
  249. package/ldid/libplist/fuzz/xplist-leaks/clusterfuzz-testcase-4634751103139840 +187 -0
  250. package/ldid/libplist/fuzz/xplist-leaks/clusterfuzz-testcase-6056412121661440 +12 -0
  251. package/ldid/libplist/fuzz/xplist-leaks/leak-47b0a9f21d3affab6cfc898e5140bb53265ada07 +0 -0
  252. package/ldid/libplist/fuzz/xplist-leaks/leak-4c81aae70b20d9b9408b78d40999a54205bdcfb7 +0 -0
  253. package/ldid/libplist/fuzz/xplist-leaks/leak-53bc466851eda790bd891733da5db0a7482886bf +6 -0
  254. package/ldid/libplist/fuzz/xplist.dict +51 -0
  255. package/ldid/libplist/fuzz/xplist_fuzzer.cc +32 -0
  256. package/ldid/libplist/fuzz/xplist_fuzzer.options +3 -0
  257. package/ldid/libplist/include/Makefile.am +15 -0
  258. package/ldid/libplist/include/plist/Array.h +55 -0
  259. package/ldid/libplist/include/plist/Boolean.h +48 -0
  260. package/ldid/libplist/include/plist/Data.h +49 -0
  261. package/ldid/libplist/include/plist/Date.h +50 -0
  262. package/ldid/libplist/include/plist/Dictionary.h +68 -0
  263. package/ldid/libplist/include/plist/Integer.h +48 -0
  264. package/ldid/libplist/include/plist/Key.h +49 -0
  265. package/ldid/libplist/include/plist/Node.h +57 -0
  266. package/ldid/libplist/include/plist/Real.h +48 -0
  267. package/ldid/libplist/include/plist/String.h +49 -0
  268. package/ldid/libplist/include/plist/Structure.h +59 -0
  269. package/ldid/libplist/include/plist/Uid.h +48 -0
  270. package/ldid/libplist/include/plist/plist++.h +39 -0
  271. package/ldid/libplist/include/plist/plist.h +953 -0
  272. package/ldid/libplist/libcnary/COPYING +502 -0
  273. package/ldid/libplist/libcnary/Makefile.am +15 -0
  274. package/ldid/libplist/libcnary/README +5 -0
  275. package/ldid/libplist/libcnary/cnary.c +46 -0
  276. package/ldid/libplist/libcnary/include/node.h +65 -0
  277. package/ldid/libplist/libcnary/include/node_list.h +47 -0
  278. package/ldid/libplist/libcnary/include/object.h +41 -0
  279. package/ldid/libplist/libcnary/node.c +216 -0
  280. package/ldid/libplist/libcnary/node_list.c +157 -0
  281. package/ldid/libplist/m4/ac_pkg_cython.m4 +67 -0
  282. package/ldid/libplist/m4/as-compiler-flag.m4 +62 -0
  283. package/ldid/libplist/m4/ax_pthread.m4 +485 -0
  284. package/ldid/libplist/m4/ax_python_devel.m4 +327 -0
  285. package/ldid/libplist/m4/cython_python.m4 +7 -0
  286. package/ldid/libplist/src/Array.cpp +148 -0
  287. package/ldid/libplist/src/Boolean.cpp +73 -0
  288. package/ldid/libplist/src/Data.cpp +79 -0
  289. package/ldid/libplist/src/Date.cpp +76 -0
  290. package/ldid/libplist/src/Dictionary.cpp +182 -0
  291. package/ldid/libplist/src/Integer.cpp +73 -0
  292. package/ldid/libplist/src/Key.cpp +80 -0
  293. package/ldid/libplist/src/Makefile.am +63 -0
  294. package/ldid/libplist/src/Node.cpp +166 -0
  295. package/ldid/libplist/src/Real.cpp +73 -0
  296. package/ldid/libplist/src/String.cpp +80 -0
  297. package/ldid/libplist/src/Structure.cpp +123 -0
  298. package/ldid/libplist/src/Uid.cpp +73 -0
  299. package/ldid/libplist/src/base64.c +119 -0
  300. package/ldid/libplist/src/base64.h +28 -0
  301. package/ldid/libplist/src/bplist.c +1381 -0
  302. package/ldid/libplist/src/bytearray.c +61 -0
  303. package/ldid/libplist/src/bytearray.h +36 -0
  304. package/ldid/libplist/src/hashtable.c +140 -0
  305. package/ldid/libplist/src/hashtable.h +50 -0
  306. package/ldid/libplist/src/plist.c +1356 -0
  307. package/ldid/libplist/src/plist.h +74 -0
  308. package/ldid/libplist/src/ptrarray.c +96 -0
  309. package/ldid/libplist/src/ptrarray.h +40 -0
  310. package/ldid/libplist/src/strbuf.h +34 -0
  311. package/ldid/libplist/src/time64.c +814 -0
  312. package/ldid/libplist/src/time64.h +81 -0
  313. package/ldid/libplist/src/time64_limits.h +97 -0
  314. package/ldid/libplist/src/xplist.c +1435 -0
  315. package/ldid/libplist/test/Makefile.am +93 -0
  316. package/ldid/libplist/test/amp.test +14 -0
  317. package/ldid/libplist/test/bigarray.test +15 -0
  318. package/ldid/libplist/test/cdata.test +12 -0
  319. package/ldid/libplist/test/data/1.plist +35 -0
  320. package/ldid/libplist/test/data/2.plist +100 -0
  321. package/ldid/libplist/test/data/3.plist +420 -0
  322. package/ldid/libplist/test/data/4.plist +5037 -0
  323. package/ldid/libplist/test/data/5.plist +55053 -0
  324. package/ldid/libplist/test/data/6.plist +4006 -0
  325. package/ldid/libplist/test/data/7.plist +14 -0
  326. package/ldid/libplist/test/data/amp.plist +6 -0
  327. package/ldid/libplist/test/data/cdata.plist +6 -0
  328. package/ldid/libplist/test/data/dictref1byte.bplist +0 -0
  329. package/ldid/libplist/test/data/dictref2bytes.bplist +0 -0
  330. package/ldid/libplist/test/data/dictref3bytes.bplist +0 -0
  331. package/ldid/libplist/test/data/dictref4bytes.bplist +0 -0
  332. package/ldid/libplist/test/data/dictref5bytes.bplist +0 -0
  333. package/ldid/libplist/test/data/dictref6bytes.bplist +0 -0
  334. package/ldid/libplist/test/data/dictref7bytes.bplist +0 -0
  335. package/ldid/libplist/test/data/dictref8bytes.bplist +0 -0
  336. package/ldid/libplist/test/data/empty_keys.plist +8 -0
  337. package/ldid/libplist/test/data/entities.plist +57 -0
  338. package/ldid/libplist/test/data/hex.plist +5 -0
  339. package/ldid/libplist/test/data/invalid_tag.plist +6 -0
  340. package/ldid/libplist/test/data/malformed_dict.bplist +0 -0
  341. package/ldid/libplist/test/data/off1byte.bplist +0 -0
  342. package/ldid/libplist/test/data/off2bytes.bplist +0 -0
  343. package/ldid/libplist/test/data/off3bytes.bplist +0 -0
  344. package/ldid/libplist/test/data/off4bytes.bplist +0 -0
  345. package/ldid/libplist/test/data/off5bytes.bplist +0 -0
  346. package/ldid/libplist/test/data/off6bytes.bplist +0 -0
  347. package/ldid/libplist/test/data/off7bytes.bplist +0 -0
  348. package/ldid/libplist/test/data/off8bytes.bplist +0 -0
  349. package/ldid/libplist/test/data/offxml.plist +8 -0
  350. package/ldid/libplist/test/data/order.bplist +0 -0
  351. package/ldid/libplist/test/data/order.plist +27 -0
  352. package/ldid/libplist/test/data/recursion.bplist +0 -0
  353. package/ldid/libplist/test/data/signed.bplist +0 -0
  354. package/ldid/libplist/test/data/signed.plist +5 -0
  355. package/ldid/libplist/test/data/signedunsigned.bplist +0 -0
  356. package/ldid/libplist/test/data/signedunsigned.plist +11 -0
  357. package/ldid/libplist/test/data/unsigned.bplist +0 -0
  358. package/ldid/libplist/test/data/unsigned.plist +5 -0
  359. package/ldid/libplist/test/dates.test +15 -0
  360. package/ldid/libplist/test/empty.test +15 -0
  361. package/ldid/libplist/test/empty_keys.test +12 -0
  362. package/ldid/libplist/test/entities.test +12 -0
  363. package/ldid/libplist/test/hex.test +12 -0
  364. package/ldid/libplist/test/huge.test +15 -0
  365. package/ldid/libplist/test/invalid_tag.test +14 -0
  366. package/ldid/libplist/test/large.test +15 -0
  367. package/ldid/libplist/test/malformed_dict.test +11 -0
  368. package/ldid/libplist/test/medium.test +15 -0
  369. package/ldid/libplist/test/offsetsize.test +12 -0
  370. package/ldid/libplist/test/order.test +13 -0
  371. package/ldid/libplist/test/plist_cmp.c +158 -0
  372. package/ldid/libplist/test/plist_test.c +135 -0
  373. package/ldid/libplist/test/recursion.test +11 -0
  374. package/ldid/libplist/test/refsize.test +12 -0
  375. package/ldid/libplist/test/signedunsigned1.test +23 -0
  376. package/ldid/libplist/test/signedunsigned2.test +23 -0
  377. package/ldid/libplist/test/signedunsigned3.test +23 -0
  378. package/ldid/libplist/test/small.test +15 -0
  379. package/ldid/libplist/test/timezone1.test +17 -0
  380. package/ldid/libplist/test/timezone2.test +21 -0
  381. package/ldid/libplist/tools/Makefile.am +10 -0
  382. package/ldid/libplist/tools/plistutil.c +299 -0
  383. package/ldid/lookup2.c +416 -0
  384. package/ldid/make.sh +90 -0
  385. package/ldid/minimal/hexdump.h +76 -0
  386. package/ldid/minimal/mapping.h +72 -0
  387. package/ldid/minimal/sqlite3.h +71 -0
  388. package/ldid/minimal/stdlib.h +129 -0
  389. package/ldid/minimal/string.h +51 -0
  390. package/ldid/plist.sh +2 -0
  391. package/ldid/sha1.h +64 -0
  392. package/ldid/sysroot.sh +31 -0
  393. package/ldid/version.sh +2 -0
  394. package/lib/client.js +243 -0
  395. package/lib/commands/account.js +785 -0
  396. package/lib/commands/avatars.js +349 -0
  397. package/lib/commands/database.js +1238 -0
  398. package/lib/commands/deploy.js +477 -0
  399. package/lib/commands/functions.js +689 -0
  400. package/lib/commands/generic.js +106 -0
  401. package/lib/commands/health.js +269 -0
  402. package/lib/commands/init.js +148 -0
  403. package/lib/commands/locale.js +177 -0
  404. package/lib/commands/projects.js +1191 -0
  405. package/lib/commands/storage.js +743 -0
  406. package/lib/commands/teams.js +435 -0
  407. package/lib/commands/users.js +542 -0
  408. package/lib/config.js +264 -0
  409. package/lib/exception.js +9 -0
  410. package/lib/parser.js +179 -0
  411. package/lib/questions.js +223 -0
  412. package/lib/sdks.js +82 -0
  413. package/package.json +41 -0
@@ -0,0 +1,953 @@
1
+ /**
2
+ * @file plist/plist.h
3
+ * @brief Main include of libplist
4
+ * \internal
5
+ *
6
+ * Copyright (c) 2012-2019 Nikias Bassen, All Rights Reserved.
7
+ * Copyright (c) 2008-2009 Jonathan Beck, All Rights Reserved.
8
+ *
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
+ */
23
+
24
+ #ifndef LIBPLIST_H
25
+ #define LIBPLIST_H
26
+
27
+ #ifdef __cplusplus
28
+ extern "C"
29
+ {
30
+ #endif
31
+
32
+ #if _MSC_VER && _MSC_VER < 1700
33
+ typedef __int8 int8_t;
34
+ typedef __int16 int16_t;
35
+ typedef __int32 int32_t;
36
+ typedef __int64 int64_t;
37
+
38
+ typedef unsigned __int8 uint8_t;
39
+ typedef unsigned __int16 uint16_t;
40
+ typedef unsigned __int32 uint32_t;
41
+ typedef unsigned __int64 uint64_t;
42
+
43
+ #else
44
+ #include <stdint.h>
45
+ #endif
46
+
47
+ #ifdef __llvm__
48
+ #if defined(__has_extension)
49
+ #if (__has_extension(attribute_deprecated_with_message))
50
+ #ifndef PLIST_WARN_DEPRECATED
51
+ #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated(x)))
52
+ #endif
53
+ #else
54
+ #ifndef PLIST_WARN_DEPRECATED
55
+ #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated))
56
+ #endif
57
+ #endif
58
+ #else
59
+ #ifndef PLIST_WARN_DEPRECATED
60
+ #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated))
61
+ #endif
62
+ #endif
63
+ #elif (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 5)))
64
+ #ifndef PLIST_WARN_DEPRECATED
65
+ #define PLIST_WARN_DEPRECATED(x) __attribute__((deprecated(x)))
66
+ #endif
67
+ #elif defined(_MSC_VER)
68
+ #ifndef PLIST_WARN_DEPRECATED
69
+ #define PLIST_WARN_DEPRECATED(x) __declspec(deprecated(x))
70
+ #endif
71
+ #else
72
+ #define PLIST_WARN_DEPRECATED(x)
73
+ #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
74
+ #endif
75
+
76
+ #include <sys/types.h>
77
+ #include <stdarg.h>
78
+
79
+ /**
80
+ * \mainpage libplist : A library to handle Apple Property Lists
81
+ * \defgroup PublicAPI Public libplist API
82
+ */
83
+ /*@{*/
84
+
85
+
86
+ /**
87
+ * The basic plist abstract data type.
88
+ */
89
+ typedef void *plist_t;
90
+
91
+ /**
92
+ * The plist dictionary iterator.
93
+ */
94
+ typedef void* plist_dict_iter;
95
+
96
+ /**
97
+ * The plist array iterator.
98
+ */
99
+ typedef void* plist_array_iter;
100
+
101
+ /**
102
+ * The enumeration of plist node types.
103
+ */
104
+ typedef enum
105
+ {
106
+ PLIST_BOOLEAN, /**< Boolean, scalar type */
107
+ PLIST_UINT, /**< Unsigned integer, scalar type */
108
+ PLIST_REAL, /**< Real, scalar type */
109
+ PLIST_STRING, /**< ASCII string, scalar type */
110
+ PLIST_ARRAY, /**< Ordered array, structured type */
111
+ PLIST_DICT, /**< Unordered dictionary (key/value pair), structured type */
112
+ PLIST_DATE, /**< Date, scalar type */
113
+ PLIST_DATA, /**< Binary data, scalar type */
114
+ PLIST_KEY, /**< Key in dictionaries (ASCII String), scalar type */
115
+ PLIST_UID, /**< Special type used for 'keyed encoding' */
116
+ PLIST_NONE /**< No type */
117
+ } plist_type;
118
+
119
+
120
+ /********************************************
121
+ * *
122
+ * Creation & Destruction *
123
+ * *
124
+ ********************************************/
125
+
126
+ /**
127
+ * Create a new root plist_t type #PLIST_DICT
128
+ *
129
+ * @return the created plist
130
+ * @sa #plist_type
131
+ */
132
+ plist_t plist_new_dict(void);
133
+
134
+ /**
135
+ * Create a new root plist_t type #PLIST_ARRAY
136
+ *
137
+ * @return the created plist
138
+ * @sa #plist_type
139
+ */
140
+ plist_t plist_new_array(void);
141
+
142
+ /**
143
+ * Create a new plist_t type #PLIST_STRING
144
+ *
145
+ * @param val the sting value, encoded in UTF8.
146
+ * @return the created item
147
+ * @sa #plist_type
148
+ */
149
+ plist_t plist_new_string(const char *val);
150
+
151
+ /**
152
+ * Create a new plist_t type #PLIST_BOOLEAN
153
+ *
154
+ * @param val the boolean value, 0 is false, other values are true.
155
+ * @return the created item
156
+ * @sa #plist_type
157
+ */
158
+ plist_t plist_new_bool(uint8_t val);
159
+
160
+ /**
161
+ * Create a new plist_t type #PLIST_UINT
162
+ *
163
+ * @param val the unsigned integer value
164
+ * @return the created item
165
+ * @sa #plist_type
166
+ */
167
+ plist_t plist_new_uint(uint64_t val);
168
+
169
+ /**
170
+ * Create a new plist_t type #PLIST_REAL
171
+ *
172
+ * @param val the real value
173
+ * @return the created item
174
+ * @sa #plist_type
175
+ */
176
+ plist_t plist_new_real(double val);
177
+
178
+ /**
179
+ * Create a new plist_t type #PLIST_DATA
180
+ *
181
+ * @param val the binary buffer
182
+ * @param length the length of the buffer
183
+ * @return the created item
184
+ * @sa #plist_type
185
+ */
186
+ plist_t plist_new_data(const char *val, uint64_t length);
187
+
188
+ /**
189
+ * Create a new plist_t type #PLIST_DATE
190
+ *
191
+ * @param sec the number of seconds since 01/01/2001
192
+ * @param usec the number of microseconds
193
+ * @return the created item
194
+ * @sa #plist_type
195
+ */
196
+ plist_t plist_new_date(int32_t sec, int32_t usec);
197
+
198
+ /**
199
+ * Create a new plist_t type #PLIST_UID
200
+ *
201
+ * @param val the unsigned integer value
202
+ * @return the created item
203
+ * @sa #plist_type
204
+ */
205
+ plist_t plist_new_uid(uint64_t val);
206
+
207
+ /**
208
+ * Destruct a plist_t node and all its children recursively
209
+ *
210
+ * @param plist the plist to free
211
+ */
212
+ void plist_free(plist_t plist);
213
+
214
+ /**
215
+ * Return a copy of passed node and it's children
216
+ *
217
+ * @param node the plist to copy
218
+ * @return copied plist
219
+ */
220
+ plist_t plist_copy(plist_t node);
221
+
222
+
223
+ /********************************************
224
+ * *
225
+ * Array functions *
226
+ * *
227
+ ********************************************/
228
+
229
+ /**
230
+ * Get size of a #PLIST_ARRAY node.
231
+ *
232
+ * @param node the node of type #PLIST_ARRAY
233
+ * @return size of the #PLIST_ARRAY node
234
+ */
235
+ uint32_t plist_array_get_size(plist_t node);
236
+
237
+ /**
238
+ * Get the nth item in a #PLIST_ARRAY node.
239
+ *
240
+ * @param node the node of type #PLIST_ARRAY
241
+ * @param n the index of the item to get. Range is [0, array_size[
242
+ * @return the nth item or NULL if node is not of type #PLIST_ARRAY
243
+ */
244
+ plist_t plist_array_get_item(plist_t node, uint32_t n);
245
+
246
+ /**
247
+ * Get the index of an item. item must be a member of a #PLIST_ARRAY node.
248
+ *
249
+ * @param node the node
250
+ * @return the node index or UINT_MAX if node index can't be determined
251
+ */
252
+ uint32_t plist_array_get_item_index(plist_t node);
253
+
254
+ /**
255
+ * Set the nth item in a #PLIST_ARRAY node.
256
+ * The previous item at index n will be freed using #plist_free
257
+ *
258
+ * @param node the node of type #PLIST_ARRAY
259
+ * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed.
260
+ * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range.
261
+ */
262
+ void plist_array_set_item(plist_t node, plist_t item, uint32_t n);
263
+
264
+ /**
265
+ * Append a new item at the end of a #PLIST_ARRAY node.
266
+ *
267
+ * @param node the node of type #PLIST_ARRAY
268
+ * @param item the new item. The array is responsible for freeing item when it is no longer needed.
269
+ */
270
+ void plist_array_append_item(plist_t node, plist_t item);
271
+
272
+ /**
273
+ * Insert a new item at position n in a #PLIST_ARRAY node.
274
+ *
275
+ * @param node the node of type #PLIST_ARRAY
276
+ * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed.
277
+ * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range.
278
+ */
279
+ void plist_array_insert_item(plist_t node, plist_t item, uint32_t n);
280
+
281
+ /**
282
+ * Remove an existing position in a #PLIST_ARRAY node.
283
+ * Removed position will be freed using #plist_free.
284
+ *
285
+ * @param node the node of type #PLIST_ARRAY
286
+ * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range.
287
+ */
288
+ void plist_array_remove_item(plist_t node, uint32_t n);
289
+
290
+ /**
291
+ * Remove a node that is a child node of a #PLIST_ARRAY node.
292
+ * node will be freed using #plist_free.
293
+ *
294
+ * @param node The node to be removed from its #PLIST_ARRAY parent.
295
+ */
296
+ void plist_array_item_remove(plist_t node);
297
+
298
+ /**
299
+ * Create an iterator of a #PLIST_ARRAY node.
300
+ * The allocated iterator should be freed with the standard free function.
301
+ *
302
+ * @param node The node of type #PLIST_ARRAY
303
+ * @param iter Location to store the iterator for the array.
304
+ */
305
+ void plist_array_new_iter(plist_t node, plist_array_iter *iter);
306
+
307
+ /**
308
+ * Increment iterator of a #PLIST_ARRAY node.
309
+ *
310
+ * @param node The node of type #PLIST_ARRAY.
311
+ * @param iter Iterator of the array
312
+ * @param item Location to store the item. The caller must *not* free the
313
+ * returned item. Will be set to NULL when no more items are left
314
+ * to iterate.
315
+ */
316
+ void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item);
317
+
318
+
319
+ /********************************************
320
+ * *
321
+ * Dictionary functions *
322
+ * *
323
+ ********************************************/
324
+
325
+ /**
326
+ * Get size of a #PLIST_DICT node.
327
+ *
328
+ * @param node the node of type #PLIST_DICT
329
+ * @return size of the #PLIST_DICT node
330
+ */
331
+ uint32_t plist_dict_get_size(plist_t node);
332
+
333
+ /**
334
+ * Create an iterator of a #PLIST_DICT node.
335
+ * The allocated iterator should be freed with the standard free function.
336
+ *
337
+ * @param node The node of type #PLIST_DICT.
338
+ * @param iter Location to store the iterator for the dictionary.
339
+ */
340
+ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter);
341
+
342
+ /**
343
+ * Increment iterator of a #PLIST_DICT node.
344
+ *
345
+ * @param node The node of type #PLIST_DICT
346
+ * @param iter Iterator of the dictionary
347
+ * @param key Location to store the key, or NULL. The caller is responsible
348
+ * for freeing the the returned string.
349
+ * @param val Location to store the value, or NULL. The caller must *not*
350
+ * free the returned value. Will be set to NULL when no more
351
+ * key/value pairs are left to iterate.
352
+ */
353
+ void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val);
354
+
355
+ /**
356
+ * Get key associated key to an item. Item must be member of a dictionary.
357
+ *
358
+ * @param node the item
359
+ * @param key a location to store the key. The caller is responsible for freeing the returned string.
360
+ */
361
+ void plist_dict_get_item_key(plist_t node, char **key);
362
+
363
+ /**
364
+ * Get the nth item in a #PLIST_DICT node.
365
+ *
366
+ * @param node the node of type #PLIST_DICT
367
+ * @param key the identifier of the item to get.
368
+ * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free
369
+ * the returned node.
370
+ */
371
+ plist_t plist_dict_get_item(plist_t node, const char* key);
372
+
373
+ /**
374
+ * Get key node associated to an item. Item must be member of a dictionary.
375
+ *
376
+ * @param node the item
377
+ * @return the key node of the given item, or NULL.
378
+ */
379
+ plist_t plist_dict_item_get_key(plist_t node);
380
+
381
+ /**
382
+ * Set item identified by key in a #PLIST_DICT node.
383
+ * The previous item identified by key will be freed using #plist_free.
384
+ * If there is no item for the given key a new item will be inserted.
385
+ *
386
+ * @param node the node of type #PLIST_DICT
387
+ * @param item the new item associated to key
388
+ * @param key the identifier of the item to set.
389
+ */
390
+ void plist_dict_set_item(plist_t node, const char* key, plist_t item);
391
+
392
+ /**
393
+ * Insert a new item into a #PLIST_DICT node.
394
+ *
395
+ * @deprecated Deprecated. Use plist_dict_set_item instead.
396
+ *
397
+ * @param node the node of type #PLIST_DICT
398
+ * @param item the new item to insert
399
+ * @param key The identifier of the item to insert.
400
+ */
401
+ PLIST_WARN_DEPRECATED("use plist_dict_set_item instead")
402
+ void plist_dict_insert_item(plist_t node, const char* key, plist_t item);
403
+
404
+ /**
405
+ * Remove an existing position in a #PLIST_DICT node.
406
+ * Removed position will be freed using #plist_free
407
+ *
408
+ * @param node the node of type #PLIST_DICT
409
+ * @param key The identifier of the item to remove. Assert if identifier is not present.
410
+ */
411
+ void plist_dict_remove_item(plist_t node, const char* key);
412
+
413
+ /**
414
+ * Merge a dictionary into another. This will add all key/value pairs
415
+ * from the source dictionary to the target dictionary, overwriting
416
+ * any existing key/value pairs that are already present in target.
417
+ *
418
+ * @param target pointer to an existing node of type #PLIST_DICT
419
+ * @param source node of type #PLIST_DICT that should be merged into target
420
+ */
421
+ void plist_dict_merge(plist_t *target, plist_t source);
422
+
423
+
424
+ /********************************************
425
+ * *
426
+ * Getters *
427
+ * *
428
+ ********************************************/
429
+
430
+ /**
431
+ * Get the parent of a node
432
+ *
433
+ * @param node the parent (NULL if node is root)
434
+ */
435
+ plist_t plist_get_parent(plist_t node);
436
+
437
+ /**
438
+ * Get the #plist_type of a node.
439
+ *
440
+ * @param node the node
441
+ * @return the type of the node
442
+ */
443
+ plist_type plist_get_node_type(plist_t node);
444
+
445
+ /**
446
+ * Get the value of a #PLIST_KEY node.
447
+ * This function does nothing if node is not of type #PLIST_KEY
448
+ *
449
+ * @param node the node
450
+ * @param val a pointer to a C-string. This function allocates the memory,
451
+ * caller is responsible for freeing it.
452
+ */
453
+ void plist_get_key_val(plist_t node, char **val);
454
+
455
+ /**
456
+ * Get the value of a #PLIST_STRING node.
457
+ * This function does nothing if node is not of type #PLIST_STRING
458
+ *
459
+ * @param node the node
460
+ * @param val a pointer to a C-string. This function allocates the memory,
461
+ * caller is responsible for freeing it. Data is UTF-8 encoded.
462
+ */
463
+ void plist_get_string_val(plist_t node, char **val);
464
+
465
+ /**
466
+ * Get a pointer to the buffer of a #PLIST_STRING node.
467
+ *
468
+ * @note DO NOT MODIFY the buffer. Mind that the buffer is only available
469
+ * until the plist node gets freed. Make a copy if needed.
470
+ *
471
+ * @param node The node
472
+ * @param length If non-NULL, will be set to the length of the string
473
+ *
474
+ * @return Pointer to the NULL-terminated buffer.
475
+ */
476
+ const char* plist_get_string_ptr(plist_t node, uint64_t* length);
477
+
478
+ /**
479
+ * Get the value of a #PLIST_BOOLEAN node.
480
+ * This function does nothing if node is not of type #PLIST_BOOLEAN
481
+ *
482
+ * @param node the node
483
+ * @param val a pointer to a uint8_t variable.
484
+ */
485
+ void plist_get_bool_val(plist_t node, uint8_t * val);
486
+
487
+ /**
488
+ * Get the value of a #PLIST_UINT node.
489
+ * This function does nothing if node is not of type #PLIST_UINT
490
+ *
491
+ * @param node the node
492
+ * @param val a pointer to a uint64_t variable.
493
+ */
494
+ void plist_get_uint_val(plist_t node, uint64_t * val);
495
+
496
+ /**
497
+ * Get the value of a #PLIST_REAL node.
498
+ * This function does nothing if node is not of type #PLIST_REAL
499
+ *
500
+ * @param node the node
501
+ * @param val a pointer to a double variable.
502
+ */
503
+ void plist_get_real_val(plist_t node, double *val);
504
+
505
+ /**
506
+ * Get the value of a #PLIST_DATA node.
507
+ * This function does nothing if node is not of type #PLIST_DATA
508
+ *
509
+ * @param node the node
510
+ * @param val a pointer to an unallocated char buffer. This function allocates the memory,
511
+ * caller is responsible for freeing it.
512
+ * @param length the length of the buffer
513
+ */
514
+ void plist_get_data_val(plist_t node, char **val, uint64_t * length);
515
+
516
+ /**
517
+ * Get a pointer to the data buffer of a #PLIST_DATA node.
518
+ *
519
+ * @note DO NOT MODIFY the buffer. Mind that the buffer is only available
520
+ * until the plist node gets freed. Make a copy if needed.
521
+ *
522
+ * @param node The node
523
+ * @param length Pointer to a uint64_t that will be set to the length of the buffer
524
+ *
525
+ * @return Pointer to the buffer
526
+ */
527
+ const char* plist_get_data_ptr(plist_t node, uint64_t* length);
528
+
529
+ /**
530
+ * Get the value of a #PLIST_DATE node.
531
+ * This function does nothing if node is not of type #PLIST_DATE
532
+ *
533
+ * @param node the node
534
+ * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001.
535
+ * @param usec a pointer to an int32_t variable. Represents the number of microseconds
536
+ */
537
+ void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec);
538
+
539
+ /**
540
+ * Get the value of a #PLIST_UID node.
541
+ * This function does nothing if node is not of type #PLIST_UID
542
+ *
543
+ * @param node the node
544
+ * @param val a pointer to a uint64_t variable.
545
+ */
546
+ void plist_get_uid_val(plist_t node, uint64_t * val);
547
+
548
+
549
+ /********************************************
550
+ * *
551
+ * Setters *
552
+ * *
553
+ ********************************************/
554
+
555
+ /**
556
+ * Set the value of a node.
557
+ * Forces type of node to #PLIST_KEY
558
+ *
559
+ * @param node the node
560
+ * @param val the key value
561
+ */
562
+ void plist_set_key_val(plist_t node, const char *val);
563
+
564
+ /**
565
+ * Set the value of a node.
566
+ * Forces type of node to #PLIST_STRING
567
+ *
568
+ * @param node the node
569
+ * @param val the string value. The string is copied when set and will be
570
+ * freed by the node.
571
+ */
572
+ void plist_set_string_val(plist_t node, const char *val);
573
+
574
+ /**
575
+ * Set the value of a node.
576
+ * Forces type of node to #PLIST_BOOLEAN
577
+ *
578
+ * @param node the node
579
+ * @param val the boolean value
580
+ */
581
+ void plist_set_bool_val(plist_t node, uint8_t val);
582
+
583
+ /**
584
+ * Set the value of a node.
585
+ * Forces type of node to #PLIST_UINT
586
+ *
587
+ * @param node the node
588
+ * @param val the unsigned integer value
589
+ */
590
+ void plist_set_uint_val(plist_t node, uint64_t val);
591
+
592
+ /**
593
+ * Set the value of a node.
594
+ * Forces type of node to #PLIST_REAL
595
+ *
596
+ * @param node the node
597
+ * @param val the real value
598
+ */
599
+ void plist_set_real_val(plist_t node, double val);
600
+
601
+ /**
602
+ * Set the value of a node.
603
+ * Forces type of node to #PLIST_DATA
604
+ *
605
+ * @param node the node
606
+ * @param val the binary buffer. The buffer is copied when set and will
607
+ * be freed by the node.
608
+ * @param length the length of the buffer
609
+ */
610
+ void plist_set_data_val(plist_t node, const char *val, uint64_t length);
611
+
612
+ /**
613
+ * Set the value of a node.
614
+ * Forces type of node to #PLIST_DATE
615
+ *
616
+ * @param node the node
617
+ * @param sec the number of seconds since 01/01/2001
618
+ * @param usec the number of microseconds
619
+ */
620
+ void plist_set_date_val(plist_t node, int32_t sec, int32_t usec);
621
+
622
+ /**
623
+ * Set the value of a node.
624
+ * Forces type of node to #PLIST_UID
625
+ *
626
+ * @param node the node
627
+ * @param val the unsigned integer value
628
+ */
629
+ void plist_set_uid_val(plist_t node, uint64_t val);
630
+
631
+
632
+ /********************************************
633
+ * *
634
+ * Import & Export *
635
+ * *
636
+ ********************************************/
637
+
638
+ /**
639
+ * Export the #plist_t structure to XML format.
640
+ *
641
+ * @param plist the root node to export
642
+ * @param plist_xml a pointer to a C-string. This function allocates the memory,
643
+ * caller is responsible for freeing it. Data is UTF-8 encoded.
644
+ * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
645
+ */
646
+ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length);
647
+
648
+ /**
649
+ * Frees the memory allocated by plist_to_xml().
650
+ *
651
+ * @param plist_xml The buffer allocated by plist_to_xml().
652
+ */
653
+ void plist_to_xml_free(char *plist_xml);
654
+
655
+ /**
656
+ * Export the #plist_t structure to binary format.
657
+ *
658
+ * @param plist the root node to export
659
+ * @param plist_bin a pointer to a char* buffer. This function allocates the memory,
660
+ * caller is responsible for freeing it.
661
+ * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
662
+ */
663
+ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length);
664
+
665
+ /**
666
+ * Frees the memory allocated by plist_to_bin().
667
+ *
668
+ * @param plist_bin The buffer allocated by plist_to_bin().
669
+ */
670
+ void plist_to_bin_free(char *plist_bin);
671
+
672
+ /**
673
+ * Import the #plist_t structure from XML format.
674
+ *
675
+ * @param plist_xml a pointer to the xml buffer.
676
+ * @param length length of the buffer to read.
677
+ * @param plist a pointer to the imported plist.
678
+ */
679
+ void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist);
680
+
681
+ /**
682
+ * Import the #plist_t structure from binary format.
683
+ *
684
+ * @param plist_bin a pointer to the xml buffer.
685
+ * @param length length of the buffer to read.
686
+ * @param plist a pointer to the imported plist.
687
+ */
688
+ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist);
689
+
690
+ /**
691
+ * Import the #plist_t structure from memory data.
692
+ * This method will look at the first bytes of plist_data
693
+ * to determine if plist_data contains a binary or XML plist.
694
+ *
695
+ * @param plist_data a pointer to the memory buffer containing plist data.
696
+ * @param length length of the buffer to read.
697
+ * @param plist a pointer to the imported plist.
698
+ */
699
+ void plist_from_memory(const char *plist_data, uint32_t length, plist_t * plist);
700
+
701
+ /**
702
+ * Test if in-memory plist data is binary or XML
703
+ * This method will look at the first bytes of plist_data
704
+ * to determine if plist_data contains a binary or XML plist.
705
+ * This method is not validating the whole memory buffer to check if the
706
+ * content is truly a plist, it's only using some heuristic on the first few
707
+ * bytes of plist_data.
708
+ *
709
+ * @param plist_data a pointer to the memory buffer containing plist data.
710
+ * @param length length of the buffer to read.
711
+ * @return 1 if the buffer is a binary plist, 0 otherwise.
712
+ */
713
+ int plist_is_binary(const char *plist_data, uint32_t length);
714
+
715
+ /********************************************
716
+ * *
717
+ * Utils *
718
+ * *
719
+ ********************************************/
720
+
721
+ /**
722
+ * Get a node from its path. Each path element depends on the associated father node type.
723
+ * For Dictionaries, var args are casted to const char*, for arrays, var args are caster to uint32_t
724
+ * Search is breath first order.
725
+ *
726
+ * @param plist the node to access result from.
727
+ * @param length length of the path to access
728
+ * @return the value to access.
729
+ */
730
+ plist_t plist_access_path(plist_t plist, uint32_t length, ...);
731
+
732
+ /**
733
+ * Variadic version of #plist_access_path.
734
+ *
735
+ * @param plist the node to access result from.
736
+ * @param length length of the path to access
737
+ * @param v list of array's index and dic'st key
738
+ * @return the value to access.
739
+ */
740
+ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v);
741
+
742
+ /**
743
+ * Compare two node values
744
+ *
745
+ * @param node_l left node to compare
746
+ * @param node_r rigth node to compare
747
+ * @return TRUE is type and value match, FALSE otherwise.
748
+ */
749
+ char plist_compare_node_value(plist_t node_l, plist_t node_r);
750
+
751
+ #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type))
752
+
753
+ /* Helper macros for the different plist types */
754
+ #define PLIST_IS_BOOLEAN(__plist) _PLIST_IS_TYPE(__plist, BOOLEAN)
755
+ #define PLIST_IS_UINT(__plist) _PLIST_IS_TYPE(__plist, UINT)
756
+ #define PLIST_IS_REAL(__plist) _PLIST_IS_TYPE(__plist, REAL)
757
+ #define PLIST_IS_STRING(__plist) _PLIST_IS_TYPE(__plist, STRING)
758
+ #define PLIST_IS_ARRAY(__plist) _PLIST_IS_TYPE(__plist, ARRAY)
759
+ #define PLIST_IS_DICT(__plist) _PLIST_IS_TYPE(__plist, DICT)
760
+ #define PLIST_IS_DATE(__plist) _PLIST_IS_TYPE(__plist, DATE)
761
+ #define PLIST_IS_DATA(__plist) _PLIST_IS_TYPE(__plist, DATA)
762
+ #define PLIST_IS_KEY(__plist) _PLIST_IS_TYPE(__plist, KEY)
763
+ #define PLIST_IS_UID(__plist) _PLIST_IS_TYPE(__plist, UID)
764
+
765
+ /**
766
+ * Helper function to check the value of a PLIST_BOOL node.
767
+ *
768
+ * @param boolnode node of type PLIST_BOOL
769
+ * @return 1 if the boolean node has a value of TRUE, 0 if FALSE,
770
+ * or -1 if the node is not of type PLIST_BOOL
771
+ */
772
+ int plist_bool_val_is_true(plist_t boolnode);
773
+
774
+ /**
775
+ * Helper function to compare the value of a PLIST_UINT node against
776
+ * a given value.
777
+ *
778
+ * @param uintnode node of type PLIST_UINT
779
+ * @param cmpval value to compare against
780
+ * @return 0 if the node's value and cmpval are equal,
781
+ * 1 if the node's value is greater than cmpval,
782
+ * or -1 if the node's value is less than cmpval.
783
+ */
784
+ int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval);
785
+
786
+ /**
787
+ * Helper function to compare the value of a PLIST_UID node against
788
+ * a given value.
789
+ *
790
+ * @param uidnode node of type PLIST_UID
791
+ * @param cmpval value to compare against
792
+ * @return 0 if the node's value and cmpval are equal,
793
+ * 1 if the node's value is greater than cmpval,
794
+ * or -1 if the node's value is less than cmpval.
795
+ */
796
+ int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval);
797
+
798
+ /**
799
+ * Helper function to compare the value of a PLIST_REAL node against
800
+ * a given value.
801
+ *
802
+ * @note WARNING: Comparing floating point values can give inaccurate
803
+ * results because of the nature of floating point values on computer
804
+ * systems. While this function is designed to be as accurate as
805
+ * possible, please don't rely on it too much.
806
+ *
807
+ * @param realnode node of type PLIST_REAL
808
+ * @param cmpval value to compare against
809
+ * @return 0 if the node's value and cmpval are (almost) equal,
810
+ * 1 if the node's value is greater than cmpval,
811
+ * or -1 if the node's value is less than cmpval.
812
+ */
813
+ int plist_real_val_compare(plist_t realnode, double cmpval);
814
+
815
+ /**
816
+ * Helper function to compare the value of a PLIST_DATE node against
817
+ * a given set of seconds and fraction of a second since epoch.
818
+ *
819
+ * @param datenode node of type PLIST_DATE
820
+ * @param cmpsec number of seconds since epoch to compare against
821
+ * @param cmpusec fraction of a second in microseconds to compare against
822
+ * @return 0 if the node's date is equal to the supplied values,
823
+ * 1 if the node's date is greater than the supplied values,
824
+ * or -1 if the node's date is less than the supplied values.
825
+ */
826
+ int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec);
827
+
828
+ /**
829
+ * Helper function to compare the value of a PLIST_STRING node against
830
+ * a given value.
831
+ * This function basically behaves like strcmp.
832
+ *
833
+ * @param strnode node of type PLIST_STRING
834
+ * @param cmpval value to compare against
835
+ * @return 0 if the node's value and cmpval are equal,
836
+ * > 0 if the node's value is lexicographically greater than cmpval,
837
+ * or < 0 if the node's value is lexicographically less than cmpval.
838
+ */
839
+ int plist_string_val_compare(plist_t strnode, const char* cmpval);
840
+
841
+ /**
842
+ * Helper function to compare the value of a PLIST_STRING node against
843
+ * a given value, while not comparing more than n characters.
844
+ * This function basically behaves like strncmp.
845
+ *
846
+ * @param strnode node of type PLIST_STRING
847
+ * @param cmpval value to compare against
848
+ * @param n maximum number of characters to compare
849
+ * @return 0 if the node's value and cmpval are equal,
850
+ * > 0 if the node's value is lexicographically greater than cmpval,
851
+ * or < 0 if the node's value is lexicographically less than cmpval.
852
+ */
853
+ int plist_string_val_compare_with_size(plist_t strnode, const char* cmpval, size_t n);
854
+
855
+ /**
856
+ * Helper function to match a given substring in the value of a
857
+ * PLIST_STRING node.
858
+ *
859
+ * @param strnode node of type PLIST_STRING
860
+ * @param substr value to match
861
+ * @return 1 if the node's value contains the given substring,
862
+ * or 0 if not.
863
+ */
864
+ int plist_string_val_contains(plist_t strnode, const char* substr);
865
+
866
+ /**
867
+ * Helper function to compare the value of a PLIST_KEY node against
868
+ * a given value.
869
+ * This function basically behaves like strcmp.
870
+ *
871
+ * @param keynode node of type PLIST_KEY
872
+ * @param cmpval value to compare against
873
+ * @return 0 if the node's value and cmpval are equal,
874
+ * > 0 if the node's value is lexicographically greater than cmpval,
875
+ * or < 0 if the node's value is lexicographically less than cmpval.
876
+ */
877
+ int plist_key_val_compare(plist_t keynode, const char* cmpval);
878
+
879
+ /**
880
+ * Helper function to compare the value of a PLIST_KEY node against
881
+ * a given value, while not comparing more than n characters.
882
+ * This function basically behaves like strncmp.
883
+ *
884
+ * @param keynode node of type PLIST_KEY
885
+ * @param cmpval value to compare against
886
+ * @param n maximum number of characters to compare
887
+ * @return 0 if the node's value and cmpval are equal,
888
+ * > 0 if the node's value is lexicographically greater than cmpval,
889
+ * or < 0 if the node's value is lexicographically less than cmpval.
890
+ */
891
+ int plist_key_val_compare_with_size(plist_t keynode, const char* cmpval, size_t n);
892
+
893
+ /**
894
+ * Helper function to match a given substring in the value of a
895
+ * PLIST_KEY node.
896
+ *
897
+ * @param keynode node of type PLIST_KEY
898
+ * @param substr value to match
899
+ * @return 1 if the node's value contains the given substring,
900
+ * or 0 if not.
901
+ */
902
+ int plist_key_val_contains(plist_t keynode, const char* substr);
903
+
904
+ /**
905
+ * Helper function to compare the data of a PLIST_DATA node against
906
+ * a given blob and size.
907
+ * This function basically behaves like memcmp after making sure the
908
+ * size of the node's data value is equal to the size of cmpval (n),
909
+ * making this a "full match" comparison.
910
+ *
911
+ * @param datanode node of type PLIST_DATA
912
+ * @param cmpval data blob to compare against
913
+ * @param n size of data blob passed in cmpval
914
+ * @return 0 if the node's data blob and cmpval are equal,
915
+ * > 0 if the node's value is lexicographically greater than cmpval,
916
+ * or < 0 if the node's value is lexicographically less than cmpval.
917
+ */
918
+ int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, size_t n);
919
+
920
+ /**
921
+ * Helper function to compare the data of a PLIST_DATA node against
922
+ * a given blob and size, while no more than n bytes are compared.
923
+ * This function basically behaves like memcmp after making sure the
924
+ * size of the node's data value is at least n, making this a
925
+ * "starts with" comparison.
926
+ *
927
+ * @param datanode node of type PLIST_DATA
928
+ * @param cmpval data blob to compare against
929
+ * @param n size of data blob passed in cmpval
930
+ * @return 0 if the node's value and cmpval are equal,
931
+ * > 0 if the node's value is lexicographically greater than cmpval,
932
+ * or < 0 if the node's value is lexicographically less than cmpval.
933
+ */
934
+ int plist_data_val_compare_with_size(plist_t datanode, const uint8_t* cmpval, size_t n);
935
+
936
+ /**
937
+ * Helper function to match a given data blob within the value of a
938
+ * PLIST_DATA node.
939
+ *
940
+ * @param datanode node of type PLIST_KEY
941
+ * @param cmpval data blob to match
942
+ * @param n size of data blob passed in cmpval
943
+ * @return 1 if the node's value contains the given data blob
944
+ * or 0 if not.
945
+ */
946
+ int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n);
947
+
948
+ /*@}*/
949
+
950
+ #ifdef __cplusplus
951
+ }
952
+ #endif
953
+ #endif