@laboratory-one/api-components 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/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ .*
2
+ tsconfig.json
3
+ babel.config.js
package/.eslintrc ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": [
3
+ "expo",
4
+ "prettier",
5
+ "plugin:@typescript-eslint/recommended",
6
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
7
+ ],
8
+ "plugins": ["prettier", "@typescript-eslint", "import"],
9
+ "rules": {
10
+ "prettier/prettier": "error"
11
+ },
12
+ "settings": {
13
+ "import/resolver": {
14
+ "typescript": {}
15
+ }
16
+ },
17
+ "parser": "@typescript-eslint/parser",
18
+ "parserOptions": {
19
+ "project": "./tsconfig.json",
20
+ "tsconfigRootDir": "./"
21
+ }
22
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 20.13.1
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ ## dev
2
+
3
+ yalc publish
4
+ yalc push
5
+
6
+ yalc add @laboratory-one/api-components
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './src/index';
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@laboratory-one/api-components",
3
+ "version": "0.0.1",
4
+ "description": "API components for Laboratory One",
5
+ "author": "Laboratory One",
6
+ "private": false,
7
+ "license": "MIT",
8
+ "main": "./dist/cjs/index.js",
9
+ "module": "./dist/esm/index.js",
10
+ "types": "./dist/esm/index.d.ts",
11
+ "type": "module",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org/"
15
+ },
16
+ "cacheDirectories": [
17
+ "node_modules"
18
+ ],
19
+ "scripts": {
20
+ "lint": "eslint 'src/**/*.{js,ts,tsx}'",
21
+ "lint:fix": "npm run lint --fix && npm run format",
22
+ "format": "prettier --write 'src/**/*.{js,ts,tsx}'",
23
+ "build": "yarn build:esm && yarn build:cjs",
24
+ "build:esm": "tsc",
25
+ "build:cjs": "tsc --module commonjs --outDir dist/cjs",
26
+ "publish": "npm publish --access public",
27
+ "publish:local": "yalc publish",
28
+ "push:local": "yalc push",
29
+ "push": "yarn build && yarn push:local"
30
+ },
31
+ "dependencies": {
32
+ "@nestjs/axios": "3.0.2",
33
+ "@nestjs/common": "10.3.9",
34
+ "@nestjs/config": "3.2.2",
35
+ "@nestjs/core": "10.3.9",
36
+ "@nestjs/jwt": "10.2.0",
37
+ "@nestjs/platform-express": "10.3.9",
38
+ "@nestjs/swagger": "7.3.1",
39
+ "@nestjs/terminus": "10.2.3",
40
+ "@prisma/client": "5.15.1",
41
+ "@sendgrid/mail": "8.1.3",
42
+ "@sentry/cli": "^2.32.1",
43
+ "@sentry/node": "8.9.2",
44
+ "@sentry/profiling-node": "8.9.2",
45
+ "algoliasearch": "4.23.3",
46
+ "axios": "1.7.2",
47
+ "class-transformer": "0.5.1",
48
+ "class-validator": "0.14.1",
49
+ "compression": "1.7.4",
50
+ "expo-server-sdk": "3.10.0",
51
+ "globals": "^15.6.0",
52
+ "helmet": "7.1.0",
53
+ "moment": "2.30.1",
54
+ "prisma": "5.15.1",
55
+ "reflect-metadata": "0.2.2",
56
+ "rxjs": "7.8.1",
57
+ "stytch": "10.18.0"
58
+ },
59
+ "devDependencies": {
60
+ "@nestjs/cli": "10.3.2",
61
+ "@nestjs/schematics": "10.1.1",
62
+ "@nestjs/testing": "10.3.9",
63
+ "@types/compression": "1.7.5",
64
+ "@types/express": "4.17.21",
65
+ "@types/node": "20.14.5",
66
+ "@types/supertest": "6.0.2",
67
+ "source-map-support": "0.5.21",
68
+ "supertest": "7.0.0",
69
+ "ts-jest": "29.1.5",
70
+ "ts-loader": "9.5.1",
71
+ "ts-node": "10.9.2",
72
+ "typescript": "5.4.5",
73
+ "@babel/core": "7.24.7",
74
+ "@tanstack/eslint-plugin-query": "5.43.1",
75
+ "@types/jest": "29.5.12",
76
+ "@typescript-eslint/eslint-plugin": "7.13.1",
77
+ "@typescript-eslint/parser": "7.13.1",
78
+ "eslint": "8.57.0",
79
+ "eslint-config-expo": "7.1.2",
80
+ "eslint-config-prettier": "9.1.0",
81
+ "eslint-import-resolver-typescript": "3.6.1",
82
+ "eslint-plugin-import": "2.29.1",
83
+ "eslint-plugin-prettier": "5.1.3",
84
+ "jest": "29.7.0",
85
+ "prettier": "3.3.2",
86
+ "tsconfig-paths": "4.2.0",
87
+ "tsc-alias": "1.8.8"
88
+ }
89
+ }
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './api';
2
+ export * from './components';
3
+ export * from './containers';
4
+ export * from './enums';
5
+ export * from './forms';
6
+ export * from './hooks';
7
+ export * from './providers';
8
+ export * from './services';
9
+ export * from './state';
10
+ export * from './types';
11
+ export * from './utils';
@@ -0,0 +1 @@
1
+ export * from '.';
@@ -0,0 +1,8 @@
1
+ import { IsBoolean } from 'class-validator';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+
4
+ export class SuccessResponseDto {
5
+ @IsBoolean()
6
+ @ApiProperty()
7
+ success: boolean;
8
+ }
@@ -0,0 +1,23 @@
1
+ import { EServerDay } from '../enums/serverDay.enum';
2
+ import { EHumanDay } from '../enums/humanDay.enum';
3
+
4
+ export const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {
5
+ switch (day) {
6
+ case EServerDay.SUNDAY:
7
+ return EHumanDay.SUNDAY;
8
+ case EServerDay.MONDAY:
9
+ return EHumanDay.MONDAY;
10
+ case EServerDay.TUESDAY:
11
+ return EHumanDay.TUESDAY;
12
+ case EServerDay.WEDNESDAY:
13
+ return EHumanDay.WEDNESDAY;
14
+ case EServerDay.THURSDAY:
15
+ return EHumanDay.THURSDAY;
16
+ case EServerDay.FRIDAY:
17
+ return EHumanDay.FRIDAY;
18
+ case EServerDay.SATURDAY:
19
+ return EHumanDay.SATURDAY;
20
+ default:
21
+ return EHumanDay.SUNDAY;
22
+ }
23
+ };
@@ -0,0 +1,11 @@
1
+ import { HttpException, HttpStatus } from '@nestjs/common';
2
+
3
+ export const handleError = (error: any) => {
4
+ if (error['error_message']) {
5
+ throw new HttpException(error['error_message'], HttpStatus.BAD_REQUEST);
6
+ } else if (error.message) {
7
+ throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
8
+ } else {
9
+ throw new HttpException(error, HttpStatus.BAD_REQUEST);
10
+ }
11
+ };
@@ -0,0 +1 @@
1
+ export * from '.';
@@ -0,0 +1,22 @@
1
+ export const cleanString = (str: string): string => {
2
+ return str.trim();
3
+ };
4
+
5
+ export const cleanStringAndLowercase = (str: string): string => {
6
+ const trimmed: string = cleanString(str);
7
+ return trimmed.toLowerCase();
8
+ };
9
+
10
+ export const cleanPhoneNumber = (str: string): string => {
11
+ const trimmed = str.trim();
12
+
13
+ if (trimmed.startsWith('+')) {
14
+ return trimmed;
15
+ }
16
+
17
+ if (trimmed.startsWith('1')) {
18
+ return `+${trimmed}`;
19
+ }
20
+
21
+ return `+1${trimmed}`;
22
+ };
@@ -0,0 +1 @@
1
+ export const NOOP = () => {};
@@ -0,0 +1,3 @@
1
+ export const getInitial = (name: string): string => {
2
+ return name[0];
3
+ };