@operationcaribbeansummer/wikiagorasocial-utils 4.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 OperationCaribbeanSummer
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,625 @@
1
+ # WikiAgoraSocial-utils
2
+
3
+ <div align="center">
4
+
5
+ <SVG>banner</SVG>
6
+
7
+ <!--
8
+ <videoID>
9
+ <endpoint>
10
+ 444444
11
+ sustainable-development-goal-##.svg
12
+ -->
13
+
14
+ <!-- Badges -->
15
+
16
+ [![followers](https://custom-icon-badges.demolab.com/github/followers/OperationCaribbeanSummer?logo=person-add&style=social&logoColor=black)](https://github.com/org/OperationCaribbeanSummer)
17
+ ![GitHub stars](https://custom-icon-badges.demolab.com/github/stars/OperationCaribbeanSummer/WikiAgoraSocial-utils?label=Stars&logo=star&logoColor=ffffff&labelColor=282828&color=663399&style=flat)
18
+ ![GitHub forks](https://custom-icon-badges.demolab.com/github/forks/OperationCaribbeanSummer/WikiAgoraSocial-utils?label=Forks&logo=fork&logoColor=ffffff&labelColor=282828&color=663399&style=flat)
19
+ ![GitHub watchers](https://custom-icon-badges.demolab.com/github/watchers/OperationCaribbeanSummer/WikiAgoraSocial-utils?label=Watchers&logoColor=ffffff&labelColor=282828&color=663399&style=flat&logo=eye)
20
+
21
+ [![GitHub release](https://custom-icon-badges.demolab.com/github/release/OperationCaribbeanSummer/WikiAgoraSocial-utils.svg?color=663399&style=flat&logo=tag)](https://GitHub.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/releases)
22
+ [![GitHub branches](https://badgen.net/github/branches/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&style=flat)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/branches)
23
+ [![GitHub commit total](https://custom-icon-badges.demolab.com/github/commit-activity/t/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&style=flat&logo=git-commit)](https://GitHub.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/commit)
24
+ [![GitHub commit activity](https://custom-icon-badges.demolab.com/github/commit-activity/m/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&style=flat&logo=git-commit)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/commits)
25
+ [![Last commit](https://custom-icon-badges.demolab.com/github/last-commit/OperationCaribbeanSummer/WikiAgoraSocial-utils.svg?style=flat&logo=history&color=663399)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/commits)
26
+
27
+ [![GitHub issues](https://custom-icon-badges.demolab.com/github/issues/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=issue-opened)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues)
28
+ [![GitHub closed issues](https://custom-icon-badges.demolab.com/github/issues-closed/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=issue-opened)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues?q=is%3Aissue+is%3Aclosed) |
29
+ [![GitHub pull requests](https://custom-icon-badges.demolab.com/github/issues-pr/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=pr)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/pulls?q=is%3Apr)
30
+ [![GitHub closed pull requests](https://custom-icon-badges.demolab.com/github/issues-pr-closed/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=pr)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/pulls?q=is%3Apr+is%3Aclosed) |
31
+ [![GitHub open milestones](https://custom-icon-badges.demolab.com/github/milestones/open/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=milestone)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/milestones?state=open)
32
+ [![GitHub closed milestones](https://custom-icon-badges.demolab.com/github/milestones/closed/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399&logo=milestone)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/milestones?state=closed)
33
+
34
+ <!-- testing -->
35
+
36
+ [![tested with jest](https://custom-icon-badges.demolab.com/badge/tested_with-jest-99424f.svg?logo=jest)](https://github.com/jestjs/jest)
37
+ [![tested with supertest](https://custom-icon-badges.demolab.com/badge/tested_with-supertest-99424f.svg?logo=beaker)](https://github.com/ladjs/supertest)
38
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/graphs/commit-activity)
39
+ [![GitHub Actions Workflow Status](https://custom-icon-badges.demolab.com/github/actions/workflow/status/OperationCaribbeanSummer/WikiAgoraSocial-utils/test.yml?branch=main&logo=beaker&label=Test)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/actions/workflows/test.yml)
40
+
41
+ <!-- ![Swagger Validator](https://img.shields.io/swagger/valid/3.0?specUrl=https%3A%2F%2Fraw.githubusercontent.com%2FOAI%2FOpenAPI-Specification%2Fmaster%2Fexamples%2Fv2.0%2Fjson%2Fpetstore-expanded.json) -->
42
+
43
+ ============================================
44
+ [![Coverage Status](https://custom-icon-badges.demolab.com/coveralls/OperationCaribbeanSummer/WikiAgoraSocial-utils.svg?logo=coveralls)](https://coveralls.io/r/OperationCaribbeanSummer/WikiAgoraSocial-utils)
45
+ [![codecov](https://codecov.io/gh/OperationCaribbeanSummer/WikiAgoraSocial-utils/graph/badge.svg?token=O42J6FBE8M)](https://codecov.io/gh/OperationCaribbeanSummer/WikiAgoraSocial-utils)
46
+ [![Code Climate](https://codeclimate.com/github/OperationCaribbeanSummer/WikiAgoraSocial-utils/badges/gpa.svg)](https://codeclimate.com/github/OperationCaribbeanSummer/WikiAgoraSocial-utils)
47
+ ============================================
48
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/badge)](https://scorecard.dev/viewer/?uri=github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils)
49
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/444444/badge)](https://www.bestpractices.dev/projects/444444)
50
+ [![CodeQL](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/actions/workflows/CodeQL.yml/badge.svg)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/actions/workflows/CodeQL.yml)
51
+ [![Hits-of-Code](https://hitsofcode.com/github/OperationCaribbeanSummer/WikiAgoraSocial-utils?branch=main)](https://hitsofcode.com/github/OperationCaribbeanSummer/WikiAgoraSocial-utils/view?branch=main)
52
+ ![GitHub repo size](https://custom-icon-badges.demolab.com/github/repo-size/OperationCaribbeanSummer/WikiAgoraSocial-utils?logo=file-code&color=red)
53
+ [![GitHub downloads](https://custom-icon-badges.demolab.com/badge/View-All_Downloads-F25278?&style=flat&logo=download&logoColor=white)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/releases)
54
+ [![download](https://custom-icon-badges.demolab.com/badge/-Download_repo-F25278?&style=flat&logo=download&logoColor=white)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/archive/refs/heads/main.zip)
55
+
56
+ [![Contributors](https://img.shields.io/github/contributors/OperationCaribbeanSummer/WikiAgoraSocial-utils.svg)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/contributors)
57
+ [![OpenCollective](https://opencollective.com/OperationCaribbeanSummer/backers/badge.svg)](https://opencollective.com/OperationCaribbeanSummer)
58
+ [![sponsors](https://custom-icon-badges.demolab.com/badge/Sponsors-D15E9B.svg?logo=heart)](https://github.com/sponsors/OperationCaribbeanSummer)
59
+ [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](https://github.com/ellerbrock/open-source-badges/)
60
+ [![Ask us anything!](https://custom-icon-badges.demolab.com/badge/Ask%20Us-anything-1abc9c.svg?logo=comment-discussion)](https://github.com/orgs/OperationCaribbeanSummer/discussions)
61
+ [![first-timers-only](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://www.firsttimersonly.com)
62
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
63
+ [![Contributor](https://custom-icon-badges.herokuapp.com/badge/become_a-contributor-663399?logoColor=white&logo=git-merge)](CONTRIBUTING.md)
64
+ [![All Contributors](https://img.shields.io/github/all-contributors/OperationCaribbeanSummer/WikiAgoraSocial-utils?color=663399)](#contributors)
65
+
66
+ <!-- standards start -->
67
+
68
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
69
+ [![semantic-release](https://img.shields.io/badge/%E2%9C%93_semantic--release-angular-brightgreen)](https://github.com/googleapis/release-please-action)
70
+ [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standards-brightgreen.svg)](https://standardjs.com)
71
+ [![commitlint config-conventional](https://img.shields.io/badge/%E2%9C%93_commitlint-config_conventional-brightgreen.svg)](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
72
+ [![Commitizen friendly](https://img.shields.io/badge/%E2%9C%93_commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli)
73
+ [![editorconfig friendly](https://img.shields.io/badge/%E2%9C%93_editorconfig-friendly-brightgreen.svg)](https://editorconfig.org)
74
+ [![check GitHub Flow](https://img.shields.io/badge/%E2%9C%93_Branching_strategy-GitHub_Flow-brightgreen.svg)](https://docs.github.com/en/get-started/using-github/github-flow)
75
+ [![check VitePress](https://img.shields.io/badge/%E2%9C%93_documentation-VitePress-brightgreen.svg)](https://VitePress.dev)
76
+ [![check OpenAPI-Specification](https://img.shields.io/badge/%E2%9C%93_OpenAPI-Specification-brightgreen.svg)](https://github.com/OAI/OpenAPI-Specification)
77
+ [![check AsyncAPI-Specification](https://img.shields.io/badge/%E2%9C%93_AsyncAPI-Specification-brightgreen.svg)](https://www.asyncapi.com)
78
+ [![SemVer](https://img.shields.io/badge/%E2%9C%93_version--controlled-SemVer-brightgreen.svg)](https://semver.org)
79
+ [![Agile Software Development](https://img.shields.io/badge/%E2%9C%93_Manifesto-Agile_Development-brightgreen.svg)](https://agilemanifesto.org/iso/en/manifesto.html)
80
+
81
+ <!--
82
+ [![check ](https://img.shields.io/badge/%E2%9C%93-4444-brightgreen.svg)](4444.md)
83
+ [![check ](https://img.shields.io/badge/%E2%9C%93-4444-brightgreen.svg)](4444.md)
84
+ [![check ](https://img.shields.io/badge/%E2%9C%93-4444-brightgreen.svg)](4444.md)
85
+ -->
86
+ <!-- standards end -->
87
+
88
+ [![All repos](https://custom-icon-badges.demolab.com/badge/-All%20Repos-blue?&style=flat&logoColor=white&logo=repo)](https://github.com/orgs/OperationCaribbeanSummer/repositories)
89
+ [![discuss](https://custom-icon-badges.demolab.com/github/discussions/OperationCaribbeanSummer/WikiAgoraSocial-utils?&style=flat&logo=comment-discussion&logoColor=black)](https://github.com/orgs/OperationCaribbeanSummer/discussions)
90
+ [![telegram](https://custom-icon-badges.demolab.com/badge/Discuss-Telegram-plum?&style=flat&logo=telegram&logoColor=black)](https://t.me/OperationCaribbeanSummer-dev)
91
+ [![phone](https://custom-icon-badges.demolab.com/badge/-+53--5843--9494-orange?&style=flat&logo=phone&logoColor=white)](sms://+5358439494)
92
+ [![email](https://custom-icon-badges.demolab.com/badge/-co2mm.esperanto@gmail.com-E61B23?&style=flat&logo=mail&logoColor=white)](mailto:co2mm.esperanto@gmail.com)
93
+ [![location](https://custom-icon-badges.demolab.com/badge/Havana-Cuba-purple?&style=flat&logo=location&logoColor=white)](geo:23.1351437,-82.3889117)
94
+
95
+ <!-- license -->
96
+
97
+ [![MIT license](https://custom-icon-badges.demolab.com/badge/license-MIT-blue.svg?logo=law)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/blob/main/LICENSE)
98
+ [![CC−BY−SA](https://custom-icon-badges.demolab.com/badge/License-CC−BY−SA_v4.0-blue.svg?logo=law)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/blob/main/LICENSE-CONTENT)
99
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FOperationCaribbeanSummer%2FWikiAgoraSocial-utils.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2FOperationCaribbeanSummer%2FWikiAgoraSocial-utils?ref=badge_shield&issueType=license)
100
+
101
+ # <!-- useful urls -->
102
+
103
+ [website](https://OperationCaribbeanSummer.com)
104
+ [Roadmap](ROADMAP.md) |
105
+ [Contribute](CONTRIBUTING.md) |
106
+
107
+ <!-- [Test]() |
108
+ [Translate]() |
109
+ [CI/CD]() |
110
+ [Guides]() | -->
111
+
112
+ ====
113
+ [Getting Started](/docs/getting-started.md) |
114
+ [Documentation](/docs) |
115
+ [docs-API](/docs-api) |
116
+ [docs-events](/docs-events)
117
+ ====
118
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/fork/github/https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils)
119
+ [![Open in Gitpod](https://img.shields.io/badge/open_in_gitpod-ff8c03?logo=gitpod&logoColor=ffffff&labelColor=&label=)](https://gitpod.io/#https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils)
120
+
121
+ <!-- useful urls end -->
122
+
123
+ ![badge only version](https://img.shields.io/github/v/WikiAgoraSocial-utils?color=663399&label=)
124
+
125
+ </div>
126
+
127
+ <!-- TODO: tech stack logos -->
128
+ <img src="/public/logos/" alt="" class="logo44">
129
+
130
+ <!-- Sustainable Development Goals (SDG) logos -->
131
+ <img src="/public/logos/sustainable-development-goals/sustainable-development-goal-##.svg" alt="Sustainable Development Goal #" class="logo44">
132
+
133
+ <!-- Description -->
134
+
135
+ **Description:** Describe the problem(s) this project solves. Describe how this software can improve the lives of its audience.
136
+
137
+ <!-- Tags / Hashtags -->
138
+
139
+ **Hashtags**: #OperationCaribbeanSummer #WikiAgora #WikiAgoraSocial #44 #mlk #mlk44 #CivicTech #democracy #LiquidDemocracy #eDemocracy #OpenGovernment #AccountableGovernance #CivicInnovation #CollectiveIntelligence #DeliberativeDemocracy #DirectDemocracy #eGovernance #eParticipation #GovernmentAsAPlatform #OpenBudgets #OpenData #OpenDecisionMaking #OpenGovernment #OpenJustice #OpenPolicy #OpenSource #ParticipatoryBudgeting #ParticipatoryDemocracy #TransparentGovernment
140
+
141
+ ## ✅Features
142
+
143
+ If you have ideas for releases in the future, it is a good idea to list them in the README and/or open an [Issues](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues).
144
+
145
+ <!-- WIP! = Work In Progress! -->
146
+
147
+ - ✅ 44
148
+ - 🚧 Unit Testing using [vitest]()
149
+ - 🚧 ....
150
+
151
+ > more 💡 **ideas** are welcome (🔗[new idea](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues/new-----) - [](https://github.com/orgs/OperationCaribbeanSummer/discussions/?category=ideas) - [project ideas](...))
152
+ >
153
+ > more ❗️ **features** are welcome (🔗[new feature](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues/new))
154
+ >
155
+ > more 💬 **comment-discussion** are welcome (🔗[discussion](https://github.com/orgs/OperationCaribbeanSummer/discussions))
156
+ >
157
+ > **PRs** are welcome 🔥🚀❤️⭐️ (🔗[new Pull Request](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/pulls))
158
+ >
159
+ > full list of features at 🗓[CHANGELOG.md](/CHANGELOG.md)
160
+
161
+ ## Versioning and releases
162
+
163
+ OperationCaribbeanSummer repositories are following **Semantic Versioning 2.0** [SemVer](https://semver.org), designating development stage (alpha `-a` or beta `-b`).
164
+
165
+ ## 📦Tech stack and Technologies
166
+
167
+ <!-- TODO: logos 25px -->
168
+ <!-- TODO: [img1][img2][img3][img4][img....] -->
169
+ <!-- TODO: logos en colores -->
170
+ <!-- TODO: hover = #663399 + link to sub #techName -->
171
+ <!-- TODO: hover = alt tech name text -->
172
+ <!-- TODO: hover = zoom +20% -->
173
+
174
+ **Status**: Beta v4, in experimental testing status (the previous version was not launched or deprecated).
175
+
176
+ ....see [technologies.md](/docs/technologies.md) for more detailed info and references
177
+
178
+ ## Requirements
179
+
180
+ ## ???Installation
181
+
182
+ ### Commands
183
+
184
+ ## ??Configuration
185
+
186
+ ### Settings Files
187
+
188
+ ## Dependencies
189
+
190
+ ## 🤸Quick Start
191
+
192
+ Follow these steps to set up the project locally on your machine.
193
+
194
+ **Prerequisites**:
195
+ Make sure you have the following installed on your machine:
196
+ Git, Node.js, npm, MongoDB, Docker, Redis, Kafka.
197
+
198
+ **Cloning the Repository**:
199
+
200
+ ```bash
201
+ git clone https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils.git
202
+ cd WikiAgoraSocial-utils
203
+ ```
204
+
205
+ ## Requirements
206
+
207
+ Complete installation requirements can be found in the documentation under Installation Requirements. See [requirements.txt](/requirements.txt) or `requirements`, `devRequirements` at [package.json](/package.json).
208
+
209
+ **requirements**:
210
+
211
+ - **Node.js** - <https://nodejs.org/en/download>
212
+ - **npm** - <https://www.npmjs.com> or **pnpm** <https://pnpm.io>
213
+ - **MongoDB** - <https://www.mongodb.com>
214
+ - **Redis** - <https://redis.io> (recommended via Docker)
215
+ - **Kafka** - <https://kafka.apache.org/downloads> (recommended via Docker)
216
+ - **Docker** - <https://docs.docker.com/desktop>
217
+
218
+ **devRequirements**:
219
+
220
+ - **Git** - <https://git-scm.com/downloads>
221
+ - **Bruno** - <https://usebruno.com>
222
+ - **GitHub-CLI** - <https://cli.github.com>
223
+ - **VSCode** - <https://code.visualstudio.com>
224
+
225
+ ## 🛠️Installation
226
+
227
+ The [INSTALL.md](./.github/INSTALL.md) file contains the detailed installation instructions.
228
+
229
+ **Simpless way**: Download (`update-or-intall.bat` or `update-or-intall.sh`), copy to your preferred directory and execute this scrypt!
230
+
231
+ - [update-or-intall.bat](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/tree/main/scripts/update-or-intall.bat) for Windows<!-- TODO: links de archivos de github-->
232
+ - [update-or-intall.sh](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/tree/main/scripts/update-or-intall.sh) for Linux, Mac<!-- TODO: links de archivos de github-->
233
+
234
+ **Installation**:
235
+
236
+ 1. Make sure you have the required software installed. (See [requirements.txt](/requirements.txt))
237
+ 1. Clone this repository - run `git clone https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils.git`
238
+ 1. Go to the directory - run `cd WikiAgoraSocial-utils`
239
+ 1. Install dependencies - run `npm install`
240
+ 1. Configure the project
241
+ 1. Create a .env file by copying the `.env.example` file - run `cp .env.example .env`
242
+ 1. Configure your settings
243
+ 1. Seed your data base - run `npm run seed` (optional but recommended)
244
+ 1. Run `npm start`
245
+ 1. Open the browser at <http://localhost:4444>. Server will connect to MongoDB & run on Port 4444
246
+
247
+ ### Commands
248
+
249
+ Useful commands for development availables in package.json:
250
+
251
+ ```bash
252
+ npm install # install all needed dependencies
253
+ ```
254
+
255
+ ```bash
256
+ npm start # run the project in development mode using nodemon so it is restarted when the code changes.
257
+ ```
258
+
259
+ ```bash
260
+ npm run prod # run the API in production mode
261
+ ```
262
+
263
+ ```bash
264
+ npm test # test using Jest
265
+ ```
266
+
267
+ ```bash
268
+ npm lint # lints the code, automatically fixing issues where possible.
269
+ ```
270
+
271
+ ```bash
272
+ npm run docs # generate API docs
273
+ npm run docs:dev
274
+ npm run docs:build
275
+ npm run docs:preview
276
+ ```
277
+
278
+ <!-- TODO: full list of issues at TODO.todo-->
279
+
280
+ ```bash
281
+ npm run todo # generate full list of issues at TODO.todo-->
282
+ ```
283
+
284
+ ## ⚙️Configuration
285
+
286
+ **Set Up Environment Variables** `.env`
287
+
288
+ Create a new file named `.env` in the root of your project and add the following content:
289
+
290
+ ```env
291
+ DB_URI=mongodb://localhost:27017/WikiAgora
292
+ PORT=4444
293
+ NODE_ENV=development
294
+ JWT_SECRET=44444444444444444444444444444444444444444444
295
+ ```
296
+
297
+ Replace the placeholder values with your credentials.
298
+
299
+ ### Settings Files
300
+
301
+ Files in the directory `/config/`:
302
+
303
+ `config44.js`
304
+
305
+ `*.config44.js`
306
+
307
+ `*.config44.json`
308
+
309
+ ### 📁/📂Project structure
310
+
311
+ ## 🕹️Usage
312
+
313
+ **Running the Project**:
314
+
315
+ ```bash
316
+ npm start
317
+ ```
318
+
319
+ Open [http://localhost:4444](http://localhost:4444/api/v4/WikiAgoraSocial-utils/status) in your browser to view the project.
320
+
321
+ ### Tools and IDE
322
+
323
+ [VSCode](https://code.visualstudio.com) editor is recommended plus [settings.json](/.vscode/settings.json) and extensions at [extensions.json](/.vscode/extensions.json), see [tools-and-IDE.md](----/docs/tools-and-IDE.md-----) for more details.
324
+
325
+ **VSCode extensions**:
326
+
327
+ - **code-spell-checker**
328
+ - **vscode-eslint**
329
+
330
+ ....see [extensions.json](/.vscode/extensions.json)
331
+
332
+ **Needed or recommended tools**:
333
+
334
+ - **bruno** - Opensource IDE for exploring and testing APIs
335
+ - **docker** - used to automate the deployment of applications in lightweight containers so that applications can work efficiently in different environments in isolation
336
+ - **localtunnel** - exposes your localhost to the world for easy testing and sharing!
337
+ - ....
338
+
339
+ **Browser addons**:
340
+
341
+ - **Vue.js devtools** - https://devtools.vuejs.org/getting-started/features - [firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools), [chrome](https://chromewebstore.google.com/detail/vuejs-devtools)
342
+ - **Vue Telescope** - [firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-telescope), [chrome](https://chromewebstore.google.com/detail/vue-telescope)
343
+ - **Material Icons for GitHub** - [firefox](https://addons.mozilla.org/en-US/firefox/addon/material-icons-for-github), [chrome](https://chromewebstore.google.com/detail/material-icons-for-github)
344
+ <!--pinia-->
345
+
346
+ ....see [tools-and-IDE.md](----/docs/tools-and-IDE.md----) for more details.
347
+
348
+ ## 📚Documentation
349
+
350
+ All repositories documentation are in the folder `/docs/`.
351
+
352
+ Build with [VitePress](https://vitepress.dev), [Redoc](https://redocly.com), collections (`.bru`), requests (`.http`) and project structure (`.tree`).
353
+
354
+ <!-- GitHub Wiki are automate builded with [CI](----): [repo.wiki](----) -->
355
+
356
+ For contribution edit .md documents in the directory [🔎/docs/\*\*.md](https://github.com/search?q=repo%3AOperationCaribbeanSummer%2FWikiAgoraSocial-utils+path%3A%2F%5Edocs%5C%2F%2F++language%3AMarkdown&type=code&l=Markdown).
357
+
358
+ ...all repos documentation: [GitHub.io docs-OperationCaribbeanSummer](https://operationcaribbeansummer.github.io/docs-OperationCaribbeanSummer)
359
+
360
+ ### ⬛Organization documentation
361
+
362
+ Organization documentation: [VitePress:docs organization](https://operationcaribbeansummer.github.io/.github)
363
+
364
+ ### Project documentation
365
+
366
+ Repo documentation at [https://operationcaribbeansummer.github.io/WikiAgoraSocial-utils](https://operationcaribbeansummer.github.io/WikiAgoraSocial-utils)
367
+
368
+ <!-- .tree -->
369
+
370
+ ### 🔀Diagrams
371
+
372
+ Diagrams are builded with [mermaid](https://mermaid.live) and [excalidraw](https://excalidraw.com), exported to SVG via github actions.
373
+
374
+ See the repository [diagrams-WikiAgora](https://github.com/OperationCaribbeanSummer/diagrams-WikiAgora) for the full list of diagrams.
375
+
376
+ ```mmd
377
+
378
+ ```
379
+
380
+ ## 🧪Tests
381
+
382
+ [![test CI](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/actions/workflows/test.yml/badge.svg)](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/actions/workflows/test.yml)
383
+
384
+ run tests:
385
+
386
+ ```bash
387
+ npm test
388
+ ```
389
+
390
+ All test are running over [Vitest](https://www.npmjs.com/package/vitest) and [SuperTest](https://www.npmjs.com/package/supertest).
391
+
392
+ All Pull Request is tested over CI ([test.yml](/.github/workflows/test.yml))
393
+
394
+ Coverage over 90% is desired but not required.
395
+
396
+ run:
397
+
398
+ ```bash
399
+ npm run coverage
400
+ ```
401
+
402
+ Detailed result at: <https://OperationCaribbeanSummer.com/projects/WikiAgoraSocial-utils/coverage>
403
+
404
+ ### ❗️Issues
405
+
406
+ - feature iss
407
+ - bug iss
408
+ - idea
409
+ - docs iss
410
+ - discussion
411
+
412
+ ....see [labels.json](/.github/labels.json)
413
+
414
+ [Bugfixes and issues always welcome](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues/new/choose)
415
+
416
+ ## 🙌Contributing
417
+
418
+ The OperationCaribbeanSummer community aims to be welcoming to everybody. We use the [Contributor Covenant (2.1)](http://contributor-covenant.org/version/2/1/0/) as our code of conduct.
419
+
420
+ Contributions needed, we are fully open to contributions!<!-- [Contribution guidelines for this project](/CONTRIBUTING.md) -->
421
+
422
+ - Contribute to OperationCaribbeanSummer and submit a pull request (PR)
423
+ - Suggest features you'd like to see (add new Issue)
424
+ - Improve the code
425
+ - Track bugs you've found - [Bugs](https://github.com/OperationCaribbeanSummer/xxxxx/labels/bug)-
426
+ - If the full system is down, build your own system and events (collaboration/not concurrency)
427
+ - Fork this repo and build your own system
428
+
429
+ ...see [CONTRIBUTING.md](/CONTRIBUTING.md) for detailed contributing guidelines.
430
+
431
+ ### 🔡Code style and format
432
+
433
+ ### 🧭Style guide
434
+
435
+ Standards.js style guide [standardjs.com](https://standardjs.com/rules)
436
+
437
+ ### 📝Conventions
438
+
439
+ Please follow the style and conventions: `naming`, `code`, `API`, `branching`, `style`, `commit`, `pull request` conventions when submitting a contribution.
440
+
441
+ ...see [Conventions](/docs/conventions.md----) at the organization documentation.
442
+
443
+ ### ⬆️Commits conventions
444
+
445
+ Sigue [las siete reglas para un gran mensaje de commit](https://chris.beams.io/posts/git-commit)
446
+
447
+ - Scope not needed but akcepted. `docs(scope):` or `docs:`----
448
+ - Description not needed but akcepted, max xx---- characters!
449
+ - Issue optional but very recommended! `closes #44`----
450
+
451
+ Rules: `feat:`, `fix:`, `chore:`, `docs:`, `test:`, `build:`, `ci:`, `perf:`, `refactor:`, `style:`, `breaking:`, `workflow:`, `types:`, `wip:`, `release:`, `deps:`, `other:`.
452
+
453
+ All commits are controled by Husky via [@commitlint/config-conventional](/commitlint.config.js) - <https://commitlint.js.org>
454
+
455
+ ### 🔱Branching conventions
456
+
457
+ **Github workflow** - Branching strategy
458
+
459
+ GitHub flow:
460
+
461
+ 1. Create issue (optional but recomended)
462
+ 1. Create a branch
463
+ 1. Make changes
464
+ 1. Commit your changes (one or meny times)
465
+ 1. Push your changes to remote storage (one or meny times)
466
+ 1. Create a Pull Request (PR)
467
+ 1. Delete your branch (after PR merge)
468
+
469
+ Branches:
470
+
471
+ - `main` - **Main Branch (formerly Master Branch)**: The primary branch of a Git repository where the production-ready code resides.
472
+ - `documentation----`
473
+ - `v5`
474
+ - ....
475
+
476
+ Branch naming convention
477
+
478
+ How to name your supporting branch prefixes?
479
+
480
+ - Feature branches? `[feature/]`, `[feat/]`
481
+ - Release branches? `[release/]`
482
+ - Hotfix branches? `[hotfix/]`, `[fix/]`, `[bug/]`
483
+ <!-- TODO: -->
484
+ <!-- feat-* || feature-* - **Feature Branch**: A branch created to work on a specific feature or task isolated from the main branch.-->
485
+ <!-- fix-* -->
486
+ <!-- hotfix-* -->
487
+
488
+ ```mmd
489
+
490
+ ```
491
+
492
+ ....read more at [branching-conventions.md](/docs/conventions-and-style/branching-conventions.md), <https://docs.github.com/en/get-started/using-github/github-flow> and <https://guides.github.com/introduction/flow>
493
+
494
+ ### ??Getting involved
495
+
496
+ ### ❓Help - Questions - Discussions
497
+
498
+ Ask for help in our [discussion forum](https://github.com/orgs/OperationCaribbeanSummer/discussions) or in the [telegram group](----).
499
+
500
+ <!-- https://github.com/OperationCaribbeanSummer/.github/discussions -->
501
+
502
+ Feel free to [open an issue](https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues/new/choose).
503
+
504
+ ## ❓Support
505
+
506
+ 💙 If you like this project, give it a ⭐ and share it with friends!
507
+
508
+ Support our [dependencies](/dependencies.md) currently we implement <https://thanks.dev>.
509
+
510
+ - hosting needed
511
+ - translations needed
512
+
513
+ ....updates of our needs at: <https://OperationCaribbeanSummer.com/needs>
514
+
515
+ ### Tanks
516
+
517
+ ## ⚠️Warning
518
+
519
+ The project are in fully experimental beta status, searching for security revisions. Maintained in no friendly country by enthusiast no professional coders during our free time.
520
+
521
+ ⚠️Maintaining, hot fixes and LTS are not guarantee....⚠️
522
+
523
+ ## Priorities
524
+
525
+ 1. Security issues
526
+ 1. Bugs (hotfix)
527
+ 1. Documentation
528
+ 1. Testing
529
+ 1. New issues, services, ideas and enhancements
530
+
531
+ ## 🌐Official Site
532
+
533
+ [https://OperationCaribbeanSummer.com/github/WikiAgoraSocial-utils](https://OperationCaribbeanSummer.com/github/WikiAgoraSocial-utils "#OperationCaribbeanSummer - WikiAgoraSocial-utils")
534
+
535
+ ## ℹ️Contact info
536
+
537
+ Javier Ramos Nistal via:
538
+
539
+ - <https://OperationCaribbeanSummer.com/contact>
540
+ - <https://javiramoslab/contact>
541
+ - <co2mm.esperanto@gmail.com>
542
+ - [telegram @Radioamatoro](https://t.me/radioamatoro)
543
+
544
+ ## 📊Stats
545
+
546
+ [![Stargazers over time](https://starchart.cc/OperationCaribbeanSummer/WikiAgoraSocial-utils.svg?variant=adaptive)](https://starchart.cc/OperationCaribbeanSummer/WikiAgoraSocial-utils)
547
+
548
+ [![Star History Chart](https://api.star-history.com/svg?repos=operationcaribbeansummer/WikiAgoraSocial-utils&type=Date)](https://www.star-history.com/#operationcaribbeansummer/feed&Date)
549
+
550
+ ....full list of stats at:
551
+
552
+ - <https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/pulse>
553
+ - <https://OperationCaribbeanSummer.com/github/WikiAgoraSocial-utils/stats>
554
+
555
+ ## 🤝Contributors / Teams
556
+
557
+ This project exists thanks to all the people who contribute. [[Contribute](/CONTRIBUTING.md)].
558
+
559
+ <!-- readme: contributors -start -->
560
+ <!-- readme: contributors -end -->
561
+
562
+ ....full list at [CONTRIBUTORS.md](/CONTRIBUTORS.md) [via .all-contributorsrc] - [authors.txt](/public/authors.txt)
563
+
564
+ Add yourself to the [AUTHORS](/AUTHORS) file is optional, you may choose to omit this.
565
+
566
+ <!-- See [CONTRIBUTORS.md](/CONTRIBUTORS.md) to get to know the project team and contributors. -->
567
+
568
+ All repo teams at [TEAMS.md](/.github/TEAMS.md) - [org teams](https://github.com/orgs/OperationCaribbeanSummer/teams)
569
+
570
+ ### 🤖Bots
571
+
572
+ <!-- readme: bots -start -->
573
+ <!-- readme: bots -end -->
574
+
575
+ ### 💪Maintainers
576
+
577
+ [![JaviRamosLab](https://github.com/JaviRamosLab.png?size=50)](https://github.com/JaviRamosLab)
578
+
579
+ ....full list of maintainers at [MAINTAINERS.md](/MAINTAINERS.md), [CODEOWNERS](/.github/CODEOWNERS) and [TEAMS.md](/.github/TEAMS.md) / [org teams](https://github.com/orgs/OperationCaribbeanSummer/teams).
580
+
581
+ ## ↬Credits
582
+
583
+ ## ↬----
584
+
585
+ Credits at [AUTHORS](/AUTHORS), the full list of [CONTRIBUTORS.md](/CONTRIBUTORS.md) and team members [TEAMS](/.github/TEAMS.md).
586
+
587
+ ## 👩‍⚖️License
588
+
589
+ Code released under [MIT License](/LICENSE) / content under [CC-BY-SA](/LICENSE_CONTENT)
590
+
591
+ Copyleft (ɔ) 2026+, **OperationCaribbeanSummer contributors** <https://github.com/orgs/OperationCaribbeanSummer/people---->
592
+
593
+ Copyleft (ɔ) 2023-2025, **Javi Ramos Nistal** <https://github.com/JaviRamosLab>
594
+
595
+ [![MIT license](https://custom-icon-badges.demolab.com/badge/license-MIT-blue.svg?logo=law)](----)
596
+ [![CC−BY−SA](https://custom-icon-badges.demolab.com/badge/License-CC−BY−SA_v4.0-blue.svg?logo=law)](http://creativecommons.org/licenses/by-sa/4.0)
597
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FOperationCaribbeanSummer%2FWikiAgoraSocial-utils.svg?type=large&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2FOperationCaribbeanSummer%2FWikiAgoraSocial-utils?ref=badge_large&issueType=license)
598
+
599
+ ### 💡➕Contributions, ❗️Issues, ⏫Pull Request and 🌟STARS are welcome 🆗
600
+
601
+ ### Show some ❤️ by starring 🌟 some of the [repositories](https://github.com/orgs/OperationCaribbeanSummer/repositories), [membering in the community](https://github.com/orgs/OperationCaribbeanSummer/people) and [fallowing us](https://github.com/orgs/OperationCaribbeanSummer)🙏!
602
+
603
+ ### Developed by Javier Ramos Nistal ([JaviRamosLab.com](https://JaviRamosLab.com)), ([@JaviRamosLab](https://github.com/JaviRamosLab)), ([++JaviRamosLab](https://OperationCaribbeanSummer.com/peoples/JaviRamosLab)) from 🇨🇺 Cuba with "❤️, ⏰" and whithout "💰"
604
+
605
+ <span align="center"><img src="public/assets/wave-OperationCaribbeanSummer.svg" alt="wave OperationCaribbeanSummer" /></span>
606
+
607
+ <!-- TODO: /.github/assets/opcasu-icons.css -->
608
+ <!-- TODO: /.github/assets/opcasu-styles.css -->
609
+ <!-- TODO:
610
+ contributor img css agrandar + sombra on hover
611
+ link css /.github/assets/styles.css
612
+ link css /.github/assets/icons.css
613
+ -->
614
+ <style>
615
+ .mlk {
616
+ background: #444444;
617
+ color: white;
618
+ border: 4px solid white;
619
+ }
620
+ .44 {
621
+ background: #663399;
622
+ color: white;
623
+ border: 4px solid white;
624
+ }
625
+ </style>
package/README.odt ADDED
Binary file
package/README.txt ADDED
@@ -0,0 +1,8 @@
1
+
2
+
3
+ // API-response
4
+ successResponse()
5
+ errorResponse()
6
+ respuestas de la API con el mismo formato
7
+
8
+
package/package.json ADDED
@@ -0,0 +1,184 @@
1
+ {
2
+ "name": "@operationcaribbeansummer/wikiagorasocial-utils",
3
+ "version": "4.0.0",
4
+ "description": "Core utility library for WikiAgora Social ecosystem - providing API response handling, database connections, messaging integration, and common helper functions for Express.js microservices",
5
+ "keywords": [
6
+ "OperationCaribbeanSummer",
7
+ "WikiAgora",
8
+ "democracy",
9
+ "LiquidDemocracy",
10
+ "eDemocracy",
11
+ "44",
12
+ "mlk",
13
+ "mlk44",
14
+ "utils",
15
+ "utilities"
16
+ ],
17
+ "homepage": "https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/issues?q=is_issue+label_bug",
20
+ "email": "co2mm.esperanto@gmail.com"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils.git"
25
+ },
26
+ "funding": [
27
+ {
28
+ "type": "individual",
29
+ "url": "https://OperationCaribbeanSummer.com/funding"
30
+ },
31
+ {
32
+ "type": "opencollective",
33
+ "url": "https://opencollective.com/OperationCaribbeanSummer"
34
+ },
35
+ {
36
+ "type": "patreon",
37
+ "url": "https://www.patreon.com/JaviRamosLab"
38
+ },
39
+ {
40
+ "type": "buymeacoffee",
41
+ "url": "https://www.buymeacoffee.com/JaviRamosLab"
42
+ },
43
+ {
44
+ "type": "ko-fi",
45
+ "url": "https://ko-fi.com/JaviRamosLab"
46
+ },
47
+ {
48
+ "type": "liberapay",
49
+ "url": "https://liberapay.com/javiramoslab/"
50
+ },
51
+ {
52
+ "type": "github",
53
+ "url": "https://github.com/sponsors/JaviRamosLab"
54
+ }
55
+ ],
56
+ "license": "MIT",
57
+ "author": {
58
+ "name": "Javier Ramos Nistal",
59
+ "email": "co2mm.esperanto@gmail.com",
60
+ "url": "https://JaviRamosLab.com"
61
+ },
62
+ "main": "src/index.js",
63
+ "files": [
64
+ "src/**/*.js",
65
+ "README.md",
66
+ "LICENSE"
67
+ ],
68
+ "scripts": {
69
+ "audit": "npm audit",
70
+ "build": "echo 'No build step required - ES modules'",
71
+ "bundle-analyzer": "npx webpack-bundle-analyzer",
72
+ "clean": "rm -rf node_modules package-lock.json",
73
+ "coverage": "vitest --coverage",
74
+ "depcheck": "npx depcheck --ignores='@operationcaribbeansummer/*'",
75
+ "dev": "node --watch src/index.js",
76
+ "docs": "vitepress dev docs",
77
+ "docs:build": "vitepress build docs",
78
+ "docs:dev": "vitepress dev docs",
79
+ "docs:preview": "vitepress preview docs",
80
+ "lint": "standard src/**/*.js",
81
+ "lint:fix": "standard --fix src/**/*.js",
82
+ "outdated": "npm outdated",
83
+ "prepare": "husky",
84
+ "prepublishOnly": "npm run lint && npm run test",
85
+ "publish": "npm publish",
86
+ "size": "npx size-limit",
87
+ "sort": "npx sort-package-json",
88
+ "start": "node --watch src/index.js",
89
+ "test": "vitest",
90
+ "test:e2e": "vitest --testPattern=e2e",
91
+ "todo": "node run CHECKLIST-scrypt.sh",
92
+ "update-deps": "npm update && npm audit fix"
93
+ },
94
+ "config": {
95
+ "commitizen": {
96
+ "path": "./node_modules/cz-conventional-changelog"
97
+ }
98
+ },
99
+ "dependencies": {
100
+ "ajv": "^8.17.1",
101
+ "compression": "^1.8.1",
102
+ "cookie-parser": "^1.4.7",
103
+ "cors": "^2.8.5",
104
+ "dayjs": "^1.11.19",
105
+ "dotenv": "^17.2.3",
106
+ "express": "^4.21.2",
107
+ "express-mongo-sanitize": "^2.2.0",
108
+ "fs-extra": "^11.3.2",
109
+ "helmet": "^8.1.0",
110
+ "hpp": "^0.2.3",
111
+ "kafkajs": "^2.2.4",
112
+ "mongoose": "^8.19.3",
113
+ "multer": "^2.0.2",
114
+ "nodemailer": "^7.0.10",
115
+ "redis": "^5.9.0",
116
+ "redoc-express": "^2.1.3",
117
+ "sharp": "^0.34.5",
118
+ "slugify": "^1.6.6",
119
+ "uuid": "^13.0.0",
120
+ "zod": "4.4.3"
121
+ },
122
+ "devDependencies": {
123
+ "@commitlint/cli": "^20.1.0",
124
+ "@commitlint/config-conventional": "^20.0.0",
125
+ "@commitlint/cz-commitlint": "^20.1.0",
126
+ "@faker-js/faker": "^9.9.0",
127
+ "cz-conventional-changelog": "^3.3.0",
128
+ "husky": "^9.1.7",
129
+ "morgan": "^1.10.1",
130
+ "standard": "^17.1.2",
131
+ "supertest": "^7.1.4",
132
+ "vitest": "^4.1.6"
133
+ },
134
+ "peerDependencies": {
135
+ "express": "^4.21.0",
136
+ "mongoose": "^8.19.0",
137
+ "node": ">=20.0.0"
138
+ },
139
+ "engines": {
140
+ "node": ">=20.0.0",
141
+ "npm": ">=10.0.0"
142
+ },
143
+ "os": [
144
+ "darwin",
145
+ "linux",
146
+ "win32"
147
+ ],
148
+ "cpu": [
149
+ "x64",
150
+ "arm64"
151
+ ],
152
+ "publishConfig": {
153
+ "access": "restricted",
154
+ "registry": "https://registry.npmjs.org/"
155
+ },
156
+ "devRequirements": {
157
+ "git": "*0.0.0",
158
+ "vscode": "*0.0.0",
159
+ "bruno": "*0.0.0"
160
+ },
161
+ "docs": "https://operationcaribbeansummer.github.io/WikiAgoraSocial-utils",
162
+ "globalDependencies": {
163
+ "sort-package-json": "*0.0.0",
164
+ "localtunnel": "*0.0.0",
165
+ "@asyncapi/cli": "*0.0.0",
166
+ "pm2": "*0.0.0",
167
+ "nodemon": "*3.0.0",
168
+ "vitepress": "*1.0.0",
169
+ "typescript": "*0.0.0"
170
+ },
171
+ "readmeFilename": "README.md",
172
+ "requirements": {
173
+ "node": "^22.0.0",
174
+ "npm": "^11.0.0",
175
+ "mongodb": "*0.0.0",
176
+ "redis": "*0.0.0",
177
+ "kafka": "*0.0.0",
178
+ "docker": "*0.0.0"
179
+ },
180
+ "security": {
181
+ "contact": "co2mm.esperanto@gmail.com",
182
+ "policy": "https://github.com/OperationCaribbeanSummer/WikiAgoraSocial-utils/security/policy"
183
+ }
184
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Generate standardized API response metadata
3
+ * @param {number} statusCode - HTTP status code
4
+ * @param {string} collection - Optional collection name
5
+ * @param {Object} req - Express request object
6
+ * @param {Object} res - Express response object
7
+ * @param {Object} options - Optional configuration overrides
8
+ * @param {string} options.apiVersion - API version (default: 'v4')
9
+ * @returns {Object} Metadata object with response information
10
+ */
11
+ const metadataResponse = (statusCode, collection, req, res, options = {}) => {
12
+ const apiVersion = options.apiVersion || process.env.API_VERSION || 'v4';
13
+
14
+ const metadata = {
15
+ code: statusCode,
16
+ success: statusCode < 400,
17
+ status: statusCode < 400 ? 'success' : 'error',
18
+ apiVersion: apiVersion,
19
+ endpoint: req ? `${req.protocol}://${req.get('host')}${req.originalUrl}` : null,
20
+ timestamp: Date.now(),
21
+ isoTime: new Date().toISOString(),
22
+ requestId: req ? req.id : '',
23
+ request: {
24
+ id: req ? (req.id || '') : '',
25
+ fullUrl: req ? `${req.protocol}://${req.get('host')}${req.originalUrl}` : '',
26
+ method: req ? req.method : null,
27
+ path: req ? req.path : null,
28
+ url: req ? req.url : null,
29
+ ip: req ? (req.ip || req.connection.remoteAddress) : null,
30
+ query: req ? req.query : {},
31
+ params: req ? req.params : {},
32
+ }
33
+ };
34
+
35
+ // Add collection field only if provided
36
+ if (collection) {
37
+ metadata.collection = collection;
38
+ }
39
+
40
+ return metadata;
41
+ };
42
+
43
+ module.exports = { metadataResponse };
@@ -0,0 +1,25 @@
1
+ // GeoJSON calculateDistance for /nearby
2
+ /**
3
+ * Calculate distance between two geographic coordinates using Haversine formula
4
+ * @param {number} lat1 - Latitude of first point in degrees
5
+ * @param {number} lon1 - Longitude of first point in degrees
6
+ * @param {number} lat2 - Latitude of second point in degrees
7
+ * @param {number} lon2 - Longitude of second point in degrees
8
+ * @returns {number} Distance in meters
9
+ */
10
+ const calculateDistance = (lat1, lon1, lat2, lon2) => {
11
+ const R = 6371e3; // Earth's radius in meters
12
+ const φ1 = lat1 * Math.PI / 180;
13
+ const φ2 = lat2 * Math.PI / 180;
14
+ const Δφ = (lat2 - lat1) * Math.PI / 180;
15
+ const Δλ = (lon2 - lon1) * Math.PI / 180;
16
+
17
+ const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
18
+ Math.cos(φ1) * Math.cos(φ2) *
19
+ Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
20
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
21
+
22
+ return R * c;
23
+ };
24
+
25
+ module.exports = { calculateDistance };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Capitaliza primera letra
3
+ * @param {string} str
4
+ */
5
+ const capitalize = (str) => str?.charAt(0).toUpperCase() + str?.slice(1);
6
+
7
+ module.exports = { capitalize };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Format date to locale string
3
+ * @param {Date} date - Date object to format
4
+ * @returns {string} Formatted date string
5
+ */
6
+ const formatDate = (date) => date.toLocaleDateString();
7
+
8
+ module.exports = { formatDate };
@@ -0,0 +1,9 @@
1
+ // global middleware
2
+ // export global44
3
+ global44()
4
+ res.header({
5
+ 'x-timestamp': Date.now(),
6
+ 'X-API-Version': 'v4',
7
+ 'X-Powered-By', 'Express44'
8
+ })
9
+ X-44-id
@@ -0,0 +1,5 @@
1
+
2
+ res..header({
3
+ 'x-timestamp': Date.now(),
4
+ 'X-API-Version': config.apiVersion,
5
+ })
package/src/index.js ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * WikiAgoraSocial-utils - Unified Utility Library
3
+ * Core utility functions for the WikiAgora Social ecosystem
4
+ *
5
+ * @module @operationcaribbeansummer/wikiagorasocial-utils
6
+ * @description Provides API response handling, string manipulation, date formatting,
7
+ * distance calculation, Kafka utilities, Mongoose helpers, and more.
8
+ */
9
+
10
+ // ============================================================================
11
+ // API Response Utilities
12
+ // ============================================================================
13
+ const { metadataResponse } = require('./apiResponse.js');
14
+
15
+ // ============================================================================
16
+ // String Utilities
17
+ // ============================================================================
18
+ const { capitalize } = require('./capitalize.js');
19
+ const { toSlug } = require('./toSlug.js');
20
+
21
+ // ============================================================================
22
+ // Date & Time Utilities
23
+ // ============================================================================
24
+ const { formatDate } = require('./formatDate.js');
25
+
26
+ // ============================================================================
27
+ // Text Processing Utilities
28
+ // ============================================================================
29
+ const { truncate } = require('./truncate.js');
30
+
31
+ // ============================================================================
32
+ // Geospatial Utilities
33
+ // ============================================================================
34
+ const { calculateDistance } = require('./calculateDistance.js');
35
+
36
+ // ============================================================================
37
+ // Mongoose & MongoDB Utilities
38
+ // ============================================================================
39
+ const { isValidObjectId, parseObjectId } = require('./mongoose.js');
40
+
41
+ const utils = {
42
+ // API Response
43
+ metadataResponse,
44
+
45
+ // String Utilities
46
+ capitalize,
47
+ toSlug,
48
+
49
+ // Date Utilities
50
+ formatDate,
51
+
52
+ // Text Utilities
53
+ truncate,
54
+
55
+ // Geospatial Utilities
56
+ calculateDistance,
57
+
58
+ // Mongoose Utilities
59
+ isValidObjectId,
60
+ parseObjectId,
61
+ };
62
+
63
+ module.exports = utils;
File without changes
@@ -0,0 +1,6 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const isValidObjectId = (id) => mongoose.Types.ObjectId.isValid(id);
4
+ const parseObjectId = (id) => new mongoose.Types.ObjectId(id);
5
+
6
+ module.exports = { isValidObjectId, parseObjectId };
package/src/toSlug.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Convierte texto a slug seguro para URLs
3
+ * @param {string} text
4
+ * @returns {string}
5
+ */
6
+ const toSlug = (text) =>
7
+ text.toLowerCase()
8
+ .normalize('NFD').replace(/[\u0300-\u036f]/g, '') // remove accents
9
+ .replace(/[^a-z0-9]+/g, '-')
10
+ .replace(/^-|-$/g, '');
11
+
12
+ module.exports = { toSlug };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Truncate string to specified length
3
+ * @param {string} str - Input string to truncate
4
+ * @param {number} length - Maximum length
5
+ * @returns {string} Truncated string
6
+ */
7
+ const truncate = (str, length) => str.substring(0, length);
8
+
9
+ module.exports = { truncate };