@atsignal/node 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.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/index.cjs +54 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +32 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NETHRU Inc.
|
|
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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# `@atsignal/node`
|
|
2
|
+
|
|
3
|
+
Node.js SDK for Signal analytics, built on the shared `@atsignal/js-core` runtime.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @atsignal/node
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import signal from "@atsignal/node";
|
|
15
|
+
|
|
16
|
+
await signal.init("your-api-key", {
|
|
17
|
+
persistQueue: false,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await signal.track("ServerStarted");
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
More SDK details live in the monorepo root README.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
SignalNodeClient: () => SignalNodeClient,
|
|
24
|
+
default: () => index_default,
|
|
25
|
+
newInstance: () => newInstance
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var import_js_core = require("@atsignal/js-core");
|
|
29
|
+
var SignalNodeClient = class extends import_js_core.SignalClient {
|
|
30
|
+
resolveInitConfig(options) {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
const queueStorage = options.persistQueue === false ? void 0 : (_a = options.storage) == null ? void 0 : _a.queue;
|
|
33
|
+
return {
|
|
34
|
+
...options,
|
|
35
|
+
transport: (_b = options.transport) != null ? _b : (0, import_js_core.createFetchTransport)(),
|
|
36
|
+
storage: {
|
|
37
|
+
identity: (_d = (_c = options.storage) == null ? void 0 : _c.identity) != null ? _d : new import_js_core.InMemoryStorage(),
|
|
38
|
+
...queueStorage !== void 0 ? { queue: queueStorage } : {}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function newInstance() {
|
|
44
|
+
return new SignalNodeClient();
|
|
45
|
+
}
|
|
46
|
+
var signal = Object.assign(new SignalNodeClient(), {
|
|
47
|
+
newInstance
|
|
48
|
+
});
|
|
49
|
+
var index_default = signal;
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
SignalNodeClient,
|
|
53
|
+
newInstance
|
|
54
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SignalClient, ClientConfig, Transport, KeyValueStorage, QueueStorageInput } from '@atsignal/js-core';
|
|
2
|
+
|
|
3
|
+
interface SignalNodeOptions extends Omit<ClientConfig, "storage"> {
|
|
4
|
+
transport?: Transport;
|
|
5
|
+
storage?: {
|
|
6
|
+
identity?: KeyValueStorage;
|
|
7
|
+
queue?: QueueStorageInput;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare class SignalNodeClient extends SignalClient<SignalNodeOptions> {
|
|
11
|
+
protected resolveInitConfig(options: SignalNodeOptions): ClientConfig;
|
|
12
|
+
}
|
|
13
|
+
declare function newInstance(): SignalNodeClient;
|
|
14
|
+
type SignalNode = SignalNodeClient & {
|
|
15
|
+
newInstance: typeof newInstance;
|
|
16
|
+
};
|
|
17
|
+
declare const signal: SignalNode;
|
|
18
|
+
|
|
19
|
+
export { type SignalNode, SignalNodeClient, type SignalNodeOptions, signal as default, newInstance };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SignalClient, ClientConfig, Transport, KeyValueStorage, QueueStorageInput } from '@atsignal/js-core';
|
|
2
|
+
|
|
3
|
+
interface SignalNodeOptions extends Omit<ClientConfig, "storage"> {
|
|
4
|
+
transport?: Transport;
|
|
5
|
+
storage?: {
|
|
6
|
+
identity?: KeyValueStorage;
|
|
7
|
+
queue?: QueueStorageInput;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare class SignalNodeClient extends SignalClient<SignalNodeOptions> {
|
|
11
|
+
protected resolveInitConfig(options: SignalNodeOptions): ClientConfig;
|
|
12
|
+
}
|
|
13
|
+
declare function newInstance(): SignalNodeClient;
|
|
14
|
+
type SignalNode = SignalNodeClient & {
|
|
15
|
+
newInstance: typeof newInstance;
|
|
16
|
+
};
|
|
17
|
+
declare const signal: SignalNode;
|
|
18
|
+
|
|
19
|
+
export { type SignalNode, SignalNodeClient, type SignalNodeOptions, signal as default, newInstance };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
InMemoryStorage,
|
|
4
|
+
SignalClient,
|
|
5
|
+
createFetchTransport
|
|
6
|
+
} from "@atsignal/js-core";
|
|
7
|
+
var SignalNodeClient = class extends SignalClient {
|
|
8
|
+
resolveInitConfig(options) {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
const queueStorage = options.persistQueue === false ? void 0 : (_a = options.storage) == null ? void 0 : _a.queue;
|
|
11
|
+
return {
|
|
12
|
+
...options,
|
|
13
|
+
transport: (_b = options.transport) != null ? _b : createFetchTransport(),
|
|
14
|
+
storage: {
|
|
15
|
+
identity: (_d = (_c = options.storage) == null ? void 0 : _c.identity) != null ? _d : new InMemoryStorage(),
|
|
16
|
+
...queueStorage !== void 0 ? { queue: queueStorage } : {}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function newInstance() {
|
|
22
|
+
return new SignalNodeClient();
|
|
23
|
+
}
|
|
24
|
+
var signal = Object.assign(new SignalNodeClient(), {
|
|
25
|
+
newInstance
|
|
26
|
+
});
|
|
27
|
+
var index_default = signal;
|
|
28
|
+
export {
|
|
29
|
+
SignalNodeClient,
|
|
30
|
+
index_default as default,
|
|
31
|
+
newInstance
|
|
32
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atsignal/node",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Node.js SDK for Signal.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/at-signal/signal-js.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/at-signal/signal-js#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/at-signal/signal-js/issues"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@atsignal/js-core": "0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean --tsconfig tsconfig.build.json",
|
|
38
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch --tsconfig tsconfig.build.json",
|
|
39
|
+
"clean": "rimraf dist",
|
|
40
|
+
"test": "pnpm --filter @atsignal/js-core run build && pnpm run build && node --test test/*.test.mjs"
|
|
41
|
+
}
|
|
42
|
+
}
|