@picked/client 0.0.1-dev.1789541668638 → 0.0.1-next.2

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 (443) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/index.js +1 -4
  3. package/dist/cjs/plugins/create-experience/index.js +1 -1
  4. package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +1 -0
  5. package/dist/cjs/plugins/history-browserstorage-plugin/index.js +1 -0
  6. package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +1 -0
  7. package/dist/cjs/plugins/responses-indexeddb-plugin/index.js +1 -0
  8. package/dist/cjs/plugins/shopify/index.js +1 -0
  9. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  10. package/dist/cjs/plugins/window-object/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/esm/index.js +739 -1814
  13. package/dist/esm/plugins/create-experience/index.js +398 -490
  14. package/dist/esm/plugins/experience-browserstorage-plugin/index.js +38 -0
  15. package/dist/esm/plugins/history-browserstorage-plugin/index.js +26 -0
  16. package/dist/esm/plugins/responses-browserstorage-plugin/index.js +36 -0
  17. package/dist/esm/plugins/responses-indexeddb-plugin/index.js +101 -0
  18. package/dist/esm/plugins/shopify/index.js +59 -0
  19. package/dist/esm/plugins/single-page-app/index.js +35 -31
  20. package/dist/esm/plugins/window-object/index.js +9 -9
  21. package/dist/esm/server/index.js +89 -141
  22. package/dist/experience-instance-6ZKZS7dF.cjs +1 -0
  23. package/dist/experience-instance-BA0EXYg5.js +712 -0
  24. package/dist/id-BKIWbSTy.cjs +1 -0
  25. package/dist/id-BW-g3y32.js +6 -0
  26. package/dist/logger-BsmHUUw1.cjs +1 -0
  27. package/dist/logger-C9a75KZn.js +5 -0
  28. package/dist/object-BbFTsGh3.cjs +1 -0
  29. package/dist/object-JwZ58NOH.js +28 -0
  30. package/dist/storage-BPJwmlva.cjs +1 -0
  31. package/dist/storage-D87xFySf.js +85 -0
  32. package/dist/supports-BvrzQAVk.js +79 -0
  33. package/dist/supports-C0y3-V5V.cjs +1 -0
  34. package/dist/types/client.d.ts +23 -119
  35. package/dist/types/client.d.ts.map +1 -1
  36. package/dist/types/entities/component/component.d.ts +6 -45
  37. package/dist/types/entities/component/component.d.ts.map +1 -1
  38. package/dist/types/entities/experience/experience.d.ts +99 -160
  39. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  40. package/dist/types/entities/experience-instance/experience-instance.d.ts +113 -83
  41. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  42. package/dist/types/entities/feature/feature.d.ts +8 -118
  43. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  44. package/dist/types/entities/field/field.d.ts +64 -96
  45. package/dist/types/entities/field/field.d.ts.map +1 -1
  46. package/dist/types/entities/framework/framework.d.ts +7 -32
  47. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  48. package/dist/types/entities/history/history.d.ts +6 -6
  49. package/dist/types/entities/history/history.d.ts.map +1 -1
  50. package/dist/types/entities/plugin/plugin.d.ts +2 -41
  51. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  52. package/dist/types/entities/predicate/predicate.d.ts +7 -30
  53. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  54. package/dist/types/entities/project/project.d.ts +9 -0
  55. package/dist/types/entities/project/project.d.ts.map +1 -0
  56. package/dist/types/entities/response/response.d.ts +21 -57
  57. package/dist/types/entities/response/response.d.ts.map +1 -1
  58. package/dist/types/exports.d.ts +4 -22
  59. package/dist/types/exports.d.ts.map +1 -1
  60. package/dist/types/index.d.ts +3 -12
  61. package/dist/types/index.d.ts.map +1 -1
  62. package/dist/types/logic-engine.d.ts +11 -13
  63. package/dist/types/logic-engine.d.ts.map +1 -1
  64. package/dist/types/picked.d.ts +184 -381
  65. package/dist/types/picked.d.ts.map +1 -1
  66. package/dist/types/ping.d.ts +10 -0
  67. package/dist/types/ping.d.ts.map +1 -0
  68. package/dist/types/plugins/create-experience/create-experience.d.ts +44 -119
  69. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  70. package/dist/types/plugins/create-experience/index.d.ts +2 -2
  71. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  72. package/dist/types/plugins/create-experience/plugin.d.ts +2 -3
  73. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  74. package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
  75. package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +1 -0
  76. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts +6 -0
  77. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +1 -0
  78. package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +1 -0
  79. package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/plugin.d.ts +1 -2
  80. package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +1 -0
  81. package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +1 -0
  82. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts +6 -0
  83. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +1 -0
  84. package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +1 -0
  85. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts +3 -0
  86. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +1 -0
  87. package/dist/types/plugins/shopify/index.d.ts +2 -0
  88. package/dist/types/plugins/shopify/index.d.ts.map +1 -0
  89. package/dist/types/plugins/shopify/plugin.d.ts +3 -0
  90. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -0
  91. package/dist/types/plugins/shopify/shopify.d.ts +28 -0
  92. package/dist/types/plugins/shopify/shopify.d.ts.map +1 -0
  93. package/dist/types/plugins/single-page-app/plugin.d.ts +2 -2
  94. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  95. package/dist/types/plugins/window-object/plugin.d.ts +2 -2
  96. package/dist/types/server/index.d.ts +3 -18
  97. package/dist/types/server/index.d.ts.map +1 -1
  98. package/dist/types/utils/dom.d.ts +6 -4
  99. package/dist/types/utils/dom.d.ts.map +1 -1
  100. package/dist/types/utils/events.d.ts +38 -83
  101. package/dist/types/utils/events.d.ts.map +1 -1
  102. package/dist/types/utils/global-obj.d.ts +2 -1
  103. package/dist/types/utils/global-obj.d.ts.map +1 -1
  104. package/dist/types/utils/id.d.ts.map +1 -1
  105. package/dist/types/utils/indexed-db.d.ts +1 -2
  106. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  107. package/dist/types/utils/logger.d.ts +1 -2
  108. package/dist/types/utils/logger.d.ts.map +1 -1
  109. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +3 -0
  110. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +1 -0
  111. package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
  112. package/dist/types/utils/node-tree/get-next-node.d.ts.map +1 -1
  113. package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
  114. package/dist/types/utils/node-tree/get-origin-node.d.ts.map +1 -1
  115. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +7 -17
  116. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  117. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +8 -19
  118. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  119. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +7 -31
  120. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  121. package/dist/types/utils/nodes.d.ts +2 -3
  122. package/dist/types/utils/nodes.d.ts.map +1 -1
  123. package/dist/types/utils/object.d.ts +8 -0
  124. package/dist/types/utils/object.d.ts.map +1 -1
  125. package/dist/types/utils/rules-logic.d.ts +3 -33
  126. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  127. package/dist/types/utils/search-params.d.ts.map +1 -1
  128. package/dist/types/utils/state-snaphot.d.ts +16 -0
  129. package/dist/types/utils/state-snaphot.d.ts.map +1 -0
  130. package/dist/types/utils/storage.d.ts +11 -374
  131. package/dist/types/utils/storage.d.ts.map +1 -1
  132. package/dist/types/utils/supports.d.ts +0 -87
  133. package/dist/types/utils/supports.d.ts.map +1 -1
  134. package/package.json +49 -182
  135. package/dist/.tsbuildinfo +0 -1
  136. package/dist/api-C7q_7vxn.js +0 -22
  137. package/dist/api-Ctvh1qkk.cjs +0 -1
  138. package/dist/cjs/form/index.js +0 -1
  139. package/dist/cjs/plugins/dom-observer/index.js +0 -1
  140. package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
  141. package/dist/cjs/plugins/experience-browser-storage/index.js +0 -1
  142. package/dist/cjs/plugins/history-browser-storage/index.js +0 -1
  143. package/dist/cjs/plugins/responses-browser-storage/index.js +0 -1
  144. package/dist/cjs/plugins/responses-indexeddb/index.js +0 -1
  145. package/dist/cjs/plugins/telemetry/index.js +0 -1
  146. package/dist/cjs/plugins/web-components/index.js +0 -1
  147. package/dist/cjs/preview/index.js +0 -1
  148. package/dist/docs/_root.css +0 -101
  149. package/dist/docs/explanation/conditions-and-the-logic-engine.md +0 -94
  150. package/dist/docs/explanation/content-references.md +0 -99
  151. package/dist/docs/explanation/feature-flag-allocation.md +0 -218
  152. package/dist/docs/explanation/how-picked-works.md +0 -124
  153. package/dist/docs/explanation/how-pickedql-works.md +0 -76
  154. package/dist/docs/explanation/pages-and-flows.md +0 -64
  155. package/dist/docs/explanation/the-content-model.md +0 -87
  156. package/dist/docs/explanation/the-two-apis.md +0 -68
  157. package/dist/docs/explanation/why-server-side-rendering.md +0 -76
  158. package/dist/docs/explanation/workspaces-and-versions.md +0 -71
  159. package/dist/docs/how-to/add-a-step-field-or-action.md +0 -43
  160. package/dist/docs/how-to/analytics/index.md +0 -316
  161. package/dist/docs/how-to/archive-or-delete-a-workspace.md +0 -46
  162. package/dist/docs/how-to/authenticate-the-cli.md +0 -97
  163. package/dist/docs/how-to/authenticate-with-a-magic-link.md +0 -40
  164. package/dist/docs/how-to/authenticate-with-a-password.md +0 -51
  165. package/dist/docs/how-to/authenticate-with-an-api-key.md +0 -51
  166. package/dist/docs/how-to/authenticate-with-oauth.md +0 -40
  167. package/dist/docs/how-to/build-a-flow.md +0 -83
  168. package/dist/docs/how-to/connect-the-mcp-server.md +0 -38
  169. package/dist/docs/how-to/create-a-content-entry.md +0 -48
  170. package/dist/docs/how-to/create-a-project.md +0 -29
  171. package/dist/docs/how-to/create-an-experience.md +0 -42
  172. package/dist/docs/how-to/create-and-revoke-an-api-key.md +0 -42
  173. package/dist/docs/how-to/debug-with-the-chrome-extension.md +0 -57
  174. package/dist/docs/how-to/define-a-page-layout.md +0 -46
  175. package/dist/docs/how-to/fill-and-publish-a-page.md +0 -66
  176. package/dist/docs/how-to/install-the-gtm-template.md +0 -84
  177. package/dist/docs/how-to/install-the-sdk.md +0 -93
  178. package/dist/docs/how-to/install-the-vite-plugin.md +0 -69
  179. package/dist/docs/how-to/invite-and-remove-members.md +0 -35
  180. package/dist/docs/how-to/point-one-entry-at-another.md +0 -61
  181. package/dist/docs/how-to/preview-a-workspace.md +0 -28
  182. package/dist/docs/how-to/publish-a-workspace.md +0 -30
  183. package/dist/docs/how-to/read-a-feature-flag.md +0 -113
  184. package/dist/docs/how-to/read-a-referenced-entry.md +0 -109
  185. package/dist/docs/how-to/register-a-component.md +0 -55
  186. package/dist/docs/how-to/register-an-action-handler.md +0 -67
  187. package/dist/docs/how-to/render-a-step-form.md +0 -131
  188. package/dist/docs/how-to/render-an-unpublished-preview.md +0 -41
  189. package/dist/docs/how-to/reuse-a-section.md +0 -53
  190. package/dist/docs/how-to/reuse-a-step-field-or-action.md +0 -28
  191. package/dist/docs/how-to/roll-back-a-published-version.md +0 -26
  192. package/dist/docs/how-to/run-an-ab-test.md +0 -49
  193. package/dist/docs/how-to/run-code-on-a-form-submission.md +0 -125
  194. package/dist/docs/how-to/server-render-a-page.md +0 -81
  195. package/dist/docs/how-to/set-a-content-security-policy.md +0 -32
  196. package/dist/docs/how-to/set-up-mfa.md +0 -69
  197. package/dist/docs/how-to/switch-workspaces.md +0 -122
  198. package/dist/docs/how-to/upload-and-use-an-asset.mdx +0 -73
  199. package/dist/docs/how-to/validate-a-field.md +0 -52
  200. package/dist/docs/how-to/write-a-condition.md +0 -45
  201. package/dist/docs/how-to/write-a-predicate.md +0 -60
  202. package/dist/docs/index.md +0 -59
  203. package/dist/docs/reference/dashboard/actions.mdx +0 -53
  204. package/dist/docs/reference/dashboard/api-keys.mdx +0 -38
  205. package/dist/docs/reference/dashboard/conditions.mdx +0 -42
  206. package/dist/docs/reference/dashboard/content/asset-library.mdx +0 -63
  207. package/dist/docs/reference/dashboard/content/blocks.mdx +0 -57
  208. package/dist/docs/reference/dashboard/content/content-entries.mdx +0 -95
  209. package/dist/docs/reference/dashboard/content/models.mdx +0 -108
  210. package/dist/docs/reference/dashboard/content/pages.mdx +0 -61
  211. package/dist/docs/reference/dashboard/experiences.mdx +0 -51
  212. package/dist/docs/reference/dashboard/features.mdx +0 -154
  213. package/dist/docs/reference/dashboard/fields.mdx +0 -106
  214. package/dist/docs/reference/dashboard/flow-builder/canvas.mdx +0 -58
  215. package/dist/docs/reference/dashboard/flow-builder/condition-builder.md +0 -57
  216. package/dist/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +0 -72
  217. package/dist/docs/reference/dashboard/flow-builder/nodes.md +0 -63
  218. package/dist/docs/reference/dashboard/projects.mdx +0 -44
  219. package/dist/docs/reference/dashboard/reports.mdx +0 -43
  220. package/dist/docs/reference/dashboard/steps.mdx +0 -37
  221. package/dist/docs/reference/dashboard/team-management.md +0 -29
  222. package/dist/docs/reference/dashboard/workspace-versioning.mdx +0 -30
  223. package/dist/docs/reference/dashboard/workspaces.mdx +0 -76
  224. package/dist/docs/reference/delivery-api/experience-content.md +0 -152
  225. package/dist/docs/reference/delivery-api/index.md +0 -45
  226. package/dist/docs/reference/delivery-api/preview-caching-crawling.md +0 -79
  227. package/dist/docs/reference/delivery-api/project-config.md +0 -65
  228. package/dist/docs/reference/delivery-api/workspace-schema.md +0 -85
  229. package/dist/docs/reference/glossary.md +0 -181
  230. package/dist/docs/reference/management-api/authentication.md +0 -74
  231. package/dist/docs/reference/management-api/authorization-and-scopes.md +0 -285
  232. package/dist/docs/reference/management-api/error-handling.md +0 -233
  233. package/dist/docs/reference/management-api/pagination.md +0 -192
  234. package/dist/docs/reference/pickedql/data-sources.md +0 -174
  235. package/dist/docs/reference/pickedql/dimensions.md +0 -103
  236. package/dist/docs/reference/pickedql/filtering.md +0 -64
  237. package/dist/docs/reference/pickedql/index.md +0 -18
  238. package/dist/docs/reference/pickedql/schema.md +0 -172
  239. package/dist/docs/reference/pickedql/virtual-functions.md +0 -248
  240. package/dist/docs/reference/sdk/actions.md +0 -30
  241. package/dist/docs/reference/sdk/analytics-events.md +0 -445
  242. package/dist/docs/reference/sdk/conditions.md +0 -147
  243. package/dist/docs/reference/sdk/content-security-policy.md +0 -21
  244. package/dist/docs/reference/sdk/content.md +0 -213
  245. package/dist/docs/reference/sdk/experiences.md +0 -51
  246. package/dist/docs/reference/sdk/features.md +0 -256
  247. package/dist/docs/reference/sdk/fields.md +0 -255
  248. package/dist/docs/reference/sdk/index.md +0 -68
  249. package/dist/docs/reference/sdk/plugins/create-experience.md +0 -123
  250. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +0 -74
  251. package/dist/docs/reference/sdk/plugins/index.md +0 -29
  252. package/dist/docs/reference/sdk/plugins/window-object.md +0 -25
  253. package/dist/docs/reference/sdk/predicates.md +0 -43
  254. package/dist/docs/reference/sdk/ssr/index.md +0 -33
  255. package/dist/docs/reference/sdk/ssr/rendering-and-hydration.md +0 -103
  256. package/dist/docs/reference/sdk/ssr/serialize.md +0 -80
  257. package/dist/docs/reference/sdk/ssr/slots-and-placements.md +0 -59
  258. package/dist/docs/reference/sdk/steps.md +0 -86
  259. package/dist/docs/reference/sdk/type-generation.md +0 -196
  260. package/dist/docs/reference/tools/chrome-extension.md +0 -16
  261. package/dist/docs/reference/tools/cli.md +0 -146
  262. package/dist/docs/reference/tools/image-optimisation-service.md +0 -104
  263. package/dist/docs/reference/tools/mcp.md +0 -90
  264. package/dist/docs/reference/tools/vite-plugin.md +0 -163
  265. package/dist/docs/tutorials/first-api-call.md +0 -228
  266. package/dist/docs/tutorials/first-experience-in-the-dashboard.mdx +0 -143
  267. package/dist/docs/tutorials/first-experience.mdx +0 -254
  268. package/dist/docs/tutorials/first-server-rendered-page.mdx +0 -186
  269. package/dist/dom-BqcToNL0.js +0 -82
  270. package/dist/dom-DlLH3FxV.cjs +0 -1
  271. package/dist/emit-D-tLiWL1.cjs +0 -1
  272. package/dist/emit-Ds2EG7CB.js +0 -14
  273. package/dist/esm/form/index.js +0 -565
  274. package/dist/esm/plugins/dom-observer/index.js +0 -87
  275. package/dist/esm/plugins/dynamic-experiences/index.js +0 -5
  276. package/dist/esm/plugins/experience-browser-storage/index.js +0 -38
  277. package/dist/esm/plugins/history-browser-storage/index.js +0 -26
  278. package/dist/esm/plugins/responses-browser-storage/index.js +0 -71
  279. package/dist/esm/plugins/responses-indexeddb/index.js +0 -89
  280. package/dist/esm/plugins/telemetry/index.js +0 -100
  281. package/dist/esm/plugins/web-components/index.js +0 -19
  282. package/dist/esm/preview/index.js +0 -2
  283. package/dist/experience-instance-B9S6Yf0N.js +0 -711
  284. package/dist/experience-instance-D8rOg6We.cjs +0 -1
  285. package/dist/id-Bo4RBeOs.js +0 -4
  286. package/dist/id-Js-62re-.cjs +0 -1
  287. package/dist/inert-script-report-B_bMPRzp.js +0 -18
  288. package/dist/inert-script-report-ijRHPtcY.cjs +0 -1
  289. package/dist/logger-CSTvAyyB.cjs +0 -1
  290. package/dist/logger-DMN6TxJJ.js +0 -4
  291. package/dist/object-BUDGxEqy.js +0 -25
  292. package/dist/object-CIkt7Fkr.cjs +0 -1
  293. package/dist/plugin-ChafFq6S.js +0 -194
  294. package/dist/plugin-Dn25Gffy.cjs +0 -1
  295. package/dist/preview-channel-CSr96XAo.js +0 -98
  296. package/dist/preview-channel-Cx0e6fye.cjs +0 -1
  297. package/dist/protocol-Bb_vpLKE.cjs +0 -1
  298. package/dist/protocol-C5KkkiZc.js +0 -84
  299. package/dist/provider-B8wvmeC8.js +0 -98
  300. package/dist/provider-BBLlQOjV.cjs +0 -1
  301. package/dist/registry-C1t8l3t9.cjs +0 -1
  302. package/dist/registry-CXZv0uLg.js +0 -18
  303. package/dist/rules-logic-CGZIYgAI.cjs +0 -1
  304. package/dist/rules-logic-HesIUCu6.js +0 -13
  305. package/dist/storage-1MW3-_As.js +0 -103
  306. package/dist/storage-DUw9UJ2h.cjs +0 -1
  307. package/dist/supports-CO9bJGNl.js +0 -92
  308. package/dist/supports-DBzjGaWD.cjs +0 -1
  309. package/dist/types/data-source/api.d.ts +0 -60
  310. package/dist/types/data-source/api.d.ts.map +0 -1
  311. package/dist/types/data-source/provider.d.ts +0 -103
  312. package/dist/types/data-source/provider.d.ts.map +0 -1
  313. package/dist/types/data-source/registry.d.ts +0 -26
  314. package/dist/types/data-source/registry.d.ts.map +0 -1
  315. package/dist/types/data-source/request-observer.d.ts +0 -62
  316. package/dist/types/data-source/request-observer.d.ts.map +0 -1
  317. package/dist/types/data-source/virtual-data.d.ts +0 -19
  318. package/dist/types/data-source/virtual-data.d.ts.map +0 -1
  319. package/dist/types/entities/action/action.d.ts +0 -85
  320. package/dist/types/entities/action/action.d.ts.map +0 -1
  321. package/dist/types/entities/component/lazyComponent.d.ts +0 -11
  322. package/dist/types/entities/component/lazyComponent.d.ts.map +0 -1
  323. package/dist/types/entities/condition/condition.d.ts +0 -29
  324. package/dist/types/entities/condition/condition.d.ts.map +0 -1
  325. package/dist/types/entities/content/content.d.ts +0 -53
  326. package/dist/types/entities/content/content.d.ts.map +0 -1
  327. package/dist/types/entities/content/reference.d.ts +0 -101
  328. package/dist/types/entities/content/reference.d.ts.map +0 -1
  329. package/dist/types/entities/field/policies.d.ts +0 -35
  330. package/dist/types/entities/field/policies.d.ts.map +0 -1
  331. package/dist/types/entities/response/response-validation.d.ts +0 -75
  332. package/dist/types/entities/response/response-validation.d.ts.map +0 -1
  333. package/dist/types/entities/session/session.d.ts +0 -46
  334. package/dist/types/entities/session/session.d.ts.map +0 -1
  335. package/dist/types/entities/step/step.d.ts +0 -56
  336. package/dist/types/entities/step/step.d.ts.map +0 -1
  337. package/dist/types/form/build-responses.d.ts +0 -18
  338. package/dist/types/form/build-responses.d.ts.map +0 -1
  339. package/dist/types/form/create-field-evaluator.d.ts +0 -28
  340. package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
  341. package/dist/types/form/create-field-validation.d.ts +0 -60
  342. package/dist/types/form/create-field-validation.d.ts.map +0 -1
  343. package/dist/types/form/create-form.d.ts +0 -153
  344. package/dist/types/form/create-form.d.ts.map +0 -1
  345. package/dist/types/form/create-submit-pipeline.d.ts +0 -116
  346. package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
  347. package/dist/types/form/get-step-fields.d.ts +0 -19
  348. package/dist/types/form/get-step-fields.d.ts.map +0 -1
  349. package/dist/types/form/index.d.ts +0 -11
  350. package/dist/types/form/index.d.ts.map +0 -1
  351. package/dist/types/lifecycle/condition-selection.d.ts +0 -146
  352. package/dist/types/lifecycle/condition-selection.d.ts.map +0 -1
  353. package/dist/types/lifecycle/lifecycle.d.ts +0 -48
  354. package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
  355. package/dist/types/lifecycle/rules-logic.d.ts +0 -25
  356. package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
  357. package/dist/types/lifecycle/state-snapshot.d.ts +0 -38
  358. package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
  359. package/dist/types/plugins/dom-observer/index.d.ts +0 -3
  360. package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
  361. package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
  362. package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
  363. package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -105
  364. package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
  365. package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -7
  366. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
  367. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -49
  368. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
  369. package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -45
  370. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
  371. package/dist/types/plugins/experience-browser-storage/index.d.ts.map +0 -1
  372. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +0 -7
  373. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +0 -1
  374. package/dist/types/plugins/history-browser-storage/index.d.ts.map +0 -1
  375. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +0 -1
  376. package/dist/types/plugins/responses-browser-storage/index.d.ts.map +0 -1
  377. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +0 -18
  378. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +0 -1
  379. package/dist/types/plugins/responses-indexeddb/index.d.ts.map +0 -1
  380. package/dist/types/plugins/responses-indexeddb/plugin.d.ts +0 -3
  381. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +0 -1
  382. package/dist/types/plugins/telemetry/emit.d.ts +0 -18
  383. package/dist/types/plugins/telemetry/emit.d.ts.map +0 -1
  384. package/dist/types/plugins/telemetry/index.d.ts +0 -4
  385. package/dist/types/plugins/telemetry/index.d.ts.map +0 -1
  386. package/dist/types/plugins/telemetry/plugin-summary.d.ts +0 -10
  387. package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +0 -1
  388. package/dist/types/plugins/telemetry/plugin.d.ts +0 -45
  389. package/dist/types/plugins/telemetry/plugin.d.ts.map +0 -1
  390. package/dist/types/plugins/web-components/index.d.ts +0 -2
  391. package/dist/types/plugins/web-components/index.d.ts.map +0 -1
  392. package/dist/types/plugins/web-components/plugin.d.ts +0 -4
  393. package/dist/types/plugins/web-components/plugin.d.ts.map +0 -1
  394. package/dist/types/preview/index.d.ts +0 -18
  395. package/dist/types/preview/index.d.ts.map +0 -1
  396. package/dist/types/preview-bridge/index.d.ts +0 -14
  397. package/dist/types/preview-bridge/index.d.ts.map +0 -1
  398. package/dist/types/preview-channel.d.ts +0 -16
  399. package/dist/types/preview-channel.d.ts.map +0 -1
  400. package/dist/types/preview-receiver/apply-ops.d.ts +0 -32
  401. package/dist/types/preview-receiver/apply-ops.d.ts.map +0 -1
  402. package/dist/types/preview-receiver/index.d.ts +0 -32
  403. package/dist/types/preview-receiver/index.d.ts.map +0 -1
  404. package/dist/types/preview-receiver/protocol.d.ts +0 -69
  405. package/dist/types/preview-receiver/protocol.d.ts.map +0 -1
  406. package/dist/types/schema-registry.d.ts +0 -206
  407. package/dist/types/schema-registry.d.ts.map +0 -1
  408. package/dist/types/server/serialize.d.ts +0 -87
  409. package/dist/types/server/serialize.d.ts.map +0 -1
  410. package/dist/types/typed-content.d.ts +0 -17
  411. package/dist/types/typed-content.d.ts.map +0 -1
  412. package/dist/types/utils/client-telemetry.d.ts +0 -25
  413. package/dist/types/utils/client-telemetry.d.ts.map +0 -1
  414. package/dist/types/utils/content-path.d.ts +0 -37
  415. package/dist/types/utils/content-path.d.ts.map +0 -1
  416. package/dist/types/utils/html-asset-value.d.ts +0 -20
  417. package/dist/types/utils/html-asset-value.d.ts.map +0 -1
  418. package/dist/types/utils/inert-script-report.d.ts +0 -40
  419. package/dist/types/utils/inert-script-report.d.ts.map +0 -1
  420. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +0 -25
  421. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +0 -1
  422. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +0 -17
  423. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +0 -1
  424. package/dist/types/utils/node-tree/node-adjacency.d.ts +0 -50
  425. package/dist/types/utils/node-tree/node-adjacency.d.ts.map +0 -1
  426. package/dist/types/utils/node-tree/node-tree-index.d.ts +0 -57
  427. package/dist/types/utils/node-tree/node-tree-index.d.ts.map +0 -1
  428. package/dist/types/utils/picked-config.d.ts +0 -39
  429. package/dist/types/utils/picked-config.d.ts.map +0 -1
  430. package/dist/types/utils/preview-session.d.ts +0 -12
  431. package/dist/types/utils/preview-session.d.ts.map +0 -1
  432. package/dist/types/utils/rehydrate-scripts.d.ts +0 -50
  433. package/dist/types/utils/rehydrate-scripts.d.ts.map +0 -1
  434. package/dist/types/utils/render-string.d.ts +0 -24
  435. package/dist/types/utils/render-string.d.ts.map +0 -1
  436. package/dist/types/utils/user-timing.d.ts +0 -21
  437. package/dist/types/utils/user-timing.d.ts.map +0 -1
  438. package/dist/version-CLjPfmxk.cjs +0 -1
  439. package/dist/version-CPKulHMH.js +0 -256
  440. /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.d.ts +0 -0
  441. /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/index.d.ts +0 -0
  442. /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.d.ts +0 -0
  443. /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.d.ts +0 -0
