@riboseinc/paneron-registry-kit 2.0.0-dev8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/common.d.ts +1 -1
  2. package/common.js +1 -1
  3. package/common.js.map +1 -1
  4. package/index.d.ts +3 -3
  5. package/index.js +3 -3
  6. package/index.js.map +1 -1
  7. package/package.json +26 -18
  8. package/types/cr.d.ts +216 -0
  9. package/types/cr.js +175 -0
  10. package/types/cr.js.map +1 -0
  11. package/types/index.d.ts +1 -0
  12. package/types/index.js +19 -0
  13. package/types/index.js.map +1 -1
  14. package/types/item.d.ts +13 -3
  15. package/types/item.js +11 -1
  16. package/types/item.js.map +1 -1
  17. package/types/proposal.d.ts +31 -14
  18. package/types/proposal.js +1 -1
  19. package/types/proposal.js.map +1 -1
  20. package/types/register.d.ts +6 -5
  21. package/types/register.js +19 -1
  22. package/types/register.js.map +1 -1
  23. package/types/registry.d.ts +8 -3
  24. package/types/registry.js +8 -1
  25. package/types/registry.js.map +1 -1
  26. package/types/stakeholder.d.ts +40 -16
  27. package/types/stakeholder.js +47 -3
  28. package/types/stakeholder.js.map +1 -1
  29. package/types/views.d.ts +98 -24
  30. package/types/views.js.map +1 -1
  31. package/views/AnnotatedChange.d.ts +7 -0
  32. package/views/AnnotatedChange.js +91 -0
  33. package/views/AnnotatedChange.js.map +1 -0
  34. package/views/BrowserCtx.d.ts +66 -2
  35. package/views/BrowserCtx.js +13 -2
  36. package/views/BrowserCtx.js.map +1 -1
  37. package/views/FilterCriteria/CRITERIA_CONFIGURATION.d.ts +17 -0
  38. package/views/FilterCriteria/CRITERIA_CONFIGURATION.js +202 -0
  39. package/views/FilterCriteria/CRITERIA_CONFIGURATION.js.map +1 -0
  40. package/views/FilterCriteria/criteriaGroupToQueryExpression.d.ts +6 -0
  41. package/views/FilterCriteria/criteriaGroupToQueryExpression.js +50 -0
  42. package/views/FilterCriteria/criteriaGroupToQueryExpression.js.map +1 -0
  43. package/views/FilterCriteria/criteriaGroupToSummary.d.ts +5 -0
  44. package/views/FilterCriteria/criteriaGroupToSummary.js +62 -0
  45. package/views/FilterCriteria/criteriaGroupToSummary.js.map +1 -0
  46. package/views/FilterCriteria/criteriaToNodes.d.ts +24 -0
  47. package/views/FilterCriteria/criteriaToNodes.js +159 -0
  48. package/views/FilterCriteria/criteriaToNodes.js.map +1 -0
  49. package/views/FilterCriteria/index.d.ts +23 -0
  50. package/views/FilterCriteria/index.js +130 -0
  51. package/views/FilterCriteria/index.js.map +1 -0
  52. package/views/FilterCriteria/models.d.ts +68 -0
  53. package/views/FilterCriteria/models.js +34 -0
  54. package/views/FilterCriteria/models.js.map +1 -0
  55. package/views/FilterCriteria/mutateGroup.d.ts +17 -0
  56. package/views/FilterCriteria/mutateGroup.js +59 -0
  57. package/views/FilterCriteria/mutateGroup.js.map +1 -0
  58. package/views/GenericRelatedItemView.d.ts +1 -1
  59. package/views/GenericRelatedItemView.js +143 -101
  60. package/views/GenericRelatedItemView.js.map +1 -1
  61. package/views/RegisterStakeholder.d.ts +9 -0
  62. package/views/RegisterStakeholder.js +40 -0
  63. package/views/RegisterStakeholder.js.map +1 -0
  64. package/views/RegisterVersion.d.ts +9 -0
  65. package/views/RegisterVersion.js +41 -0
  66. package/views/RegisterVersion.js.map +1 -0
  67. package/views/SearchQuery.d.ts +13 -0
  68. package/views/SearchQuery.js +137 -0
  69. package/views/SearchQuery.js.map +1 -0
  70. package/views/change-request/ChangeRequestContext.d.ts +20 -0
  71. package/views/change-request/ChangeRequestContext.js +56 -0
  72. package/views/change-request/ChangeRequestContext.js.map +1 -0
  73. package/views/change-request/Proposals.d.ts +21 -0
  74. package/views/change-request/Proposals.js +331 -0
  75. package/views/change-request/Proposals.js.map +1 -0
  76. package/views/change-request/objectChangeset.d.ts +31 -0
  77. package/views/change-request/objectChangeset.js +229 -0
  78. package/views/change-request/objectChangeset.js.map +1 -0
  79. package/views/detail/ChangeRequest/Proposal.d.ts +0 -0
  80. package/views/detail/ChangeRequest/Proposal.js +142 -0
  81. package/views/detail/ChangeRequest/Proposal.js.map +1 -0
  82. package/views/detail/ChangeRequest/index.d.ts +13 -0
  83. package/views/detail/ChangeRequest/index.js +207 -0
  84. package/views/detail/ChangeRequest/index.js.map +1 -0
  85. package/views/detail/ChangeRequest/transitions.d.ts +28 -0
  86. package/views/detail/ChangeRequest/transitions.js +530 -0
  87. package/views/detail/ChangeRequest/transitions.js.map +1 -0
  88. package/views/detail/CustomView/index.d.ts +13 -0
  89. package/views/detail/CustomView/index.js +68 -0
  90. package/views/detail/CustomView/index.js.map +1 -0
  91. package/views/detail/RegisterHome/index.d.ts +5 -0
  92. package/views/detail/RegisterHome/index.js +128 -0
  93. package/views/detail/RegisterHome/index.js.map +1 -0
  94. package/views/detail/RegisterItem/RelatedItems.d.ts +13 -0
  95. package/views/detail/RegisterItem/RelatedItems.js +61 -0
  96. package/views/detail/RegisterItem/RelatedItems.js.map +1 -0
  97. package/views/detail/RegisterItem/SupersedingItemMenu.d.ts +13 -0
  98. package/views/detail/RegisterItem/SupersedingItemMenu.js +56 -0
  99. package/views/detail/RegisterItem/SupersedingItemMenu.js.map +1 -0
  100. package/views/detail/RegisterItem/index.d.ts +13 -0
  101. package/views/detail/RegisterItem/index.js +356 -0
  102. package/views/detail/RegisterItem/index.js.map +1 -0
  103. package/views/detail/RegisterMeta/RegisterMetaForm.d.ts +10 -0
  104. package/views/detail/RegisterMeta/RegisterMetaForm.js +331 -0
  105. package/views/detail/RegisterMeta/RegisterMetaForm.js.map +1 -0
  106. package/views/detail/RegisterMeta/index.d.ts +10 -0
  107. package/views/detail/RegisterMeta/index.js +111 -0
  108. package/views/detail/RegisterMeta/index.js.map +1 -0
  109. package/views/detail/index.d.ts +1 -0
  110. package/views/detail/index.js +24 -0
  111. package/views/detail/index.js.map +1 -0
  112. package/views/diffing/InlineDiff.d.ts +12 -0
  113. package/views/diffing/InlineDiff.js +58 -0
  114. package/views/diffing/InlineDiff.js.map +1 -0
  115. package/views/diffing/StructuredDiff.d.ts +11 -0
  116. package/views/diffing/StructuredDiff.js +65 -0
  117. package/views/diffing/StructuredDiff.js.map +1 -0
  118. package/views/hooks/useCustomView.d.ts +3 -0
  119. package/views/hooks/useCustomView.js +24 -0
  120. package/views/hooks/useCustomView.js.map +1 -0
  121. package/views/hooks/useItemClassConfig.d.ts +3 -0
  122. package/views/hooks/useItemClassConfig.js +24 -0
  123. package/views/hooks/useItemClassConfig.js.map +1 -0
  124. package/views/hooks/useItemRef.d.ts +3 -0
  125. package/views/hooks/useItemRef.js +39 -0
  126. package/views/hooks/useItemRef.js.map +1 -0
  127. package/views/hooks/useSingleRegisterItemData.d.ts +3 -0
  128. package/views/hooks/useSingleRegisterItemData.js +32 -0
  129. package/views/hooks/useSingleRegisterItemData.js.map +1 -0
  130. package/views/index.d.ts +2 -2
  131. package/views/index.js +161 -130
  132. package/views/index.js.map +1 -1
  133. package/views/itemPathUtils.d.ts +45 -2
  134. package/views/itemPathUtils.js +101 -14
  135. package/views/itemPathUtils.js.map +1 -1
  136. package/views/itemQueryUtils.d.ts +11 -0
  137. package/views/itemQueryUtils.js +48 -0
  138. package/views/itemQueryUtils.js.map +1 -0
  139. package/views/protocolRegistry.d.ts +12 -0
  140. package/views/protocolRegistry.js +42 -0
  141. package/views/protocolRegistry.js.map +1 -0
  142. package/views/sidebar/Browse/index.d.ts +11 -0
  143. package/views/sidebar/Browse/index.js +453 -0
  144. package/views/sidebar/Browse/index.js.map +1 -0
  145. package/views/sidebar/Export/index.d.ts +5 -0
  146. package/views/sidebar/Export/index.js +94 -0
  147. package/views/sidebar/Export/index.js.map +1 -0
  148. package/views/sidebar/ListItem.d.ts +10 -0
  149. package/views/sidebar/ListItem.js +43 -0
  150. package/views/sidebar/ListItem.js.map +1 -0
  151. package/views/sidebar/Registration/index.d.ts +5 -0
  152. package/views/sidebar/Registration/index.js +163 -0
  153. package/views/sidebar/Registration/index.js.map +1 -0
  154. package/views/sidebar/Search/index.d.ts +18 -0
  155. package/views/sidebar/Search/index.js +177 -0
  156. package/views/sidebar/Search/index.js.map +1 -0
  157. package/views/sidebar/index.d.ts +6 -0
  158. package/views/sidebar/index.js +104 -0
  159. package/views/sidebar/index.js.map +1 -0
  160. package/views/util.d.ts +29 -5
  161. package/views/util.js +92 -6
  162. package/views/util.js.map +1 -1
  163. package/views/ChangeRequest.d.ts +0 -12
  164. package/views/ChangeRequest.js +0 -689
  165. package/views/ChangeRequest.js.map +0 -1
  166. package/views/FilterCriteria.d.ts +0 -27
  167. package/views/FilterCriteria.js +0 -410
  168. package/views/FilterCriteria.js.map +0 -1
  169. package/views/ItemBrowser.d.ts +0 -12
  170. package/views/ItemBrowser.js +0 -255
  171. package/views/ItemBrowser.js.map +0 -1
  172. package/views/ItemDetails.d.ts +0 -14
  173. package/views/ItemDetails.js +0 -128
  174. package/views/ItemDetails.js.map +0 -1
  175. package/views/MainView.d.ts +0 -8
  176. package/views/MainView.js +0 -34
  177. package/views/MainView.js.map +0 -1
  178. package/views/RegisterInformation.d.ts +0 -7
  179. package/views/RegisterInformation.js +0 -264
  180. package/views/RegisterInformation.js.map +0 -1
  181. package/views/RegisterItemGrid.d.ts +0 -25
  182. package/views/RegisterItemGrid.js +0 -248
  183. package/views/RegisterItemGrid.js.map +0 -1
