workpeg 0.152.0__tar.gz → 0.153.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 (123) hide show
  1. {workpeg-0.152.0/src/workpeg.egg-info → workpeg-0.153.0}/PKG-INFO +1 -1
  2. {workpeg-0.152.0 → workpeg-0.153.0}/pyproject.toml +1 -1
  3. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/build.py +62 -2
  4. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/workpeg-runtime.js +69 -23
  5. {workpeg-0.152.0 → workpeg-0.153.0/src/workpeg.egg-info}/PKG-INFO +1 -1
  6. {workpeg-0.152.0 → workpeg-0.153.0}/LICENSE +0 -0
  7. {workpeg-0.152.0 → workpeg-0.153.0}/MANIFEST.in +0 -0
  8. {workpeg-0.152.0 → workpeg-0.153.0}/README.md +0 -0
  9. {workpeg-0.152.0 → workpeg-0.153.0}/setup.cfg +0 -0
  10. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/__init__.py +0 -0
  11. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/auth.py +0 -0
  12. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/build.py +0 -0
  13. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/cdn.py +0 -0
  14. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/cli.py +0 -0
  15. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/config.py +0 -0
  16. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/context.py +0 -0
  17. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/create_new.py +0 -0
  18. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/doctor.py +0 -0
  19. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/project.py +0 -0
  20. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/run.py +0 -0
  21. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/runtime.py +0 -0
  22. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/sandbox/__init__.py +0 -0
  23. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/sandbox/docker_driver.py +0 -0
  24. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/sandbox/driver.py +0 -0
  25. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/submit.py +0 -0
  26. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/__init__.py +0 -0
  27. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/Dockerfile +0 -0
  28. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/LICENSE +0 -0
  29. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/README.md +0 -0
  30. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
  31. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/app/main.py +0 -0
  32. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/functions/requirements.txt +0 -0
  33. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/README.md +0 -0
  34. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/function/Dockerfile +0 -0
  35. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/function/app/__init__.py +0 -0
  36. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/function/app/main.py +0 -0
  37. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/function/requirements.txt +0 -0
  38. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/ui/main.py +0 -0
  39. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/templates/project/workpeg.json +0 -0
  40. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/terminal.py +0 -0
  41. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/__init__.py +0 -0
  42. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/actions.py +0 -0
  43. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/actions_manifest.py +0 -0
  44. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/app.py +0 -0
  45. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/calendar.py +0 -0
  46. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/compiler/__init__.py +0 -0
  47. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/compiler/ast_parser.py +0 -0
  48. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/compiler/ir.py +0 -0
  49. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/compiler/js_generator.py +0 -0
  50. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/create.py +0 -0
  51. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/dates.py +0 -0
  52. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/dev_refused_names.json +0 -0
  53. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/devmode.py +0 -0
  54. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/devserve.py +0 -0
  55. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/devsite.py +0 -0
  56. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/fake_cloud.py +0 -0
  57. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/minify.py +0 -0
  58. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/render_nodes.py +0 -0
  59. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/renderers_manifest.py +0 -0
  60. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
  61. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
  62. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
  63. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
  64. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/ai.js +0 -0
  65. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/editor.js +0 -0
  66. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
  67. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
  68. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
  69. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
  70. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
  71. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
  72. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
  73. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
  74. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
  75. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
  76. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
  77. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/icons.css.gz +0 -0
  78. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/overlay.js +0 -0
  79. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/pegment.css +0 -0
  80. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/runtime/scaffold.js +0 -0
  81. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/scaffold.py +0 -0
  82. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/search_manifest.py +0 -0
  83. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/serve.py +0 -0
  84. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/skills_manifest.py +0 -0
  85. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/state.py +0 -0
  86. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/validators.py +0 -0
  87. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/watcher.py +0 -0
  88. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/__init__.py +0 -0
  89. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/base.py +0 -0
  90. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/canvas.py +0 -0
  91. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/display.py +0 -0
  92. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/fields.py +0 -0
  93. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/forms.py +0 -0
  94. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/futures.py +0 -0
  95. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/gestures.py +0 -0
  96. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/interactive.py +0 -0
  97. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/layout.py +0 -0
  98. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/ui/widgets/pickers.py +0 -0
  99. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg/utils.py +0 -0
  100. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg.egg-info/SOURCES.txt +0 -0
  101. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
  102. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg.egg-info/entry_points.txt +0 -0
  103. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg.egg-info/requires.txt +0 -0
  104. {workpeg-0.152.0 → workpeg-0.153.0}/src/workpeg.egg-info/top_level.txt +0 -0
  105. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_auth.py +0 -0
  106. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_build.py +0 -0
  107. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_cdn.py +0 -0
  108. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_cdn_publish.py +0 -0
  109. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_changelog.py +0 -0
  110. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_changelog_guard.py +0 -0
  111. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_cli.py +0 -0
  112. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_config.py +0 -0
  113. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_context.py +0 -0
  114. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_create_new.py +0 -0
  115. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_doctor.py +0 -0
  116. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_project_create.py +0 -0
  117. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_release_script.py +0 -0
  118. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_run.py +0 -0
  119. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_runtime.py +0 -0
  120. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_submit.py +0 -0
  121. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_utils.py +0 -0
  122. {workpeg-0.152.0 → workpeg-0.153.0}/tests/test_version.py +0 -0
  123. {workpeg-0.152.0 → workpeg-0.153.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.152.0
3
+ Version: 0.153.0
4
4
  Summary: Workpeg function runtime and SDK
5
5
  Author-email: Workpeg <support@workpeg.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "workpeg"
7
- version = "0.152.0"
7
+ version = "0.153.0"
8
8
  description = "Workpeg function runtime and SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -883,8 +883,10 @@ def _check_manifest_size(text: str) -> None:
883
883
  f"manifest.json is {size} bytes; the platform refuses to read one "
884
884
  f"over {MAX_MANIFEST_BYTES}. It does not read part of it — the "
885
885
  f"whole file is skipped, so every section in it (search, actions, "
886
- f"renderers, skills) silently never arrives. Shorten the longest "
887
- f"section; skill instructions are usually what grows.")
886
+ f"renderers, skills, summary, dev) silently never arrives, and a "
887
+ f"\"dev\": {{\"others\": \"deny\"}} with it lets other "
888
+ f"businesses' dev pages back onto this namespace. Shorten the "
889
+ f"longest section; skill instructions are usually what grows.")
888
890
 
