@pubtech-ai/core 3.0.0 → 3.0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVectorEncoder=void 0;var BitLength_js_1=require("../BitLength.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),IntEncoder_js_1=require("./IntEncoder.js"),index_js_2=require("../../model/index.js"),PurposeRestrictionVectorEncoder=function(){function e(){}return e.encode=function(e){var n=IntEncoder_js_1.IntEncoder.encode(e.numRestrictions,BitLength_js_1.BitLength.numRestrictions);if(!e.isEmpty()){var t=Array.from(e.gvl.vendorIds),r=function(e,n){var r=t.indexOf(e);if(t.indexOf(n)-r>0){var o=t.indexOf(e+1);return{nextVendorId:t[o],index:t[r+1]}}return{nextVendorId:e,index:e}},o=new Map;e.getRestrictions().forEach((function(t){n+=IntEncoder_js_1.IntEncoder.encode(t.purposeId,BitLength_js_1.BitLength.purposeId),n+=IntEncoder_js_1.IntEncoder.encode(t.restrictionType,BitLength_js_1.BitLength.restrictionType);var i=e.getVendorsSet(t),s=0,d="";if(o.has(i)){var _=o.get(i);s=_.numEntries,d=_.rangeField}else{for(var c=Array.from(i).sort((function(e,n){return e-n})),g=c.length,B=0,h=0;h<g;h++){var L=c[h];0===B&&(s++,B=L);var j=h===g-1;if(!j){var u=r(L,c[g-1]),a=u.nextVendorId,E=u.index;c[h+1]>a?j=!0:E>h&&E<g&&(h
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVectorEncoder=void 0;var BitLength_js_1=require("../BitLength.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),IntEncoder_js_1=require("./IntEncoder.js"),index_js_2=require("../../model/index.js"),PurposeRestrictionVectorEncoder=function(){function e(){}return e.encode=function(e){var n=IntEncoder_js_1.IntEncoder.encode(e.numRestrictions,BitLength_js_1.BitLength.numRestrictions);if(!e.isEmpty()){var t=Array.from(e.gvl.vendorIds),r=function(e,n){var r=t.indexOf(e);if(t.indexOf(n)-r>0){var o=t.indexOf(e+1);return{nextVendorId:t[o],index:t[r+1]}}return{nextVendorId:e,index:e}},o=new Map;e.getRestrictions().forEach((function(t){n+=IntEncoder_js_1.IntEncoder.encode(t.purposeId,BitLength_js_1.BitLength.purposeId),n+=IntEncoder_js_1.IntEncoder.encode(t.restrictionType,BitLength_js_1.BitLength.restrictionType);var i=e.getVendorsSet(t),s=0,d="";if(o.has(i)){var _=o.get(i);s=_.numEntries,d=_.rangeField}else{for(var c=Array.from(i).sort((function(e,n){return e-n})),g=c.length,B=0,h=0;h<g;h++){var L=c[h];0===B&&(s++,B=L);var j=h===g-1;if(!j){var u=r(L,c[g-1]),a=u.nextVendorId,E=u.index;c[h+1]>a?j=!0:E>h&&E<g&&(h+=1)}if(L==h-1&&g==h+1&&(j=!0),j){var I=!(L===B);d+=BooleanEncoder_js_1.BooleanEncoder.encode(I),d+=IntEncoder_js_1.IntEncoder.encode(B,BitLength_js_1.BitLength.vendorId),I&&(d+=IntEncoder_js_1.IntEncoder.encode(L,BitLength_js_1.BitLength.vendorId)),B=0}}o.set(i,{numEntries:s,rangeField:d})}n+=IntEncoder_js_1.IntEncoder.encode(s,BitLength_js_1.BitLength.numEntries),n+=d}))}return n},e.decode=function(e){var n=0,t=new index_js_2.PurposeRestrictionVector,r=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.numRestrictions),BitLength_js_1.BitLength.numRestrictions);n+=BitLength_js_1.BitLength.numRestrictions;for(var o=0;o<r;o++){var i=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.purposeId),BitLength_js_1.BitLength.purposeId);n+=BitLength_js_1.BitLength.purposeId;var s=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.restrictionType),BitLength_js_1.BitLength.restrictionType);n+=BitLength_js_1.BitLength.restrictionType;var d=new index_js_2.PurposeRestriction(i,s),_=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.numEntries),BitLength_js_1.BitLength.numEntries);n+=BitLength_js_1.BitLength.numEntries;for(var c=0;c<_;c++){var g=BooleanEncoder_js_1.BooleanEncoder.decode(e.substr(n,BitLength_js_1.BitLength.anyBoolean));n+=BitLength_js_1.BitLength.anyBoolean;var B=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(n+=BitLength_js_1.BitLength.vendorId,g){var h=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(n+=BitLength_js_1.BitLength.vendorId,h<B)throw new index_js_1.DecodingError("Invalid RangeEntry: endVendorId ".concat(h," is less than ").concat(B));for(var L=B;L<=h;L++)t.add(L,d)}else t.add(B,d)}}return t.bitLength=n,t},e}();exports.PurposeRestrictionVectorEncoder=PurposeRestrictionVectorEncoder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubtech-ai/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Ensures consistent encoding and decoding of TC Signals for the iab. Transparency and Consent Framework (TCF).",
|
|
5
5
|
"author": "Mayank Mishra <mayank@iabtechlab.com>",
|
|
6
6
|
"homepage": "https://iabtcf.com/",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test-ci": "mocha --reporter mocha-junit-reporter"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@pubtech-ai/testing": "3.0.
|
|
32
|
+
"@pubtech-ai/testing": "3.0.1",
|
|
33
33
|
"@istanbuljs/nyc-config-typescript": "^0.1.3",
|
|
34
34
|
"@types/sinon": "^10.0.11",
|
|
35
35
|
"@types/sinon-chai": "3.2.8",
|