@@ -1,9 +1,52 @@
1
- import { InternalItemReference } from '../types';
2
- export declare function itemRefToItemPath({ subregisterID, classID, itemID }: InternalItemReference): string;
1
+ import type { InternalItemReference } from '../types';
2
+ /**
3
+ * Returns dataset-relative path to a register item,
4
+ * given structured item reference.
5
+ *
6
+ * Optionally makes path include given change request contents.
7
+ */
8
+ export declare function itemRefToItemPath({ subregisterID, classID, itemID }: InternalItemReference, inCRWithID?: string): string;
9
+ /**
10
+ * Returns dataset-relative prefix to a register item,
11
+ * given structured item reference without `itemID`.
12
+ *
13
+ * Optionally makes path include given change request contents.
14
+ */
15
+ export declare function incompleteItemRefToItemPathPrefix({ subregisterID, classID }: Omit<InternalItemReference, 'itemID'>, inCRWithID?: string): string;
16
+ /**
17
+ * Attempts to return a structured register item reference
18
+ * given a dataset-relative item path.
19
+ * If some components are missing, returns an incomplete reference.
20
+ */
3
21
  export declare function itemPathToItemRefLike(hasSubregisters: boolean, itemPath: string): {
4
22
  itemID?: string;
5
23
  classID?: string;
6
24
  subregisterID?: string;
7
25
  };
