@siteline/core 1.0.1 → 1.0.3
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/constants.d.ts +2 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/siteline.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const DEFAULT_ENDPOINT = "https://
|
|
1
|
+
export declare const DEFAULT_ENDPOINT = "https://api.gptrends.io/v1/intake/pageview";
|
|
2
2
|
export declare const DEFAULT_SDK_NAME = "@siteline/core";
|
|
3
|
-
export declare const DEFAULT_SDK_VERSION = "1.0.
|
|
3
|
+
export declare const DEFAULT_SDK_VERSION = "1.0.3";
|
|
4
4
|
export declare const DEFAULT_INTEGRATION_TYPE = "custom";
|
|
5
5
|
export declare const WEBSITEKEY_PATTERN: RegExp;
|
|
6
6
|
export declare const LIMITS: {
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAC7E,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AACjD,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAC3C,eAAO,MAAM,wBAAwB,WAAW,CAAC;AAEjD,eAAO,MAAM,kBAAkB,QAAwC,CAAC;AAExE,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAaT,CAAC;AAEX,eAAO,MAAM,UAAU,OAAO,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";class e extends Error{constructor(e){super(e),this.name="SitelineError"}}class t extends e{constructor(e){super(e),this.name="SitelineValidationError"}}const
|
|
1
|
+
"use strict";class e extends Error{constructor(e){super(e),this.name="SitelineError"}}class t extends e{constructor(e){super(e),this.name="SitelineValidationError"}}const s=/^(siteline_secret|gptrends_secret)_/;exports.Siteline=class{constructor(e){if(!e.websiteKey?.match(s))throw new t("Invalid websiteKey format. Expected: siteline_secret_<32 hex chars>");this.key=e.websiteKey,this.endpoint=e.endpoint||"https://api.gptrends.io/v1/intake/pageview",this.debug=e.debug||!1,this.sdk=e.sdk||"@siteline/core",this.sdkVersion=e.sdkVersion||"1.0.3",this.integrationType=e.integrationType||"custom",this.debug&&console.log("[Siteline] Siteline initialized")}track(e){const t=this.sanitize(e);this.send(t).catch(e=>{this.debug&&console.error("[Siteline] Track failed:",e.message)})}sanitize(e){return{websiteKey:this.key,url:(e.url+"").slice(0,2048),method:(e.method+"").toUpperCase().slice(0,10),status:Math.max(0,Math.min(999,Number(e.status)||0)),duration:Math.max(0,Math.min(3e5,Number(e.duration)||0)),userAgent:e.userAgent?(e.userAgent+"").slice(0,512):null,ref:e.ref?(e.ref+"").slice(0,2048):null,ip:e.ip?(e.ip+"").slice(0,45):null,integration_type:this.integrationType.slice(0,50),sdk:this.sdk.slice(0,50),sdk_version:this.sdkVersion.slice(0,20)}}async send(e){const t=new AbortController,s=setTimeout(()=>t.abort(),5e3);try{const s=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`${this.sdk}/${this.sdkVersion}`},body:JSON.stringify(e),signal:t.signal});this.debug&&(s.ok?console.log("[Siteline] Tracked:",e.url):console.error("[Siteline] HTTP error:",s.status))}catch(e){this.debug&&console.error("[Siteline] Network error:",e.message)}finally{clearTimeout(s)}}},exports.SitelineError=e,exports.SitelineTransportError=class extends e{constructor(e){super(e),this.name="SitelineTransportError"}},exports.SitelineValidationError=t;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/errors.ts","../src/constants.ts","../src/siteline.ts"],"sourcesContent":[null,null,null],"names":["SitelineError","Error","constructor","message","super","this","name","SitelineValidationError","WEBSITEKEY_PATTERN","config","websiteKey","match","key","endpoint","debug","sdk","sdkVersion","integrationType","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/errors.ts","../src/constants.ts","../src/siteline.ts"],"sourcesContent":[null,null,null],"names":["SitelineError","Error","constructor","message","super","this","name","SitelineValidationError","WEBSITEKEY_PATTERN","config","websiteKey","match","key","endpoint","debug","sdk","sdkVersion","integrationType","console","log","track","data","sanitized","sanitize","send","catch","err","error","url","String","slice","method","toUpperCase","status","Math","max","min","Number","duration","userAgent","ref","ip","integration_type","sdk_version","controller","AbortController","timeout","setTimeout","abort","res","fetch","headers","body","JSON","stringify","signal","ok","clearTimeout"],"mappings":"aAAM,MAAOA,UAAsBC,MACjC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,eACd,EAGI,MAAOC,UAAgCP,EAC3C,WAAAE,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,yBACd,ECXK,MAKME,EAAqB,6DCehC,WAAAN,CAAYO,GACV,IAAKA,EAAOC,YAAYC,MAAMH,GAC5B,MAAM,IAAID,EACR,uEAIJF,KAAKO,IAAMH,EAAOC,WAClBL,KAAKQ,SAAWJ,EAAOI,UD5BK,6CC6B5BR,KAAKS,MAAQL,EAAOK,QAAS,EAC7BT,KAAKU,IAAMN,EAAOM,KD7BU,iBC8B5BV,KAAKW,WAAaP,EAAOO,YD7BM,QC8B/BX,KAAKY,gBAAkBR,EAAOQ,iBD7BM,SC+BhCZ,KAAKS,OACPI,QAAQC,IAAI,kCAEhB,CAEA,KAAAC,CAAMC,GACJ,MAAMC,EAAYjB,KAAKkB,SAASF,GAE3BhB,KAAKmB,KAAKF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S,OAEPI,QAAQS,MAAM,4BADAD,EACmCvB,QAErD,SACEsD,aAAaX,EACf,CACF,0DFjFI,cAAsC9C,EAC1C,WAAAE,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,wBACd"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class e extends Error{constructor(e){super(e),this.name="SitelineError"}}class t extends e{constructor(e){super(e),this.name="SitelineValidationError"}}class s extends e{constructor(e){super(e),this.name="SitelineTransportError"}}const i=/^
|
|
1
|
+
class e extends Error{constructor(e){super(e),this.name="SitelineError"}}class t extends e{constructor(e){super(e),this.name="SitelineValidationError"}}class s extends e{constructor(e){super(e),this.name="SitelineTransportError"}}const i=/^(siteline_secret|gptrends_secret)_/;class r{constructor(e){if(!e.websiteKey?.match(i))throw new t("Invalid websiteKey format. Expected: siteline_secret_<32 hex chars>");this.key=e.websiteKey,this.endpoint=e.endpoint||"https://api.gptrends.io/v1/intake/pageview",this.debug=e.debug||!1,this.sdk=e.sdk||"@siteline/core",this.sdkVersion=e.sdkVersion||"1.0.3",this.integrationType=e.integrationType||"custom",this.debug&&console.log("[Siteline] Siteline initialized")}track(e){const t=this.sanitize(e);this.send(t).catch(e=>{this.debug&&console.error("[Siteline] Track failed:",e.message)})}sanitize(e){return{websiteKey:this.key,url:(e.url+"").slice(0,2048),method:(e.method+"").toUpperCase().slice(0,10),status:Math.max(0,Math.min(999,Number(e.status)||0)),duration:Math.max(0,Math.min(3e5,Number(e.duration)||0)),userAgent:e.userAgent?(e.userAgent+"").slice(0,512):null,ref:e.ref?(e.ref+"").slice(0,2048):null,ip:e.ip?(e.ip+"").slice(0,45):null,integration_type:this.integrationType.slice(0,50),sdk:this.sdk.slice(0,50),sdk_version:this.sdkVersion.slice(0,20)}}async send(e){const t=new AbortController,s=setTimeout(()=>t.abort(),5e3);try{const s=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`${this.sdk}/${this.sdkVersion}`},body:JSON.stringify(e),signal:t.signal});this.debug&&(s.ok?console.log("[Siteline] Tracked:",e.url):console.error("[Siteline] HTTP error:",s.status))}catch(e){this.debug&&console.error("[Siteline] Network error:",e.message)}finally{clearTimeout(s)}}}export{r as Siteline,e as SitelineError,s as SitelineTransportError,t as SitelineValidationError};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/errors.ts","../src/constants.ts","../src/siteline.ts"],"sourcesContent":[null,null,null],"names":["SitelineError","Error","constructor","message","super","this","name","SitelineValidationError","SitelineTransportError","WEBSITEKEY_PATTERN","Siteline","config","websiteKey","match","key","endpoint","debug","sdk","sdkVersion","integrationType","
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/errors.ts","../src/constants.ts","../src/siteline.ts"],"sourcesContent":[null,null,null],"names":["SitelineError","Error","constructor","message","super","this","name","SitelineValidationError","SitelineTransportError","WEBSITEKEY_PATTERN","Siteline","config","websiteKey","match","key","endpoint","debug","sdk","sdkVersion","integrationType","console","log","track","data","sanitized","sanitize","send","catch","err","error","url","String","slice","method","toUpperCase","status","Math","max","min","Number","duration","userAgent","ref","ip","integration_type","sdk_version","controller","AbortController","timeout","setTimeout","abort","res","fetch","headers","body","JSON","stringify","signal","ok","clearTimeout"],"mappings":"AAAM,MAAOA,UAAsBC,MACjC,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,eACd,EAGI,MAAOC,UAAgCP,EAC3C,WAAAE,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,yBACd,EAGI,MAAOE,UAA+BR,EAC1C,WAAAE,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,wBACd,EClBK,MAKMG,EAAqB,4CCOrBC,EAQX,WAAAR,CAAYS,GACV,IAAKA,EAAOC,YAAYC,MAAMJ,GAC5B,MAAM,IAAIF,EACR,uEAIJF,KAAKS,IAA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7CtB,KC+CtB,IACE,MAAMC,QAAYC,MAAM/C,KAAKU,SAAU,CACrCkB,OAAQ,OACRoB,QAAS,CACP,eAAgB,mBAChB,aAAc,GAAGhD,KAAKY,OAAOZ,KAAKa,cAEpCoC,KAAMC,KAAKC,UAAUjC,GACrBkC,OAAQX,EAAWW,SAGjBpD,KAAKW,QACHmC,EAAIO,GACNtC,QAAQC,IAAI,sBAAuBE,EAAKO,KAExCV,QAAQS,MAAM,yBAA0BsB,EAAIhB,QAGlD,CAAE,MAAOP,GACHvB,KAAKW,OAEPI,QAAQS,MAAM,4BADAD,EACmCzB,QAErD,SACEwD,aAAaX,EACf,CACF"}
|
package/dist/siteline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteline.d.ts","sourceRoot":"","sources":["../src/siteline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY5D,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;gBAE7B,MAAM,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"siteline.d.ts","sourceRoot":"","sources":["../src/siteline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY5D,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;gBAE7B,MAAM,EAAE,cAAc;IAmBlC,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAU/B,OAAO,CAAC,QAAQ;YAgBF,IAAI;CA+BnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siteline/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Core tracking SDK for Siteline - Agent Analytics platform for tracking AI agents, bots, and crawlers",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|
|
55
|
-
"url": "https://github.com/siteline-ai/siteline-sdk-js",
|
|
55
|
+
"url": "git+https://github.com/siteline-ai/siteline-sdk-js.git",
|
|
56
56
|
"directory": "packages/core"
|
|
57
57
|
},
|
|
58
58
|
"bugs": {
|