deltas-js 1.0.0

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/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # deltas-js
2
+ JS/TS Server Package for deltas.dev
3
+
4
+ Capture deltas from JS/TS server side environment
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(i,n)=>{for(var t in n)o(i,t,{get:n[t],enumerable:!0})},p=(i,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of d(n))!g.call(i,e)&&e!==t&&o(i,e,{get:()=>n[e],enumerable:!(s=a(n,e))||s.enumerable});return i};var y=i=>p(o({},"__esModule",{value:!0}),i);var l={};h(l,{default:()=>r});module.exports=y(l);var r=class{constructor(n,t){typeof n=="string"?(this.host=n.replace(/\/+$/,""),this.apiKey=t):(this.host=n.host.replace(/\/+$/,""),this.apiKey=n.apiKey)}send(n,t){try{fetch(`${this.host}${n}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(t),keepalive:!0})}catch{}}log(n,t,s){this.send("/log",{what:n,data:t,user_id:s})}info(n,t,s){this.send("/log/info",{what:n,data:t,user_id:s})}warn(n,t,s){this.send("/log/warn",{what:n,data:t,user_id:s})}error(n,t,s){this.send("/log/error",{what:n,data:t,user_id:s})}fyi(n,t,s){this.send("/fyi",{what:n,data:t,user_id:s})}notify(n,t,s){this.send("/notify",{what:n,data:t,user_id:s})}email(n,t,s){this.send("/email",{what:n,data:t,user_id:s})}run(n,t,s){this.send("/run",{what:n,data:t,user_id:s})}};
@@ -0,0 +1,23 @@
1
+ type UserId = string | string[];
2
+ type DeltasConfig = {
3
+ host: string;
4
+ apiKey: string;
5
+ };
6
+ declare class Deltas {
7
+ private host;
8
+ private apiKey;
9
+ constructor(host: string, apiKey: string);
10
+ constructor(config: DeltasConfig);
11
+ /** Core fire-and-forget transport */
12
+ private send;
13
+ log(what: string, data?: unknown, user_id?: UserId): void;
14
+ info(what: string, data?: unknown, user_id?: UserId): void;
15
+ warn(what: string, data?: unknown, user_id?: UserId): void;
16
+ error(what: string, data?: unknown, user_id?: UserId): void;
17
+ fyi(what: string, data?: unknown, user_id?: UserId): void;
18
+ notify(what: string, data?: unknown, user_id?: UserId): void;
19
+ email(what: string, data?: unknown, user_id?: UserId): void;
20
+ run(what: string, data?: unknown, user_id?: UserId): void;
21
+ }
22
+
23
+ export { Deltas as default };
@@ -0,0 +1,23 @@
1
+ type UserId = string | string[];
2
+ type DeltasConfig = {
3
+ host: string;
4
+ apiKey: string;
5
+ };
6
+ declare class Deltas {
7
+ private host;
8
+ private apiKey;
9
+ constructor(host: string, apiKey: string);
10
+ constructor(config: DeltasConfig);
11
+ /** Core fire-and-forget transport */
12
+ private send;
13
+ log(what: string, data?: unknown, user_id?: UserId): void;
14
+ info(what: string, data?: unknown, user_id?: UserId): void;
15
+ warn(what: string, data?: unknown, user_id?: UserId): void;
16
+ error(what: string, data?: unknown, user_id?: UserId): void;
17
+ fyi(what: string, data?: unknown, user_id?: UserId): void;
18
+ notify(what: string, data?: unknown, user_id?: UserId): void;
19
+ email(what: string, data?: unknown, user_id?: UserId): void;
20
+ run(what: string, data?: unknown, user_id?: UserId): void;
21
+ }
22
+
23
+ export { Deltas as default };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var i=class{constructor(n,t){typeof n=="string"?(this.host=n.replace(/\/+$/,""),this.apiKey=t):(this.host=n.host.replace(/\/+$/,""),this.apiKey=n.apiKey)}send(n,t){try{fetch(`${this.host}${n}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(t),keepalive:!0})}catch{}}log(n,t,s){this.send("/log",{what:n,data:t,user_id:s})}info(n,t,s){this.send("/log/info",{what:n,data:t,user_id:s})}warn(n,t,s){this.send("/log/warn",{what:n,data:t,user_id:s})}error(n,t,s){this.send("/log/error",{what:n,data:t,user_id:s})}fyi(n,t,s){this.send("/fyi",{what:n,data:t,user_id:s})}notify(n,t,s){this.send("/notify",{what:n,data:t,user_id:s})}email(n,t,s){this.send("/email",{what:n,data:t,user_id:s})}run(n,t,s){this.send("/run",{what:n,data:t,user_id:s})}};export{i as default};
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "deltas-js",
3
+ "version": "1.0.0",
4
+ "description": "JS/TS Server SDK for deltas.dev",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsup",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/deltasdotdev/deltas-js.git"
25
+ },
26
+ "keywords": [
27
+ "deltas",
28
+ "logging",
29
+ "trace",
30
+ "events",
31
+ "analytics",
32
+ "email",
33
+ "workflow",
34
+ "notify",
35
+ "sdk"
36
+ ],
37
+ "author": "deltas.dev",
38
+ "license": "ISC",
39
+ "bugs": {
40
+ "url": "https://github.com/deltasdotdev/deltas-js/issues"
41
+ },
42
+ "homepage": "https://github.com/deltasdotdev/deltas-js#readme",
43
+ "engines": {
44
+ "node": ">=18"
45
+ },
46
+ "devDependencies": {
47
+ "tsup": "^8.5.1",
48
+ "typescript": "^5.9.3"
49
+ }
50
+ }