@ti-engine/core 1.8.0 → 1.8.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  This document contains the list of changes made to the framework. The format is based on the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
4
4
 
5
+ ## Version 1.8.1
6
+
7
+ Presentation and documentation only — no functional change. The npm page is the first thing a prospective user sees, and it was working against the package.
8
+
9
+ The two JSDoc corrections here were found while attempting to generate TypeScript declarations from the framework's JSDoc. That work is **deferred to a later release**: the generated declarations did not type-check for a consumer using TypeScript's default settings, and fixing that properly means rewiring the cross-file typedef graph rather than patching the output. These two fixes stand on their own regardless, because the JSDoc was wrong.
10
+
11
+ * fix(types): correct the `TiEnum` typedef's function-property annotations. `function( (number|string), [string] ): (string|undefined)` cannot be parsed — the JSDoc-optional bracket inside a function type is not readable — so `name`, `description` and `contains` were described as unnamed `Function` members. Documentation that reads correctly to a person and not at all to a parser
12
+ * refactor(tools): declare the enum factory as a named constant and export it as `module.exports.enum = createEnum`. Identical export name, arguments and behaviour; a direct assignment to a reserved word emits invalid syntax in a generated declaration, so this removes the obstacle ahead of the deferred work
13
+ * fix(docs): remove the CodeRabbit badge, which rendered as `provider or repo not found` — an error message sitting in the first line of the package page
14
+ * fix(docs): remove the `npms.io` popularity and quality badges. They were not broken; they worked, and published `popularity 4%` and `quality 47%` about this package on its own front page. Popularity is a restatement of the download count, which no niche framework wins, and there is no reason to advertise either
15
+ * feat(docs): show `npm version`, monthly downloads, the supported Node range, the licence and CI status instead — facts that stay true on their own, sourced from npm and GitHub rather than a third-party scoring service. Provenance needs no badge: npm renders it natively beside the version
16
+ * feat(docs): open the README with the install command and a minimal working service — the class and the handler — so the first screenful shows what using the framework looks like rather than three paragraphs about it
17
+ * fix(package): replace the description, which was the generic monorepo blurb shared verbatim with `tester`, with one that says what this package is. It is the line npm shows in search results
18
+ * fix(package): drop the `pubsub` keyword and add `message-queue`, `ioredis` and `microservice-framework`. The framework does not use Redis pub/sub at all — its exchange is built on lists, hashes and RedisJSON — so that keyword advertised something it does not do
19
+
5
20
  ## Version 1.8.0
6
21
 
7
22
  `ioredis` 6 makes RESP3 its default wire protocol. The framework does not set the `protocol` option, so this changes how every `core` connection talks to Redis without a line of framework code changing — and the suite here never touches a live Redis, so a green test run says nothing about it either way. It was checked against a real server rather than assumed: for every command the framework issues — `hgetall`, `smembers`, `hget`, `get`, `brpop`, the same commands through the generic `call()` path used for RedisJSON, and again inside `multi` — RESP3 and RESP2 return **identical** JavaScript values, because `ioredis` maps the new protocol's map and set types back to the objects and arrays it always returned. No consumer code changes.
package/README.md CHANGED
@@ -1,15 +1,45 @@
1
1
  # ti-engine core
2
2
 