26
+ /** Returns just register item ID, given dataset-relative path. */
8
27
  export declare function itemPathToItemID(objPath: string): string | undefined;
28
+ /**
29
+ * Attempts to return a structured register item reference
30
+ * given a dataset-relative item path.
31
+ * If some components are missing, throws an Error.
32
+ */
9
33
  export declare function itemPathToItemRef(hasSubregisters: boolean, itemPath: string): InternalItemReference;
34
+ /**
35
+ * If given item path indicates that it is within any CR, returns respective CR ID.
36
+ * Otherwise, returns `null`.
37
+ */
38
+ export declare function getCRIDFromProposedItemPath(givenItemPath: string): string | null;
39
+ /**
40
+ * Given an item path, returns path relative to specified CR ID
41
+ * (even if the path is already relative to another CR ID).
42
+ */
43
+ export declare function itemPathInCR(givenItemPath: string, crID: string): string;
44
+ /**
45
+ * Returns given item path in register-relative form,
46
+ * even if the path is given within proposal contents.
47
+ */
48
+ export declare function itemPathNotInCR(givenItemPath: string): string;
49
+ /** Converts a change request ID to dataset-relative path to respective main.yaml. */
50
+ export declare function crIDToCRPath(crID: string): string;
51
+ /** Extracts change request ID from dataset-relative path to its main.yaml. */
52
+ export declare function crPathToCRID(crPath: string): string;
@@ -4,42 +4,82 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.itemRefToItemPath = itemRefToItemPath;
7
+ exports.incompleteItemRefToItemPathPrefix = incompleteItemRefToItemPathPrefix;
7
8
  exports.itemPathToItemRefLike = itemPathToItemRefLike;
8
9
  exports.itemPathToItemID = itemPathToItemID;
9
10
  exports.itemPathToItemRef = itemPathToItemRef;
11
+ exports.getCRIDFromProposedItemPath = getCRIDFromProposedItemPath;
12
+ exports.itemPathInCR = itemPathInCR;
13
+ exports.itemPathNotInCR = itemPathNotInCR;
14
+ exports.crIDToCRPath = crIDToCRPath;
15
+ exports.crPathToCRID = crPathToCRID;
10
16
 
17
+ /**
18
+ * Returns dataset-relative path to a register item,
19
+ * given structured item reference.
20
+ *
21
+ * Optionally makes path include given change request contents.
22
+ */
11
23
  function itemRefToItemPath({
12
24
  subregisterID,
13
25
  classID,
14
26
  itemID
15
- }) {
16
- if (subregisterID) {
17
- return `/${subregisterID}/${classID}/${itemID}.yaml`;
18
- } else {
19
- return `/${classID}/${itemID}.yaml`;
20
- }
27
+ }, inCRWithID) {
28
+ return `${incompleteItemRefToItemPathPrefix({
29
+ subregisterID,
30
+ classID
31
+ }, inCRWithID)}/${itemID}.yaml`;
21
32
  }
