@verdocs/js-sdk 5.0.34 → 5.0.36

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/index.mjs CHANGED
@@ -824,59 +824,68 @@ function getDefaultExportFromCjs (x) {
824
824
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
825
825
  }
826
826
 
827
- // This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
828
- // an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
829
- // (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
830
- // tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
831
- // StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
832
- // when those Components load js-sdk they get a separate instance. Without messy options like having to
833
- // pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
834
- // have no way to access authenticated sessions unless we make the Endpoint a true global.
835
- //
836
- // @credit https://github.com/medikoo/es5-ext/blob/master/global.js
837
- // @credit https://mathiasbynens.be/notes/globalthis
838
- var naiveFallback = function () {
839
- if (typeof self === 'object' && self)
840
- return self;
841
- if (typeof window === 'object' && window)
842
- return window;
843
- throw new Error('Unable to resolve global `this`');
844
- };
845
- var globalThis_1 = (function () {
846
- if (this)
847
- return this;
848
- // Unexpected strict mode (may happen if e.g. bundled into ESM module)
849
- // Fallback to standard globalThis if available
850
- if (typeof globalThis === 'object' && globalThis)
851
- return globalThis;
852
- // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
853
- // In all ES5+ engines global object inherits from Object.prototype
854
- // (if you approached one that doesn't please report)
855
- try {
856
- Object.defineProperty(Object.prototype, '__global__', {
857
- get: function () {
858
- return this;
859
- },
860
- configurable: true,
861
- });
862
- }
863
- catch (error) {
864
- // Unfortunate case of updates to Object.prototype being restricted
865
- // via preventExtensions, seal or freeze
866
- return naiveFallback();
867
- }
868
- try {
869
- // Safari case (window.__global__ works, but __global__ does not)
870
- if (!__global__)
871
- return naiveFallback();
872
- return __global__;
873
- }
874
- finally {
875
- delete Object.prototype.__global__;
876
- }
877
- })();
827
+ var globalThis_1;
828
+ var hasRequiredGlobalThis;
878
829
 
879
- var globalThis$1 = /*@__PURE__*/getDefaultExportFromCjs(globalThis_1);
830
+ function requireGlobalThis () {
831
+ if (hasRequiredGlobalThis) return globalThis_1;
832
+ hasRequiredGlobalThis = 1;
833
+ // This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
834
+ // an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
835
+ // (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
836
+ // tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
837
+ // StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
838
+ // when those Components load js-sdk they get a separate instance. Without messy options like having to
839
+ // pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
840
+ // have no way to access authenticated sessions unless we make the Endpoint a true global.
841
+ //
842
+ // @credit https://github.com/medikoo/es5-ext/blob/master/global.js
843
+ // @credit https://mathiasbynens.be/notes/globalthis
844
+ var naiveFallback = function () {
845
+ if (typeof self === 'object' && self)
846
+ return self;
847
+ if (typeof window === 'object' && window)
848
+ return window;
849
+ throw new Error('Unable to resolve global `this`');
850
+ };
851
+ globalThis_1 = (function () {
852
+ if (this)
853
+ return this;
854
+ // Unexpected strict mode (may happen if e.g. bundled into ESM module)
855
+ // Fallback to standard globalThis if available
856
+ if (typeof globalThis === 'object' && globalThis)
857
+ return globalThis;
858
+ // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
859
+ // In all ES5+ engines global object inherits from Object.prototype
860
+ // (if you approached one that doesn't please report)
861
+ try {
862
+ Object.defineProperty(Object.prototype, '__global__', {
863
+ get: function () {
864
+ return this;
865
+ },
866
+ configurable: true,
867
+ });
868
+ }
869
+ catch (error) {
870
+ // Unfortunate case of updates to Object.prototype being restricted
871
+ // via preventExtensions, seal or freeze
872
+ return naiveFallback();
873
+ }
874
+ try {
875
+ // Safari case (window.__global__ works, but __global__ does not)
876
+ if (!__global__)
877
+ return naiveFallback();
878
+ return __global__;
879
+ }
880
+ finally {
881
+ delete Object.prototype.__global__;
882
+ }
883
+ })();
884
+ return globalThis_1;
885
+ }
886
+
887
+ var globalThisExports = requireGlobalThis();
888
+ var globalThis$1 = /*@__PURE__*/getDefaultExportFromCjs(globalThisExports);
880
889
 
881
890
  /**
882
891
  * Authenticate to Verdocs.
@@ -2862,9 +2871,6 @@ const canPerformTemplateAction = (profile, action, template) => {
2862
2871
  // were undefined, they would actually match.
2863
2872
  const profile_id = profile?.id || 'BOGUS';
2864
2873
  const organization_id = profile?.organization_id || 'BOGUS';
2865
- if (!profile_id) {
2866
- return { canPerform: false, message: 'Active session required' };
2867
- }
2868
2874
  const isCreator = template?.profile_id === profile_id;
2869
2875
  const isSameOrg = template?.organization_id === organization_id;
2870
2876
  const isPersonal = template?.is_personal ?? false;