@skrr-ai/signals 0.1.1 → 0.1.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/index.cjs +4 -2
- package/dist/index.js +4 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
35
35
|
|
|
36
36
|
// src/contracts.ts
|
|
37
37
|
var import_cloudevents = require("cloudevents");
|
|
38
|
+
var VALIDATE_URI_REFERENCE_RE = /\s/;
|
|
38
39
|
var SIGNAL_CLOUDEVENTS_CONTENT_TYPE = "application/cloudevents+json";
|
|
39
40
|
var SIGNAL_API_VERSION = "v1";
|
|
40
41
|
var CLOUD_EVENTS_V1 = "1.0";
|
|
@@ -317,7 +318,7 @@ function validateNonEmptyString(value, path, issues) {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
function validateUriReference(value, path, issues) {
|
|
320
|
-
if (typeof value !== "string" || value.trim().length === 0 ||
|
|
321
|
+
if (typeof value !== "string" || value.trim().length === 0 || VALIDATE_URI_REFERENCE_RE.test(value)) {
|
|
321
322
|
issues.push({ path, code: "format", message: "A non-empty URI-reference is required." });
|
|
322
323
|
}
|
|
323
324
|
}
|
|
@@ -371,6 +372,7 @@ function omitUndefined(input) {
|
|
|
371
372
|
|
|
372
373
|
// src/publisher.ts
|
|
373
374
|
var import_cloudevents2 = require("cloudevents");
|
|
375
|
+
var CONSTRUCTOR_RE = /\/$/;
|
|
374
376
|
var SignalAPIError = class extends Error {
|
|
375
377
|
status;
|
|
376
378
|
code;
|
|
@@ -401,7 +403,7 @@ var SignalPublisher = class {
|
|
|
401
403
|
if (!options.endpoint) throw new Error("[skrr Signals] endpoint is required.");
|
|
402
404
|
if (!options.source) throw new Error("[skrr Signals] source is required.");
|
|
403
405
|
if (!options.token) throw new Error("[skrr Signals] source-scoped token is required.");
|
|
404
|
-
this.endpoint = options.endpoint.replace(
|
|
406
|
+
this.endpoint = options.endpoint.replace(CONSTRUCTOR_RE, "");
|
|
405
407
|
this.source = options.source;
|
|
406
408
|
this.token = options.token;
|
|
407
409
|
this.timeoutMs = options.timeoutMs ?? 15e3;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/contracts.ts
|
|
2
2
|
import { CloudEvent, ValidationError } from "cloudevents";
|
|
3
|
+
var VALIDATE_URI_REFERENCE_RE = /\s/;
|
|
3
4
|
var SIGNAL_CLOUDEVENTS_CONTENT_TYPE = "application/cloudevents+json";
|
|
4
5
|
var SIGNAL_API_VERSION = "v1";
|
|
5
6
|
var CLOUD_EVENTS_V1 = "1.0";
|
|
@@ -282,7 +283,7 @@ function validateNonEmptyString(value, path, issues) {
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
function validateUriReference(value, path, issues) {
|
|
285
|
-
if (typeof value !== "string" || value.trim().length === 0 ||
|
|
286
|
+
if (typeof value !== "string" || value.trim().length === 0 || VALIDATE_URI_REFERENCE_RE.test(value)) {
|
|
286
287
|
issues.push({ path, code: "format", message: "A non-empty URI-reference is required." });
|
|
287
288
|
}
|
|
288
289
|
}
|
|
@@ -336,6 +337,7 @@ function omitUndefined(input) {
|
|
|
336
337
|
|
|
337
338
|
// src/publisher.ts
|
|
338
339
|
import { CloudEvent as CloudEvent2, HTTP } from "cloudevents";
|
|
340
|
+
var CONSTRUCTOR_RE = /\/$/;
|
|
339
341
|
var SignalAPIError = class extends Error {
|
|
340
342
|
status;
|
|
341
343
|
code;
|
|
@@ -366,7 +368,7 @@ var SignalPublisher = class {
|
|
|
366
368
|
if (!options.endpoint) throw new Error("[skrr Signals] endpoint is required.");
|
|
367
369
|
if (!options.source) throw new Error("[skrr Signals] source is required.");
|
|
368
370
|
if (!options.token) throw new Error("[skrr Signals] source-scoped token is required.");
|
|
369
|
-
this.endpoint = options.endpoint.replace(
|
|
371
|
+
this.endpoint = options.endpoint.replace(CONSTRUCTOR_RE, "");
|
|
370
372
|
this.source = options.source;
|
|
371
373
|
this.token = options.token;
|
|
372
374
|
this.timeoutMs = options.timeoutMs ?? 15e3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skrr-ai/signals",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CloudEvents-native Signal contracts and publisher SDK for OverSky",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/skrr-ai/OverSky.git",
|
|
18
18
|
"directory": "packages/signal-sdk"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^20.0.0",
|
|
58
58
|
"tsup": "^8.0.0",
|
|
59
|
-
"typescript": "^5.3
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
60
|
"vitest": "^4.1.6"
|
|
61
61
|
}
|
|
62
62
|
}
|