@hyperframes/share 0.9.80 → 0.9.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/share",
3
- "version": "0.9.80",
3
+ "version": "0.9.82",
4
4
  "description": "Shared review identity, version upload and sharing state for HyperFrames hosts",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -78,6 +78,22 @@ const isSavedIdentity = (record) =>
78
78
  isOptionalBoolean(record.removed) &&
79
79
  (!record.opened || isSavedId(record.projectId));
80
80
 
81
+ // This is a display hint. Keep ordinary mailbox names, including internationalized ones.
82
+ /** @param {unknown} value */
83
+ function displayOwnerEmail(value) {
84
+ if (typeof value !== "string" || value.length > 254) return null;
85
+ const parts = value.split("@");
86
+ if (parts.length !== 2) return null;
87
+ const [local, domain] = parts;
88
+ const atom = /^[\p{L}\p{M}\p{N}!#$%&'*+/=?^`_{|}~-]+$/u;
89
+ const label = /^[\p{L}\p{N}](?:[\p{L}\p{M}\p{N}-]{0,61}[\p{L}\p{M}\p{N}])?$/u;
90
+ return local.length <= 64 &&
91
+ local.split(".").every((part) => atom.test(part)) &&
92
+ domain.split(".").every((part) => label.test(part))
93
+ ? value
94
+ : null;
95
+ }
96
+
81
97
  /** @param {unknown} value @param {string} studioProjectId @param {string} file */
82
98
  function savedRegistration(value, studioProjectId, file) {
83
99
  if (value == null) return undefined;
@@ -101,7 +117,7 @@ async function readRecord(projectPath, at = site()) {
101
117
  removed: record.removed === true,
102
118
  registration: savedRegistration(record.registration, record.studioProjectId, file),
103
119
  site: madeOn,
104
- ownerEmail: typeof record.ownerEmail === "string" ? record.ownerEmail : null,
120
+ ownerEmail: displayOwnerEmail(record.ownerEmail),
105
121
  };
106
122
  }
107
123