Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d3210b73c9
|
|||
|
6951cd3218
|
|||
|
9393a8441a
|
|||
|
b2af58532c
|
|||
|
f19288833a
|
|||
|
37122626ff
|
|||
|
59ba0d2ec4
|
91
.drone.yml
Normal file
91
.drone.yml
Normal file
@@ -0,0 +1,91 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Test Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/auth
|
||||
|
||||
steps:
|
||||
- name: yarn install
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn install
|
||||
- name: Code Style Checks
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn prettier
|
||||
- name: Lint
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn lint
|
||||
- name: Unit Tests
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn test
|
||||
- name: Send Test Status Notification
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||
"text": "[{{ repo.name }} - Build # {{ build.number }}] Code Quality Checks {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- develop
|
||||
event:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Publish Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/auth
|
||||
|
||||
steps:
|
||||
- name: Publish NPM
|
||||
image: node:20-alpine
|
||||
failure: ignore
|
||||
commands:
|
||||
- yarn publish -t ${DRONE_TAG}
|
||||
volumes:
|
||||
- name: npmrc
|
||||
path: /drone/auth/.npmrc
|
||||
- name: Report NPM Publish Status
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||
"text": "[{{ repo.name }} - New npm package release {{tag}} from # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
volumes:
|
||||
- name: npmrc
|
||||
host:
|
||||
path: /volume1/docker/beethoven/labs-auth/.npmrc
|
||||
|
||||
depends_on:
|
||||
- Test Pipeline
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
1
.yarnrc.yml
Normal file
1
.yarnrc.yml
Normal file
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Auth, Log } from '..';
|
||||
import { Action } from '../../constants/action';
|
||||
import { Action } from '../constants/action';
|
||||
import { getLoginToken } from '../utils/getLoginToken';
|
||||
|
||||
export const authenticate = async (username: string, password: string) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readOneByUsername } from '../dao/readOneByUsername';
|
||||
import { Log, Token } from '..';
|
||||
import { TokenType } from '../../constants/tokens';
|
||||
import { Action } from '../../constants/action';
|
||||
import { TokenType } from '../constants/tokens';
|
||||
import { Action } from '../constants/action';
|
||||
|
||||
export const resetPasswordGet = async (username: string) => {
|
||||
const doc = await readOneByUsername(username);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Types } from 'mongoose';
|
||||
|
||||
import { Log, Strategy, Token } from '..';
|
||||
import { STRATEGIES } from '../../constants/strategies';
|
||||
import { STRATEGIES } from '../constants/strategies';
|
||||
import { AuthDocument } from '../schema/auth';
|
||||
import { getLoginToken } from '../utils/getLoginToken';
|
||||
import { StrategyDocument } from '../schema/strategy';
|
||||
import { Action } from '../../constants/action';
|
||||
import { Action } from '../constants/action';
|
||||
|
||||
export const resetPasswordPost = async (token: string, password: string) => {
|
||||
const parentId = await Token.validateResetToken(token);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DatabaseError } from '@mifi/services-common/domain/errors/DatabaseError';
|
||||
import { DatabaseError } from '@mifi/services-common/lib/domain/errors/DatabaseError';
|
||||
|
||||
import { Auth, Log, Strategy, Token } from '..';
|
||||
import { Auth as AuthProps } from '../schema/auth';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
import { DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_USERNAME } from '../constants/db';
|
||||
import { DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_USERNAME } from './constants/db';
|
||||
import { Auth } from './model/auth';
|
||||
import { Log } from './model/log';
|
||||
import { Strategy } from './model/strategy';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InferSchemaType, Model, Schema, StringSchemaDefinition, Types } from 'mongoose';
|
||||
|
||||
import { Payload } from '@mifi/services-common/types/Payload';
|
||||
import { Payload } from '@mifi/services-common/lib/types/Payload';
|
||||
|
||||
import { Action } from '../constants/action';
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ export const StrategySchema = new Schema<StrategyDocument, StrategyModel>(
|
||||
},
|
||||
);
|
||||
|
||||
StrategySchema.methods.getPopulatedStrategy = async function (this: StrategyModel) {
|
||||
StrategySchema.methods.getPopulatedStrategy = async function (this: StrategyDocument) {
|
||||
return this.populate<StrategyPopulatedDocument>('parent');
|
||||
};
|
||||
|
||||
StrategySchema.methods.getAuthRecord = async function (this: StrategyModel) {
|
||||
StrategySchema.methods.getAuthRecord = async function (this: StrategyDocument) {
|
||||
return (await this.getPopulatedStrategy()).parent;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mifi/auth-db",
|
||||
"version": "0.0.39",
|
||||
"version": "1.0.4",
|
||||
"author": "mifi (Mike Fitzpatrick)",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@@ -17,7 +17,8 @@
|
||||
"@babel/core": "^7.21.8",
|
||||
"@babel/preset-env": "^7.21.5",
|
||||
"@babel/preset-typescript": "^7.21.5",
|
||||
"@tsconfig/node16": "^1.0.3",
|
||||
"@tsconfig/node16": "^1.0.4",
|
||||
"@types/jsonwebtoken": "^9.0.2",
|
||||
"@types/node": "^18.14.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
||||
"@typescript-eslint/parser": "^5.59.2",
|
||||
@@ -37,7 +38,7 @@
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mifi/services-common": "1.0.0",
|
||||
"@mifi/services-common": "1.x.x",
|
||||
"dotenv": "^16.0.3",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"mongoose": "^6.9.2"
|
||||
|
||||
30
yarn.lock
30
yarn.lock
@@ -2629,7 +2629,10 @@ __metadata:
|
||||
"@babel/core": ^7.21.8
|
||||
"@babel/preset-env": ^7.21.5
|
||||
"@babel/preset-typescript": ^7.21.5
|
||||
"@tsconfig/node16": ^1.0.3
|
||||
"@mifi/services-common": 1.x.x
|
||||
"@tsconfig/node16": ^1.0.4
|
||||
"@types/jsonwebtoken": ^9.0.2
|
||||
"@types/node": ^18.14.0
|
||||
"@typescript-eslint/eslint-plugin": ^5.59.2
|
||||
"@typescript-eslint/parser": ^5.59.2
|
||||
babel-jest: ^29.5.0
|
||||
@@ -2652,6 +2655,13 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@mifi/services-common@npm:1.x.x":
|
||||
version: 1.0.1
|
||||
resolution: "@mifi/services-common@npm:1.0.1::__archiveUrl=https%3A%2F%2Fgit.mifi.dev%2Fapi%2Fpackages%2Fmifi%2Fnpm%2F%2540mifi%252Fservices-common%2F-%2F1.0.1%2Fservices-common-1.0.1.tgz"
|
||||
checksum: b8ba60584616826615bf4600dc45a0fbe390a2ff5c1a8238e0f9e016fd2ff069e4c6fd96d4d02af7eb41671436a58ab69e6017301a509a175aeff08d7b056fc2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@nodelib/fs.scandir@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "@nodelib/fs.scandir@npm:2.1.5"
|
||||
@@ -2786,7 +2796,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tsconfig/node16@npm:^1.0.3":
|
||||
"@tsconfig/node16@npm:^1.0.4":
|
||||
version: 1.0.4
|
||||
resolution: "@tsconfig/node16@npm:1.0.4"
|
||||
checksum: 202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff
|
||||
@@ -2899,6 +2909,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/jsonwebtoken@npm:^9.0.2":
|
||||
version: 9.0.2
|
||||
resolution: "@types/jsonwebtoken@npm:9.0.2"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: 3bb8d40e78d7eb53e427db6e9f0f22e0890cfee80965dcf741d08341814913afb211306de6e9847c6d241cc8e36f8a59090cbfdcc510ab7c81af9d650c5afe0e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*":
|
||||
version: 20.2.3
|
||||
resolution: "@types/node@npm:20.2.3"
|
||||
@@ -2906,6 +2925,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:^18.14.0":
|
||||
version: 18.16.14
|
||||
resolution: "@types/node@npm:18.16.14"
|
||||
checksum: c11cb3c787236414efe58240ae71854971592554d82ff9d201876ce7cafd51c37aaa001c63602d002e8238614d7331bd6d48ac4c1c0caa826799980b6846fb08
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/prettier@npm:^2.1.5, @types/prettier@npm:^2.6.0":
|
||||
version: 2.7.2
|
||||
resolution: "@types/prettier@npm:2.7.2"
|
||||
|
||||
Reference in New Issue
Block a user