889
891
 
890
892
  def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
@@ -926,6 +928,10 @@ def _peg_manifest(ir, namespace: str, source: Path) -> "dict | None":
926
928
  summary = _summary_section(source)
927
929
  if summary:
928
930
  sections["summary"] = summary
931
+
932
+ dev = _dev_section(source)
933
+ if dev:
934
+ sections["dev"] = dev
929
935
  # Future sections slot in here, each read from its own workpeg.json block.
930
936
 
931
937
  if not sections:
@@ -1006,6 +1012,60 @@ def _summary_section(source: Path) -> "str | None":
1006
1012
  return text
1007
1013
 
1008
1014
 
1015
+ #: Who may run a dev page on this Peg's label, besides its owner: the one
1016
+ #: key the ``dev`` section has, and the only two words it takes.
1017
+ DEV_KEYS = ("others",)
1018
+ DEV_OTHERS = ("allow", "deny")
1019
+
1020
+
1021
+ def _dev_section(source: Path) -> "dict | None":
1022
+ """The Peg's ``dev`` section: whether other businesses may run a dev
1023
+ page (``https://<namespace>.dev.workpeg.com``) on this Peg's label.
1024
+
1025
+ ``{"others": "allow"}`` or ``{"others": "deny"}``. The owner's own
1026
+ business is never refused by it. With no section, others are allowed.
1027
+
1028
+ **Exact words, closed key set, refused at build.** The registry reads
1029
+ this from the uploaded ``manifest.json`` and counts anything it cannot
1030
+ read as ``deny``, so a typo would quietly close the Peg to everyone
1031
+ else. Failing here says so where the author can fix it. Nothing is
1032
+ normalised: ``"Deny"`` and ``" deny"`` are refused, not guessed at.
1033
+ """
1034
+ from workpeg.ui.search_manifest import ManifestValidationError
1035
+
1036
+ config_path = _find_peg_config(source)
1037
+ if config_path is None:
1038
+ return None
1039
+ try:
1040
+ data = json.loads(config_path.read_text(encoding="utf-8"))
1041
+ except (OSError, ValueError):
1042
+ # Reported by _search_section, which reads the same file.
1043
+ return None
1044
+ if not isinstance(data, dict) or "dev" not in data:
1045
+ return None
1046
+ value = data["dev"]
1047
+ shape = ('"dev" must be {"others": "allow"} or {"others": "deny"}')
1048
+ if not isinstance(value, dict):
1049
+ raise ManifestValidationError(
1050
+ f"{config_path}: {shape}, an object; got "
1051
+ f"{type(value).__name__}.")
1052
+ unknown = sorted(str(k) for k in value if k not in DEV_KEYS)
1053
+ if unknown:
1054
+ raise ManifestValidationError(
1055
+ f"{config_path}: {shape}. Unknown key(s) {unknown}; "
1056
+ f'"others" is the only key.')
1057
+ if "others" not in value:
1058
+ raise ManifestValidationError(
1059
+ f'{config_path}: {shape}. "others" is missing; leave the whole '
1060
+ f'"dev" section out to allow others.')
1061
+ others = value["others"]
1062
+ if not isinstance(others, str) or others not in DEV_OTHERS:
1063
+ raise ManifestValidationError(
1064
+ f'{config_path}: {shape}. "others" is {others!r}; it takes '
1065
+ f'exactly "allow" or "deny", in lower case.')
1066
+ return {"others": others}
1067
+
1068
+
1009
1069
  def _actions_section(source: Path) -> "list | None":
