@cyprnet/node-red-contrib-uibuilder-formgen 0.5.18 → 0.5.19

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/CHANGELOG.md CHANGED
@@ -19,6 +19,10 @@ All notable changes to this package will be documented in this file.
19
19
  - Lookup/Auto-fill (dynamic): improved per-selection requests and pending/timeout handling to make <code>lookup:get</code> reliable.
20
20
  - Documentation: expanded <code>schema.lookups</code> formatting guidance and added dynamic lookup examples in Node-RED help + Schema Builder help.
21
21
 
22
+ ## 0.5.19
23
+
24
+ - Legacy node: fixed license resolution for <code>uibuilder-formgen-uib2</code> to match other nodes and clarified the “logo disabled” warning when custom branding is not enabled by the license policy.
25
+
22
26
  ## 0.5.18
23
27
 
24
28
  - Added <code>uibuilder-formgen-uib2</code> legacy generator for <strong>uibuilder 2.x</strong> (vendor Vue 2 + Bootstrap-Vue v2 stack).
@@ -85,6 +85,14 @@ module.exports = function(RED) {
85
85
  return typeof v === "string" && v.trim().length > 0;
86
86
  }
87
87
 
88
+ function firstNonEmptyString(...candidates) {
89
+ for (const c of candidates) {
90
+ const s = String(c ?? "").trim();
91
+ if (s) return s;
92
+ }
93
+ return "";
94
+ }
95
+
88
96
  function safeBasename(filename) {
89
97
  // Basic hardening: strip path separators
90
98
  return path.basename(String(filename || "").replace(/[/\\]+/g, "_"));
@@ -365,18 +373,13 @@ module.exports = function(RED) {
365
373
  if (Array.isArray(parsed)) exportFormats = parsed;
366
374
  } catch (e) { /* ignore */ }
367
375
 
368
- // Resolve license
369
- const perNodeLicense = String(node.credentials && node.credentials.licenseKey ? node.credentials.licenseKey : "").trim();
370
- const sharedLicense = String(licenseConfigNode && licenseConfigNode.credentials ? licenseConfigNode.credentials.licenseKey : "").trim();
371
- const envLicense = String(process.env.PORTALSMITH_LICENSE || "").trim();
372
- const rawLicense = String(msg.options?.licenseKey ?? msg.licenseKey ?? perNodeLicense ?? sharedLicense ?? envLicense ?? "").trim();
373
-
374
- const licenseResolved = licensing.resolveLicenseString(rawLicense);
376
+ // Resolve license (use the shared resolver so behavior matches other nodes)
377
+ const licenseResolved = licensing.resolveLicense({ node, RED, licenseConfigNode });
375
378
  const licensePublic = {
376
379
  licensed: licenseResolved.licensed,
377
380
  tier: licenseResolved.tier,
378
- watermark: licenseResolved.policy && licenseResolved.policy.watermark === false ? false : !licenseResolved.licensed,
379
- brandingLocked: licenseResolved.policy && licenseResolved.policy.brandingLocked === false ? false : !licenseResolved.licensed,
381
+ watermark: Boolean(licenseResolved.policy && licenseResolved.policy.watermark),
382
+ brandingLocked: Boolean(licenseResolved.policy && licenseResolved.policy.brandingLocked),
380
383
  displayName: licenseResolved.display && licenseResolved.display.displayName ? licenseResolved.display.displayName : (licenseResolved.licensed ? "Licensed" : "Free"),
381
384
  reason: licenseResolved.reason,
382
385
  brandingAttempted: false,
@@ -398,7 +401,11 @@ module.exports = function(RED) {
398
401
  DEFAULT_LOGO_MAX_WIDTH_PX
399
402
  );
400
403
  if (isNonEmptyString(logoPathRaw) && licensePublic.brandingLocked) {
401
- node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
404
+ if (licensePublic.licensed) {
405
+ node.warn("PortalSmith FormGen: custom logo is disabled by your license policy (customBranding is not enabled). Using default branding.");
406
+ } else {
407
+ node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
408
+ }
402
409
  licensePublic.brandingAttempted = Boolean(logoRequested);
403
410
  logoPathRaw = "";
404
411
  }
@@ -436,7 +436,11 @@ module.exports = function(RED) {
436
436
  DEFAULT_LOGO_MAX_WIDTH_PX
437
437
  );
438
438
  if (isNonEmptyString(logoPathRaw) && licensePublic.brandingLocked) {
439
- node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
439
+ if (licensePublic.licensed) {
440
+ node.warn("PortalSmith FormGen: custom logo is disabled by your license policy (customBranding is not enabled). Using default branding.");
441
+ } else {
442
+ node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
443
+ }
440
444
  licensePublic.brandingAttempted = Boolean(logoRequested);
441
445
  logoPathRaw = "";
442
446
  }
@@ -524,7 +528,7 @@ module.exports = function(RED) {
524
528
  "src/form.schema.json": { sha256: await sha256FileHex(targetSchema) },
525
529
  };
526
530
  const runtimeData = {
527
- generatorVersion: "0.5.18",
531
+ generatorVersion: "0.5.19",
528
532
  generatorNode: "uibuilder-formgen-v3",
529
533
  timestamp: new Date().toISOString(),
530
534
  instanceName: instanceName,
@@ -442,7 +442,11 @@ module.exports = function(RED) {
442
442
  DEFAULT_LOGO_MAX_WIDTH_PX
443
443
  );
444
444
  if (isNonEmptyString(logoPathRaw) && licensePublic.brandingLocked) {
445
- node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
445
+ if (licensePublic.licensed) {
446
+ node.warn("PortalSmith FormGen: custom logo is disabled by your license policy (customBranding is not enabled). Using default branding.");
447
+ } else {
448
+ node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
449
+ }
446
450
  licensePublic.brandingAttempted = Boolean(logoRequested);
447
451
  logoPathRaw = "";
448
452
  }
@@ -556,7 +560,7 @@ module.exports = function(RED) {
556
560
  "src/form.schema.json": { sha256: await sha256FileHex(targetSchema) },
557
561
  };
558
562
  const runtimeData = {
559
- generatorVersion: "0.5.18",
563
+ generatorVersion: "0.5.19",
560
564
  timestamp: new Date().toISOString(),
561
565
  instanceName: instanceName,
562
566
  storageMode: storageMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyprnet/node-red-contrib-uibuilder-formgen",
3
- "version": "0.5.18",
3
+ "version": "0.5.19",
4
4
  "description": "PortalSmith: Generate schema-driven uibuilder form portals from JSON",
5
5
  "keywords": [
6
6
  "node-red",