JairoDanielMT commited on
Commit
0324409
1 Parent(s): b647e89

templates actualizados y blindados

Browse files
app/templates/IndexDocument.html.j2 CHANGED
@@ -3,30 +3,64 @@
3
  <head>
4
  <meta charset="UTF-8" />
5
  <title>脥ndice de Formas 路 {{ job_id }}</title>
 
 
 
 
 
 
 
 
 
6
  <style>
 
 
 
 
 
7
  body {
8
- font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Noto Sans", sans-serif;
 
9
  color: #0f172a;
10
- margin: 28px;
11
  font-size: 12px;
 
 
 
 
 
 
 
 
12
  }
 
13
  h1 {
14
- font-size: 24px;
15
  text-transform: uppercase;
16
  letter-spacing: 0.06em;
17
- margin-bottom: 4px;
18
  }
 
19
  h2 {
20
  color: #475569;
21
  font-size: 14px;
22
- margin-top: 4px;
23
- margin-bottom: 16px;
24
  }
 
25
  table {
26
  width: 100%;
27
  border-collapse: collapse;
28
  font-size: 11px;
29
  }
 
 
 
 
 
 
 
 
 
30
  th,
31
  td {
32
  border: 1px solid #e2e8f0;
@@ -34,51 +68,77 @@
34
  text-align: left;
35
  vertical-align: top;
36
  }
 
37
  th {
38
  text-transform: uppercase;
39
  letter-spacing: 0.08em;
40
  font-size: 10px;
41
  background: #f1f5f9;
42
  }
 
43
  tbody tr:nth-child(odd) {
44
  background: #f8fafc;
45
  }
 
46
  .muted {
47
  color: #94a3b8;
48
  font-size: 10px;
49
  text-transform: uppercase;
50
  letter-spacing: 0.08em;
51
  margin-top: 24px;
 
52
  }
53
  </style>
54
  </head>
55
  <body>
56
- <h1>脥ndice de Formas</h1>
57
- <h2>Job {{ job_id }} 路 {{ entries|length }} documentos</h2>
58
- <table>
59
- <thead>
60
- <tr>
61
- <th>#</th>
62
- <th>Archivo</th>
63
- <th>T铆tulo</th>
64
- <th>Tipo</th>
65
- <th>Descripci贸n</th>
66
- <th>SuiteScript</th>
67
- </tr>
68
- </thead>
69
- <tbody>
70
- {% for entry in entries %}
71
- <tr>
72
- <td>{{ loop.index }}</td>
73
- <td>{{ entry.path }}</td>
74
- <td>{{ entry.title }}</td>
75
- <td>{{ entry.script_type or "-" }}</td>
76
- <td>{{ entry.description or "Sin descripci贸n" }}</td>
77
- <td>{{ entry.api_version or "-" }}</td>
78
- </tr>
79
- {% endfor %}
80
- </tbody>
81
- </table>
82
- <p class="muted">Generado autom谩ticamente {{ generated_at }}</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  </body>
84
  </html>
 
3
  <head>
4
  <meta charset="UTF-8" />
5
  <title>脥ndice de Formas 路 {{ job_id }}</title>
6
+
7
+ <!-- Fuente corporativa (Inter) -->
8
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
+ <link
11
+ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
12
+ rel="stylesheet"
13
+ />
14
+
15
  <style>
16
+ @page {
17
+ size: A4;
18
+ margin: 25.4mm; /* 2.54 cm por lado */
19
+ }
20
+
21
  body {
22
+ font-family: "Inter", -apple-system, BlinkMacSystemFont, "Noto Sans",
23
+ system-ui, sans-serif;
24
  color: #0f172a;
25
+ margin: 0;
26
  font-size: 12px;
27
+ line-height: 1.6;
28
+ background: #ffffff;
29
+ padding: 0 0 8mm 0;
30
+ }
31
+
32
+ .page {
33
+ padding: 0;
34
+ margin: 0;
35
  }
36
+
37
  h1 {
38
+ font-size: 22px;
39
  text-transform: uppercase;
40
  letter-spacing: 0.06em;
41
+ margin: 0 0 4px 0;
42
  }
43
+
44
  h2 {
45
  color: #475569;
46
  font-size: 14px;
47
+ margin: 0 0 16px 0;
 
48
  }
49
+
50
  table {
51
  width: 100%;
52
  border-collapse: collapse;
53
  font-size: 11px;
54
  }
55
+
56
+ thead {
57
+ display: table-header-group; /* repite encabezado en cada p谩gina */
58
+ }
59
+
60
+ tbody tr {
61
+ page-break-inside: avoid;
62
+ }
63
+
64
  th,
65
  td {
66
  border: 1px solid #e2e8f0;
 
68
  text-align: left;
69
  vertical-align: top;
70
  }
71
+
72
  th {
73
  text-transform: uppercase;
74
  letter-spacing: 0.08em;
75
  font-size: 10px;
76
  background: #f1f5f9;
77
  }
78
+
79
  tbody tr:nth-child(odd) {
80
  background: #f8fafc;
81
  }
82
+
83
  .muted {
84
  color: #94a3b8;
85
  font-size: 10px;
86
  text-transform: uppercase;
87
  letter-spacing: 0.08em;
88
  margin-top: 24px;
89
+ text-align: right;
90
  }
91
  </style>
92
  </head>
93
  <body>
