New:Socket for Asana Is Now Available.Learn more
Sign In

@warpfreight/sdk

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@warpfreight/sdk - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+2
-0
dist/index.d.ts

@@ -20,2 +20,4 @@ /**

export declare const DEFAULT_BASE_URL = "https://www.wearewarp.com/api/v1";
/** The value sent as `user-agent` on every request, e.g. `warpfreight-sdk-js/0.1.1`. */
export declare const USER_AGENT: string;
/** Options for constructing a {@link WarpFreight} client. */

@@ -22,0 +24,0 @@ export interface WarpFreightOptions {

@@ -21,5 +21,21 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.WarpFreight = exports.WarpFreightError = exports.DEFAULT_BASE_URL = void 0;
exports.WarpFreight = exports.WarpFreightError = exports.USER_AGENT = exports.DEFAULT_BASE_URL = void 0;
exports.DEFAULT_BASE_URL = "https://www.wearewarp.com/api/v1";
/**
* SDK version, read from package.json at runtime so the user-agent never drifts
* from the published version. dist/index.js resolves ../package.json to the
* package root, which npm always ships. Falls back silently if unreadable
* (e.g. an exotic bundler) — a missing version never breaks a request.
*/
let SDK_VERSION = "0.0.0";
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
SDK_VERSION = require("../package.json").version || SDK_VERSION;
}
catch {
/* keep fallback */
}
/** The value sent as `user-agent` on every request, e.g. `warpfreight-sdk-js/0.1.1`. */
exports.USER_AGENT = `warpfreight-sdk-js/${SDK_VERSION}`;
/**
* An error from the Warp API. `code` is prefixed `WARPFREIGHT_` so it is

@@ -85,3 +101,9 @@ * greppable and attributable when pasted into a search box or AI assistant;

}
const headers = { "content-type": "application/json" };
// `user-agent` identifies SDK traffic server-side. Node applies it; browsers
// silently ignore it (forbidden header) with no error and no CORS preflight,
// so browser embeds keep working unchanged.
const headers = {
"content-type": "application/json",
"user-agent": exports.USER_AGENT,
};
if (this.apiKey)

@@ -88,0 +110,0 @@ headers["authorization"] = `Bearer ${this.apiKey}`;

+1
-1
{
"name": "@warpfreight/sdk",
"version": "0.1.0",
"version": "0.1.1",
"description": "Official TypeScript client for the Warp freight API \u2014 keyless quoting, booking, and tracking.",

@@ -5,0 +5,0 @@ "keywords": [