workpeg 0.167.0__tar.gz → 0.169.0__tar.gz

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 (176) hide show
  1. {workpeg-0.167.0/src/workpeg.egg-info → workpeg-0.169.0}/PKG-INFO +6 -1
  2. {workpeg-0.167.0 → workpeg-0.169.0}/README.md +3 -0
  3. {workpeg-0.167.0 → workpeg-0.169.0}/pyproject.toml +9 -1
  4. workpeg-0.169.0/src/workpeg/auth/__init__.py +76 -0
  5. workpeg-0.169.0/src/workpeg/auth/errors.py +172 -0
  6. workpeg-0.169.0/src/workpeg/auth/oidc.py +1363 -0
  7. workpeg-0.169.0/src/workpeg/auth/urls.py +101 -0
  8. workpeg-0.169.0/src/workpeg/auth/workpeg.py +211 -0
  9. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/target_sdk.py +53 -4
  10. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/__init__.py +46 -0
  11. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/app.py +676 -35
  12. workpeg-0.169.0/src/workpeg/ui/autocomplete.py +421 -0
  13. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/build.py +470 -24
  14. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/ast_parser.py +3390 -234
  15. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/ir.py +7 -4
  16. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/js_generator.py +820 -82
  17. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/rtc_checks.py +4 -1
  18. workpeg-0.169.0/src/workpeg/ui/compose.py +201 -0
  19. workpeg-0.169.0/src/workpeg/ui/mail.py +716 -0
  20. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/rtc.py +115 -0
  21. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/editor.js +70 -61
  22. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/pegment.css +1195 -125
  23. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/rtc.js +383 -11
  24. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/scaffold.js +1350 -140
  25. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/workpeg-runtime.js +9022 -691
  26. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/scaffold.py +6 -3
  27. workpeg-0.169.0/src/workpeg/ui/selection.py +65 -0
  28. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/state.py +5 -2
  29. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/validators.py +18 -7
  30. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/verify.py +250 -16
  31. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/__init__.py +19 -1
  32. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/display.py +446 -35
  33. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/futures.py +8 -0
  34. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/interactive.py +467 -33
  35. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/layout.py +195 -12
  36. {workpeg-0.167.0 → workpeg-0.169.0/src/workpeg.egg-info}/PKG-INFO +6 -1
  37. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg.egg-info/SOURCES.txt +10 -1
  38. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg.egg-info/requires.txt +3 -0
  39. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_auth.py +6 -6
  40. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_changelog.py +15 -0
  41. workpeg-0.169.0/tests/test_image_layout.py +121 -0
  42. workpeg-0.167.0/src/workpeg/auth.py +0 -294
  43. {workpeg-0.167.0 → workpeg-0.169.0}/LICENSE +0 -0
  44. {workpeg-0.167.0 → workpeg-0.169.0}/MANIFEST.in +0 -0
  45. {workpeg-0.167.0 → workpeg-0.169.0}/setup.cfg +0 -0
  46. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/__init__.py +0 -0
  47. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/build.py +0 -0
  48. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/builder/__init__.py +0 -0
  49. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/builder/__main__.py +0 -0
  50. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/builder/canonical.py +0 -0
  51. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/builder/envelope.py +0 -0
  52. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/builder/stages.py +0 -0
  53. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/cdn.py +0 -0
  54. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/cli.py +0 -0
  55. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/config.py +0 -0
  56. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/context.py +0 -0
  57. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/create_new.py +0 -0
  58. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/doctor.py +0 -0
  59. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/function_base.py +0 -0
  60. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/function_check.py +0 -0
  61. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/function_envelopes.py +0 -0
  62. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/function_local.py +0 -0
  63. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/listen.py +0 -0
  64. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/project.py +0 -0
  65. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/project_submit.py +0 -0
  66. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/run.py +0 -0
  67. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/runtime.py +0 -0
  68. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/sandbox/__init__.py +0 -0
  69. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/sandbox/docker_driver.py +0 -0
  70. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/sandbox/driver.py +0 -0
  71. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/starter.py +0 -0
  72. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/submit.py +0 -0
  73. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/__init__.py +0 -0
  74. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/agents/AGENTS.md +0 -0
  75. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/agents/CLAUDE.md +0 -0
  76. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/Dockerfile +0 -0
  77. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/LICENSE +0 -0
  78. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/README.md +0 -0
  79. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
  80. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/app/main.py +0 -0
  81. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/requirements.txt +0 -0
  82. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/functions/wheels/README.txt +0 -0
  83. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/README.md +0 -0
  84. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/function/Dockerfile +0 -0
  85. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/function/app/__init__.py +0 -0
  86. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/function/app/main.py +0 -0
  87. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/function/requirements.txt +0 -0
  88. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/function/wheels/README.txt +0 -0
  89. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/project/workpeg.json +0 -0
  90. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/app_shell.py +0 -0
  91. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/components.py +0 -0
  92. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/main.py +0 -0
  93. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/pages/__init__.py +0 -0
  94. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/pages/customer.py +0 -0
  95. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/pages/customers.py +0 -0
  96. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/pages/home.py +0 -0
  97. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/templates/starter/pages/not_found.py +0 -0
  98. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/terminal.py +0 -0
  99. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/actions.py +0 -0
  100. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/actions_manifest.py +0 -0
  101. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/calendar.py +0 -0
  102. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/__init__.py +0 -0
  103. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/compiler/rtc_tables.py +0 -0
  104. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/create.py +0 -0
  105. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/dates.py +0 -0
  106. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/dev_refused_names.json +0 -0
  107. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/devmode.py +0 -0
  108. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/devserve.py +0 -0
  109. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/devsite.py +0 -0
  110. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/fake_cloud.py +0 -0
  111. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/minify.py +0 -0
  112. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/permissions_manifest.py +0 -0
  113. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/render_nodes.py +0 -0
  114. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/renderers_manifest.py +0 -0
  115. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
  116. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
  117. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
  118. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
  119. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/ai.js +0 -0
  120. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
  121. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
  122. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
  123. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
  124. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
  125. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
  126. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
  127. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
  128. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
  129. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
  130. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
  131. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/icons.css.gz +0 -0
  132. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/runtime/overlay.js +0 -0
  133. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/scaffold_check.py +0 -0
  134. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/search_manifest.py +0 -0
  135. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/serve.py +0 -0
  136. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/skills_manifest.py +0 -0
  137. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/watcher.py +0 -0
  138. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/base.py +0 -0
  139. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/canvas.py +0 -0
  140. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/fields.py +0 -0
  141. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/forms.py +0 -0
  142. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/gestures.py +0 -0
  143. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/ui/widgets/pickers.py +0 -0
  144. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg/utils.py +0 -0
  145. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
  146. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg.egg-info/entry_points.txt +0 -0
  147. {workpeg-0.167.0 → workpeg-0.169.0}/src/workpeg.egg-info/top_level.txt +0 -0
  148. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_agents_guide.py +0 -0
  149. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_build.py +0 -0
  150. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_cdn.py +0 -0
  151. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_cdn_publish.py +0 -0
  152. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_changelog_guard.py +0 -0
  153. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_cli.py +0 -0
  154. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_command_cheatsheet.py +0 -0
  155. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_config.py +0 -0
  156. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_context.py +0 -0
  157. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_create_new.py +0 -0
  158. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_dev_functions_wire.py +0 -0
  159. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_dev_install_example.py +0 -0
  160. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_doctor.py +0 -0
  161. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_function_check.py +0 -0
  162. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_function_envelopes.py +0 -0
  163. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_function_listen.py +0 -0
  164. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_pegfn_base.py +0 -0
  165. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_project_create.py +0 -0
  166. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_project_submit.py +0 -0
  167. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_release_script.py +0 -0
  168. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_run.py +0 -0
  169. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_run_cli.py +0 -0
  170. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_runtime.py +0 -0
  171. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_runtime_invoke_key.py +0 -0
  172. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_submit.py +0 -0
  173. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_target_sdk.py +0 -0
  174. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_utils.py +0 -0
  175. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_version.py +0 -0
  176. {workpeg-0.167.0 → workpeg-0.169.0}/tests/test_watch_pipeline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workpeg
