@sjawhar/pi-legion-envoy 1.60.1 → 1.60.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.
package/dist/envoy.js CHANGED
@@ -29849,6 +29849,29 @@ var AskFollowerEventPayloadSchema = object({
29849
29849
  session_id: string2().optional(),
29850
29850
  by: object({ kind: string2(), id: string2().optional() }).passthrough().optional()
29851
29851
  });
29852
+ // ../contracts/src/dispatch-href.ts
29853
+ function itemFromSearch(search) {
29854
+ const params = new URLSearchParams(search);
29855
+ const ask = params.get("ask");
29856
+ const comment = params.get("comment");
29857
+ if (ask === null && comment === null) {
29858
+ return;
29859
+ }
29860
+ if (ask !== null && comment !== null) {
29861
+ return null;
29862
+ }
29863
+ const raw = ask ?? comment ?? "";
29864
+ if (raw === "" || raw.includes("/")) {
29865
+ return null;
29866
+ }
29867
+ let id;
29868
+ try {
29869
+ id = decodeURIComponent(raw);
29870
+ } catch {
29871
+ return null;
29872
+ }
29873
+ return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
29874
+ }
29852
29875
  // ../contracts/src/dispatch-snippet.ts
29853
29876
  var HTML_ENTITIES = [
29854
29877
  ["&lt;", "<"],
@@ -33004,6 +33027,13 @@ function dispatchRefFromUrl(value, serverUrl) {
33004
33027
  if (issuePage) {
33005
33028
  const [, key, page, artifact, ask, comment, message] = issuePage;
33006
33029
  const version = versionOf("v");
33030
+ if (page === "spec" || artifact !== undefined) {
33031
+ const item = itemFromSearch(url.search);
33032
+ if (item === null)
33033
+ return;
33034
+ if (item !== undefined)
33035
+ return `dispatch://${key}/${item.kind}/${item.id}`;
33036
+ }
33007
33037
  if (page === "spec" && version !== "")
33008
33038
  return `dispatch://${key}/artifact/spec${version}`;
33009
33039
  if (page !== undefined)
@@ -33024,13 +33054,10 @@ function dispatchRefFromUrl(value, serverUrl) {
33024
33054
  return;
33025
33055
  const [, project, slug] = documentPage;
33026
33056
  const document = `dispatch://${project}/artifact/${decodeURIComponent(slug ?? "")}${versionOf("version")}`;
33027
- const ask = url.searchParams.get("ask");
33028
- if (ask !== null)
33029
- return `${document}/ask/${ask}`;
33030
- const comment = url.searchParams.get("comment");
33031
- if (comment !== null)
33032
- return `${document}/comment/${comment}`;
33033
- return document;
33057
+ const item = itemFromSearch(url.search);
33058
+ if (item === null)
33059
+ return;
33060
+ return item === undefined ? document : `${document}/${item.kind}/${item.id}`;
33034
33061
  }
33035
33062
  var refGrammarProblem = "ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, or " + "dispatch://PROJECT/artifact/<document-ref> (an artifact id, slug, or filename); " + "a dashboard URL on this Dispatch server is accepted too";
33036
33063
  var ownerRequiredProblem = "issue is required; supply issue or set LEGION_ISSUE";
package/dist/legion.js CHANGED
@@ -16144,7 +16144,7 @@ import { logger } from "@oh-my-pi/pi-utils";
16144
16144
  // package.json
16145
16145
  var package_default = {
16146
16146
  name: "@sjawhar/pi-legion-envoy",
16147
- version: "1.60.1",
16147
+ version: "1.60.2",
16148
16148
  type: "module",
16149
16149
  omp: {
16150
16150
  extensions: [
@@ -29921,6 +29921,29 @@ var AskFollowerEventPayloadSchema = object({
29921
29921
  session_id: string2().optional(),
29922
29922
  by: object({ kind: string2(), id: string2().optional() }).passthrough().optional()
29923
29923
  });
29924
+ // ../contracts/src/dispatch-href.ts
29925
+ function itemFromSearch(search) {
29926
+ const params = new URLSearchParams(search);
29927
+ const ask = params.get("ask");
29928
+ const comment = params.get("comment");
29929
+ if (ask === null && comment === null) {
29930
+ return;
29931
+ }
29932
+ if (ask !== null && comment !== null) {
29933
+ return null;
29934
+ }
29935
+ const raw = ask ?? comment ?? "";
29936
+ if (raw === "" || raw.includes("/")) {
29937
+ return null;
29938
+ }
29939
+ let id;
29940
+ try {
29941
+ id = decodeURIComponent(raw);
29942
+ } catch {
29943
+ return null;
29944
+ }
29945
+ return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
29946
+ }
29924
29947
  // ../contracts/src/dispatch-snippet.ts
29925
29948
  var HTML_ENTITIES = [
29926
29949
  ["&lt;", "<"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion-envoy",
3
- "version": "1.60.1",
3
+ "version": "1.60.2",
4
4
  "type": "module",
5
5
  "omp": {
6
6
  "extensions": [