@konker.dev/tiny-utils-fp 0.0.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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024 Konrad Markus <mail@konker.dev>
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
+ OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @konker.dev/tiny-utils-fp
2
+
3
+ General utility functions for [Node.js](https://nodejs.org/) based on [Effect-TS](https://www.effect.website/)
4
+
5
+ ![License](https://img.shields.io/github/license/konkerdotdev/node-ts-fp-boilerplate)
6
+ [![NPM Version](https://img.shields.io/npm/v/%40konker.dev%2Ftiny-utils-fp)](https://www.npmjs.com/package/@konker.dev/tiny-utils-fp)
7
+ [![CI](https://github.com/konkerdotdev/tiny-utils-fp/actions/workflows/ci.yml/badge.svg)](https://github.com/konkerdotdev/tiny-utils-fp/actions/workflows/ci.yml)
8
+ [![codecov](https://codecov.io/gh/konkerdotdev/tiny-utils-fp/graph/badge.svg?token=W3BFLXCWTH)](https://codecov.io/gh/konkerdotdev/tiny-utils-fp)
9
+
10
+ ## Usage
11
+
12
+ Copy the contents of this repo, and:
13
+
14
+ - Search and replace files for `YOUR_SRC_DIR_COULD_BE_DOT` and substitute for the desired source directory
15
+ - Edit package.json `staticFiles` property as needed
16
+ - Run `pnpm install`
17
+ - Run `git init`
18
+ - Run: `pnpm dlx husky-init && pnpm install`
19
+ - Replace this with your actual README.md
20
+ - Replace ISC.LICENSE as needed
21
+ - Amend .github/workflows/cd.yml to replace `PATH_TO_PACKAGE_JSON`
22
+ - Remember:
23
+ - README.md title / content
24
+ - package.json name
25
+ - package.json description
26
+
27
+ ## For An Existing Project
28
+
29
+ - Copy the following. merging as necessary:
30
+ - .editorconfig
31
+ - .eslintignore
32
+ - .eslintrc.json
33
+ - .madgerc
34
+ - .nvmrc
35
+ - .prettierignore
36
+ - .prettierrc
37
+ - gulpfile.mjs
38
+ - jest.config.ts
39
+ - Replaces jest.config.js if applicable
40
+ - tsconfig.json
41
+ - Search and replace for `YOUR_SRC_DIR_COULD_BE_DOT`
42
+ - Merge .gitignore
43
+ - Copy over dev dependencies not already present
44
+ - Copy over dependencies not already present
45
+ - LICENSE
@@ -0,0 +1,4 @@
1
+ import * as P from '@konker.dev/effect-ts-prelude';
2
+ export declare const md5Hex: (s: string) => P.Effect.Effect<string, Error>;
3
+ export declare const sha256Hex: (s: string) => P.Effect.Effect<string, Error>;
4
+ export declare const sha256HmacHex: (s: string, secret: string) => P.Effect.Effect<string, Error>;
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.sha256HmacHex = exports.sha256Hex = exports.md5Hex = void 0;
30
+ const P = __importStar(require("@konker.dev/effect-ts-prelude"));
31
+ const lib_1 = require("@konker.dev/tiny-error-fp/dist/lib");
32
+ const node_crypto_1 = __importDefault(require("node:crypto"));
33
+ const md5Hex = (s) => P.Effect.try({
34
+ try: () => node_crypto_1.default.createHash('md5').update(s).digest('hex'),
35
+ catch: lib_1.toError,
36
+ });
37
+ exports.md5Hex = md5Hex;
38
+ const sha256Hex = (s) => P.Effect.try({
39
+ try: () => node_crypto_1.default.createHash('sha256').update(s).digest('hex'),
40
+ catch: lib_1.toError,
41
+ });
42
+ exports.sha256Hex = sha256Hex;
43
+ const sha256HmacHex = (s, secret) => P.Effect.try({
44
+ try: () => node_crypto_1.default.createHmac('sha256', secret).update(s).digest('hex'),
45
+ catch: lib_1.toError,
46
+ });
47
+ exports.sha256HmacHex = sha256HmacHex;
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AAEnD,4DAA6D;AAC7D,8DAAiC;AAE1B,MAAM,MAAM,GAAG,CAAC,CAAS,EAAkC,EAAE,CAClE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3D,KAAK,EAAE,aAAO;CACf,CAAC,CAAC;AAJQ,QAAA,MAAM,UAId;AAEE,MAAM,SAAS,GAAG,CAAC,CAAS,EAAkC,EAAE,CACrE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAC9D,KAAK,EAAE,aAAO;CACf,CAAC,CAAC;AAJQ,QAAA,SAAS,aAIjB;AAEE,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,MAAc,EAAkC,EAAE,CACzF,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IACtE,KAAK,EAAE,aAAO;CACf,CAAC,CAAC;AAJQ,QAAA,aAAa,iBAIrB"}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@konker.dev/tiny-utils-fp",
3
+ "version": "0.0.1",
4
+ "author": "Konrad Markus <mail@konker.dev>",
5
+ "description": "General utility functions for Node.js TypeScript projects based on Effect-ts",
6
+ "license": "ISC",
7
+ "main": "dist/index.js",
8
+ "files": [
9
+ "dist/**/*",
10
+ "!dist/**/*.test.*"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/konkerdotdev/tiny-utils-fp"
15
+ },
16
+ "keywords": [
17
+ "node",
18
+ "boilerplate",
19
+ "typescript",
20
+ "functional-programming",
21
+ "effect-ts"
22
+ ],
23
+ "dependencies": {
24
+ "@effect/schema": "^0.68.23",
25
+ "@konker.dev/effect-ts-prelude": "^0.0.16",
26
+ "@konker.dev/tiny-error-fp": "^0.0.7",
27
+ "effect": "^3.5.3"
28
+ },
29
+ "devDependencies": {
30
+ "@effect/language-service": "^0.1.0",
31
+ "@types/jest": "^29.5.12",
32
+ "@types/node": "^20.14.10",
33
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
34
+ "@typescript-eslint/parser": "^7.16.0",
35
+ "@typescript-eslint/typescript-estree": "^7.16.0",
36
+ "eslint": "^8.57.0",
37
+ "eslint-config-prettier": "^9.1.0",
38
+ "eslint-import-resolver-typescript": "^3.6.1",
39
+ "eslint-plugin-deprecation": "^2.0.0",
40
+ "eslint-plugin-fp": "^2.3.0",
41
+ "eslint-plugin-import": "^2.29.1",
42
+ "eslint-plugin-json": "^3.1.0",
43
+ "eslint-plugin-prettier": "^5.1.3",
44
+ "eslint-plugin-simple-import-sort": "^12.1.1",
45
+ "eslint-plugin-sort-destructure-keys": "^1.6.0",
46
+ "gulp": "^4.0.2",
47
+ "husky": "^9.0.11",
48
+ "jest": "^29.7.0",
49
+ "leasot": "^13.3.0",
50
+ "madge": "^6.1.0",
51
+ "npx": "^10.2.2",
52
+ "prettier": "^3.3.3",
53
+ "ts-jest": "^29.2.2",
54
+ "ts-node": "^10.9.2",
55
+ "type-coverage": "^2.29.1",
56
+ "typescript": "^5.5.3"
57
+ },
58
+ "staticFiles": [],
59
+ "scripts": {
60
+ "test": "jest --no-cache -w 4",
61
+ "clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
62
+ "typecheck": "tsc --noEmit",
63
+ "build": "pnpm run clean && tsc && gulp copy-static",
64
+ "type-coverage-check": "type-coverage --detail --at-least 100",
65
+ "circular-check": "madge --extensions ts --circular --no-color --no-spinner --warning --ts-config ./tsconfig.json src",
66
+ "eslint-check": "eslint --max-warnings=0 '**/*.{ts,js,json}'",
67
+ "fixme-check": "leasot --exit-nicely --skip-unsupported --ignore node_modules src",
68
+ "eslint-fix": "npx eslint --fix||true",
69
+ "prettier-check": "npx prettier --check --ignore-path .gitignore --ignore-path .prettierignore '**/*.{css,html,js,ts,json,md,yaml,yml}'",
70
+ "prettier-fix": "pnpm run prettier-check --write",
71
+ "lint-check": "pnpm run eslint-check && pnpm run prettier-check && pnpm run circular-check && pnpm run fixme-check",
72
+ "lint-fix": "pnpm run eslint-fix && pnpm run prettier-fix",
73
+ "pre-push": "pnpm run lint-check && pnpm run typecheck",
74
+ "ci": "pnpm run lint-check && pnpm run typecheck && pnpm run type-coverage-check && pnpm run test && pnpm run build && pnpm run fixme-check",
75
+ "cd": "pnpm run build && pnpm publish --access public"
76
+ }
77
+ }