seqpulse 0.1.0 → 0.2.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 CHANGED
@@ -23,7 +23,6 @@ const seqpulse = require("seqpulse");
23
23
  const app = express();
24
24
 
25
25
  seqpulse.init({
26
- apiKey: process.env.SEQPULSE_API_KEY,
27
26
  endpoint: "/seqpulse-metrics",
28
27
  hmacEnabled: process.env.SEQPULSE_HMAC_ENABLED === "true",
29
28
  hmacSecret: process.env.SEQPULSE_HMAC_SECRET,
@@ -57,7 +56,8 @@ app.listen(3000, () => {
57
56
  ## Notes
58
57
 
59
58
  - This SDK does not manage CI/CD trigger/finish workflow.
60
- - `apiKey` is required for config consistency, but not used directly in endpoint responses.
59
+ - `apiKey` is optional and not used directly in metrics payload or HMAC validation.
60
+ - Metrics sampling window is fixed to 60 seconds (not configurable in SDK init).
61
61
 
62
62
  ## Local smoke test
63
63
 
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export type SeqPulseInitConfig = {
2
- apiKey: string
2
+ apiKey?: string
3
3
  endpoint?: string
4
- windowSeconds?: number
5
4
  hmacEnabled?: boolean
6
5
  hmacSecret?: string
7
6
  maxSkewPastSeconds?: number
package/index.js CHANGED
@@ -143,26 +143,20 @@ function init(config) {
143
143
  if (!config || typeof config !== "object") {
144
144
  throw new Error("seqpulse.init(config) requires a config object");
145
145
  }
146
- if (!config.apiKey || typeof config.apiKey !== "string") {
147
- throw new Error("seqpulse.init requires apiKey");
148
- }
149
146
 
150
147
  const endpoint = canonicalizePath(config.endpoint || DEFAULT_ENDPOINT);
151
- const windowSeconds = Number(config.windowSeconds || DEFAULT_WINDOW_SECONDS);
152
148
  const hmacEnabled = Boolean(config.hmacEnabled);
153
149
  const hmacSecret = String(config.hmacSecret || "");
154
150
 
155
- if (!Number.isFinite(windowSeconds) || windowSeconds <= 0) {
156
- throw new Error("windowSeconds must be a positive number");
157
- }
158
151
  if (hmacEnabled && !hmacSecret) {
159
152
  throw new Error("hmacSecret is required when hmacEnabled=true");
160
153
  }
161
154
 
162
155
  state.config = {
163
- apiKey: config.apiKey,
156
+ apiKey: typeof config.apiKey === "string" ? config.apiKey : "",
164
157
  endpoint,
165
- windowSeconds,
158
+ // Fixed to backend contract: 60s observation window for SDK sampling.
159
+ windowSeconds: DEFAULT_WINDOW_SECONDS,
166
160
  hmacEnabled,
167
161
  hmacSecret,
168
162
  maxSkewPastSeconds: Number(config.maxSkewPastSeconds || DEFAULT_MAX_SKEW_PAST_SECONDS),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seqpulse",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "SeqPulse SDK for metrics endpoint instrumentation and HMAC validation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/scripts/smoke.js CHANGED
@@ -42,7 +42,7 @@ function runMiddleware(mw, req, res) {
42
42
  }
43
43
 
44
44
  async function testNoHmac() {
45
- sdk.init({ apiKey: "sp_local", endpoint: "/seqpulse-metrics", hmacEnabled: false });
45
+ sdk.init({ endpoint: "/seqpulse-metrics", hmacEnabled: false });
46
46
  const mw = sdk.metrics();
47
47
 
48
48
  const req1 = mockReq({ path: "/health" });
@@ -63,7 +63,6 @@ async function testNoHmac() {
63
63
  async function testHmac() {
64
64
  const secret = "local_hmac_secret";
65
65
  sdk.init({
66
- apiKey: "sp_local",
67
66
  endpoint: "/seqpulse-metrics",
68
67
  hmacEnabled: true,
69
68
  hmacSecret: secret,