1010
1070
  """The Peg's ``actions`` manifest section, from ``workpeg.json``.
1011
1071
 
@@ -639,7 +639,7 @@
639
639
  // "fail" (4xx -> redirect to login) | "error" (5xx / network -> retry, no
640
640
  // redirect, so a transient outage doesn't log an authed user out) |
641
641
  // "refused" (a dev install's page whose address the API refuses: said on
642
- // the page, never redirected, see devNoticeKind).
642
+ // the page, never redirected, see devNoticeOf).
643
643
  Workpeg.accountsBase = "https://accounts.workpeg.com";
644
644
  Workpeg._auth = "unknown";
645
645
  Workpeg._authUser = {};
@@ -819,9 +819,10 @@
819
819
  // refused lists ever differed, would bounce the person back here).
820
820
  // Every other 4xx, on every host, signs in exactly as before.
821
821
  if (r.status === 403 && onDevHost()) {
822
- return devSlug(r).then(function (slug) {
823
- if (slug !== DEV_REFUSED) { signIn(); return; }
822
+ return devProblem(r).then(function (said) {
823
+ if (said[0] !== DEV_REFUSED) { signIn(); return; }
824
824
  devRefusedLoad = true;
825
+ devRefusedWhy = said[1];
825
826
  Workpeg._auth = "refused";
826
827
  Workpeg.render();
827
828
  });
@@ -973,15 +974,50 @@
973
974
  && (p === DEV_REFUSED || p === DEV_MISSING || p === DEV_PAUSED);
974
975
  }
975
976
 
976
- // The slug of an answer's problem type; "" for a body that has none or
977
+ // Why the API refused a dev page's address (dev-origin-refused's
978
+ // "reason"), and the runtime's OWN words for each. The API's reason is
979
+ // only ever compared, by exact string equality, with these four names;
980
+ // what is shown is always the fixed sentence next to it, never anything
981
+ // the answer carried. Any other reason, or none, gets the generic words.
982
+ var DEV_REASONS = [
983
+ ["developer", "This business is not a developer yet. A business can " +
984
+ "run dev pages once Workpeg approves its first peg."],
985
+ ["closed", "The owner of this peg does not allow dev pages on it."],
986
+ ["label", "This name belongs to the platform and cannot be used for " +
987
+ "a dev page."],
988
+ ["registry", "Workpeg could not check this dev page right now. Try " +
989
+ "again in a minute."],
990
+ ];
991
+
992
+ // The name in DEV_REASONS that *reason* is exactly; "" for anything else.
993
+ function devReason(reason) {
994
+ for (var i = 0; i < DEV_REASONS.length; i++) {
995
+ if (reason === DEV_REASONS[i][0]) return DEV_REASONS[i][0];
996
+ }
997
+ return "";
998
+ }
999
+
1000
+ // The fixed sentence for a reason devReason returned; "" for "".
1001
+ function devReasonWords(reason) {
1002
+ for (var i = 0; i < DEV_REASONS.length; i++) {
1003
+ if (reason === DEV_REASONS[i][0]) return DEV_REASONS[i][1];
1004
+ }
1005
+ return "";
1006
+ }
1007
+
1008
+ // An answer's problem: [the slug of its type, its dev-origin-refused
1009
+ // reason as devReason reads it]; ["", ""] for a body that has none or
977
1010
  // does not parse.
978
- function devSlug(r) {
1011
+ function devProblem(r) {
979
1012
  try {
980
1013
  return Promise.resolve(r.json()).then(function (data) {
981
- return Workpeg._problemSlug(data && data.type);
982
- }, function () { return ""; });
1014
+ var slug = Workpeg._problemSlug(data && data.type);
1015
+ var why = slug === DEV_REFUSED && data && typeof data === "object"
1016
+ ? devReason(data.reason) : "";
1017
+ return [slug, why];
1018
+ }, function () { return ["", ""]; });
983
1019
  } catch (e) {
984
- return Promise.resolve("");
1020
+ return Promise.resolve(["", ""]);
985
1021
  }
986
1022
  }
987
1023
 
@@ -992,7 +1028,9 @@
992
1028
  // another. Kept here, not on `Workpeg`, so nothing a page runs can clear
993
1029
  // it, and only ever set on a dev host.
994
1030
  var devRefusedLoad = false;
995
- var devAnswers = []; // [business id, "" | DEV_MISSING | DEV_PAUSED]
1031
+ var devRefusedWhy = ""; // users/me's reason, as devReason reads it
1032
+ // [business id, "" | DEV_REFUSED | DEV_MISSING | DEV_PAUSED, reason]
1033
+ var devAnswers = [];
996
1034
 
997
1035
  function devAnswer(biz) {
998
1036
  for (var i = 0; i < devAnswers.length; i++) {
@@ -1001,24 +1039,27 @@
1001
1039
  return null;
1002
1040
  }
1003
1041
 
1004
- function devNoticeKind() {
1005
- if (devRefusedLoad) return DEV_REFUSED;
1042
+ // [kind, reason] of the notice this load shows, or null for none.
1043
+ function devNoticeOf() {
1044
+ if (devRefusedLoad) return [DEV_REFUSED, devRefusedWhy];
1006
1045
  var a = devAnswer(Workpeg._businessIdFromPath());
1007
- return a ? a[1] : "";
1046
+ return a && a[1] ? [a[1], a[2]] : null;
1008
1047
  }
1009
1048
 
1010
1049
  // Is this peg installed for testing in this business? Asked once per
1011
1050
  // business in the path, once users/me has said yes, on a dev page only
1012
1051
  // (the API's gate decides staff/me like any table route). A 403 typed
1013
1052
  // dev-install-missing or dev-install-paused puts its notice in place of
1014
- // the app. Every other answer, and no answer, leaves the page as it is:
1015
- // its own calls meet their own refusals, as they would without this.
1053
+ // the app, and so does dev-origin-refused, a 403 or the 503 the API gives
1054
+ // when the registry cannot answer, in the words for its reason. Every
1055
+ // other answer, and no answer, leaves the page as it is: its own calls
1056
+ // meet their own refusals, as they would without this.
1016
1057
  function devStaffCheck() {
1017
1058
  try {
1018
1059
  if (!onDevHost()) return;
1019
1060
  var biz = Workpeg._businessIdFromPath();
1020
1061
  if (!biz || devAnswer(biz)) return;
1021
- var asked = [biz, ""];
1062
+ var asked = [biz, "", ""];
1022
1063
  devAnswers.push(asked);
1023
1064
  var headers = {};
1024
1065
  var ns = Workpeg._pegNamespace();
@@ -1027,10 +1068,14 @@
1027
1068
  encodeURIComponent(biz) + "/staff/me/",
1028
1069
  { method: "GET", credentials: "include", headers: headers })
1029
1070
  .then(function (r) {
1030
- if (r.status !== 403) return;
1031
- return devSlug(r).then(function (slug) {
1032
- if (slug !== DEV_MISSING && slug !== DEV_PAUSED) return;
1071
+ if (r.status !== 403 && r.status !== 503) return;
1072
+ return devProblem(r).then(function (said) {
1073
+ var slug = said[0];
1074
+ if (r.status === 503 ? slug !== DEV_REFUSED
1075
+ : slug !== DEV_REFUSED && slug !== DEV_MISSING
1076
+ && slug !== DEV_PAUSED) return;
1033
1077
  asked[1] = slug;
1078
+ asked[2] = said[1];
1034
1079
  Workpeg.render();
1035
1080
  });
1036
1081
  })
@@ -1042,7 +1087,7 @@
1042
1087
  var DEV_INSTALL_PAGE = "https://developers.workpeg.com/dev-install/";
1043
1088
  var DEV_LABEL = /^[a-z][a-z0-9-]{1,61}[a-z0-9]$/;
1044
1089
 
1045
- function devNotice(kind) {
1090
+ function devNotice(kind, reason) {
1046
1091
  var box = document.createElement("div");
1047
1092
  box.style.display = "flex";
1048
1093
  box.style.flexDirection = "column";
@@ -1064,7 +1109,8 @@
1064
1109
  ? "Testing is paused for this peg: the registry did not confirm it " +
1065
1110
  "just now. Try again in a minute; a rejected peg stays paused " +
1066
1111
  "until it is resubmitted."
1067
- : "This address cannot be used for a development page.";
1112
+ : devReasonWords(reason)
1113
+ || "This address cannot be used for a development page.";
1068
1114
  box.appendChild(words);
1069
1115
  // The peg's page on the developer dashboard, where an owner or admin
1070
1116
  // presses Install for testing. Only a namespace that is a label gets a
@@ -4395,9 +4441,9 @@
4395
4441
  // else a loader (checking) or notice (5xx/network); a 4xx has already
4396
4442
  // redirected. The check is kicked off once, the first time we hit "unknown".
4397
4443
  if (Workpeg._auth === "unknown") Workpeg._runAuthCheck();
4398
- var devKind = devNoticeKind();
4399
- if (devKind) {
4400
- el = devNotice(devKind); // a dev page's refusal, said
4444
+ var dev = devNoticeOf();
4445
+ if (dev) {
4446
+ el = devNotice(dev[0], dev[1]); // a dev page's refusal, said
4401
4447
  } else if (Workpeg._auth === "ok") {
4402
4448
  devStaffCheck(); // a dev install's page only
4403
4449
  el = Workpeg.renderNode(children[0], owner);
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workpeg
3
- Version: 0.152.0
3
+ Version: 0.153.0
4
4
  Summary: Workpeg function runtime and SDK
5
5
  Author-email: Workpeg <support@workpeg.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes