@apia/api 0.1.1 → 0.2.2

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/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
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
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
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
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # Initiator
2
-
3
- Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
4
-
5
- Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
6
-
7
- ## IMPORTANTE
8
-
9
- Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
10
-
11
- ## Procedimiento
12
-
13
- - Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
14
- - Modificar el package.json:
15
- - Eliminar la línea ```private: true```.
16
- - Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
17
- - Agregar los scripts convenientes: dev, build, etc.
18
- - Ejecutar el comando lerna bootstrap desde la carpeta raíz.
19
-
20
- Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
21
-
22
- Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```.
23
-
24
- **Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
25
-
26
- **Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
1
+ # Initiator
2
+
3
+ Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
4
+
5
+ Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
6
+
7
+ ## IMPORTANTE
8
+
9
+ Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
10
+
11
+ ## Procedimiento
12
+
13
+ - Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
14
+ - Modificar el package.json:
15
+ - Eliminar la línea ```private: true```.
16
+ - Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
17
+ - Agregar los scripts convenientes: dev, build, etc.
18
+ - Ejecutar el comando lerna bootstrap desde la carpeta raíz.
19
+
20
+ Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
21
+
22
+ Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```.
23
+
24
+ **Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
25
+
26
+ **Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as theme_ui_jsx_runtime from 'theme-ui/jsx-runtime';
2
1
  import * as React from 'react';
3
2
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
4
3
  import { TModify, TApiaLoad } from '@apia/util';
5
4
  import { TNotificationMessage, notify } from '@apia/notifications';
5
+ import { TModal } from '@apia/components';
6
6
  import QueryString from 'qs';
7
7
 
8
8
  declare function getConfig<LoadType>(outerBehaveConfig?: IApiaApiRequestConfig<LoadType>): IApiaApiRequestConfig<unknown> & IApiaApiRequestConfig<LoadType> & Partial<IApiaApiRequestConfig<unknown>>;
@@ -145,7 +145,14 @@ declare function makeApiaUrl(props?: {
145
145
  preventAsXmlParameter?: boolean;
146
146
  avoidTabId?: boolean;
147
147
  [key: string]: unknown;
148
- }): string;
148
+ }): string;
149
+ declare global {
150
+ interface Window {
151
+ TAB_ID_REQUEST: string;
152
+ CONTEXT: string;
153
+ URL_REQUEST_AJAX: string;
154
+ }
155
+ }
149
156
 
150
157
  interface TColors {
151
158
  exception?: string;
@@ -157,10 +164,12 @@ interface IApiaApiConsoleConfig {
157
164
  colors?: TColors;
158
165
  debug?: boolean;
159
166
  }
167
+ type TSetModalProps = (configuration: THandleConfiguration, formDefinition?: TApiaLoad) => TModal | null;
160
168
  interface IApiaApiRequestConfig<DataType> extends IApiaApiConsoleConfig {
161
169
  axiosConfig?: AxiosRequestConfig;
162
170
  modalConfiguration?: IModalConfig;
163
171
  handleLoad?: boolean;
172
+ setModalProps?: TSetModalProps;
164
173
  /**
165
174
  * Algunas veces las funciones llamadas por una acción en el servidor
166
175
  * tienen el mismo nombre siendo en realidad funciones distintas. Para
@@ -189,6 +198,7 @@ type TApiaApiMethodHandler = {
189
198
  close: () => void;
190
199
  configuration?: THandleConfiguration;
191
200
  formDefinition: TApiaLoad;
201
+ setModalProps?: (configuration: THandleConfiguration, formDefinition?: TApiaLoad) => TModal | null;
192
202
  reset: () => void;
193
203
  setError: typeof notify;
194
204
  setMessage: (message: Record<string, unknown>) => unknown;
@@ -204,7 +214,7 @@ interface IModalConfig {
204
214
  onMessageClose?: () => unknown;
205
215
  onSubmitted?: (handler: TApiaApiMethodHandler, response: AxiosResponse<Record<string, unknown> | null> | null) => unknown;
206
216
  }
207
- type THandleConfiguration = Partial<Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath'>>;
217
+ type THandleConfiguration = Partial<Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath' | 'setModalProps'>>;
208
218
  interface IApiaApiHandlerState {
209
219
  disabled: boolean;
210
220
  isLoading: boolean;
@@ -213,13 +223,6 @@ interface IApiaApiHandlerState {
213
223
  errors: Record<string, string>;
214
224
  windowIndex: number;
215
225
  }
216
- declare const ApiaApiHandler: React.MemoExoticComponent<() => theme_ui_jsx_runtime.JSX.Element>;
217
-
218
- declare global {
219
- interface Window {
220
- [key: string]: string;
221
- }
222
- }
226
+ declare const ApiaApiHandler: React.MemoExoticComponent<() => React.JSX.Element>;
223
227
 
224
- export { ApiaApi, ApiaApiHandler, TApiaApiMethod, TApiaApiResult, makeApiaUrl };
225
- //# sourceMappingURL=index.d.ts.map
228
+ export { ApiaApi, ApiaApiHandler, IApiaApiRequestConfig, TApiaApiAxiosResponse, TApiaApiMethod, TApiaApiResult, makeApiaUrl };