gas-api 1.0.0 → 1.1.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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +47 -2
- package/package.json +5 -6
- package/src/api.mjs +0 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
- Peer dependency on `gas-contract` bumped to `^0.2.0` (zod 4 migration upstream).
|
|
5
|
+
- Removed the unused `zod` import and dependency (the factory never validated with zod).
|
|
6
|
+
|
|
7
|
+
## 1.0.1
|
|
8
|
+
- Peer dependency on `gas-contract` uses `^0.1.0` instead of a `file:` path.
|
|
9
|
+
|
|
10
|
+
## 1.0.0
|
|
11
|
+
- Initial release: API token setup (`api_Setup.gs`) and the `api` extension factory.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pedro Alejandro
|
|
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.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ API declarativa en el mismo proyecto Apps Script que las vistas HTML. Define end
|
|
|
6
6
|
|
|
7
7
|
## Peer dependency
|
|
8
8
|
|
|
9
|
-
- `gas-contract
|
|
9
|
+
- `gas-contract@^0.1.0` — contrato `GasExtension` y config-objeto de la familia.
|
|
10
10
|
|
|
11
11
|
## Instalación
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ npm install --save-dev gas-api
|
|
|
17
17
|
## Contrato `GasExtension` — factory `api()`
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
|
-
import api,
|
|
20
|
+
import { api, endpoint } from 'gas-api';
|
|
21
21
|
|
|
22
22
|
export default defineGasConfig({
|
|
23
23
|
/* ...config del base... */
|
|
@@ -134,6 +134,51 @@ const api = crearCliente(endpoints, {
|
|
|
134
134
|
- Endpoint `protected`: envía el token en query (GET) o en el body JSON (POST/PUT/DELETE). Nunca en headers.
|
|
135
135
|
- El token **no aparece en logs ni en errores**.
|
|
136
136
|
|
|
137
|
+
## Pasos secuenciales
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# 1. Instalar (junto a su peer)
|
|
141
|
+
npm install --save-dev gas-api gas-contract
|
|
142
|
+
|
|
143
|
+
# 2. Declararlo en gas.config.mjs
|
|
144
|
+
# 3. Compilar
|
|
145
|
+
npm run gas:build # = ng build && gas build && gas domain
|
|
146
|
+
|
|
147
|
+
# 4. Verificar
|
|
148
|
+
npm run gas:check
|
|
149
|
+
|
|
150
|
+
# 5. Subir
|
|
151
|
+
clasp push gas/
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Cómo se comunica con el resto
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
gas.config.mjs ──extensions[]──► angular-to-appsscript (orquestador)
|
|
158
|
+
│
|
|
159
|
+
inyecta runtime/api_Setup.gs en gas/
|
|
160
|
+
inyecta config → GAS_MANIFEST.extensions
|
|
161
|
+
│
|
|
162
|
+
▼
|
|
163
|
+
Apps Script (scope global)
|
|
164
|
+
│
|
|
165
|
+
▼
|
|
166
|
+
apiSetup + despacho de endpoints
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
| Vía | Qué viaja |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `extensions[]` en tu config | `api({ auth: { mode: "token" }, endpoints: [endpoint("GET /ping", {...})] })` |
|
|
172
|
+
| `runtime/*.gs` (lo inyecta el build) | `api_Setup.gs` con `apiSetup + despacho de endpoints` |
|
|
173
|
+
| `GAS_MANIFEST.extensions.api.manifest` | tu config, para que otros la lean |
|
|
174
|
+
|
|
175
|
+
**Las capacidades NO se importan entre sí.** Se leen por el manifest (R7):
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
const cfg = GAS_MANIFEST.extensions.api?.manifest;
|
|
179
|
+
if (!cfg) return { ok: false, error: 'gas-api no está instalado' };
|
|
180
|
+
```
|
|
181
|
+
|
|
137
182
|
## Composición con otros paquetes
|
|
138
183
|
|
|
139
184
|
Los paquetes de extensión no se importan entre sí. Se leen entre sí vía `GAS_MANIFEST.extensions.<nombre>.manifest` (inyectado por el base en `Router.gs`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gas-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "API declarativa en el mismo proyecto Apps Script que las vistas.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
"index.mjs",
|
|
11
11
|
"src/",
|
|
12
12
|
"runtime/",
|
|
13
|
-
"README.md"
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"CHANGELOG.md"
|
|
14
16
|
],
|
|
15
17
|
"engines": {
|
|
16
18
|
"node": ">=20"
|
|
17
19
|
},
|
|
18
20
|
"peerDependencies": {
|
|
19
|
-
"gas-contract": "^0.
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"zod": "^3.24.0"
|
|
21
|
+
"gas-contract": "^0.2.0"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|
|
25
24
|
"test": "node --test 'test/**/*.test.mjs'"
|
package/src/api.mjs
CHANGED