@@ -1,74 +0,0 @@
1
- ---
2
- type: reference
3
- layout: docs
4
- ---
5
-
6
- # Authentication
7
-
8
- The Picked API supports four ways to authenticate. They are a session from an email
9
- address and a password, an OAuth provider, a magic link, and an API key. This guide
10
- covers each one. It also covers how to control a session and how to use multi-factor
11
- authentication (MFA).
12
-
13
- ## Use a session
14
-
15
- After the caller has a session, it puts the access token in the `Authorization`
16
- header of every request that needs authentication:
17
-
18
- ```
19
- Authorization: Bearer <accessToken>
20
- ```
21
-
22
- The `expiresAt` field of the session gives the time at which the access token
23
- expires. The caller must refresh the session before that time.
24
-
25
- ### Authenticator assurance levels
26
-
27
- The session holds an `aal` field, and it gives the strength of the authentication:
28
-
29
- | Level | Meaning |
30
- |-------|---------|
31
- | `AAL1` | One factor: an email address and a password, OAuth, or a magic link |
32
- | `AAL2` | More than one factor: the user completed an MFA challenge |
33
-
34
- Some operations need `AAL2`. When a caller at `AAL1` tries one of them, the API
35
- returns an authorization error.
36
-
37
- ## The mutations
38
-
39
- | Mutation | What it does |
40
- | --- | --- |
41
- | `sessionCreate` | Authenticates an email address and a password. Returns a session, or `requiresMfa`. |
42
- | `sessionRefresh` | Exchanges a refresh token for a new session. Needs no `Authorization` header. |
43
- | `accountCreate` | Creates an account. `metadata` takes any JSON. |
44
- | `accountVerifyEmail` | Completes email verification with the token from the email. |
45
- | `accountResendVerification` | Sends the verification email again. |
46
- | `oauthAuthorize` | Returns the authorization URL for a provider. Google is supported. |
47
- | `oauthCallback` | Exchanges an OAuth code for a session. |
48
- | `magicLinkSend` | Sends a sign-in link to an email address. |
49
- | `magicLinkVerify` | Exchanges a magic-link token for a session. |
50
- | `passwordResetSend` | Sends a password reset email. |
51
- | `passwordReset` | Completes a reset with the token from the email. |
52
- | `passwordUpdate` | Changes a password. Needs authentication. |
53
- | `mfaFactorEnroll` | Adds an MFA factor. A new factor is `UNVERIFIED`. |
54
- | `mfaChallengeSend` | Sends a code to the telephone number of the factor. |
55
- | `mfaChallengeVerify` | Verifies a challenge. Moves the session to `AAL2`. |
56
- | `mfaFactorUnenroll` | Removes an MFA factor. |
57
- | `apiKeyCreate` | Creates an API key. Only a user with a session can call it. |
58
- | `apiKeyRevoke` | Invalidates a key immediately. |
59
-
60
- ## Credentials
61
-
62
- | Credential | Header |
63
- | --- | --- |
64
- | Session access token | `Authorization: Bearer <accessToken>` |
65
- | API key | `x-api-key: pk_live_abc123...` |
66
-
67
- ## Related
68
-
69
- - [How to authenticate with a password](/how-to/authenticate-with-a-password)
70
- - [How to authenticate with OAuth](/how-to/authenticate-with-oauth)
71
- - [How to authenticate with a magic link](/how-to/authenticate-with-a-magic-link)
72
- - [How to set up MFA](/how-to/set-up-mfa)
73
- - [How to authenticate with an API key](/how-to/authenticate-with-an-api-key)
74
- - [Authorization and scopes](/reference/management-api/authorization-and-scopes)
@@ -1,285 +0,0 @@
1
- ---
2
- type: reference
3
- layout: docs
4
- ---
5
-
6
- # Authorization and scopes
7
-
8
- The Picked API controls access with scopes. Every authenticated caller carries a set
9
- of scopes, and those scopes decide which operations the caller can do. A caller is
10
- either a user with a session or an API key. This guide covers the scopes, the roles,
11
- and how the API resolves a permission.
12
-
13
- ## The format of a scope name
14
-
15
- A scope has the form `resource/action`:
16
-
17
- ```
18
- organization/read
19
- organization_members/create
20
- organization_projects/delete
21
- ```
22
-
23
- - **resource** — a lowercase name. It uses an underscore between words, as in
24
- `organization_members` and `organization_api_keys`.
25
- - **action** — one of `create`, `read`, `update`, or `delete`.
26
-
27
- The GraphQL schema holds the scopes in the `Scope` enum. There they are uppercase
28
- with an underscore between words, as in `ORGANIZATION_READ` and
29
- `ORGANIZATION_MEMBERS_CREATE`. The two forms name the same scope.
30
-
31
- ## Full scope list
32
-
33
- These are the scopes:
34
-
35
- ### Organization
36
-
37
- | Scope | GraphQL Enum | Description |
38
- |-------|-------------|-------------|
39
- | `organization/create` | `ORGANIZATION_CREATE` | Create an organization |
40
- | `organization/read` | `ORGANIZATION_READ` | Read the detail of an organization |
41
- | `organization/update` | `ORGANIZATION_UPDATE` | Update the name, the slug, and the settings of an organization |
42
- | `organization/delete` | `ORGANIZATION_DELETE` | Delete an organization |
43
-
44
- ### Organization members
45
-
46
- | Scope | GraphQL Enum | Description |
47
- |-------|-------------|-------------|
48
- | `organization_members/create` | `ORGANIZATION_MEMBERS_CREATE` | Add a member to an organization |
49
- | `organization_members/read` | `ORGANIZATION_MEMBERS_READ` | Read the member list of an organization |
50
- | `organization_members/update` | `ORGANIZATION_MEMBERS_UPDATE` | Update the role of a member |
51
- | `organization_members/delete` | `ORGANIZATION_MEMBERS_DELETE` | Remove a member from an organization |
52
-
53
- ### Organization invitations
54
-
55
- | Scope | GraphQL Enum | Description |
56
- |-------|-------------|-------------|
57
- | `organization_invitations/create` | `ORGANIZATION_INVITATIONS_CREATE` | Send an invitation to join an organization |
58
- | `organization_invitations/read` | `ORGANIZATION_INVITATIONS_READ` | Read the invitations that wait for an answer |
59
- | `organization_invitations/delete` | `ORGANIZATION_INVITATIONS_DELETE` | Revoke an invitation that waits for an answer |
60
-
61
- ### Organization projects
62
-
63
- | Scope | GraphQL Enum | Description |
64
- |-------|-------------|-------------|
65
- | `organization_projects/create` | `ORGANIZATION_PROJECTS_CREATE` | Create a project |
66
- | `organization_projects/read` | `ORGANIZATION_PROJECTS_READ` | Read the detail of a project |
67
- | `organization_projects/update` | `ORGANIZATION_PROJECTS_UPDATE` | Update the settings of a project |
68
- | `organization_projects/delete` | `ORGANIZATION_PROJECTS_DELETE` | Delete a project |
69
-
70
- ### Organization API keys
71
-
72
- | Scope | GraphQL Enum | Description |
73
- |-------|-------------|-------------|
74
- | `organization_api_keys/create` | `ORGANIZATION_API_KEYS_CREATE` | Create an API key |
75
- | `organization_api_keys/read` | `ORGANIZATION_API_KEYS_READ` | Read the API keys. This gives the prefix only, and not the full key. |
76
- | `organization_api_keys/delete` | `ORGANIZATION_API_KEYS_DELETE` | Revoke an API key |
77
-
78
- ### Organization integrations
79
-
80
- | Scope | GraphQL Enum | Description |
81
- |-------|-------------|-------------|
82
- | `organization_integrations/create` | `ORGANIZATION_INTEGRATIONS_CREATE` | Set up an integration |
83
- | `organization_integrations/read` | `ORGANIZATION_INTEGRATIONS_READ` | Read the options of an integration |
84
- | `organization_integrations/update` | `ORGANIZATION_INTEGRATIONS_UPDATE` | Change the settings of an integration |
85
- | `organization_integrations/delete` | `ORGANIZATION_INTEGRATIONS_DELETE` | Remove an integration |
86
-
87
- ### Organization reports
88
-
89
- | Scope | GraphQL Enum | Description |
90
- |-------|-------------|-------------|
91
- | `organization_reports/create` | `ORGANIZATION_REPORTS_CREATE` | Create a report |
92
- | `organization_reports/read` | `ORGANIZATION_REPORTS_READ` | Read a report |
93
- | `organization_reports/update` | `ORGANIZATION_REPORTS_UPDATE` | Update the settings of a report |
94
- | `organization_reports/delete` | `ORGANIZATION_REPORTS_DELETE` | Delete a report |
95
-
96
- ## Roles
97
-
98
- Each member of an organization holds one of two roles:
99
-
100
- ### Owner
101
-
102
- An owner has full control inside the organization. These are the default scopes of an
103
- owner:
104
-
105
- - All `organization/*` scopes (`read`, `update`, `delete`)
106
- - All `organization_members/*` scopes
107
- - All `organization_invitations/*` scopes
108
- - `organization_projects/read`, `organization_projects/update`, `organization_projects/delete`
109
- - All `organization_api_keys/*` scopes
110
- - All `organization_integrations/*` scopes
111
- - `organization_reports/read`
112
-
113
- ### Member
114
-
115
- A member can reach most things, but cannot delete the organization and cannot control
116
- another member. These are the default scopes of a member:
117
-
118
- - `organization/read`, `organization/update`
119
- - `organization_members/read`
120
- - `organization_invitations/read`
121
- - `organization_projects/read`, `organization_projects/update`, `organization_projects/delete`
122
- - All `organization_api_keys/*` scopes
123
- - All `organization_integrations/*` scopes
124
- - `organization_reports/read`
125
-
126
- These are the differences between an owner and a member:
127
-
128
- | Capability | Owner | Member |
129
- |-----------|-------|--------|
130
- | Delete the organization | Yes | No |
131
- | Invite new members | Yes | No |
132
- | Remove members | Yes | No |
133
- | Update member roles | Yes | No |
134
- | Revoke invitations | Yes | No |
135
- | Control projects and integrations | Yes | Yes |
136
- | Control API keys | Yes | Yes |
137
- | Read reports | Yes | Yes |
138
-
139
- ## How scopes are resolved
140
-
141
- When an authenticated request reaches the API, the API resolves the scopes like this:
142
-
143
- 1. **A user with a session** — the API finds the role of that caller in the target
144
- organization. It then gives the caller the default scopes of that role.
145
- 2. **A request with an API key** — the API uses the scopes that the key received when
146
- somebody created it. Those scopes are always scopes of the user who created the
147
- key.
148
-
149
- Most queries and mutations point at one organization. For those, the caller must hold
150
- the scope inside that organization. For a root-level operation such as
151
- `organizationCreate`, the API resolves the scope at the account level.
152
-
153
- When the caller does not hold the scope that an operation needs, the API returns an
154
- authorization error with the code `FORBIDDEN`. See [Errors](/reference/management-api/error-handling).
155
-
156
- ## Operations and required scopes
157
-
158
- This table gives the scope that each common operation needs:
159
-
160
- ### Queries
161
-
162
- | Query | Required Scope |
163
- |-------|---------------|
164
- | `organization` | `organization/read` |
165
- | `organizations` | `organization/read` |
166
- | `project` | `organization_projects/read` |
167
- | `apiKeys` | `organization_api_keys/read` |
168
- | `shopifyWebhooks` | `organization_integrations/read` |
169
- | `shopifyMetafieldConfigs` | `organization_integrations/read` |
170
- | `shopifyProduct` / `shopifyProducts` | `organization_integrations/read` |
171
- | `report` | `organization_reports/read` |
172
-
173
- ### Mutations
174
-
175
- | Mutation | Required Scope |
176
- |----------|---------------|
177
- | `organizationCreate` | `organization/create` |
178
- | `organizationUpdate` | `organization/update` |
179
- | `organizationDelete` | `organization/delete` |
180
- | `organizationMemberInvite` | `organization_invitations/create` |
181
- | `organizationInvitationRevoke` | `organization_invitations/delete` |
182
- | `organizationMemberRemove` | `organization_members/delete` |
183
- | `organizationMemberRoleUpdate` | `organization_members/update` |
184
- | `projectCreate` | `organization_projects/create` |
185
- | `apiKeyCreate` | `organization_api_keys/create` |
186
- | `apiKeyRevoke` | `organization_api_keys/delete` |
187
- | `shopifyWebhookCreate` | `organization_integrations/create` |
188
- | `shopifyWebhookUpdate` | `organization_integrations/update` |
189
- | `shopifyWebhookDelete` | `organization_integrations/delete` |
190
- | `shopifyMetafieldConfigCreate` | `organization_integrations/create` |
191
- | `shopifyMetafieldConfigUpdate` | `organization_integrations/update` |
192
- | `shopifyMetafieldConfigDelete` | `organization_integrations/delete` |
193
- | `reportCreate` | `organization_reports/create` |
194
- | `reportUpdate` | `organization_reports/update` |
195
- | `reportDelete` | `organization_reports/delete` |
196
-
197
- Some mutations do not require organization-level scopes because they operate on the caller's own data:
198
-
199
- | Mutation | Requirement |
200
- |----------|------------|
201
- | `sessionCreate` / `sessionRefresh` | No authentication required |
202
- | `accountCreate` / `accountVerifyEmail` | No authentication required |
203
- | `oauthAuthorize` / `oauthCallback` | No authentication required |
204
- | `magicLinkSend` / `magicLinkVerify` | No authentication required |
205
- | `passwordResetSend` / `passwordReset` | No authentication required |
206
- | `passwordUpdate` | Authenticated session (no specific scope) |
207
- | `organizationInvitationAccept` / `organizationInvitationDecline` | Authenticated session (no specific scope) |
208
- | `mfaFactorEnroll` / `mfaChallengeSend` / `mfaChallengeVerify` / `mfaFactorUnenroll` | Authenticated session (no specific scope) |
209
-
210
- ## Read your scopes
211
-
212
- ### Root-level scopes
213
-
214
- The `viewerScopes` query returns the root-level scopes for the authenticated caller:
215
-
216
- ```graphql
217
- query {
218
- viewerScopes
219
- }
220
- ```
221
-
222
- Response:
223
-
224
- ```json
225
- {
226
- "data": {
227
- "viewerScopes": [
228
- "ORGANIZATION_CREATE"
229
- ]
230
- }
231
- }
232
- ```
233
-
234
- ### Organization-level scopes
235
-
236
- Each `Organization` object exposes a `viewerScopes` field that returns the scopes the caller has within that specific organization:
237
-
238
- ```graphql
239
- query {
240
- organization(input: { slug: "my-company" }) {
241
- id
242
- name
243
- viewerScopes
244
- }
245
- }
246
- ```
247
-
248
- Response:
249
-
250
- ```json
251
- {
252
- "data": {
253
- "organization": {
254
- "id": "org_abc123",
255
- "name": "My Company",
256
- "viewerScopes": [
257
- "ORGANIZATION_READ",
258
- "ORGANIZATION_UPDATE",
259
- "ORGANIZATION_MEMBERS_READ",
260
- "ORGANIZATION_PROJECTS_READ",
261
- "ORGANIZATION_PROJECTS_UPDATE",
262
- "ORGANIZATION_PROJECTS_DELETE",
263
- "ORGANIZATION_API_KEYS_CREATE",
264
- "ORGANIZATION_API_KEYS_READ",
265
- "ORGANIZATION_API_KEYS_DELETE",
266
- "ORGANIZATION_INTEGRATIONS_CREATE",
267
- "ORGANIZATION_INTEGRATIONS_READ",
268
- "ORGANIZATION_INTEGRATIONS_UPDATE",
269
- "ORGANIZATION_INTEGRATIONS_DELETE",
270
- "ORGANIZATION_REPORTS_READ"
271
- ]
272
- }
273
- }
274
- }
275
- ```
276
-
277
- Use this to build a UI that changes with the permissions of the caller. An example is
278
- a **Delete Organization** button that the UI hides when the caller does not hold
279
- `ORGANIZATION_DELETE`.
280
-
281
- ## Related
282
-
283
- - [Authentication](/reference/management-api/authentication)
284
- - [How to authenticate with an API key](/how-to/authenticate-with-an-api-key)
285
- - [API keys](/reference/dashboard/api-keys) — the dashboard surface.
@@ -1,233 +0,0 @@
1
- ---
2
- type: reference
3
- layout: docs
4
- ---
5
-
6
- # Errors
7
-
8
- The Picked API returns an error in the standard GraphQL format. This guide covers the
9
- shape of an error response, every error code, and what your code must do with each
10
- one.
11
-
12
- ## Error response shape
13
-
14
- When an operation fails, the API returns an `errors` array in the response body. Each
15
- error object holds these fields:
16
-
17
- ```json
18
- {
19
- "data": null,
20
- "errors": [
21
- {
22
- "message": "A human-readable description of the error",
23
- "path": ["mutationName"],
24
- "extensions": {
25
- "code": "ERROR_CODE"
26
- }
27
- }
28
- ]
29
- }
30
- ```
31
-
32
- | Field | Description |
33
- |-------|-------------|
34
- | `message` | A description of the error that a person can read. Put it in your log. Do not write code against it. |
35
- | `path` | The path to the field in the query that made the error. |
36
- | `extensions.code` | An error code that a machine can read. Write your code against this field. |
37
-
38
- One response can hold more than one error. The `data` field is `null` when the whole
39
- operation failed. It holds part of the data when only some fields failed.
40
-
41
- ## Authentication error codes
42
-
43
- These errors come from a session, an account, OAuth, a magic link, a password
44
- operation, or MFA. They match the `AuthErrorCode` enum in the schema.
45
-
46
- | Code | Description |
47
- |------|-------------|
48
- | `INVALID_CREDENTIALS` | The email address and the password do not match. |
49
- | `EMAIL_NOT_CONFIRMED` | The account is there, but nobody verified the email address. See [Authentication](/reference/management-api/authentication#the-mutations). |
50
- | `USER_NOT_FOUND` | There is no account with that email address. |
51
- | `USER_ALREADY_EXISTS` | An account with that email address is there already. The API returns this when you create an account. |
52
- | `WEAK_PASSWORD` | The password is not strong enough. |
53
- | `INVALID_TOKEN` | The token is invalid or malformed. This covers a verification token, a reset token, and a magic link token. |
54
- | `TOKEN_EXPIRED` | The token expired. Ask for a new one. |
55
- | `MFA_CHALLENGE_FAILED` | The MFA verification code is not correct. |
56
- | `MFA_FACTOR_NOT_FOUND` | That MFA factor is not there, or it belongs to another caller. |
57
- | `OAUTH_PROVIDER_ERROR` | The exchange with the OAuth provider, such as Google, failed. |
58
- | `RATE_LIMITED` | Too many requests in a short period. Wait, then try again. |
59
-
60
- ### Example: invalid credentials
61
-
62
- ```json
63
- {
64
- "data": {
65
- "sessionCreate": {
66
- "session": null,
67
- "requiresMfa": false,
68
- "mfaFactors": null
69
- }
70
- },
71
- "errors": [
72
- {
73
- "message": "Invalid credentials",
74
- "path": ["sessionCreate"],
75
- "extensions": {
76
- "code": "INVALID_CREDENTIALS"
77
- }
78
- }
79
- ]
80
- }
81
- ```
82
-
83
- ## Authorization error codes
84
-
85
- An authorization error happens when the caller does not hold the
86
- [scope](/reference/management-api/authorization-and-scopes) that an operation needs.
87
-
88
- | Code | Description |
89
- |------|-------------|
90
- | `UNAUTHORIZED` | The request carries no valid authentication. It has no `Authorization` header and no `x-api-key` header, or the token is invalid. |
91
- | `FORBIDDEN` | The caller is authenticated, but it does not hold the scope that the operation needs. |
92
-
93
- ### Example: the scope is not enough
94
-
95
- A caller that holds `organization/read` only tries to delete an organization. It
96
- receives this:
97
-
98
- ```json
99
- {
100
- "data": {
101
- "organizationDelete": null
102
- },
103
- "errors": [
104
- {
105
- "message": "Insufficient permissions",
106
- "path": ["organizationDelete"],
107
- "extensions": {
108
- "code": "FORBIDDEN"
109
- }
110
- }
111
- ]
112
- }
113
- ```
114
-
115
- ## Organization, member, and invitation error codes
116
-
117
- These errors come from an organization, a member operation, or an invitation. They
118
- match the `ErrorCode` enum in the schema.
119
-
120
- ### Organization errors
121
-
122
- | Code | Description |
123
- |------|-------------|
124
- | `ORGANIZATION_NOT_FOUND` | That organization is not there, or the caller cannot reach it. |
125
- | `ORGANIZATION_ALREADY_EXISTS` | An organization with that name is there already. |
126
- | `SLUG_ALREADY_EXISTS` | Another organization uses that slug already. |
127
- | `INVALID_SLUG` | The slug holds an invalid character. A slug takes lowercase letters, digits, and hyphens only. |
128
-
129
- ### Member errors
130
-
131
- | Code | Description |
132
- |------|-------------|
133
- | `MEMBER_NOT_FOUND` | That user is not a member of the organization. |
134
- | `MEMBER_ALREADY_EXISTS` | The user is a member of the organization already. |
135
- | `CANNOT_REMOVE_PRIMARY_OWNER` | You cannot remove the primary owner of an organization. |
136
- | `CANNOT_CHANGE_OWN_ROLE` | A member cannot change the role of that same member. Another owner must do it. |
137
-
138
- ### Invitation errors
139
-
140
- | Code | Description |
141
- |------|-------------|
142
- | `INVITATION_NOT_FOUND` | That invitation is not there. |
143
- | `INVITATION_EXPIRED` | The invitation expired. Nobody can accept it now. |
144
- | `INVITATION_ALREADY_ACCEPTED` | Somebody accepted the invitation already. |
145
-
146
- ### Project errors
147
-
148
- | Code | Description |
149
- |------|-------------|
150
- | `PROJECT_NOT_FOUND` | That project is not there, or the caller cannot reach it. |
151
-
152
- ### General errors
153
-
154
- | Code | Description |
155
- |------|-------------|
156
- | `VALIDATION_ERROR` | The input failed a validation rule. Read the `message` field to learn which field is invalid. |
157
- | `INTERNAL_ERROR` | The server met an unexpected error. Try the request again. Contact support when the error continues. |
158
-
159
- ## What your code must do
160
-
161
- ### Look for an error first
162
-
163
- Check every response for an `errors` array before you read `data`:
164
-
165
- ```javascript
166
- const response = await fetch('/graphql', {
167
- method: 'POST',
168
- headers: {
169
- 'Content-Type': 'application/json',
170
- 'Authorization': `Bearer ${accessToken}`,
171
- },
172
- body: JSON.stringify({ query, variables }),
173
- });
174
-
175
- const result = await response.json();
176
-
177
- if (result.errors) {
178
- for (const error of result.errors) {
179
- const code = error.extensions?.code;
180
-
181
- switch (code) {
182
- case 'UNAUTHORIZED':
183
- // Send the user to the sign-in page.
184
- break;
185
- case 'FORBIDDEN':
186
- // Show a permissions error.
187
- break;
188
- case 'RATE_LIMITED':
189
- // Wait, then try again.
190
- break;
191
- default:
192
- // Put the message in the log, or show it.
193
- console.error(error.message);
194
- }
195
- }
196
- }
197
- ```
198
-
199
- ### Refresh a token that expired
200
-
201
- A request can return `UNAUTHORIZED` while the caller holds a refresh token. Try a
202
- [session refresh](/reference/management-api/authentication#the-mutations) first. Do not treat it as a
203
- failure to sign in:
204
-
205
- ```javascript
206
- if (code === 'UNAUTHORIZED' && refreshToken) {
207
- const refreshResult = await sessionRefresh(refreshToken);
208
- if (refreshResult.session) {
209
- // Try the first request again with the new access token.
210
- } else {
211
- // Send the user to the sign-in page.
212
- }
213
- }
214
- ```
215
-
216
- ### Read data that is only part complete
217
-
218
- GraphQL can return part of the data together with an error. Take a query that reads
219
- an organization and its members. It can succeed for the organization and fail for the
220
- members, when the caller does not hold `organization_members/read`. The response then
221
- holds `data` with the organization, and `errors` for the members field. Always read
222
- both.
223
-
224
- ### Try again after a transient failure
225
-
226
- `INTERNAL_ERROR` and `RATE_LIMITED` are both transient. For `RATE_LIMITED`, use an
227
- exponential backoff before you try again. For `INTERNAL_ERROR`, one more try is
228
- usually enough.
229
-
230
- ## Related
231
-
232
- - [Authentication](/reference/management-api/authentication)
233
- - [Your first API call](/tutorials/first-api-call)