33
+ /**
34
+ * Returns dataset-relative prefix to a register item,
35
+ * given structured item reference without `itemID`.
36
+ *
37
+ * Optionally makes path include given change request contents.
38
+ */
22
39
 
23
- function itemPathToItemRefLike(hasSubregisters, itemPath) {
24
- var _a;
25
40
 
26
- const pathNormalized = itemPath ? stripLeadingSlash(itemPath) : undefined;
27
- const pathParts = (_a = pathNormalized === null || pathNormalized === void 0 ? void 0 : pathNormalized.split('/')) !== null && _a !== void 0 ? _a : [];
28
- const subregisterID = hasSubregisters && pathParts.length >= 1 ? pathParts[0] : undefined;
29
- const classID = hasSubregisters ? pathParts.length >= 2 ? pathParts[1] : undefined : pathParts.length >= 1 ? pathParts[0] : undefined;
30
- const itemID = hasSubregisters && pathParts.length === 3 || !hasSubregisters && pathParts.length === 2 ? pathParts[pathParts.length - 1].split('.')[0] : undefined;
41
+ function incompleteItemRefToItemPathPrefix({
42
+ subregisterID,
43
+ classID
44
+ }, inCRWithID) {
45
+ const itemWithClass = `${classID}`;
46
+ const fullPath = subregisterID ? `subregisters/${subregisterID}/${itemWithClass}` : itemWithClass;
47
+ const maybeInCR = inCRWithID !== undefined ? `/proposals/${inCRWithID}/items/${fullPath}` : `/${fullPath}`;
48
+ return maybeInCR;
49
+ }
50
+ /**
51
+ * Attempts to return a structured register item reference
52
+ * given a dataset-relative item path.
53
+ * If some components are missing, returns an incomplete reference.
54
+ */
55
+
56
+
57
+ function itemPathToItemRefLike(hasSubregisters, itemPath) {
58
+ const pathNormalized = itemPath.trim() ? stripLeadingSlash(itemPathNotInCR(itemPath)) : undefined;
59
+ const pathParts = (pathNormalized === null || pathNormalized === void 0 ? void 0 : pathNormalized.split('/')) ?? [];
60
+ const subregisterID = hasSubregisters && pathParts.length >= 1 ? pathParts[1] : undefined;
61
+ const classID = hasSubregisters ? pathParts.length >= 3 ? pathParts[2] : undefined : pathParts.length >= 1 ? pathParts[0] : undefined;
62
+ const itemID = hasSubregisters && pathParts.length === 4 || !hasSubregisters && pathParts.length === 2 ? pathParts[pathParts.length - 1].split('.')[0] : undefined;
31
63
  return {
32
64
  subregisterID,
33
65
  classID,
34
66
  itemID
35
67
  };
36
68
  }
69
+ /** Returns just register item ID, given dataset-relative path. */
70
+
37
71
 
38
72
  function itemPathToItemID(objPath) {
39
73
  const objPathComponents = objPath === null || objPath === void 0 ? void 0 : objPath.split('/');
40
74
  const selectedItemID = objPathComponents !== undefined ? objPathComponents[objPathComponents.length - 1].split('.')[0] : undefined;
41
75
  return selectedItemID;
42
76
  }
77
+ /**
78
+ * Attempts to return a structured register item reference
79
+ * given a dataset-relative item path.
80
+ * If some components are missing, throws an Error.
81
+ */
82
+
43
83
 
44
84
  function itemPathToItemRef(hasSubregisters, itemPath) {
45
85
  const maybeRef = itemPathToItemRefLike(hasSubregisters, itemPath);
@@ -47,11 +87,58 @@ function itemPathToItemRef(hasSubregisters, itemPath) {
47
87
  if (maybeRef.classID && maybeRef.itemID) {
48
88
  return maybeRef;
49
89
  } else {
50
- console.error("Internal item reference cannot be constructed from given item path", itemPath, hasSubregisters);
90
+ console.error("Internal item reference cannot be constructed from given item path, got", maybeRef, itemPath, hasSubregisters, "from", itemPath);
51
91
  throw new Error("Internal item reference cannot be constructed from given item path");
52
92
  }
53
93
  }
54
94
 
95
+ const CR_ITEM_PREFIX_REGEX = /^proposals\/(?<crID>\p{Hex_Digit}{8}(?:-\p{Hex_Digit}{4}){3}-\p{Hex_Digit}{12})\/items\//u;
96
+ /**
97
+ * If given item path indicates that it is within any CR, returns respective CR ID.
98
+ * Otherwise, returns `null`.
99
+ */
100
+
101
+ function getCRIDFromProposedItemPath(givenItemPath) {
102
+ var _stripLeadingSlash$ma, _stripLeadingSlash$ma2;
103
+
104
+ return ((_stripLeadingSlash$ma = stripLeadingSlash(givenItemPath).match(CR_ITEM_PREFIX_REGEX)) === null || _stripLeadingSlash$ma === void 0 ? void 0 : (_stripLeadingSlash$ma2 = _stripLeadingSlash$ma.groups) === null || _stripLeadingSlash$ma2 === void 0 ? void 0 : _stripLeadingSlash$ma2.crID) ?? null;
105
+ }
106
+ /**
107
+ * Given an item path, returns path relative to specified CR ID
108
+ * (even if the path is already relative to another CR ID).
109
+ */
110
+
111
+
112
+ function itemPathInCR(givenItemPath, crID) {
113
+ // Remove any CR prefix from given path
114
+ // TODO(perf): Don’t do if prefix matches CR ID already specified?
115
+ // TODO: Validate given path actually looks like a register item path and throw?
116
+ const normalized = stripLeadingSlash(givenItemPath).replace(CR_ITEM_PREFIX_REGEX, '');
117
+ return `/proposals/${crID}/items/${normalized}`;
118
+ }
119
+ /**
120
+ * Returns given item path in register-relative form,
121
+ * even if the path is given within proposal contents.
122
+ */
123
+
124
+
125
+ function itemPathNotInCR(givenItemPath) {
126
+ const normalized = stripLeadingSlash(givenItemPath).replace(CR_ITEM_PREFIX_REGEX, '');
127
+ return `/${normalized}`;
128
+ }
129
+
55
130
  function stripLeadingSlash(aPath) {
56
131
  return aPath.replace(/^\//, '');
132
+ }
133
+ /** Converts a change request ID to dataset-relative path to respective main.yaml. */
134
+
135
+
136
+ function crIDToCRPath(crID) {
137
+ return `/proposals/${crID}/main.yaml`;
138
+ }
139
+ /** Extracts change request ID from dataset-relative path to its main.yaml. */
140
+
141
+
142
+ function crPathToCRID(crPath) {
143
+ return stripLeadingSlash(crPath).replace('proposals/', '').split('/')[0];
57
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"itemPathUtils.js","sourceRoot":"","sources":["../../src/views/itemPathUtils.tsx"],"names":[],"mappings":"AAGA,MAAM,UAAU,iBAAiB,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAyB;IACzF,IAAI,aAAa,EAAE;QACjB,OAAO,IAAI,aAAa,IAAI,OAAO,IAAI,MAAM,OAAO,CAAC;KACtD;SAAM;QACL,OAAO,IAAI,OAAO,IAAI,MAAM,OAAO,CAAC;KACrC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,eAAwB,EAAE,QAAgB;;IAE9E,MAAM,cAAc,GAAG,QAAQ;QAC7B,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC;QAC7B,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,SAAS,GAAG,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;IAEnD,MAAM,aAAa,GAAuB,eAAe,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC;QAChF,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QACd,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,OAAO,GAAuB,eAAe;QACjD,CAAC,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC;YACrB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,CAAC,CAAC,SAAS;QACb,CAAC,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC;YACrB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,MAAM,GACV,CAAC,eAAe,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,eAAe,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,iBAAiB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,cAAc,GAAG,iBAAiB,KAAK,SAAS;QACpD,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,eAAwB,EAAE,QAAgB;IAC1E,MAAM,QAAQ,GAAG,qBAAqB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAClE,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE;QACvC,OAAO,QAAiC,CAAC;KAC1C;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,oEAAoE,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC/G,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;KACvF;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { InternalItemReference } from '../types';\n\n\nexport function itemRefToItemPath({ subregisterID, classID, itemID }: InternalItemReference): string {\n if (subregisterID) {\n return `/${subregisterID}/${classID}/${itemID}.yaml`;\n } else {\n return `/${classID}/${itemID}.yaml`;\n }\n}\n\nexport function itemPathToItemRefLike(hasSubregisters: boolean, itemPath: string):\n{ itemID?: string; classID?: string; subregisterID?: string; } {\n const pathNormalized = itemPath\n ? stripLeadingSlash(itemPath)\n : undefined;\n const pathParts = pathNormalized?.split('/') ?? [];\n\n const subregisterID: string | undefined = hasSubregisters && pathParts.length >= 1\n ? pathParts[0]\n : undefined;\n\n const classID: string | undefined = hasSubregisters\n ? pathParts.length >= 2\n ? pathParts[1]\n : undefined\n : pathParts.length >= 1\n ? pathParts[0]\n : undefined;\n\n const itemID: string | undefined =\n (hasSubregisters && pathParts.length === 3) ||\n (!hasSubregisters && pathParts.length === 2)\n ? pathParts[pathParts.length - 1].split('.')[0]\n : undefined;\n\n return { subregisterID, classID, itemID };\n}\n\nexport function itemPathToItemID(objPath: string): string | undefined {\n const objPathComponents = objPath?.split('/');\n const selectedItemID = objPathComponents !== undefined\n ? objPathComponents[objPathComponents.length - 1].split('.')[0]\n : undefined;\n return selectedItemID;\n}\n\nexport function itemPathToItemRef(hasSubregisters: boolean, itemPath: string): InternalItemReference {\n const maybeRef = itemPathToItemRefLike(hasSubregisters, itemPath);\n if (maybeRef.classID && maybeRef.itemID) {\n return maybeRef as InternalItemReference;\n } else {\n console.error(\"Internal item reference cannot be constructed from given item path\", itemPath, hasSubregisters);\n throw new Error(\"Internal item reference cannot be constructed from given item path\");\n }\n}\n\nfunction stripLeadingSlash(aPath: string): string {\n return aPath.replace(/^\\//, '');\n}\n"]}
1
+ {"version":3,"file":"itemPathUtils.js","sourceRoot":"","sources":["../../src/views/itemPathUtils.tsx"],"names":[],"mappings":"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","sourcesContent":["import type { InternalItemReference } from '../types';\n\n\n/**\n * Returns dataset-relative path to a register item,\n * given structured item reference.\n *\n * Optionally makes path include given change request contents.\n */\nexport function itemRefToItemPath(\n { subregisterID, classID, itemID }: InternalItemReference,\n inCRWithID?: string,\n): string {\n return `${incompleteItemRefToItemPathPrefix({ subregisterID, classID }, inCRWithID)}/${itemID}.yaml`;\n}\n\n\n/**\n * Returns dataset-relative prefix to a register item,\n * given structured item reference without `itemID`.\n *\n * Optionally makes path include given change request contents.\n */\nexport function incompleteItemRefToItemPathPrefix(\n { subregisterID, classID }: Omit<InternalItemReference, 'itemID'>,\n inCRWithID?: string,\n): string {\n const itemWithClass = `${classID}`;\n const fullPath = subregisterID\n ? `subregisters/${subregisterID}/${itemWithClass}`\n : itemWithClass;\n const maybeInCR = inCRWithID !== undefined\n ? `/proposals/${inCRWithID}/items/${fullPath}`\n : `/${fullPath}`;\n return maybeInCR;\n}\n\n/**\n * Attempts to return a structured register item reference\n * given a dataset-relative item path.\n * If some components are missing, returns an incomplete reference.\n */\nexport function itemPathToItemRefLike(hasSubregisters: boolean, itemPath: string):\n{ itemID?: string; classID?: string; subregisterID?: string; } {\n const pathNormalized = itemPath.trim()\n ? stripLeadingSlash(itemPathNotInCR(itemPath))\n : undefined;\n const pathParts = pathNormalized?.split('/') ?? [];\n\n const subregisterID: string | undefined = hasSubregisters && pathParts.length >= 1\n ? pathParts[1]\n : undefined;\n\n const classID: string | undefined = hasSubregisters\n ? pathParts.length >= 3\n ? pathParts[2]\n : undefined\n : pathParts.length >= 1\n ? pathParts[0]\n : undefined;\n\n const itemID: string | undefined =\n (hasSubregisters && pathParts.length === 4) ||\n (!hasSubregisters && pathParts.length === 2)\n ? pathParts[pathParts.length - 1].split('.')[0]\n : undefined;\n\n return { subregisterID, classID, itemID };\n}\n\n/** Returns just register item ID, given dataset-relative path. */\nexport function itemPathToItemID(objPath: string): string | undefined {\n const objPathComponents = objPath?.split('/');\n const selectedItemID = objPathComponents !== undefined\n ? objPathComponents[objPathComponents.length - 1].split('.')[0]\n : undefined;\n return selectedItemID;\n}\n\n/**\n * Attempts to return a structured register item reference\n * given a dataset-relative item path.\n * If some components are missing, throws an Error.\n */\nexport function itemPathToItemRef(hasSubregisters: boolean, itemPath: string): InternalItemReference {\n const maybeRef = itemPathToItemRefLike(hasSubregisters, itemPath);\n if (maybeRef.classID && maybeRef.itemID) {\n return maybeRef as InternalItemReference;\n } else {\n console.error(\"Internal item reference cannot be constructed from given item path, got\", maybeRef, itemPath, hasSubregisters, \"from\", itemPath);\n throw new Error(\"Internal item reference cannot be constructed from given item path\");\n }\n}\n\n\nconst CR_ITEM_PREFIX_REGEX = /^proposals\\/(?<crID>\\p{Hex_Digit}{8}(?:-\\p{Hex_Digit}{4}){3}-\\p{Hex_Digit}{12})\\/items\\//u;\n\n\n/**\n * If given item path indicates that it is within any CR, returns respective CR ID.\n * Otherwise, returns `null`.\n */\nexport function getCRIDFromProposedItemPath(givenItemPath: string): string | null {\n return stripLeadingSlash(givenItemPath).match(CR_ITEM_PREFIX_REGEX)?.groups?.crID ?? null;\n}\n\n\n/**\n * Given an item path, returns path relative to specified CR ID\n * (even if the path is already relative to another CR ID).\n */\nexport function itemPathInCR(givenItemPath: string, crID: string): string {\n // Remove any CR prefix from given path\n // TODO(perf): Don’t do if prefix matches CR ID already specified?\n // TODO: Validate given path actually looks like a register item path and throw?\n const normalized = stripLeadingSlash(givenItemPath).replace(CR_ITEM_PREFIX_REGEX, '');\n return `/proposals/${crID}/items/${normalized}`;\n}\n\n/**\n * Returns given item path in register-relative form,\n * even if the path is given within proposal contents.\n */\nexport function itemPathNotInCR(givenItemPath: string): string {\n const normalized = stripLeadingSlash(givenItemPath).replace(CR_ITEM_PREFIX_REGEX, '');\n return `/${normalized}`;\n}\n\nfunction stripLeadingSlash(aPath: string): string {\n return aPath.replace(/^\\//, '');\n}\n\n\n/** Converts a change request ID to dataset-relative path to respective main.yaml. */\nexport function crIDToCRPath(crID: string): string {\n return `/proposals/${crID}/main.yaml`;\n}\n\n/** Extracts change request ID from dataset-relative path to its main.yaml. */\nexport function crPathToCRID(crPath: string): string {\n return (\n stripLeadingSlash(crPath).\n replace('proposals/', '').\n split('/')[0]\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Base as BaseCR } from '../types/cr';
2
+ /**
3
+ * Returns a query criteria for use with filtered indexes
4
+ * by combining given `queryExpression` with base query that matches only
5
+ * objects corresponding to register items.
6
+ *
7
+ * `withCR` should be set to active CR, and would make the query
8
+ * additionally match clarified/added register items that did not yet make it
9
+ * into the register proper.
10
+ */
11
+ export declare function getRegisterItemQuery(queryExpression: string, withCR?: BaseCR): string;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getRegisterItemQuery = getRegisterItemQuery;
7
+
8
+ var _itemPathUtils = require("./itemPathUtils");
9
+
10
+ // TODO: Should it be three path components? Probably four
11
+ const REGISTER_ITEM_QUERY = `
12
+ objPath.startsWith("/subregisters/") || (
13
+ objPath.split("/").length === 3 &&
14
+ !objPath.startsWith("/proposals/")
15
+ )
16
+ `;
17
+ /**
18
+ * Returns a query that matches given register item object path
19
+ * depending on how it appears in given change request.
20
+ *
21
+ * For additions, object path would be full in-proposal path
22
+ * (the item doesn’t exist in the register “normally”), so we want to match that.
23
+ * For clarifications, object path we want to match is normal
24
+ */
25
+
26
+ function getItemInCRQuery(cr) {
27
+ //const affectedItemPathsQuoted: string[] = Object.entries(withCR.items).
28
+ // filter(([, proposal]) => proposal.type === 'clarification' || proposal.type === 'addition').
29
+ // map(([itemPath, proposal]) => proposal.type === 'clarification' ? `"${itemPath}"` : `/proposals/${withCR.id}/items/${itemPath}`);
30
+ const affectedItemPathsQuoted = Object.entries(cr.items).filter(([, proposal]) => proposal.type !== 'amendment').map(([itemPath]) => `"${(0, _itemPathUtils.itemPathInCR)(itemPath, cr.id)}"`);
31
+ return `[${affectedItemPathsQuoted.join(',')}].indexOf(objPath) >= 0`;
32
+ }
33
+ /**
34
+ * Returns a query criteria for use with filtered indexes
35
+ * by combining given `queryExpression` with base query that matches only
36
+ * objects corresponding to register items.
37
+ *
38
+ * `withCR` should be set to active CR, and would make the query
39
+ * additionally match clarified/added register items that did not yet make it
40
+ * into the register proper.
41
+ */
42
+
43
+
44
+ function getRegisterItemQuery(queryExpression, withCR) {
45
+ const baseQuery = withCR ? `(${getItemInCRQuery(withCR)}) || (${REGISTER_ITEM_QUERY})` : REGISTER_ITEM_QUERY; // console.debug("CR QUERY", baseQuery);
46
+
47
+ return `return (${baseQuery}) && (${queryExpression.trim()})`;
48
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemQueryUtils.js","sourceRoot":"","sources":["../../src/views/itemQueryUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,0DAA0D;AAC1D,MAAM,mBAAmB,GAAG;;;;;CAK3B,CAAC;AAGF;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,EAAU;IAClC,yEAAyE;IACzE,gGAAgG;IAChG,qIAAqI;IACrI,MAAM,uBAAuB,GAAa,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC;QAChE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC;QACvD,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAG,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAC9D,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC;AACxE,CAAC;AAGD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAAuB,EAAE,MAAe;IAC3E,MAAM,SAAS,GAAG,MAAM;QACtB,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,SAAS,mBAAmB,GAAG;QAC7D,CAAC,CAAC,mBAAmB,CAAC;IACxB,wCAAwC;IAExC,OAAO,WAAW,SAAS,SAAS,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;AAChE,CAAC","sourcesContent":["import { Base as BaseCR } from '../types/cr';\nimport { itemPathInCR } from './itemPathUtils';\n\n\n// TODO: Should it be three path components? Probably four\nconst REGISTER_ITEM_QUERY = `\n objPath.startsWith(\"/subregisters/\") || (\n objPath.split(\"/\").length === 3 &&\n !objPath.startsWith(\"/proposals/\")\n )\n`;\n\n\n/**\n * Returns a query that matches given register item object path\n * depending on how it appears in given change request.\n *\n * For additions, object path would be full in-proposal path\n * (the item doesn’t exist in the register “normally”), so we want to match that.\n * For clarifications, object path we want to match is normal\n */\nfunction getItemInCRQuery(cr: BaseCR): string {\n //const affectedItemPathsQuoted: string[] = Object.entries(withCR.items).\n // filter(([, proposal]) => proposal.type === 'clarification' || proposal.type === 'addition').\n // map(([itemPath, proposal]) => proposal.type === 'clarification' ? `\"${itemPath}\"` : `/proposals/${withCR.id}/items/${itemPath}`);\n const affectedItemPathsQuoted: string[] = Object.entries(cr.items).\n filter(([, proposal]) => proposal.type !== 'amendment').\n map(([itemPath, ]) => `\"${itemPathInCR(itemPath, cr.id)}\"`);\n return `[${affectedItemPathsQuoted.join(',')}].indexOf(objPath) >= 0`;\n}\n\n\n/**\n * Returns a query criteria for use with filtered indexes\n * by combining given `queryExpression` with base query that matches only\n * objects corresponding to register items.\n *\n * `withCR` should be set to active CR, and would make the query\n * additionally match clarified/added register items that did not yet make it\n * into the register proper.\n */\nexport function getRegisterItemQuery(queryExpression: string, withCR?: BaseCR): string {\n const baseQuery = withCR\n ? `(${getItemInCRQuery(withCR)}) || (${REGISTER_ITEM_QUERY})`\n : REGISTER_ITEM_QUERY;\n // console.debug(\"CR QUERY\", baseQuery);\n\n return `return (${baseQuery}) && (${queryExpression.trim()})`;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { ProtocolRegistry } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/types';
2
+ export declare const Protocols: {
3
+ readonly ITEM_DETAILS: "itemdetails";
4
+ readonly REGISTER_META: "registermeta";
5
+ readonly CHANGE_REQUEST: "changerequest";
6
+ readonly CUSTOM_VIEW: "customview";
7
+ };
8
+ export declare type Protocol = typeof Protocols[keyof typeof Protocols];
9
+ export declare const protocols: Protocol[];
10
+ export declare function isValidProtocol(val: string): val is Protocol;
11
+ declare const protocolRegistry: ProtocolRegistry<Protocol>;
12
+ export default protocolRegistry;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidProtocol = isValidProtocol;
7
+ exports.default = exports.protocols = exports.Protocols = void 0;
8
+
9
+ var _RegisterItem = _interopRequireDefault(require("./detail/RegisterItem"));
10
+
11
+ var _RegisterMeta = _interopRequireDefault(require("./detail/RegisterMeta"));
12
+
13
+ var _ChangeRequest = _interopRequireDefault(require("./detail/ChangeRequest"));
14
+
15
+ var _CustomView = _interopRequireDefault(require("./detail/CustomView"));
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ const Protocols = {
20
+ ITEM_DETAILS: 'itemdetails',
21
+ REGISTER_META: 'registermeta',
22
+ CHANGE_REQUEST: 'changerequest',
23
+ CUSTOM_VIEW: 'customview'
24
+ };
25
+ exports.Protocols = Protocols;
26
+ const protocols = Object.values(Protocols);
27
+ exports.protocols = protocols;
28
+
29
+ function isValidProtocol(val) {
30
+ return protocols.indexOf(val) >= 0;
31
+ } // TODO: Implement proper registration pattern rather than registering
32
+ // these in a centralized manner.
33
+
34
+
35
+ const protocolRegistry = {
36
+ [Protocols.ITEM_DETAILS]: _RegisterItem.default,
37
+ [Protocols.REGISTER_META]: _RegisterMeta.default,
38
+ [Protocols.CHANGE_REQUEST]: _ChangeRequest.default,
39
+ [Protocols.CUSTOM_VIEW]: _CustomView.default
40
+ };
41
+ var _default = protocolRegistry;
42
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocolRegistry.js","sourceRoot":"","sources":["../../src/views/protocolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,aAAa;IAC3B,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,eAAe;IAC/B,WAAW,EAAE,YAAY;CACjB,CAAC;AAIX,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAe,CAAC;AAEhE,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,SAAS,CAAC,OAAO,CAAC,GAAe,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,iCAAiC;AACjC,MAAM,gBAAgB,GAA+B;IACnD,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,YAAY;IACtC,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,YAAY;IACvC,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,aAAa;IACzC,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU;CACpC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { ProtocolRegistry } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/types';\nimport RegisterItem from './detail/RegisterItem';\nimport RegisterMeta from './detail/RegisterMeta';\nimport ChangeRequest from './detail/ChangeRequest';\nimport CustomView from './detail/CustomView';\n\nexport const Protocols = {\n ITEM_DETAILS: 'itemdetails',\n REGISTER_META: 'registermeta',\n CHANGE_REQUEST: 'changerequest',\n CUSTOM_VIEW: 'customview',\n} as const;\n\nexport type Protocol = typeof Protocols[keyof typeof Protocols];\n\nexport const protocols = Object.values(Protocols) as Protocol[];\n\nexport function isValidProtocol(val: string): val is Protocol {\n return protocols.indexOf(val as Protocol) >= 0;\n}\n\n// TODO: Implement proper registration pattern rather than registering\n// these in a centralized manner.\nconst protocolRegistry: ProtocolRegistry<Protocol> = {\n [Protocols.ITEM_DETAILS]: RegisterItem,\n [Protocols.REGISTER_META]: RegisterMeta,\n [Protocols.CHANGE_REQUEST]: ChangeRequest,\n [Protocols.CUSTOM_VIEW]: CustomView,\n};\n\nexport default protocolRegistry;\n"]}
@@ -0,0 +1,11 @@
1
+ /** @jsx jsx */
2
+ /** @jsxFrag React.Fragment */
3
+ import React from 'react';
4
+ declare const Browse: React.FC<{
5
+ availableClassIDs?: string[];
6
+ onOpenItem?: (itemPath: string) => void;
7
+ stateName?: string;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ }>;
11
+ export default Browse;