@vulog/aima-billing 1.1.43

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/.eslintrc.js ADDED
@@ -0,0 +1,112 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ // Indicates the location of the TypeScript configuration file
5
+ project: 'tsconfig.json',
6
+ // Sets the root directory for the TypeScript configuration
7
+ tsconfigRootDir: __dirname,
8
+ // Specifies the version of ECMAScript syntax to be used
9
+ ecmaVersion: 'latest',
10
+ // Indicates the type of source code (script or module)
11
+ sourceType: 'module',
12
+ },
13
+ plugins: ['@typescript-eslint', 'prettier', 'import'],
14
+ extends: [
15
+ 'airbnb-base',
16
+ 'airbnb-typescript/base',
17
+ 'plugin:@typescript-eslint/recommended',
18
+ 'prettier',
19
+ 'plugin:prettier/recommended',
20
+ ],
21
+ root: true,
22
+ env: {
23
+ es6: true,
24
+ node: true,
25
+ },
26
+ ignorePatterns: [
27
+ '/dist/**/*', // Ignore built files.
28
+ '.eslintrc.js',
29
+ '**/*.test.ts',
30
+ ],
31
+ rules: {
32
+ // Configures the Prettier integration with ESLint
33
+ 'prettier/prettier': ['error', { endOfLine: 'auto' }],
34
+ // Disables the rule requiring an 'I' prefix for interfaces
35
+ '@typescript-eslint/interface-name-prefix': 'off',
36
+ // Configures the naming conventions for various code constructs
37
+ '@typescript-eslint/naming-convention': [
38
+ // ... various naming convention configurations ...
39
+ 'error',
40
+ // Allows any naming format for destructured variables
41
+ {
42
+ selector: 'variable',
43
+ modifiers: ['destructured'],
44
+ format: null,
45
+ },
46
+ // Requires strict camelCase for function names
47
+ {
48
+ selector: 'function',
49
+ format: ['strictCamelCase'],
50
+ },
51
+ // Requires boolean variables to have one of the specified prefixes
52
+ {
53
+ selector: 'variable',
54
+ format: null,
55
+ types: ['boolean'],
56
+ prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
57
+ },
58
+ // Requires enum names to have a strict PascalCase format
59
+ {
60
+ selector: 'enum',
61
+ format: ['StrictPascalCase'],
62
+ },
63
+ ],
64
+ 'import/extensions': 'off',
65
+ // Disables the rule requiring explicit return types for functions
66
+ '@typescript-eslint/explicit-function-return-type': 'off',
67
+ // Disables the rule requiring explicit boundary types for modules
68
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
69
+ // Disables the rule prohibiting the use of 'any' type
70
+ '@typescript-eslint/no-explicit-any': 'off',
71
+ // Disables the rule detecting unused variables
72
+ 'no-unused-vars': 0,
73
+ // Disables the rule disallowing named exports used as a default export
74
+ 'import/no-named-as-default': 0,
75
+ // Configures the order and formatting of import statements
76
+ 'import/order': [
77
+ // ... import order configuration ...
78
+ 'error',
79
+ {
80
+ // Configure the alphabetization settings
81
+ alphabetize: {
82
+ // Enforce ascending alphabetical order
83
+ order: 'asc',
84
+ // Do not ignore the case while sorting
85
+ caseInsensitive: false,
86
+ },
87
+ // Enforce newlines between different groups and inside groups of imports
88
+ 'newlines-between': 'always-and-inside-groups',
89
+ // Warn when there is an import statement that is not part of any group
90
+ warnOnUnassignedImports: true,
91
+ },
92
+ ],
93
+ // Configures the rule detecting extraneous dependencies
94
+ 'import/no-extraneous-dependencies': [
95
+ // ... extraneous dependencies configuration ...
96
+ 'error',
97
+ {
98
+ // Specify the file patterns where devDependencies imports are allowed
99
+ devDependencies: [
100
+ // Allow devDependencies imports in test and spec files
101
+ '**/*.test.{ts,js}',
102
+ '**/*.spec.{ts,js}',
103
+ // Allow devDependencies imports in the 'test' folder
104
+ './test/**.{ts,js}',
105
+ // Allow devDependencies imports in the 'scripts' folder
106
+ './scripts/**/*.{ts,js}',
107
+ ],
108
+ },
109
+ ],
110
+ 'import/prefer-default-export': 'off',
111
+ },
112
+ };
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @vulog/aima-billing
@@ -0,0 +1,20 @@
1
+ import { Client } from '@vulog/aima-client';
2
+
3
+ type ChargeProductInfo = {
4
+ productId: string;
5
+ serviceId?: string;
6
+ amount: number;
7
+ userId: string;
8
+ entityId: string;
9
+ subscriptionId?: string;
10
+ productNotes?: string;
11
+ originId?: string;
12
+ chargeProductRequestId?: string;
13
+ };
14
+ type Invoice = {
15
+ [key: string]: any;
16
+ };
17
+
18
+ declare const chargeProduct: (client: Client, info: ChargeProductInfo) => Promise<Invoice>;
19
+
20
+ export { type ChargeProductInfo, type Invoice, chargeProduct };
@@ -0,0 +1,20 @@
1
+ import { Client } from '@vulog/aima-client';
2
+
3
+ type ChargeProductInfo = {
4
+ productId: string;
5
+ serviceId?: string;
6
+ amount: number;
7
+ userId: string;
8
+ entityId: string;
9
+ subscriptionId?: string;
10
+ productNotes?: string;
11
+ originId?: string;
12
+ chargeProductRequestId?: string;
13
+ };
14
+ type Invoice = {
15
+ [key: string]: any;
16
+ };
17
+
18
+ declare const chargeProduct: (client: Client, info: ChargeProductInfo) => Promise<Invoice>;
19
+
20
+ export { type ChargeProductInfo, type Invoice, chargeProduct };
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ chargeProduct: () => chargeProduct
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/chargeProduct.ts
38
+ var import_zod = __toESM(require("zod"));
39
+ var schema = import_zod.default.object({
40
+ productId: import_zod.default.string().trim().min(1).uuid(),
41
+ serviceId: import_zod.default.string().trim().min(1).uuid().nullable().optional(),
42
+ amount: import_zod.default.number().min(0),
43
+ userId: import_zod.default.string().trim().min(1).uuid(),
44
+ entityId: import_zod.default.string().trim().min(1).uuid(),
45
+ subscriptionId: import_zod.default.string().trim().min(1).uuid().nullable().optional(),
46
+ productNotes: import_zod.default.string().trim().nullable().optional(),
47
+ originId: import_zod.default.string().trim().nullable().optional(),
48
+ chargeProductRequestId: import_zod.default.string().trim().min(1).uuid().nullable().optional()
49
+ });
50
+ var chargeProduct = async (client, info) => {
51
+ const result = schema.safeParse(info);
52
+ if (!result.success) {
53
+ throw new TypeError("Invalid args", {
54
+ cause: result.error.issues
55
+ });
56
+ }
57
+ return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/product`, info).then(({ data }) => data);
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ chargeProduct
62
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,25 @@
1
+ // src/chargeProduct.ts
2
+ import z from "zod";
3
+ var schema = z.object({
4
+ productId: z.string().trim().min(1).uuid(),
5
+ serviceId: z.string().trim().min(1).uuid().nullable().optional(),
6
+ amount: z.number().min(0),
7
+ userId: z.string().trim().min(1).uuid(),
8
+ entityId: z.string().trim().min(1).uuid(),
9
+ subscriptionId: z.string().trim().min(1).uuid().nullable().optional(),
10
+ productNotes: z.string().trim().nullable().optional(),
11
+ originId: z.string().trim().nullable().optional(),
12
+ chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional()
13
+ });
14
+ var chargeProduct = async (client, info) => {
15
+ const result = schema.safeParse(info);
16
+ if (!result.success) {
17
+ throw new TypeError("Invalid args", {
18
+ cause: result.error.issues
19
+ });
20
+ }
21
+ return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/product`, info).then(({ data }) => data);
22
+ };
23
+ export {
24
+ chargeProduct
25
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@vulog/aima-billing",
3
+ "version": "1.1.43",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.mjs",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsup",
9
+ "dev": "tsup --watch",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest",
12
+ "lint": "eslint src/**/* --ext .ts"
13
+ },
14
+ "keywords": [
15
+ "AIMA",
16
+ "VULOG",
17
+ "BILLING"
18
+ ],
19
+ "author": "Vulog",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@vulog/aima-client": "1.1.43",
23
+ "@vulog/aima-core": "1.1.43"
24
+ },
25
+ "peerDependencies": {
26
+ "zod": "^3.24.2"
27
+ },
28
+ "description": ""
29
+ }
@@ -0,0 +1,29 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import z from 'zod';
3
+
4
+ import { ChargeProductInfo, Invoice } from './types';
5
+
6
+ const schema = z.object({
7
+ productId: z.string().trim().min(1).uuid(),
8
+ serviceId: z.string().trim().min(1).uuid().nullable().optional(),
9
+ amount: z.number().min(0),
10
+ userId: z.string().trim().min(1).uuid(),
11
+ entityId: z.string().trim().min(1).uuid(),
12
+ subscriptionId: z.string().trim().min(1).uuid().nullable().optional(),
13
+ productNotes: z.string().trim().nullable().optional(),
14
+ originId: z.string().trim().nullable().optional(),
15
+ chargeProductRequestId: z.string().trim().min(1).uuid().nullable().optional(),
16
+ });
17
+
18
+ export const chargeProduct = async (client: Client, info: ChargeProductInfo) => {
19
+ const result = schema.safeParse(info);
20
+ if (!result.success) {
21
+ throw new TypeError('Invalid args', {
22
+ cause: result.error.issues,
23
+ });
24
+ }
25
+
26
+ return client
27
+ .post<Invoice>(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/product`, info)
28
+ .then(({ data }) => data);
29
+ };
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './chargeProduct';
2
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,15 @@
1
+ export type ChargeProductInfo = {
2
+ productId: string;
3
+ serviceId?: string;
4
+ amount: number;
5
+ userId: string;
6
+ entityId: string;
7
+ subscriptionId?: string;
8
+ productNotes?: string;
9
+ originId?: string;
10
+ chargeProductRequestId?: string;
11
+ };
12
+
13
+ export type Invoice = {
14
+ [key: string]: any;
15
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "include": ["src"],
3
+ "exclude": ["**/*.test.ts"],
4
+ "compilerOptions": {
5
+ "module": "esnext",
6
+ "target": "esnext",
7
+ "lib": ["esnext"],
8
+ "declaration": true,
9
+ "strict": true,
10
+ "moduleResolution": "node",
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "outDir": "dist",
14
+ "rootDir": "src"
15
+ }
16
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ clean: true,
6
+ format: ['cjs', 'esm'],
7
+ dts: true,
8
+ });
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ },
8
+ });