3
- Version: 0.167.0
3
+ Version: 0.169.0
4
4
  Summary: Workpeg function runtime and SDK
5
5
  Author-email: Workpeg <support@workpeg.com>
6
6
  License: MIT
@@ -18,6 +18,8 @@ Requires-Dist: requests>=2.31.0
18
18
  Requires-Dist: rjsmin>=1.2.0
19
19
  Provides-Extra: docs
20
20
  Requires-Dist: mkdocs-material>=9.5; extra == "docs"
21
+ Provides-Extra: auth
22
+ Requires-Dist: pyjwt[crypto]>=2.10.1; extra == "auth"
21
23
  Provides-Extra: e2e
22
24
  Requires-Dist: playwright==1.47.0; extra == "e2e"
23
25
  Requires-Dist: pytest; extra == "e2e"
@@ -479,6 +481,9 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
479
481
  | `http.*` blocked from Workpeg domains (compile + runtime); reach the platform via the namespaced `workpeg.*` client | Available |
480
482
  | `workpeg.get`/`post`/`put`/`patch`/`delete` — Workpeg-domains-only client; resolves paths against `apiBase` | Available |
481
483
  | `workpeg.*` sends a `Namespace` whoami header (explicit > serving host > baked `peg-namespace` meta) | Available |
484
+ | `data_namespace` in `workpeg.json` — table calls name another Peg's namespace while the logo, login and support stay the Peg's own ([docs](docs/manifest.md#data_namespace)) | Available |
485
+ | `workpeg.files.*` / `workpeg.mail.*` — typed Drive and mail-admin helpers, each group opened by a `scopes` entry in `workpeg.json` and refused at build and before any request without it ([docs](docs/files-and-mail.md)) | Available |
486
+ | `icons` in `workpeg.json` — a page whose icon names come from state ships its own icon subset instead of the CDN's ~26 MB sheet, and the console names any name outside it ([docs](docs/manifest.md#icons)) | Available |
482
487
  | Method local variables (`step = 5; self.count += step`) | Available |
483
488
  | Console logging (`print()` → `console.log()`) | Available |
484
489
  | Dev error overlay (compile + runtime errors in the browser) | Available |
@@ -454,6 +454,9 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
454
454
  | `http.*` blocked from Workpeg domains (compile + runtime); reach the platform via the namespaced `workpeg.*` client | Available |
455
455
  | `workpeg.get`/`post`/`put`/`patch`/`delete` — Workpeg-domains-only client; resolves paths against `apiBase` | Available |
456
456
  | `workpeg.*` sends a `Namespace` whoami header (explicit > serving host > baked `peg-namespace` meta) | Available |
457
+ | `data_namespace` in `workpeg.json` — table calls name another Peg's namespace while the logo, login and support stay the Peg's own ([docs](docs/manifest.md#data_namespace)) | Available |
458
+ | `workpeg.files.*` / `workpeg.mail.*` — typed Drive and mail-admin helpers, each group opened by a `scopes` entry in `workpeg.json` and refused at build and before any request without it ([docs](docs/files-and-mail.md)) | Available |
459
+ | `icons` in `workpeg.json` — a page whose icon names come from state ships its own icon subset instead of the CDN's ~26 MB sheet, and the console names any name outside it ([docs](docs/manifest.md#icons)) | Available |
457
460
  | Method local variables (`step = 5; self.count += step`) | Available |
458
461
  | Console logging (`print()` → `console.log()`) | Available |
459
462
  | Dev error overlay (compile + runtime errors in the browser) | Available |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "workpeg"
7
- version = "0.167.0"
7
+ version = "0.169.0"
8
8
  description = "Workpeg function runtime and SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -32,6 +32,14 @@ dependencies = [
32
32
  docs = [
33
33
  "mkdocs-material>=9.5",
34
34
  ]
35
+ # Sign in with Workpeg, or with any OpenID Connect provider (workpeg.auth):
36
+ # verifying an id_token's signature needs PyJWT with its crypto backend.
37
+ # 2.10.1 at least: 2.10.0 compared a string issuer as a substring
38
+ # (CVE-2024-53861). workpeg.auth compares the issuer itself as well, but
39
+ # nothing older is worth allowing.
40
+ auth = [
41
+ "pyjwt[crypto]>=2.10.1",
42
+ ]
35
43
  # The real-browser smoke (tests/e2e) — pinned to the CI image's Playwright so
36
44
  # local runs and the `e2e_smoke` job drive the same Chromium. Install the
37
45
  # browser once with `playwright install chromium` (or have Google Chrome).
@@ -0,0 +1,76 @@
1
+ """Signing people in: Sign in with Workpeg, or with any OpenID Connect
2
+ provider — the relying party's side.
3
+
4
+ For Workpeg::
5
+
6
+ from workpeg.auth import WorkpegAuth
7
+
8
+ auth = WorkpegAuth(client_id="partner-app",
9
+ client_secret=os.environ["WORKPEG_CLIENT_SECRET"],
10
+ redirect_uri="https://app.partner.example/cb")
11
+
12
+ start = auth.begin() # keep start.to_session() server-side
13
+ ... # send the browser to start.url
14
+ # back at the callback:
15
+ identity = auth.complete_callback(request.GET, start=start)
16
+ identity.subject, identity.business_id, identity.email
17
+
18
+ For another provider, :class:`OIDCClient` with its ``issuer=``; a preset
19
+ such as :class:`WorkpegAuth` is that class with the provider's details
20
+ filled in. The guides are ``docs/sign-in-with-workpeg.md`` and
21
+ ``docs/openid-connect.md``.
22
+
23
+ WHAT WORKPEG GIVES YOU IS A STAFF IDENTITY — a person AND the business they
24
+ signed in as. One human who belongs to three businesses can sign in three
25
+ times and you receive three different ``subject`` values sharing one
26
+ ``email``. Key your accounts on ``subject``.
27
+
28
+ Every error is a :class:`WorkpegAuthError` (the base class itself, also
29
+ called :class:`OIDCError`), typed by what happened; see
30
+ :mod:`workpeg.auth.errors`.
31
+ """
32
+
33
+ from __future__ import annotations
34
+
35
+ # THE HTTP seam: every request in this package goes through the attribute
36
+ # workpeg.auth.requests, looked up when the call is made, so replacing it
37
+ # (a test's fake provider, newtmail-site's tokenwatch) reroutes them all.
38
+ import requests # noqa: F401
39
+
40
+ from workpeg.auth.errors import (AccessTokenRejected, AccountMismatch,
41
+ ConsentDenied, DiscoveryError,
42
+ InteractionRequired, IssuerMismatch,
43
+ LoginNotFresh, LoginRequired,
44
+ LogoutUnsupported, OIDCError,
45
+ ProviderUnavailable, ProviderUnreachable,
46
+ RequestExpired, SignInNotCompleted,
47
+ StateMismatch, TokenExchangeFailed,
48
+ TokenInvalid, UnsafeURL)
49
+ from workpeg.auth.oidc import (ASYMMETRIC_ALGORITHMS, DEFAULT_LEEWAY,
50
+ DEFAULT_TIMEOUT, STANDARD_PROMPTS, OIDCClient,
51
+ OIDCIdentity, ProviderMetadata, SignInStart,
52
+ SignOutStart, discover, discovery_url,
53
+ forget_discovery)
54
+ from workpeg.auth.workpeg import DEFAULT_ISSUER, WorkpegAuth, WorkpegIdentity
55
+
56
+ #: Every error this package raises is one of these; the name predates the
57
+ #: generic client and stays, so ``except WorkpegAuthError`` catches all.
58
+ WorkpegAuthError = OIDCError
59
+
60
+
61
+ __all__ = [
62
+ # Sign in with Workpeg
63
+ "DEFAULT_ISSUER", "WorkpegAuth", "WorkpegIdentity",
64
+ # any OpenID Connect provider
65
+ "OIDCClient", "OIDCIdentity", "ProviderMetadata", "SignInStart",
66
+ "SignOutStart", "discover", "discovery_url", "forget_discovery",
67
+ "ASYMMETRIC_ALGORITHMS", "DEFAULT_LEEWAY", "DEFAULT_TIMEOUT",
68
+ "STANDARD_PROMPTS",
69
+ # why a sign-in did not complete (every one is a WorkpegAuthError)
70
+ "WorkpegAuthError", "OIDCError", "DiscoveryError", "ProviderUnavailable",
71
+ "ProviderUnreachable", "StateMismatch", "IssuerMismatch",
72
+ "SignInNotCompleted", "ConsentDenied", "RequestExpired",
73
+ "LoginRequired", "InteractionRequired", "TokenExchangeFailed",
74
+ "TokenInvalid", "LoginNotFresh", "AccountMismatch",
75
+ "AccessTokenRejected", "LogoutUnsupported", "UnsafeURL",
76
+ ]
@@ -0,0 +1,172 @@
1
+ """Why a sign-in did not complete, as types a caller can branch on.
2
+
3
+ Every class is an :class:`OIDCError`, and ``workpeg.auth.WorkpegAuthError``
4
+ IS that class, so ``except WorkpegAuthError`` written before these existed
5
+ still catches every one of them. Each carries ``.hint``: what to do about
6
+ it, for whoever reads the log. The message (``str(error)``) is for the same
7
+ reader, never for the person signing in: show them something calm.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import requests
13
+
14
+
15
+ class OIDCError(Exception):
16
+ """A sign-in, sign-out or token check did not succeed."""
17
+
18
+ #: What to do about it. Overridden per class, and per raise when the
19
+ #: provider's own case says more.
20
+ hint = "Start the sign-in again."
21
+
22
+ def __init__(self, message: str = "", *, hint: str | None = None):
23
+ super().__init__(message or self.hint)
24
+ if hint is not None:
25
+ self.hint = hint
26
+
27
+
28
+ class DiscoveryError(OIDCError):
29
+ """The provider's discovery document is unreadable, names another
30
+ issuer, or lists an endpoint that is not plain https."""
31
+
32
+ hint = ("Check the issuer URL: it must be exactly the provider's "
33
+ "issuer, and its discovery document must match it.")
34
+
35
+
36
+ class ProviderUnavailable(OIDCError):
37
+ """The provider did not answer usefully: a 5xx, a 429, no keys, or a
38
+ reply that was not JSON. Nothing is wrong with the sign-in itself."""
39
+
40
+ hint = "Try again in a moment; the provider is unavailable."
41
+
42
+
43
+ class ProviderUnreachable(ProviderUnavailable, requests.RequestException):
44
+ """The request never got an answer (DNS, TLS, timeout, refused).
45
+
46
+ Also a ``requests.RequestException``, which is what the same failure
47
+ raised before these types existed, so a caller catching that keeps
48
+ catching it. The original exception is ``__cause__``.
49
+ """
50
+
51
+
52
+ class StateMismatch(OIDCError):
53
+ """The callback, or the return from a sign-out, does not belong to a
54
+ sign-in this browser started: no stored start, a malformed one, a
55
+ different state, or a start already used."""
56
+
57
+ hint = "Start the sign-in again from your own page."
58
+
59
+
60
+ class IssuerMismatch(OIDCError):
61
+ """A callback or a sign-in link named another issuer than the one this
62
+ client is configured for (RFC 9207, OIDC Core section 4)."""
63
+
64
+ hint = ("Ignore it and start the sign-in from your own page; never "
65
+ "follow an issuer named by a link.")
66
+
67
+
68
+ class SignInNotCompleted(OIDCError):
69
+ """The provider sent the person back without a sign-in: the callback
70
+ carried ``error=``, or no code. ``.error`` is the OAuth error code,
71
+ reduced to ``[a-z_]`` and never the provider's free text."""
72
+
73
+ hint = "Offer to start the sign-in again."
74
+
75
+ def __init__(self, message: str = "", *, error: str = "",
76
+ hint: str | None = None):
77
+ super().__init__(message, hint=hint)
78
+ self.error = error
79
+
80
+
81
+ class ConsentDenied(SignInNotCompleted):
82
+ """The person chose not to sign in (``access_denied``)."""
83
+
84
+ hint = "The person chose not to sign in; offer to start again."
85
+
86
+
87
+ class RequestExpired(SignInNotCompleted):
88
+ """The sign-in request expired or was already used, and the provider
89
+ led the person back here to start again."""
90
+
91
+ hint = "Start a new sign-in; the old request cannot be finished."
92
+
93
+
94
+ class LoginRequired(SignInNotCompleted):
95
+ """The provider needs the person to sign in again (``login_required``)."""
96
+
97
+ hint = "Start again with prompt='login'."
98
+
99
+
100
+ class InteractionRequired(SignInNotCompleted):
101
+ """``prompt=none`` asked for a sign-in without a page, and the provider
102
+ needs to show one (``interaction_required`` and its kin)."""
103
+
104
+ hint = "Start an interactive sign-in, without prompt='none'."
105
+
106
+
107
+ class TokenExchangeFailed(OIDCError):
108
+ """The token endpoint refused the code: ``invalid_grant``,
109
+ ``invalid_client``, ``invalid_scope``, or an answer without an
110
+ id_token. ``.error`` is the OAuth code when there was one."""
111
+
112
+ hint = ("Check client_id, client_secret and redirect_uri; a code is "
113
+ "one-time and short-lived, so start the sign-in again.")
114
+
115
+ def __init__(self, message: str = "", *, error: str = "",
116
+ status: int = 0, hint: str | None = None):
117
+ super().__init__(message, hint=hint)
118
+ self.error = error
119
+ self.status = status
120
+
121
+
122
+ class TokenInvalid(OIDCError):
123
+ """The id_token failed a check. ``.reason`` names which one:
124
+ ``signature``, ``kid``, ``alg``, ``issuer``, ``audience``, ``azp``,
125
+ ``expired``, ``iat``, ``nonce``, ``sub``, ``auth_time``, ``amr``,
126
+ ``format``."""
127
+
128
+ hint = ("Do not sign the person in. Log the reason; if it repeats, "
129
+ "the provider or this client's configuration is wrong.")
130
+
131
+ def __init__(self, message: str = "", *, reason: str = "",
132
+ hint: str | None = None):
133
+ super().__init__(message, hint=hint)
134
+ self.reason = reason
135
+
136
+
137
+ class LoginNotFresh(TokenInvalid):
138
+ """``prompt='login'`` or ``max_age`` asked for a recent sign-in, and the
139
+ id_token does not prove one (no ``auth_time``, or too old)."""
140
+
141
+ hint = "Start again with prompt='login'."
142
+
143
+
144
+ class AccountMismatch(OIDCError):
145
+ """Somebody else signed in: the subject (or, for Workpeg, the business)
146
+ is not the one this step expected, or userinfo named another subject."""
147
+
148
+ hint = ("Another account signed in. Sign the person out of your "
149
+ "application and ask them to sign in as the expected account.")
150
+
151
+
152
+ class AccessTokenRejected(OIDCError):
153
+ """The userinfo endpoint answered 401: the access token expired, or the
154
+ person revoked this application."""
155
+
156
+ hint = "Sign the person in again to get a new access token."
157
+
158
+
159
+ class LogoutUnsupported(OIDCError):
160
+ """The provider has no ``end_session_endpoint``."""
161
+
162
+ hint = ("Sign the person out of your application only; the provider "
163
+ "session stays signed in.")
164
+
165
+
166
+ class UnsafeURL(OIDCError, ValueError):
167
+ """A URL that is not plain https (http only on a loopback host), or a
168
+ sign-out return that is not one this client registered. Also a
169
+ ``ValueError``: it is a configuration mistake, raised when the client
170
+ is built or the URL is first used."""
171
+
172
+ hint = "Fix the configuration: use the exact https URL you registered."