94
+ <div class="page">
95
+ <h1>脥ndice de Formas</h1>
96
+ <h2>
97
+ Job {{ job_id }} 路
98
+ {{ entries is defined and entries is iterable and entries|length or 0 }}
99
+ documentos
100
+ </h2>
101
+
102
+ {% if entries and entries is iterable %}
103
+ <table>
104
+ <thead>
105
+ <tr>
106
+ <th>#</th>
107
+ <th>Archivo</th>
108
+ <th>T铆tulo</th>
109
+ <th>Tipo</th>
110
+ <th>Descripci贸n</th>
111
+ <th>SuiteScript</th>
112
+ </tr>
113
+ </thead>
114
+ <tbody>
115
+ {% for entry in entries %}
116
+ {# Si entry es mapping (dict), usamos sus campos. Si no, lo mostramos crudo. #}
117
+ {% if entry is mapping %}
118
+ <tr>
119
+ <td>{{ loop.index }}</td>
120
+ <td>{{ entry.path | default("-") }}</td>
121
+ <td>{{ entry.title | default("-") }}</td>
122
+ <td>{{ entry.script_type | default("-") }}</td>
123
+ <td>{{ entry.description | default("Sin descripci贸n") }}</td>
124
+ <td>{{ entry.api_version | default("-") }}</td>
125
+ </tr>
126
+ {% else %}
127
+ <tr>
128
+ <td>{{ loop.index }}</td>
129
+ <td colspan="5">
130
+ {{ entry }}
131
+ </td>
132
+ </tr>
133
+ {% endif %}
134
+ {% endfor %}
135
+ </tbody>
136
+ </table>
137
+ {% else %}
138
+ <p>No se encontraron documentos para este job.</p>
139
+ {% endif %}
140
+
141
+ <p class="muted">Generado autom谩ticamente {{ generated_at }}</p>
142
+ </div>
143
  </body>
144
  </html>
app/templates/InternalModule.html.j2 CHANGED
@@ -2,30 +2,65 @@
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
- <h1>{{ doc.metadata.script_type or "M贸dulo interno" }} 路 {{ doc.metadata.description or "Documentaci贸n" }}</h1>
6
- <p class="muted">Referencia funcional del m贸dulo compartido.</p>
7
-
8
- {{ ui.metadata_block(doc.metadata) }}
9
- {{ ui.summary_block(doc.summary) }}
10
-
11
- {% if doc.api %}
12
- <div class="section">
13
- <h2>API p煤blica</h2>
14
- {% for fn in doc.api %}
15
- <h3>{{ fn.name }}</h3>
16
- <p>{{ fn.description }}</p>
17
- {{ ui.table_block("Par谩metros", fn.parameters, [
18
- {"field": "name", "title": "Nombre"},
19
- {"field": "description", "title": "Descripci贸n"},
20
- {"field": "type", "title": "Tipo"}
21
- ]) }}
22
- {{ ui.list_block("Efectos colaterales", fn.side_effects) }}
23
- {{ ui.logic_block("Retorna", fn.returns) }}
24
- {% endfor %}
25
- </div>
26
- {% endif %}
27
- {{ ui.list_block("Efectos colaterales", doc.side_effects) }}
28
- {{ ui.list_block("Errores", doc.errors) }}
29
- {{ ui.logic_block("Detalles de implementaci贸n", doc.logic) }}
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  {% endblock %}
 
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
+ <header class="doc-header">
6
+ <h1>{{ doc.metadata.script_type or "M贸dulo interno" }} {{ doc.metadata.description or "Documentaci贸n" }}</h1>
7
+ <p class="doc-header-meta">
8
+ M贸dulo compartido / servicios internos
9
+ </p>
10
+ <p class="muted">Referencia funcional del m贸dulo compartido.</p>
11
+ </header>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ {{ ui.metadata_block(doc.metadata) }}
14
+ {{ ui.summary_block(doc.summary) }}
15
+
16
+ {# ------------------------ API p煤blica ------------------------ #}
17
+ {% if doc.api %}
18
+ <div class="section">
19
+ <h2>API p煤blica</h2>
20
+
21
+ {% for fn in doc.api %}
22
+ <h3>{{ fn.name }}</h3>
23
+ <p>{{ fn.description }}</p>
24
+
25
+ {# Par&aacute;metros: solo tabla si hay datos estructurados #}
26
+ {% if fn.parameters %}
27
+ {{ ui.table_block("Par谩metros", fn.parameters, [
28
+ {"field": "name", "title": "Nombre"},
29
+ {"field": "description", "title": "Descripci贸n"},
30
+ {"field": "type", "title": "Tipo"}
31
+ ]) }}
32
+ {% endif %}
33
+
34
+ {% if fn.side_effects %}
35
+ {{ ui.list_block("Efectos colaterales", fn.side_effects) }}
36
+ {% endif %}
37
+
38
+ {% if fn.returns %}
39
+ {{ ui.logic_block("Retorna", fn.returns) }}
40
+ {% endif %}
41
+ {% endfor %}
42
+ </div>
43
+ {% endif %}
44
+
45
+ {# ------------------------ Efectos generales del m贸dulo ------------------------ #}
46
+ {% if doc.side_effects %}
47
+ {{ ui.list_block("Efectos colaterales", doc.side_effects) }}
48
+ {% endif %}
49
+
50
+ {# ------------------------ Errores ------------------------ #}
51
+ {% if doc.errors %}
52
+ {% if doc.errors is mapping %}
53
+ {# Si alg煤n d铆a viene como objeto: usar list_block sobre sus partes #}
54
+ {{ ui.list_block("Errores", doc.errors.explicit_checks or []) }}
55
+ {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
56
+ {% else %}
57
+ {# Caso actual t铆pico: lista simple de strings #}
58
+ {{ ui.list_block("Errores", doc.errors) }}
59
+ {% endif %}
60
+ {% endif %}
61
+
62
+ {# ------------------------ Detalles de implementaci贸n ------------------------ #}
63
+ {% if doc.logic %}
64
+ {{ ui.logic_block("Detalles de implementaci贸n", doc.logic) }}
65
+ {% endif %}
66
  {% endblock %}
app/templates/MapReduce.html.j2 CHANGED
@@ -2,77 +2,141 @@
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
- <h1>Map/Reduce 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
6
- <p class="muted">Pipeline de procesamiento por lotes.</p>
7
-
8
- {{ ui.metadata_block(doc.metadata) }}
9
- {{ ui.summary_block(doc.summary) }}
10
-
11
- {% if doc.getInputData %}
12
- <div class="section">
13
- <h2>getInputData</h2>
14
- <p>{{ doc.getInputData.details }}</p>
15
- {{ ui.table_block("Filtros", doc.getInputData.filters, [
16
- {"field": "field", "title": "Campo"},
17
- {"field": "operator", "title": "Operador"},
18
- {"field": "value", "title": "Valor"}
19
- ]) }}
20
- {{ ui.table_block("Columnas", doc.getInputData.columns, [
21
- {"field": "name", "title": "Nombre"},
22
- {"field": "label", "title": "Etiqueta"}
23
- ]) }}
24
- </div>
25
- {% endif %}
26
-
27
- {% if doc.map %}
28
- <div class="section">
29
- <h2>map</h2>
30
- <p>{{ doc.map.logic }}</p>
31
- {{ ui.list_block("Campos utilizados", doc.map.fields_used) }}
32
- {{ ui.table_block("Operaciones en registros", doc.map.record_operations, [
33
- {"field": "type", "title": "Operaci贸n"},
34
- {"field": "recordType", "title": "Record"},
35
- {"field": "fields", "title": "Campos"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ]) }}
37
- </div>
38
- {% endif %}
39
-
40
- {% if doc.reduce %}
41
- <div class="section">
42
- <h2>reduce</h2>
43
- <p>{{ doc.reduce.logic }}</p>
44
- {{ ui.list_block("Agregaciones", doc.reduce.aggregations) }}
45
- {{ ui.table_block("Operaciones en registros", doc.reduce.record_operations, [
46
  {"field": "type", "title": "Operaci贸n"},
47
  {"field": "recordType", "title": "Record"},
48
  {"field": "fields", "title": "Campos"}
49
  ]) }}
50
- </div>
51
- {% endif %}
52
-
53
- {% if doc.summarize %}
54
- <div class="section">
55
- <h2>summarize</h2>
56
- <p>{{ doc.summarize.usage }}</p>
57
- {{ ui.list_block("Errores", doc.summarize.errors) }}
58
- {{ ui.list_block("Acciones finales", doc.summarize.final_actions) }}
59
- </div>
60
- {% endif %}
61
-
62
- {{ ui.table_block("B煤squedas utilizadas", doc.searches, [
63
- {"field": "id", "title": "ID"},
64
- {"field": "filters", "title": "Filtros"},
65
- {"field": "columns", "title": "Columnas"}
66
- ]) }}
67
- {{ ui.table_block("Operaciones con registros", doc.records, [
68
- {"field": "type", "title": "Operaci贸n"},
69
- {"field": "recordType", "title": "Record"},
70
- {"field": "fields", "title": "Campos"}
71
- ]) }}
72
- {{ ui.list_block("Side effects", doc.side_effects) }}
73
- {{ ui.table_block("Errores", doc.errors, [
74
- {"field": "location", "title": "Ubicaci贸n"},
75
- {"field": "description", "title": "Descripci贸n"}
76
- ]) }}
77
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  {% endblock %}
 
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
+ <header class="doc-header">
6
+ <h1>Map/Reduce {{ doc.metadata.description or doc.metadata.script_type }}</h1>
7
+ <p class="doc-header-meta">
8
+ Pipeline de procesamiento por lotes (SuiteScript Map/Reduce).
9
+ </p>
10
+ <p class="muted">Procesos masivos, b煤squedas y operaciones sobre registros.</p>
11
+ </header>
12
+
13
+ {{ ui.metadata_block(doc.metadata) }}
14
+ {{ ui.summary_block(doc.summary) }}
15
+
16
+ {# ------------------------ getInputData ------------------------ #}
17
+ {% if doc.getInputData %}
18
+ <div class="section">
19
+ <h2>getInputData</h2>
20
+
21
+ {% if doc.getInputData.details %}
22
+ <p>{{ doc.getInputData.details }}</p>
23
+ {% endif %}
24
+
25
+ {% if doc.getInputData.filters %}
26
+ {{ ui.table_block("Filtros", doc.getInputData.filters, [
27
+ {"field": "field", "title": "Campo"},
28
+ {"field": "operator", "title": "Operador"},
29
+ {"field": "value", "title": "Valor"}
30
+ ]) }}
31
+ {% endif %}
32
+
33
+ {% if doc.getInputData.columns %}
34
+ {{ ui.table_block("Columnas", doc.getInputData.columns, [
35
+ {"field": "name", "title": "Nombre"},
36
+ {"field": "label", "title": "Etiqueta"}
37
+ ]) }}
38
+ {% endif %}
39
+ </div>
40
+ {% endif %}
41
+
42
+ {# ------------------------ map ------------------------ #}
43
+ {% if doc.map %}
44
+ <div class="section">
45
+ <h2>map</h2>
46
+
47
+ {% if doc.map.logic %}
48
+ <p>{{ doc.map.logic }}</p>
49
+ {% endif %}
50
+
51
+ {% if doc.map.fields_used %}
52
+ {{ ui.list_block("Campos utilizados", doc.map.fields_used) }}
53
+ {% endif %}
54
+
55
+ {% if doc.map.record_operations %}
56
+ {{ ui.table_block("Operaciones en registros (map)", doc.map.record_operations, [
57
+ {"field": "type", "title": "Operaci贸n"},
58
+ {"field": "recordType", "title": "Record"},
59
+ {"field": "fields", "title": "Campos"}
60
+ ]) }}
61
+ {% endif %}
62
+ </div>
63
+ {% endif %}
64
+
65
+ {# ------------------------ reduce ------------------------ #}
66
+ {% if doc.reduce %}
67
+ <div class="section">
68
+ <h2>reduce</h2>
69
+
70
+ {% if doc.reduce.logic %}
71
+ <p>{{ doc.reduce.logic }}</p>
72
+ {% endif %}
73
+
74
+ {% if doc.reduce.aggregations %}
75
+ {{ ui.list_block("Agregaciones", doc.reduce.aggregations) }}
76
+ {% endif %}
77
+
78
+ {% if doc.reduce.record_operations %}
79
+ {{ ui.table_block("Operaciones en registros (reduce)", doc.reduce.record_operations, [
80
+ {"field": "type", "title": "Operaci贸n"},
81
+ {"field": "recordType", "title": "Record"},
82
+ {"field": "fields", "title": "Campos"}
83
+ ]) }}
84
+ {% endif %}
85
+ </div>
86
+ {% endif %}
87
+
88
+ {# ------------------------ summarize ------------------------ #}
89
+ {% if doc.summarize %}
90
+ <div class="section">
91
+ <h2>summarize</h2>
92
+
93
+ {% if doc.summarize.usage %}
94
+ <p>{{ doc.summarize.usage }}</p>
95
+ {% endif %}
96
+
97
+ {% if doc.summarize.errors %}
98
+ {{ ui.list_block("Errores", doc.summarize.errors) }}
99
+ {% endif %}
100
+
101
+ {% if doc.summarize.final_actions %}
102
+ {{ ui.list_block("Acciones finales", doc.summarize.final_actions) }}
103
+ {% endif %}
104
+ </div>
105
+ {% endif %}
106
+
107
+ {# ------------------------ b煤squedas globales ------------------------ #}
108
+ {% if doc.searches %}
109
+ {{ ui.table_block("B煤squedas utilizadas", doc.searches, [
110
+ {"field": "id", "title": "ID"},
111
+ {"field": "filters", "title": "Filtros"},
112
+ {"field": "columns", "title": "Columnas"}
113
  ]) }}
114
+ {% endif %}
115
+
116
+ {# ------------------------ operaciones globales con registros ------------------------ #}
117
+ {% if doc.records %}
118
+ {{ ui.table_block("Operaciones con registros", doc.records, [
 
 
 
 
119
  {"field": "type", "title": "Operaci贸n"},
120
  {"field": "recordType", "title": "Record"},
121
  {"field": "fields", "title": "Campos"}
122
  ]) }}
123
+ {% endif %}
124
+
125
+ {# ------------------------ side effects globales ------------------------ #}
126
+ {% if doc.side_effects %}
127
+ {{ ui.list_block("Side effects", doc.side_effects) }}
128
+ {% endif %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ {# ------------------------ errores globales ------------------------ #}
131
+ {% if doc.errors %}
132
+ {% if doc.errors is mapping %}
133
+ {{ ui.list_block("Errores", doc.errors.explicit_checks or []) }}
134
+ {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
135
+ {% else %}
136
+ {{ ui.table_block("Errores", doc.errors, [
137
+ {"field": "location", "title": "Ubicaci贸n"},
138
+ {"field": "description", "title": "Descripci贸n"}
139
+ ]) }}
140
+ {% endif %}
141
+ {% endif %}
142
  {% endblock %}
app/templates/RESTlet.html.j2 CHANGED
@@ -2,61 +2,136 @@
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
- <h1>RESTlet 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
6
- <p class="muted">Documentaci贸n t茅cnica del servicio RESTlet.</p>
 
 
 
 
 
 
7
 
8
  {{ ui.metadata_block(doc.metadata) }}
9
  {{ ui.summary_block(doc.summary) }}
10
 
11
-
 
 
12
  {% set endpoints = doc.endpoints or {} %}
13
- {% if endpoints %}
14
  <div class="section">
15
  <h2>Endpoints</h2>
16
- {% for method, definition in endpoints.items() if definition %}
 
 
 
 
 
 
 
 
 
17
  <h3>{{ method|upper }}</h3>
18
- {% if definition.description %}<p>{{ definition.description }}</p>{% endif %}
 
 
 
 
 
19
  {% set inputs = definition.inputs or {} %}
20
- {{ ui.table_block("URL params", inputs.url_params, [
21
- {"field": "name", "title": "Nombre"},
22
- {"field": "description", "title": "Descripci贸n"},
23
- {"field": "type", "title": "Tipo"}
24
- ]) }}
25
- {{ ui.table_block("Query string", inputs.query_string, [
26
- {"field": "name", "title": "Nombre"},
27
- {"field": "description", "title": "Descripci贸n"},
28
- {"field": "type", "title": "Tipo"}
29
- ]) }}
30
- {{ ui.table_block("Body", inputs.body_fields, [
31
- {"field": "name", "title": "Nombre"},
32
- {"field": "description", "title": "Descripci贸n"},
33
- {"field": "type", "title": "Tipo"}
34
- ]) }}
35
- {{ ui.logic_block("L贸gica", definition.logic) }}
36
- {{ ui.table_block("Operaciones sobre registros", definition.record_operations, [
37
- {"field": "type", "title": "Operaci贸n"},
38
- {"field": "recordType", "title": "Record"},
39
- {"field": "details", "title": "Detalles"}
40
- ]) }}
41
- {{ ui.table_block("B煤squedas", definition.searches, [
42
- {"field": "id", "title": "ID"},
43
- {"field": "filters", "title": "Filtros"},
44
- {"field": "columns", "title": "Columnas"}
45
- ]) }}
46
- {{ ui.logic_block("Salida", definition.output) }}
47
-
48
- {{ ui.list_block("Validaciones", definition.validations) }}
49
- {{ ui.list_block("Side effects", definition.side_effects) }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  {% endfor %}
51
  </div>
52
  {% endif %}
53
 
54
- {{ ui.list_block("Validaciones globales", doc.validations) }}
55
- {{ ui.table_block("Errores", doc.errors, [
56
- {"field": "location", "title": "Ubicaci贸n"},
57
- {"field": "description", "title": "Descripci贸n"},
58
- {"field": "throws", "title": "Excepci贸n"}
59
- ]) }}
60
- {{ ui.list_block("Side effects globales", doc.side_effects) }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  {% endblock %}
 
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
+
6
+ <header class="doc-header">
7
+ <h1>RESTlet 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
8
+ <p class="doc-header-meta">
9
+ SuiteScript {{ doc.metadata.suitescript_version or "N/D" }}
10
+ </p>
11
+ <p class="muted">Documentaci贸n t茅cnica del servicio RESTlet.</p>
12
+ </header>
13
 
14
  {{ ui.metadata_block(doc.metadata) }}
15
  {{ ui.summary_block(doc.summary) }}
16
 
17
+ {# ============================================================
18
+ ENDPOINTS (GET, POST, PUT, DELETE...)
19
+ ============================================================ #}
20
  {% set endpoints = doc.endpoints or {} %}
21
+ {% if endpoints and endpoints is mapping %}
22
  <div class="section">
23
  <h2>Endpoints</h2>
24
+
25
+ {% for method, definition in endpoints.items() %}
26
+
27
+ {# Saltar si la IA devolvi贸 algo no v谩lido #}
28
+ {% if not (definition and definition is mapping) %}
29
+ <h3>{{ method|upper }}</h3>
30
+ <p>No se pudo interpretar la definici贸n de este endpoint.</p>
31
+ {% continue %}
32
+ {% endif %}
33
+
34
  <h3>{{ method|upper }}</h3>
35
+
36
+ {% if definition.description %}
37
+ <p>{{ definition.description }}</p>
38
+ {% endif %}
39
+
40
+ {# ---------------------- INPUTS ---------------------- #}
41
  {% set inputs = definition.inputs or {} %}
42
+ {% if inputs is mapping %}
43
+
44
+ {% if inputs.url_params %}
45
+ {{ ui.table_block("URL params", inputs.url_params, [
46
+ {"field": "name", "title": "Nombre"},
47
+ {"field": "description", "title": "Descripci贸n"},
48
+ {"field": "type", "title": "Tipo"}
49
+ ]) }}
50
+ {% endif %}
51
+
52
+ {% if inputs.query_string %}
53
+ {{ ui.table_block("Query string", inputs.query_string, [
54
+ {"field": "name", "title": "Nombre"},
55
+ {"field": "description", "title": "Descripci贸n"},
56
+ {"field": "type", "title": "Tipo"}
57
+ ]) }}
58
+ {% endif %}
59
+
60
+ {% if inputs.body_fields %}
61
+ {{ ui.table_block("Body", inputs.body_fields, [
62
+ {"field": "name", "title": "Nombre"},
63
+ {"field": "description", "title": "Descripci贸n"},
64
+ {"field": "type", "title": "Tipo"}
65
+ ]) }}
66
+ {% endif %}
67
+
68
+ {% else %}
69
+ <p class="muted">Inputs no estructurados o no disponibles.</p>
70
+ {% endif %}
71
+
72
+ {# ---------------------- L脫GICA ---------------------- #}
73
+ {% if definition.logic %}
74
+ {{ ui.logic_block("L贸gica", definition.logic) }}
75
+ {% endif %}
76
+
77
+ {# ---------------------- OPERACIONES ---------------------- #}
78
+ {% if definition.record_operations %}
79
+ {{ ui.table_block("Operaciones sobre registros", definition.record_operations, [
80
+ {"field": "type", "title": "Operaci贸n"},
81
+ {"field": "recordType", "title": "Record"},
82
+ {"field": "details", "title": "Detalles"}
83
+ ]) }}
84
+ {% endif %}
85
+
86
+ {% if definition.searches %}
87
+ {{ ui.table_block("B煤squedas", definition.searches, [
88
+ {"field": "id", "title": "ID"},
89
+ {"field": "filters", "title": "Filtros"},
90
+ {"field": "columns", "title": "Columnas"}
91
+ ]) }}
92
+ {% endif %}
93
+
94
+ {# ---------------------- OUTPUT ---------------------- #}
95
+ {% if definition.output %}
96
+ {{ ui.logic_block("Salida", definition.output) }}
97
+ {% endif %}
98
+
99
+ {# ---------------------- VALIDACIONES ---------------------- #}
100
+ {% if definition.validations %}
101
+ {{ ui.list_block("Validaciones", definition.validations) }}
102
+ {% endif %}
103
+
104
+ {# ---------------------- SIDE EFFECTS ---------------------- #}
105
+ {% if definition.side_effects %}
106
+ {{ ui.list_block("Side effects", definition.side_effects) }}
107
+ {% endif %}
108
+
109
  {% endfor %}
110
  </div>
111
  {% endif %}
112
 
113
+ {# VALIDACIONES GLOBALES #}
114
+ {% if doc.validations %}
115
+ {{ ui.list_block("Validaciones globales", doc.validations) }}
116
+ {% endif %}
117
+
118
+ {# ERRORES #}
119
+ {% if doc.errors %}
120
+ {% if doc.errors is mapping %}
121
+ {{ ui.list_block("Errores detectados", doc.errors.explicit_checks or []) }}
122
+ {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
123
+ {% else %}
124
+ {{ ui.table_block("Errores", doc.errors, [
125
+ {"field": "location", "title": "Ubicaci贸n"},
126
+ {"field": "description", "title": "Descripci贸n"},
127
+ {"field": "throws", "title": "Excepci贸n"}
128
+ ]) }}
129
+ {% endif %}
130
+ {% endif %}
131
+
132
+ {# SIDE EFFECTS GLOBALES #}
133
+ {% if doc.side_effects %}
134
+ {{ ui.list_block("Side effects globales", doc.side_effects) }}
135
+ {% endif %}
136
 
137
  {% endblock %}
app/templates/ScheduledScript.html.j2 CHANGED
@@ -2,66 +2,137 @@
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
- <h1>Scheduled Script 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
6
- <p class="muted">Procesos peri贸dicos y lotes programados.</p>
 
 
 
 
 
 
7
 
8
  {{ ui.metadata_block(doc.metadata) }}
9
  {{ ui.summary_block(doc.summary) }}
10
 
 
 
 
11
  {% if doc.input_data %}
12
  <div class="section">
13
  <h2>Entrada</h2>
14
- <p>{{ doc.input_data.details }}</p>
15
- {{ ui.table_block("Par谩metros", doc.input_data.parameters, [
16
- {"field": "id", "title": "Par谩metro"},
17
- {"field": "description", "title": "Descripci贸n"}
18
- ]) }}
19
- {{ ui.table_block("Filtros", doc.input_data.filters, [
20
- {"field": "field", "title": "Campo"},
21
- {"field": "operator", "title": "Operador"},
22
- {"field": "value", "title": "Valor"}
23
- ]) }}
24
- {{ ui.table_block("Columnas", doc.input_data.columns, [
25
- {"field": "name", "title": "Nombre"},
26
- {"field": "label", "title": "Etiqueta"}
27
- ]) }}
 
 
 
 
 
 
 
 
 
 
 
 
28
  </div>
29
  {% endif %}
30
 
 
 
 
31
  {% if doc.logic %}
32
  <div class="section">
33
  <h2>L贸gica</h2>
34
- <p>{{ doc.logic.steps }}</p>
35
- {{ ui.list_block("Bucles", doc.logic.loops) }}
36
- {{ ui.list_block("Condiciones", doc.logic.conditions) }}
 
 
 
 
 
 
 
 
 
37
  </div>
38
  {% endif %}
39
 
40
- {{ ui.table_block("Operaciones con registros", doc.record_operations, [
41
- {"field": "type", "title": "Operaci贸n"},
42
- {"field": "record", "title": "Record"},
43
- {"field": "details", "title": "Detalles"}
44
- ]) }}
 
 
 
 
 
45
 
46
- {{ ui.table_block("B煤squedas", doc.searches, [
47
- {"field": "type", "title": "Tipo"},
48
- {"field": "filters", "title": "Filtros"},
49
- {"field": "columns", "title": "Columnas"}
50
- ]) }}
 
 
 
 
 
51
 
 
 
 
52
  {% if doc.governance %}
53
  <div class="section">
54
  <h2>Governance</h2>
55
- <p>Usage checks: {{ doc.governance.usage_checks }}</p>
56
- <p>Yielding: {{ doc.governance.yielding }}</p>
57
- <p>Task rescheduling: {{ doc.governance.task_rescheduling }}</p>
 
 
 
 
 
 
 
 
 
58
  </div>
59
  {% endif %}
60
 
61
- {{ ui.table_block("Errores", doc.errors, [
62
- {"field": "scenario", "title": "Escenario"},
63
- {"field": "handling", "title": "Manejo"}
64
- ]) }}
65
- {{ ui.list_block("Side effects", doc.side_effects) }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  {% endblock %}
 
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
+
6
+ <header class="doc-header">
7
+ <h1>Scheduled Script 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
8
+ <p class="doc-header-meta">
9
+ SuiteScript {{ doc.metadata.suitescript_version or "N/D" }}
10
+ </p>
11
+ <p class="muted">Procesos peri贸dicos y lotes programados.</p>
12
+ </header>
13
 
14
  {{ ui.metadata_block(doc.metadata) }}
15
  {{ ui.summary_block(doc.summary) }}
16
 
17
+ {# ============================================================
18
+ INPUT DATA
19
+ ============================================================ #}
20
  {% if doc.input_data %}
21
  <div class="section">
22
  <h2>Entrada</h2>
23
+
24
+ {% if doc.input_data.details %}
25
+ <p>{{ doc.input_data.details }}</p>
26
+ {% endif %}
27
+
28
+ {% if doc.input_data.parameters %}
29
+ {{ ui.table_block("Par谩metros", doc.input_data.parameters, [
30
+ {"field": "id", "title": "Par谩metro"},
31
+ {"field": "description", "title": "Descripci贸n"}
32
+ ]) }}
33
+ {% endif %}
34
+
35
+ {% if doc.input_data.filters %}
36
+ {{ ui.table_block("Filtros", doc.input_data.filters, [
37
+ {"field": "field", "title": "Campo"},
38
+ {"field": "operator", "title": "Operador"},
39
+ {"field": "value", "title": "Valor"}
40
+ ]) }}
41
+ {% endif %}
42
+
43
+ {% if doc.input_data.columns %}
44
+ {{ ui.table_block("Columnas", doc.input_data.columns, [
45
+ {"field": "name", "title": "Nombre"},
46
+ {"field": "label", "title": "Etiqueta"}
47
+ ]) }}
48
+ {% endif %}
49
  </div>
50
  {% endif %}
51
 
52
+ {# ============================================================
53
+ L脫GICA
54
+ ============================================================ #}
55
  {% if doc.logic %}
56
  <div class="section">
57
  <h2>L贸gica</h2>
58
+
59
+ {% if doc.logic.steps %}
60
+ <p>{{ doc.logic.steps }}</p>
61
+ {% endif %}
62
+
63
+ {% if doc.logic.loops %}
64
+ {{ ui.list_block("Bucles", doc.logic.loops) }}
65
+ {% endif %}
66
+
67
+ {% if doc.logic.conditions %}
68
+ {{ ui.list_block("Condiciones", doc.logic.conditions) }}
69
+ {% endif %}
70
  </div>
71
  {% endif %}
72
 
73
+ {# ============================================================
74
+ OPERACIONES CON REGISTROS
75
+ ============================================================ #}
76
+ {% if doc.record_operations %}
77
+ {{ ui.table_block("Operaciones con registros", doc.record_operations, [
78
+ {"field": "type", "title": "Operaci贸n"},
79
+ {"field": "record", "title": "Record"},
80
+ {"field": "details", "title": "Detalles"}
81
+ ]) }}
82
+ {% endif %}
83
 
84
+ {# ============================================================
85
+ B脷SQUEDAS
86
+ ============================================================ #}
87
+ {% if doc.searches %}
88
+ {{ ui.table_block("B煤squedas", doc.searches, [
89
+ {"field": "type", "title": "Tipo"},
90
+ {"field": "filters", "title": "Filtros"},
91
+ {"field": "columns", "title": "Columnas"}
92
+ ]) }}
93
+ {% endif %}
94
 
95
+ {# ============================================================
96
+ GOVERNANCE
97
+ ============================================================ #}
98
  {% if doc.governance %}
99
  <div class="section">
100
  <h2>Governance</h2>
101
+
102
+ {% if doc.governance.usage_checks %}
103
+ <p><strong>Usage checks:</strong> {{ doc.governance.usage_checks }}</p>
104
+ {% endif %}
105
+
106
+ {% if doc.governance.yielding %}
107
+ <p><strong>Yielding:</strong> {{ doc.governance.yielding }}</p>
108
+ {% endif %}
109
+
110
+ {% if doc.governance.task_rescheduling %}
111
+ <p><strong>Task rescheduling:</strong> {{ doc.governance.task_rescheduling }}</p>
112
+ {% endif %}
113
  </div>
114
  {% endif %}
115
 
116
+ {# ============================================================
117
+ ERRORES
118
+ ============================================================ #}
119
+ {% if doc.errors %}
120
+ {% if doc.errors is mapping %}
121
+ {{ ui.list_block("Escenarios de error", doc.errors.scenarios or []) }}
122
+ {{ ui.list_block("Manejo", doc.errors.handling or []) }}
123
+ {% else %}
124
+ {{ ui.table_block("Errores", doc.errors, [
125
+ {"field": "scenario", "title": "Escenario"},
126
+ {"field": "handling", "title": "Manejo"}
127
+ ]) }}
128
+ {% endif %}
129
+ {% endif %}
130
+
131
+ {# ============================================================
132
+ SIDE EFFECTS
133
+ ============================================================ #}
134
+ {% if doc.side_effects %}
135
+ {{ ui.list_block("Side effects", doc.side_effects) }}
136
+ {% endif %}
137
 
138
  {% endblock %}
app/templates/UserEventScript.html.j2 CHANGED
@@ -2,37 +2,84 @@
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
- <h1>User Event 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
6
- <p class="muted">Eventos server-side sobre records.</p>
 
 
 
 
 
 
7
 
8
  {{ ui.metadata_block(doc.metadata) }}
9
  {{ ui.summary_block(doc.summary) }}
10
 
 
 
 
11
  {% if doc.events %}
12
  <div class="section">
13
  <h2>Eventos implementados</h2>
14
- {% for name, description in doc.events.items() if description %}
15
- <h3>{{ name }}</h3>
16
- <p>{{ description }}</p>
17
- {% endfor %}
 
 
 
 
18
  </div>
19
  {% endif %}
20
 
21
- {{ ui.list_block("Validaciones", doc.validations) }}
22
- {{ ui.table_block("B煤squedas", doc.searches, [
23
- {"field": "type", "title": "Tipo"},
24
- {"field": "filters", "title": "Filtros"},
25
- {"field": "columns", "title": "Columnas"}
26
- ]) }}
27
- {{ ui.table_block("Operaciones en registros", doc.record_operations, [
28
- {"field": "type", "title": "Operaci贸n"},
29
- {"field": "record", "title": "Record"},
30
- {"field": "details", "title": "Detalles"}
31
- ]) }}
32
- {{ ui.list_block("Side effects", doc.side_effects) }}
33
- {{ ui.table_block("Errores", doc.errors, [
34
- {"field": "location", "title": "Ubicaci贸n"},
35
- {"field": "description", "title": "Descripci贸n"}
36
- ]) }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  {% endblock %}
 
2
  {% import "components.html.j2" as ui %}
3
 
4
  {% block content %}
5
+
6
+ <header class="doc-header">
7
+ <h1>User Event 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
8
+ <p class="doc-header-meta">
9
+ SuiteScript {{ doc.metadata.suitescript_version or "N/D" }}
10
+ </p>
11
+ <p class="muted">Eventos server-side sobre records.</p>
12
+ </header>
13
 
14
  {{ ui.metadata_block(doc.metadata) }}
15
  {{ ui.summary_block(doc.summary) }}
16
 
17
+ {# ============================================================
18
+ EVENTOS IMPLEMENTADOS
19
+ ============================================================ #}
20
  {% if doc.events %}
21
  <div class="section">
22
  <h2>Eventos implementados</h2>
23
+ {% if doc.events is mapping %}
24
+ {% for name, description in doc.events.items() if description %}
25
+ <h3>{{ name }}</h3>
26
+ <p>{{ description }}</p>
27
+ {% endfor %}
28
+ {% else %}
29
+ <p>{{ doc.events }}</p>
30
+ {% endif %}
31
  </div>
32
  {% endif %}
33
 
34
+ {# ============================================================
35
+ VALIDACIONES
36
+ ============================================================ #}
37
+ {% if doc.validations %}
38
+ {{ ui.list_block("Validaciones", doc.validations) }}
39
+ {% endif %}
40
+
41
+ {# ============================================================
42
+ B脷SQUEDAS
43
+ ============================================================ #}
44
+ {% if doc.searches %}
45
+ {{ ui.table_block("B煤squedas", doc.searches, [
46
+ {"field": "type", "title": "Tipo"},
47
+ {"field": "filters", "title": "Filtros"},
48
+ {"field": "columns", "title": "Columnas"}
49
+ ]) }}
50
+ {% endif %}
51
+
52
+ {# ============================================================
53
+ OPERACIONES EN REGISTROS
54
+ ============================================================ #}
55
+ {% if doc.record_operations %}
56
+ {{ ui.table_block("Operaciones en registros", doc.record_operations, [
57
+ {"field": "type", "title": "Operaci贸n"},
58
+ {"field": "record", "title": "Record"},
59
+ {"field": "details", "title": "Detalles"}
60
+ ]) }}
61
+ {% endif %}
62
+
63
+ {# ============================================================
64
+ SIDE EFFECTS
65
+ ============================================================ #}
66
+ {% if doc.side_effects %}
67
+ {{ ui.list_block("Side effects", doc.side_effects) }}
68
+ {% endif %}
69
+
70
+ {# ============================================================
71
+ ERRORES
72
+ ============================================================ #}
73
+ {% if doc.errors %}
74
+ {% if doc.errors is mapping %}
75
+ {{ ui.list_block("Errores detectados", doc.errors.explicit_checks or []) }}
76
+ {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
77
+ {% else %}
78
+ {{ ui.table_block("Errores", doc.errors, [
79
+ {"field": "location", "title": "Ubicaci贸n"},
80
+ {"field": "description", "title": "Descripci贸n"}
81
+ ]) }}
82
+ {% endif %}
83
+ {% endif %}
84
 
85
  {% endblock %}
app/templates/components.html.j2 CHANGED
@@ -50,6 +50,7 @@
50
  {% endif %}
51
  {%- endmacro %}
52
 
 
53
  {% macro table_block(title, rows, columns) -%}
54
  {% if rows %}
55
  <div class="section">
@@ -64,16 +65,26 @@
64
  </thead>
65
  <tbody>
66
  {% for row in rows %}
67
- <tr>
68
- {% for column in columns %}
69
- {% set value = row.get(column.field) %}
70
- {% if value is sequence and value is not string %}
71
- <td>{{ value|join(", ") }}</td>
72
- {% else %}
73
- <td>{{ value or "" }}</td>
74
- {% endif %}
75
- {% endfor %}
76
- </tr>
 
 
 
 
 
 
 
 
 
 
77
  {% endfor %}
78
  </tbody>
79
  </table>
 
50
  {% endif %}
51
  {%- endmacro %}
52
 
53
+ {# --------- AQU脥 EST脕 EL CAMBIO IMPORTANTE --------- #}
54
  {% macro table_block(title, rows, columns) -%}
55
  {% if rows %}
56
  <div class="section">
 
65
  </thead>
66
  <tbody>
67
  {% for row in rows %}
68
+ {# Si row es un dict: comportamiento normal #}
69
+ {% if row is mapping %}
70
+ <tr>
71
+ {% for column in columns %}
72
+ {% set value = row.get(column.field) %}
73
+ {% if value is sequence and value is not string %}
74
+ <td>{{ value|join(", ") }}</td>
75
+ {% else %}
76
+ <td>{{ value or "" }}</td>
77
+ {% endif %}
78
+ {% endfor %}
79
+ </tr>
80
+ {% else %}
81
+ {# Fallback: fila no estructurada (string, n煤mero, etc.) #}
82
+ <tr>
83
+ <td colspan="{{ columns|length }}">
84
+ {{ row }}
85
+ </td>
86
+ </tr>
87
+ {% endif %}
88
  {% endfor %}
89
  </tbody>
90
  </table>