@egdesk/next-api-plugin 1.2.0 → 1.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.
|
@@ -88,7 +88,8 @@ function generateApiWrapper(projectPath) {
|
|
|
88
88
|
* Generated by @egdesk/next-api-plugin
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
|
-
const
|
|
91
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
92
|
+
const basePath = isDev ? '' : (process.env.NEXT_PUBLIC_EGDESK_BASE_PATH || '');
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
* Fetch wrapper that handles basePath for tunneled environments
|
package/dist/setup-userdata.d.ts
CHANGED
package/dist/setup-userdata.js
CHANGED
|
@@ -163,7 +163,7 @@ function updateEnvLocal(projectPath, config) {
|
|
|
163
163
|
'',
|
|
164
164
|
'# Available Tables',
|
|
165
165
|
`# Total tables: ${config.tables.length}`,
|
|
166
|
-
...config.tables.map((table, index) => `# ${index + 1}. ${table.displayName} (${table.tableName}) - ${table.rowCount} rows, ${table.columnCount} columns`),
|
|
166
|
+
...config.tables.map((table, index) => `# ${index + 1}. ${table.displayName} (${table.tableName}) - ${table.rowCount != null ? table.rowCount : '?'} rows, ${table.columnCount} columns`),
|
|
167
167
|
''
|
|
168
168
|
].join('\n');
|
|
169
169
|
fs.writeFileSync(envPath, envContent.replace(/\r?\n/g, os.EOL), 'utf-8');
|
|
@@ -190,20 +190,26 @@ export interface TableDefinition {
|
|
|
190
190
|
name: string;
|
|
191
191
|
displayName: string;
|
|
192
192
|
description?: string;
|
|
193
|
-
|
|
193
|
+
/** Omitted or unknown until synced / counted */
|
|
194
|
+
rowCount?: number;
|
|
194
195
|
columnCount: number;
|
|
195
196
|
columns: string[];
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
export const TABLES = {
|
|
199
|
-
${config.tables.map((table, index) =>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
${config.tables.map((table, index) => {
|
|
201
|
+
const properties = [
|
|
202
|
+
`name: '${table.tableName}'`,
|
|
203
|
+
`displayName: '${table.displayName}'`,
|
|
204
|
+
table.description ? `description: '${table.description}'` : null,
|
|
205
|
+
table.rowCount != null ? `rowCount: ${table.rowCount}` : null,
|
|
206
|
+
`columnCount: ${table.columnCount}`,
|
|
207
|
+
`columns: [${table.columns.map(col => `'${col}'`).join(', ')}]`
|
|
208
|
+
].filter(Boolean).join(',\n ');
|
|
209
|
+
return ` table${index + 1}: {
|
|
210
|
+
${properties}
|
|
211
|
+
} as TableDefinition`;
|
|
212
|
+
}).join(',\n')}
|
|
207
213
|
} as const;
|
|
208
214
|
|
|
209
215
|
${config.tables.length > 0 ? `
|
package/package.json
CHANGED
|
@@ -61,7 +61,8 @@ export function generateApiWrapper(projectPath: string): void {
|
|
|
61
61
|
* Generated by @egdesk/next-api-plugin
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
const
|
|
64
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
65
|
+
const basePath = isDev ? '' : (process.env.NEXT_PUBLIC_EGDESK_BASE_PATH || '');
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
68
|
* Fetch wrapper that handles basePath for tunneled environments
|
package/src/setup-userdata.ts
CHANGED
|
@@ -14,7 +14,8 @@ export interface UserDataTable {
|
|
|
14
14
|
tableName: string;
|
|
15
15
|
displayName: string;
|
|
16
16
|
description?: string;
|
|
17
|
-
|
|
17
|
+
/** May be unknown until the table is synced or counted */
|
|
18
|
+
rowCount?: number;
|
|
18
19
|
columnCount: number;
|
|
19
20
|
columns: string[];
|
|
20
21
|
}
|
|
@@ -168,7 +169,7 @@ export function updateEnvLocal(
|
|
|
168
169
|
'# Available Tables',
|
|
169
170
|
`# Total tables: ${config.tables.length}`,
|
|
170
171
|
...config.tables.map((table, index) =>
|
|
171
|
-
`# ${index + 1}. ${table.displayName} (${table.tableName}) - ${table.rowCount} rows, ${table.columnCount} columns`
|
|
172
|
+
`# ${index + 1}. ${table.displayName} (${table.tableName}) - ${table.rowCount != null ? table.rowCount : '?'} rows, ${table.columnCount} columns`
|
|
172
173
|
),
|
|
173
174
|
''
|
|
174
175
|
].join('\n');
|
|
@@ -202,20 +203,27 @@ export interface TableDefinition {
|
|
|
202
203
|
name: string;
|
|
203
204
|
displayName: string;
|
|
204
205
|
description?: string;
|
|
205
|
-
|
|
206
|
+
/** Omitted or unknown until synced / counted */
|
|
207
|
+
rowCount?: number;
|
|
206
208
|
columnCount: number;
|
|
207
209
|
columns: string[];
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
export const TABLES = {
|
|
211
|
-
${config.tables.map((table, index) =>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
${config.tables.map((table, index) => {
|
|
214
|
+
const properties = [
|
|
215
|
+
`name: '${table.tableName}'`,
|
|
216
|
+
`displayName: '${table.displayName}'`,
|
|
217
|
+
table.description ? `description: '${table.description}'` : null,
|
|
218
|
+
table.rowCount != null ? `rowCount: ${table.rowCount}` : null,
|
|
219
|
+
`columnCount: ${table.columnCount}`,
|
|
220
|
+
`columns: [${table.columns.map(col => `'${col}'`).join(', ')}]`
|
|
221
|
+
].filter(Boolean).join(',\n ');
|
|
222
|
+
|
|
223
|
+
return ` table${index + 1}: {
|
|
224
|
+
${properties}
|
|
225
|
+
} as TableDefinition`;
|
|
226
|
+
}).join(',\n')}
|
|
219
227
|
} as const;
|
|
220
228
|
|
|
221
229
|
${config.tables.length > 0 ? `
|