ixc-orm 1.2.0 → 1.3.0

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/README.md CHANGED
@@ -50,5 +50,5 @@ Para configurar a comunicação da biblioteca com seu servidor IXC, é necessár
50
50
 
51
51
  `IXC_TOKEN`
52
52
 
53
- > **IXC_HOST** deve conter a url do seu servidor IXC, no formato: `https://seudominio.com.br/webservice/v1`\
54
- > **IXC_TOKEN** deve conter um token de API gerado dentro do seu sistema IXCsoft.
53
+ > **IXC_HOST** A url do seu servidor IXC, no formato: `https://seudominio.com.br/webservice/v1`\
54
+ > **IXC_TOKEN** Um token de API gerado dentro do seu sistema IXCsoft.
package/dist/IXCClient.js CHANGED
@@ -48,7 +48,7 @@ class IXCClient {
48
48
  */
49
49
  where(whereClauses) {
50
50
  if (whereClauses.length > 3) {
51
- throw new Error(`> O array de cláusulas não pode conter mais de 3 elementos.`);
51
+ throw new Error(`> As cláusulas não podem conter mais de 3 elementos.`);
52
52
  }
53
53
  const [alwaysColumn, operatorOrValue, valueOrUndefined] = whereClauses;
54
54
  const availableOperators = Object.keys(types_1.IXCOperator);
package/dist/request.js CHANGED
@@ -8,7 +8,7 @@ exports.createRequestPayload = createRequestPayload;
8
8
  const axios_1 = __importDefault(require("axios"));
9
9
  /**
10
10
  *
11
- * @param method GET | POST | PUT
11
+ * @param method GET | POST | PUT | DELETE
12
12
  * @returns A instância de um objeto do tipo AxiosInstance, pré-configurado com os cabeçalhos necessários
13
13
  */
14
14
  function createAxiosInstance(method = 'GET') {
@@ -27,7 +27,7 @@ function createAxiosInstance(method = 'GET') {
27
27
  /**
28
28
  *
29
29
  * @param table Nome da tabela do IXC onde será feita a busca, atualização, inserção ou remoção
30
- * @param params Parâmetros da busca (desconciderado quando a ação é a de inserir novos registros)
30
+ * @param params Parâmetros da busca (desconsiderados quando a ação for a de inserir novos registros)
31
31
  * @param options Parâmetros de formatação dos dados da responsta (página, ítens por página e ordenação)
32
32
  * @returns
33
33
  */
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "ixc-orm",
3
- "version": "1.2.0",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "license": "MIT",
7
- "description": "ORM para consumo de dados da API oficial do IXCsoft",
8
- "scripts": {
9
- "declare": "tsc --declaration",
10
- "build": "tsc --build",
11
- "dev": "nodemon --watch \"src//\" --exec \"ts-node src/index.ts\" -e ts"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/SousaFelipe/ixc-orm.git"
16
- },
17
- "keywords": [
18
- "IXCSoft API",
19
- "IXCsoft",
20
- "IXC API"
21
- ],
22
- "author": {
23
- "name": "Felipe Sousa",
24
- "email": "flpssdocarmo@gmail.com",
25
- "url": "https://github.com/SousaFelipe"
26
- },
27
- "bugs": {
28
- "url": "https://github.com/SousaFelipe/ixc-orm/issues"
29
- },
30
- "dependencies": {
31
- "axios": "^1.7.7",
32
- "dotenv": "^16.4.5"
33
- },
34
- "devDependencies": {
35
- "@types/node": "^22.5.5",
36
- "nodemon": "^3.1.5",
37
- "ts-node": "^10.9.2",
38
- "typescript": "^5.6.2"
39
- }
40
- }
1
+ {
2
+ "name": "ixc-orm",
3
+ "version": "1.3.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "license": "MIT",
7
+ "description": "ORM para consumo de dados da API oficial do IXCsoft",
8
+ "scripts": {
9
+ "declare": "tsc --declaration",
10
+ "build": "tsc --build",
11
+ "dev": "nodemon --watch \"src//\" --exec \"ts-node src/index.ts\" -e ts"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/SousaFelipe/ixc-orm.git"
16
+ },
17
+ "keywords": [
18
+ "IXCSoft API",
19
+ "IXCsoft",
20
+ "IXC API"
21
+ ],
22
+ "author": {
23
+ "name": "Felipe Sousa",
24
+ "email": "flpssdocarmo@gmail.com",
25
+ "url": "https://github.com/SousaFelipe"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/SousaFelipe/ixc-orm/issues"
29
+ },
30
+ "dependencies": {
31
+ "axios": "^1.10.0",
32
+ "dotenv": "^17.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^24.0.12",
36
+ "nodemon": "^3.1.10",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^5.6.2"
39
+ }
40
+ }
@@ -1,53 +0,0 @@
1
- import { AxiosError } from 'axios';
2
- import { IXCOptions, IXCQuery, IXCResponse, IXCSortOrder } from './types';
3
- export default abstract class IXCClient {
4
- protected table: string;
5
- protected params: IXCQuery[];
6
- protected options: IXCOptions;
7
- /**
8
- *
9
- * @param table O nome da tabela correspondente ao banco de dados do seu servidor IXC
10
- * @see {@link https://wikiapiprovedor.ixcsoft.com.br/index.php}
11
- */
12
- constructor(table: string);
13
- /**
14
- *
15
- * @param whereClauses Um array de strings, no formato [coluna, operador, valor]
16
- * Obs: se você passar um array no formato [coluna, valor] o operador será considerado como '='
17
- * Operadores válidos: =, !=, >, <, >=, <=, LIKE
18
- * @returns A própria instância
19
- */
20
- where(whereClauses: string[]): IXCClient;
21
- /**
22
- *
23
- * @param column A coluna que será usada para ordenar a busca
24
- * @param order A ordem da busca ('asc'ou 'desc')
25
- * @returns A própria instância
26
- */
27
- orderBy(column: string, order: keyof typeof IXCSortOrder): IXCClient;
28
- /**
29
- *
30
- * @param pg O número da página que será solicitada ao IXC
31
- * @param rows A quantidade de linhas (registros) por página
32
- * @returns Promise<null | IXCResponse | AxiosError>
33
- */
34
- get(pg?: number, rows?: number): Promise<null | IXCResponse | AxiosError>;
35
- /**
36
- *
37
- * @param body Um objeto no formado "chave: valor" contendo as informações do novo registro
38
- * a ser inserido no banco de dados do seu servidor IXC
39
- * @returns Promise<null | IXCResponse | AxiosError>
40
- */
41
- post(body?: {
42
- [key: string]: any;
43
- }): Promise<null | IXCResponse | AxiosError>;
44
- /**
45
- *
46
- * @param id O id do registro que será alterado
47
- * @param body Um objeto no formado "chave : valor" contendo as colunas que serão alteradas
48
- * @returns Promise<null | IXCResponse | AxiosError>
49
- */
50
- put(id: number, body?: {
51
- [key: string]: any;
52
- }): Promise<null | IXCResponse | AxiosError>;
53
- }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import IXCClient from './IXCClient';
2
- import { IXCOperator, IXCOptions, IXCQuery, IXCRequest, IXCRequestMethods, IXCResponse, IXCSortOrder } from './types';
3
- export { IXCClient, IXCOperator, IXCOptions, IXCQuery, IXCRequest, IXCRequestMethods, IXCResponse, IXCSortOrder };
package/dist/request.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
- import { IXCOptions, IXCQuery, IXCRequest, IXCRequestMethods } from './types';
3
- /**
4
- *
5
- * @param method GET | POST | PUT
6
- * @returns A instância de um objeto do tipo AxiosInstance, pré-configurado com os cabeçalhos necessários
7
- */
8
- export declare function createAxiosInstance(method?: keyof typeof IXCRequestMethods): AxiosInstance;
9
- /**
10
- *
11
- * @param table Nome da tabela do IXC onde será feita a busca, atualização, inserção ou remoção
12
- * @param params Parâmetros da busca (desconciderado quando a ação é a de inserir novos registros)
13
- * @param options Parâmetros de formatação dos dados da responsta (página, ítens por página e ordenação)
14
- * @returns
15
- */
16
- export declare function createRequestPayload(table: string, params: IXCQuery | IXCQuery[], options?: IXCOptions): AxiosRequestConfig<IXCRequest>;
package/dist/types.d.ts DELETED
@@ -1,50 +0,0 @@
1
- export declare const IXCOperator: {
2
- '=': string;
3
- '>': string;
4
- '<': string;
5
- '>=': string;
6
- '<=': string;
7
- '!=': string;
8
- LIKE: string;
9
- };
10
- export declare const IXCSortOrder: {
11
- asc: string;
12
- desc: string;
13
- };
14
- export declare const IXCRequestMethods: {
15
- GET: string;
16
- POST: string;
17
- PUT: string;
18
- DELETE: string;
19
- };
20
- export interface IXCOptions {
21
- page: number;
22
- rowsPerPage?: number;
23
- sortName?: string;
24
- sortOrder?: keyof typeof IXCSortOrder;
25
- }
26
- export interface IXCQuery {
27
- TB: string;
28
- OP?: string;
29
- P: string;
30
- }
31
- export interface IXCRequest {
32
- qtype: string;
33
- query: string;
34
- oper: string;
35
- page: number;
36
- rp: number;
37
- sortname: string;
38
- sortorder: string;
39
- grid_param?: string;
40
- }
41
- export interface IXCResponse {
42
- error?: boolean | object;
43
- message?: string | null;
44
- id?: string | number;
45
- page: number | string;
46
- total: number;
47
- registros: Array<{
48
- [key: string]: any;
49
- }>;
50
- }