Skip to content

Commit fbda676

Browse files
committed
feat: initial commit
0 parents  commit fbda676

28 files changed

Lines changed: 12095 additions & 0 deletions

.eslintrc.cjs

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
const getNamingConventionRule = () => [
2+
"error",
3+
{
4+
selector: "variable",
5+
format: ["camelCase", "UPPER_CASE"],
6+
},
7+
{
8+
selector: "variable",
9+
filter: "__typename",
10+
format: null,
11+
},
12+
{
13+
selector: "parameter",
14+
format: ["camelCase"],
15+
},
16+
{
17+
selector: "parameter",
18+
filter: "_",
19+
format: null,
20+
},
21+
{
22+
selector: "enumMember",
23+
format: ["UPPER_CASE", "PascalCase"],
24+
},
25+
];
26+
27+
module.exports = {
28+
ignorePatterns: ["**/node_modules/", "**/dist/", "**/*.js"],
29+
parser: "@typescript-eslint/parser",
30+
env: {
31+
node: true,
32+
},
33+
extends: [
34+
"airbnb-base",
35+
"plugin:@typescript-eslint/recommended",
36+
"prettier",
37+
"plugin:import/recommended",
38+
"plugin:import/typescript",
39+
"plugin:prettier/recommended",
40+
],
41+
plugins: [
42+
"@typescript-eslint",
43+
"import",
44+
"no-only-tests",
45+
"prettier",
46+
"unicorn",
47+
],
48+
rules: {
49+
"@typescript-eslint/explicit-function-return-type": "off",
50+
"@typescript-eslint/explicit-member-accessibility": "off",
51+
"@typescript-eslint/explicit-module-boundary-types": "off",
52+
"@typescript-eslint/no-empty-function": "off",
53+
"@typescript-eslint/no-explicit-any": "warn",
54+
"@typescript-eslint/no-non-null-assertion": "error",
55+
"@typescript-eslint/no-use-before-define": ["error", { functions: false }],
56+
"@typescript-eslint/consistent-type-assertions": [
57+
"error",
58+
{
59+
assertionStyle: "as",
60+
objectLiteralTypeAssertions: "allow-as-parameter",
61+
},
62+
],
63+
"@typescript-eslint/consistent-type-imports": "error",
64+
"@typescript-eslint/no-unused-vars": [
65+
"error",
66+
{ ignoreRestSiblings: true },
67+
],
68+
"@typescript-eslint/array-type": [
69+
"error",
70+
{
71+
default: "array-simple",
72+
readonly: "array-simple",
73+
},
74+
],
75+
camelcase: "off",
76+
"@typescript-eslint/naming-convention": getNamingConventionRule(),
77+
curly: ["error", "all"],
78+
"import/extensions": [
79+
"error",
80+
"ignorePackages",
81+
{ js: "never", ts: "never" },
82+
],
83+
"import/no-extraneous-dependencies": ["error"],
84+
"import/no-named-as-default-member": "error",
85+
"import/prefer-default-export": "off",
86+
"lines-around-directive": "warn",
87+
"lines-between-class-members": [
88+
"error",
89+
"always",
90+
{ exceptAfterSingleLine: true },
91+
],
92+
"max-classes-per-file": "off",
93+
"new-cap": "off",
94+
"no-bitwise": "warn",
95+
"no-alert": "error",
96+
"no-console": ["error", { allow: ["warn", "info", "error"] }],
97+
"no-debugger": "error",
98+
"no-fallthrough": "warn",
99+
"no-nested-ternary": "off",
100+
// The Typescript version doesn't warn for optional chaining
101+
"no-unused-expressions": "off",
102+
"@typescript-eslint/no-unused-expressions": "error",
103+
104+
// Deprecated in favor of ban-ts-comments: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-ignore.md
105+
"@typescript-eslint/ban-ts-ignore": "off",
106+
"@typescript-eslint/ban-ts-comment": "error",
107+
108+
"no-shadow": "off",
109+
"@typescript-eslint/no-shadow": "error",
110+
111+
"import/no-duplicates": "error",
112+
"no-plusplus": "off",
113+
"no-prototype-builtins": "warn",
114+
"no-restricted-globals": "error",
115+
"no-restricted-properties": "warn",
116+
"no-restricted-syntax": "warn",
117+
"no-return-assign": "error",
118+
"no-undef": "error",
119+
"no-underscore-dangle": "off",
120+
"no-unreachable": "warn",
121+
"no-unsafe-finally": "warn",
122+
// Turning "no-unused-vars" and "no-use-before-define" off
123+
// since the rule is already covered by
124+
// @typescript-eslint/no-unused-vars and @typescript-eslint/no-use-before-define
125+
"no-unused-vars": "off",
126+
"no-use-before-define": "off",
127+
"no-multiple-empty-lines": "error",
128+
"operator-assignment": "warn",
129+
"prefer-destructuring": "off",
130+
"prefer-rest-params": "warn",
131+
"prefer-spread": "warn",
132+
"import/no-cycle": "error",
133+
"import/order": [
134+
"error",
135+
{
136+
alphabetize: {
137+
order: "asc",
138+
},
139+
pathGroups: [
140+
{
141+
pattern: "**/*.service",
142+
group: "object",
143+
position: "after",
144+
},
145+
{
146+
pattern: "**/*.helper",
147+
group: "object",
148+
position: "after",
149+
},
150+
{
151+
pattern: "types/**",
152+
group: "type",
153+
},
154+
{
155+
pattern: "types",
156+
group: "type",
157+
},
158+
],
159+
groups: [
160+
"builtin",
161+
"external",
162+
"internal",
163+
"unknown",
164+
"parent",
165+
"sibling",
166+
"index",
167+
"object",
168+
"type",
169+
],
170+
"newlines-between": "always",
171+
},
172+
],
173+
// File and import related
174+
"unicorn/filename-case": [
175+
"warn",
176+
{
177+
cases: {
178+
camelCase: true,
179+
pascalCase: true,
180+
},
181+
},
182+
], // Manual fix
183+
"unicorn/relative-url-style": "error",
184+
185+
// Abbreviations and naming
186+
"unicorn/prevent-abbreviations": [
187+
"off",
188+
{
189+
checkShorthandImports: true,
190+
allowList: {
191+
req: true,
192+
res: true,
193+
ref: true,
194+
Param: true,
195+
args: true,
196+
env: true,
197+
Env: true,
198+
Ref: true,
199+
el: true,
200+
toRef: true,
201+
def: true,
202+
pkg: true,
203+
params: true,
204+
Params: true,
205+
Props: true,
206+
props: true,
207+
src: true,
208+
},
209+
},
210+
], // Manual fix
211+
212+
// Array and function related
213+
"unicorn/require-number-to-fixed-digits-argument": "error",
214+
},
215+
settings: {
216+
"import/resolver": {
217+
node: {
218+
moduleDirectory: ["node_modules"],
219+
},
220+
typescript: {
221+
project: "./tsconfig.json",
222+
},
223+
},
224+
},
225+
};

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Members of this group will be automatically added to any pull request on this project
2+
# Code owned by @Kpler/crew-auth-dev crew
3+
* @Kpler/crew-auth-dev

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write # to be able to publish a GitHub release
5+
id-token: write # to enable use of OIDC for npm provenance
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '22.x'
20+
- run: npm ci
21+
- run: npx semantic-release
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.husky/pre-push

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BLOCKED_DOMAIN="kpler.com"
2+
3+
if git log origin/HEAD..HEAD --pretty=format:"%ae" | grep "@$BLOCKED_DOMAIN"; then
4+
echo "❌ Push blocked: Commits contain blocked email domain ($BLOCKED_DOMAIN)"
5+
exit 1
6+
fi

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.*
2+
/node_modules/
3+
/src/