3
- ![GitHub top language](https://img.shields.io/github/languages/top/Belleal/ti-engine)
4
- ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/Belleal/ti-engine)
5
- ![npms.io (scoped package)](https://img.shields.io/npms-io/maintenance-score/%40ti-engine/core)
6
- ![npms.io (scoped package)](https://img.shields.io/npms-io/popularity-score/%40ti-engine/core)
7
- ![npms.io (scoped package)](https://img.shields.io/npms-io/quality-score/%40ti-engine/core)
3
+ [![npm version](https://img.shields.io/npm/v/%40ti-engine/core)](https://www.npmjs.com/package/@ti-engine/core)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40ti-engine/core)](https://www.npmjs.com/package/@ti-engine/core)
5
+ [![node](https://img.shields.io/node/v/%40ti-engine/core)](https://nodejs.org/)
6
+ [![license](https://img.shields.io/npm/l/%40ti-engine/core)](https://github.com/Belleal/ti-engine/blob/master/LICENSE.md)
7
+ [![CI](https://github.com/Belleal/ti-engine/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Belleal/ti-engine/actions/workflows/ci.yml)
8
8
 
9
9
  ![Logo](https://raw.githubusercontent.com/Belleal/ti-engine/master/packages/core/docs/ti-engine-icon.ico)
10
10
 
11
11
  Flexible framework for the creation of microservices with [node.js](https://nodejs.org/).
12
12
 
13
+ Every release is published from CI with a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements), so the tarball on npm is verifiably built from the commit it names.
14
+
15
+ ```shell
16
+ npm install @ti-engine/core
17
+ ```
18
+
19
+ A service is a class and a handler. The class declares the lifecycle; the handler is the business logic:
20
+
21
+ ```javascript
22
+ // my-service.js — the instance
23
+ const ServiceProvider = require( "@ti-engine/core/service-provider" );
24
+
25
+ class MyService extends ServiceProvider {
26
+ onStart() {
27
+ return Promise.resolve();
28
+ }
29
+ }
30
+
31
+ module.exports = MyService;
32
+ ```
33
+
34
+ ```javascript
35
+ // services/v1/greet.js — one service, registered in the service registry JSON
36
+ module.exports.service = ( serviceDefinition, serviceParams, serviceCallContext ) => {
37
+ return Promise.resolve( { greeting: `hello, ${ serviceParams.name }` } );
38
+ };
39
+ ```
40
+
41
+ Point `TI_INSTANCE_CLASS` at the class, `TI_INSTANCE_NAME` at the service domain, and start it with `node ./node_modules/@ti-engine/core/bin/start-instance.js`. Calls between instances travel over Redis as an envelope plus a payload, traced end to end. The rest of this document covers that machinery in detail — start with [Prerequisites & installation](#prerequisites--installation).
42
+
13
43
  ## Introduction
14
44
 
15
45
  The **ti-engine** is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using **node.js**. The architectural concept of the framework is based on a standard _messaging system_ that allows for certain customization but also provides predictability and traceability of its behavior.
@@ -117,10 +117,10 @@
117
117
 
118
118
  /**
119
119
  * @typedef {Object} TiEnum
120
- * @property {Object.<number|string,TiEnumValue>} properties
121
- * @property {function( (number|string), [string] ): (string|undefined)} name
122
- * @property {function( (number|string), [string] ): (string|undefined)} description
123
- * @property {function( (number|string) ): boolean} contains
120
+ * @property {Object.<string,TiEnumValue>} properties
121
+ * @property {(enumValue: number|string, placeholder?: string) => string|undefined} name
122
+ * @property {(enumValue: number|string, placeholder?: string) => string|undefined} description
123
+ * @property {(enumValue: number|string) => boolean} contains
124
124
  */
125
125
 
126
126
  /**
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@ti-engine/core",
3
- "version": "1.8.0",
4
- "description": "The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.",
3
+ "version": "1.8.1",
4
+ "description": "Microservice framework for Node.js: a Redis-backed message exchange with end-to-end call tracing, retries and tamper-evident message envelopes.",
5
5
  "keywords": [
6
6
  "microservices",
7
+ "microservice-framework",
7
8
  "framework",
8
9
  "node",
9
10
  "redis",
11
+ "ioredis",
10
12
  "messaging",
11
- "pubsub",
13
+ "message-queue",
12
14
  "distributed-systems"
13
15
  ],
14
16
  "author": "Boris Kostadinov <kostadinov.boris@gmail.com>",
@@ -63,8 +65,7 @@
63
65
  "lodash": "^4.18.1",
64
66
  "node-schedule": "^2.1.1"
65
67
  },
66
- "optionalDependencies": {
67
- },
68
+ "optionalDependencies": {},
68
69
  "files": [
69
70
  "bin/",
70
71
  "components/",
@@ -87,4 +88,4 @@
87
88
  "engines": {
88
89
  "node": ">=20.12.0"
89
90
  }
90
- }
91
+ }
package/utils/tools.js CHANGED
@@ -49,7 +49,11 @@ module.exports.deepFreeze = ( object, seen = new WeakSet() ) => {
49
49
  * @returns {Object} This is a {@link TiEnum} object. Setting the proper reference here would unfortunately break IDE support.
50
50
  * @public
51
51
  */
52
- module.exports.enum = ( seed ) => {
52
+ // Declared as a named constant and exported below rather than assigned straight onto `module.exports`:
53
+ // `enum` is a reserved word in TypeScript, and a direct assignment makes the generated declaration
54
+ // `export declare var enum`, which is a syntax error. Named and re-exported, it emits the aliased
55
+ // form instead. The runtime export is unchanged — this is still `tools.enum( ... )`.
56
+ const createEnum = ( seed ) => {
53
57
  const enumObject = Object.create( null );
54
58
  const properties = Object.create( null );
55
59
  const reserved = new Set( [ "properties", "name", "description", "contains", "__proto__", "prototype", "constructor" ] );
@@ -147,6 +151,7 @@ module.exports.enum = ( seed ) => {
147
151
 
148
152
  return enumObject;
149
153
  };
154
+ module.exports.enum = createEnum;
150
155
 
151
156
  /**
152
157
  * Used to get the name of an {@link TiEnum} value if such exists.