@floegence/redevplugin-ui 0.7.0 → 0.7.1

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 (2) hide show
  1. package/dist/surface.js +47 -2
  2. package/package.json +2 -2
package/dist/surface.js CHANGED
@@ -38,7 +38,6 @@ const maxSurfaceQuiesceMs = 1500;
38
38
  const maxSurfaceInteractionEventsPerSecond = 120;
39
39
  const pluginBridgeErrorCodeSet = new Set(pluginBridgeErrorCodes);
40
40
  const hostCapabilityIDPattern = new RegExp("^[A-Za-z0-9][A-Za-z0-9._-]*$");
41
- const canonicalSemverPattern = new RegExp("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-(?:(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$");
42
41
  const lowercaseSHA256Pattern = new RegExp("^[0-9a-f]{64}$");
43
42
  const businessErrorCodePattern = new RegExp("^[A-Z][A-Z0-9_]*$");
44
43
  export class PluginBridgeClient {
@@ -4312,7 +4311,7 @@ function isCapabilityBusinessErrorDetails(value) {
4312
4311
  ]))
4313
4312
  return false;
4314
4313
  if (typeof value.capability_id !== "string" || !hostCapabilityIDPattern.test(value.capability_id) ||
4315
- typeof value.capability_version !== "string" || !canonicalSemverPattern.test(value.capability_version) ||
4314
+ typeof value.capability_version !== "string" || !isCanonicalSemver(value.capability_version) ||
4316
4315
  typeof value.detail_schema_sha256 !== "string" || !lowercaseSHA256Pattern.test(value.detail_schema_sha256) ||
4317
4316
  typeof value.business_error_code !== "string" || !businessErrorCodePattern.test(value.business_error_code)) {
4318
4317
  return false;
@@ -4327,6 +4326,52 @@ function isCapabilityBusinessErrorDetails(value) {
4327
4326
  return false;
4328
4327
  }
4329
4328
  }
4329
+ function isCanonicalSemver(value) {
4330
+ if (value.length < 5 || value.length > 255)
4331
+ return false;
4332
+ const plus = value.indexOf("+");
4333
+ if (plus !== value.lastIndexOf("+") || plus === value.length - 1)
4334
+ return false;
4335
+ const withoutBuild = plus < 0 ? value : value.slice(0, plus);
4336
+ if (plus >= 0 && !validSemverIdentifiers(value.slice(plus + 1), false))
4337
+ return false;
4338
+ const dash = withoutBuild.indexOf("-");
4339
+ if (dash === withoutBuild.length - 1)
4340
+ return false;
4341
+ const core = dash < 0 ? withoutBuild : withoutBuild.slice(0, dash);
4342
+ if (dash >= 0 && !validSemverIdentifiers(withoutBuild.slice(dash + 1), true))
4343
+ return false;
4344
+ const coreIdentifiers = core.split(".");
4345
+ return coreIdentifiers.length === 3 && coreIdentifiers.every(validSemverNumericIdentifier);
4346
+ }
4347
+ function validSemverIdentifiers(value, rejectNumericLeadingZero) {
4348
+ const identifiers = value.split(".");
4349
+ return identifiers.every((identifier) => {
4350
+ if (identifier.length === 0)
4351
+ return false;
4352
+ let numeric = true;
4353
+ for (let index = 0; index < identifier.length; index += 1) {
4354
+ const code = identifier.charCodeAt(index);
4355
+ const digit = code >= 48 && code <= 57;
4356
+ const upper = code >= 65 && code <= 90;
4357
+ const lower = code >= 97 && code <= 122;
4358
+ if (!digit && !upper && !lower && code !== 45)
4359
+ return false;
4360
+ numeric = numeric && digit;
4361
+ }
4362
+ return !rejectNumericLeadingZero || !numeric || identifier.length === 1 || identifier[0] !== "0";
4363
+ });
4364
+ }
4365
+ function validSemverNumericIdentifier(value) {
4366
+ if (value.length === 0 || (value.length > 1 && value[0] === "0"))
4367
+ return false;
4368
+ for (let index = 0; index < value.length; index += 1) {
4369
+ const code = value.charCodeAt(index);
4370
+ if (code < 48 || code > 57)
4371
+ return false;
4372
+ }
4373
+ return true;
4374
+ }
4330
4375
  function isLifecycleMessage(value) {
4331
4376
  return hasAllowedKeys(value, ["type", "event", "quiesce_id"]) &&
4332
4377
  value.type === "redevplugin.bridge.lifecycle" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/redevplugin-ui",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -40,7 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "dependencies": {
43
- "@floegence/redevplugin-contracts": "0.7.0"
43
+ "@floegence/redevplugin-contracts": "0.7.1"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"