.releaserc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
["@semantic-release/npm", {
7+
"npmPublish": true
8+
}],
9+
"@semantic-release/github"
10+
]
11+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Kpler
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.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# auth0-types
2+
3+
This package provides types for [Auth0 Action Triggers](https://auth0.com/docs/customize/actions/explore-triggers).
4+
5+
It is not endorsed by, maintained by, or affiliated with Auth0 in any way.
6+
7+
Brought to you by [Kpler - Intelligence tools for trade](https://www.kpler.com/).
8+
9+
## Installation
10+
11+
```sh
12+
npm install -D @kpler/auth0-types
13+
```
14+
15+
## Available types
16+
17+
* `credentials-exchange`
18+
* [CredentialsExchangeEvent](./src/credentialsExchangeEvent.ts)
19+
* [CredentialsExchangeApi](./src/credentialsExchangeApi.ts)
20+
* `post-challenge`
21+
* [PostChallengeEvent](./src/postChallengeEvent.ts)
22+
* [PostChallengeApi](./src/postChallengeApi.ts)
23+
* `post-change-password`
24+
* [PostChangePasswordEvent](./src/postChangePasswordEvent.ts)
25+
* [PostChangePasswordApi](./src/postChangePasswordApi.ts)
26+
* `post-login`
27+
* [PostLoginEvent](./src/postLoginEvent.ts)
28+
* [PostLoginApi](./src/postLoginApi.ts)
29+
* `post-user-registration`
30+
* [PostUserRegistrationEvent](./src/postUserRegistrationEvent.ts)
31+
* [PostUserRegistrationApi](./src/postUserRegistrationApi.ts)
32+
* `pre-user-registration`
33+
* [PreUserRegistrationEvent](./src/preUserRegistrationEvent.ts)
34+
* [PreUserRegistrationApi](./src/preUserRegistrationApi.ts)
35+
* `send-phone-message`
36+
* [SendPhoneMessageEvent](./src/sendPhoneMessageEvent.ts)
37+
* [SendPhoneMessageApi](./src/sendPhoneMessageApi.ts)
38+
39+
## Usage (example)
40+
41+
```ts
42+
import type { PostLoginApi, PostLoginEvent } from "auth0-types";
43+
44+
export const onExecutePostLogin = async (
45+
event: PostLoginEvent,
46+
api: PostLoginApi,
47+
) => {
48+
// "event" and "api" now have proper types!
49+
};
50+
```
51+
52+
## Contributing
53+
54+
Contributions are welcome! Please adhere to the coding standards used and [open a PR](https://github.com/Kpler/auth0-types/compare).
55+
56+
Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) for your commit messages and make sure your code passes the ESLint ruleset (`npm run lint`).
57+
58+
If you plan for larger changes, please [create an issue](https://github.com/Kpler/auth0-types/issues/new) first.
59+
60+
## License
61+
62+
[MIT](./LICENSE)

0 commit comments

Comments
 (0)