@benup/bensdk 1.8.2 → 1.9.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/bin/lib/schemas/action.schema.d.ts +28159 -11173
- package/bin/lib/types/benefit-definition.types.d.ts +16 -0
- package/bin/lib/types/lib/token-helper.lib.type.d.ts +17 -0
- package/bin/lib/types/state-handler.types.d.ts +4 -0
- package/bin/src/cli/templates/bensdk-base/.github/workflows/lint.yml.template +29 -0
- package/bin/src/cli/templates/bensdk-base/eslint.config.mjs.template +2 -1
- package/bin/src/cli/templates/package.template.json +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
2
3
|
import { BenefitDefinitionSchema } from '../schemas/benefit-definition.schema';
|
|
4
|
+
import { TokenHelper } from './lib/token-helper.lib.type';
|
|
3
5
|
type Base = z.infer<typeof BenefitDefinitionSchema>;
|
|
6
|
+
export type AuthHandlerCtx = {
|
|
7
|
+
tokenHelper: TokenHelper;
|
|
8
|
+
};
|
|
9
|
+
export type AuthHandlerResult = {
|
|
10
|
+
outcome: 'FAILED';
|
|
11
|
+
reason?: string;
|
|
12
|
+
retry?: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
outcome: 'SUCCEEDED';
|
|
15
|
+
instance?: AxiosInstance;
|
|
16
|
+
};
|
|
4
17
|
export type BenefitDefinition = Omit<Base, 'stateMachine'> & {
|
|
5
18
|
stateMachine: Base['stateMachine'] & {
|
|
6
19
|
DEDUCTION_FILE_INGESTION?: {
|
|
@@ -14,5 +27,8 @@ export type BenefitDefinition = Omit<Base, 'stateMachine'> & {
|
|
|
14
27
|
};
|
|
15
28
|
} & any;
|
|
16
29
|
};
|
|
30
|
+
auth?: {
|
|
31
|
+
handler: (credentials: any, ctx: AuthHandlerCtx) => Promise<AuthHandlerResult>;
|
|
32
|
+
};
|
|
17
33
|
};
|
|
18
34
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type GetTokenParameters = {
|
|
2
|
+
accountID: string;
|
|
3
|
+
companyID: string;
|
|
4
|
+
benefitID: string;
|
|
5
|
+
};
|
|
6
|
+
type SetTokenParameters = {
|
|
7
|
+
accountID: string;
|
|
8
|
+
companyID: string;
|
|
9
|
+
benefitID: string;
|
|
10
|
+
valueToBeStored: string;
|
|
11
|
+
storeForSeconds: number;
|
|
12
|
+
};
|
|
13
|
+
export interface TokenHelper {
|
|
14
|
+
get: (params: GetTokenParameters) => Promise<string | null>;
|
|
15
|
+
set: (params: SetTokenParameters) => Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Run lint - static checker
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js 20.x
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: 20.x
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm install
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: npm run lint
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable n/no-unpublished-import */
|
|
1
2
|
/* eslint-disable n/no-extraneous-import */
|
|
2
3
|
|
|
3
4
|
import js from "@eslint/js";
|
|
@@ -37,6 +38,6 @@ export default [
|
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
ignores: [".docs/", "build/"],
|
|
41
|
+
ignores: [".docs/", "build/", "bin/"],
|
|
41
42
|
},
|
|
42
43
|
];
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"concurrently": "^9.1.2",
|
|
28
|
+
"eslint": "^9.36.0",
|
|
29
|
+
"eslint-config-prettier": "^10.1.8",
|
|
30
|
+
"eslint-plugin-jsdoc": "^60.7.1",
|
|
31
|
+
"eslint-plugin-n": "^17.23.1",
|
|
28
32
|
"prettier": "^3.5.1",
|
|
29
33
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
30
34
|
"tsx": "^4.19.2",
|