@simplif/node 0.0.0-stage → 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -3
  3. package/index.js +44 -0
  4. package/package.json +18 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simplif
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,40 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @simplif/node
2
+
3
+ Official Node.js SDK for the Simplif fraud prevention API.
4
+
5
+ ## Requirements
6
+ Node.js 18 or later.
7
+
8
+ ## Installation
9
+ npm install @simplif/node
10
+
11
+ ## Quick Start
12
+
13
+ Import the SDK into your Node.js backend:
14
+
15
+ import { Simplif } from "@simplif/node";
16
+
17
+ const simplif = new Simplif({
18
+ apiKey: process.env.SIMPLIF_SECRET_KEY
19
+ });
20
+
21
+ const result = await simplif.evaluateSignup({
22
+ email: "customer@example.com",
23
+ device_id: "device_123",
24
+ user_agent: "Mozilla/5.0"
25
+ });
26
+
27
+ console.log(result);
28
+
29
+ ## Authentication
30
+ Generate your secret API key in the Simplif Developers dashboard.
31
+ Store it securely in SIMPLIF_SECRET_KEY.
32
+ Never expose secret API keys in browser code.
33
+
34
+ ## Error handling
35
+ The SDK throws errors with status and code properties for API failures.
36
+
37
+ ## Security
38
+ This SDK is intended for server-side use only.
39
+
40
+ API endpoint: https://api.simplif.com
package/index.js ADDED
@@ -0,0 +1,44 @@
1
+ export class Simplif {
2
+ constructor({ apiKey, baseUrl = "https://api.simplif.com" } = {}) {
3
+ if (!apiKey || typeof apiKey !== "string") {
4
+ throw new Error("Simplif secret API key is required");
5
+ }
6
+
7
+ this.apiKey = apiKey;
8
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
9
+ }
10
+
11
+ async evaluateSignup(data) {
12
+ if (!data || typeof data.email !== "string" || !data.email.trim()) {
13
+ throw new Error("Signup email is required");
14
+ }
15
+
16
+ const response = await fetch(
17
+ `${this.baseUrl}/v1/signups/evaluate`,
18
+ {
19
+ method: "POST",
20
+ headers: {
21
+ "Content-Type": "application/json",
22
+ "x-api-key": this.apiKey
23
+ },
24
+ body: JSON.stringify(data),
25
+ signal: AbortSignal.timeout(15000)
26
+ }
27
+ );
28
+
29
+ const result = await response.json();
30
+
31
+ if (!response.ok) {
32
+ const error = new Error(
33
+ result.error || `Simplif API error (${response.status})`
34
+ );
35
+ error.status = response.status;
36
+ error.code = result.code;
37
+ throw error;
38
+ }
39
+
40
+ return result;
41
+ }
42
+ }
43
+
44
+ export default Simplif;
package/package.json CHANGED
@@ -1,6 +1,18 @@
1
- {
2
- "name": "@simplif/node",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@simplif/node",
3
+ "version": "0.1.0",
4
+ "description": "Simplif fraud prevention Node.js SDK",
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "exports": "./index.js",
8
+ "engines": {
9
+ "node": ">=18"
10
+ },
11
+ "license": "MIT",
12
+ "files": [
13
+ "index.js"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ }
18
+ }