supatool 0.3.3 → 0.3.4

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
@@ -285,6 +285,12 @@ supatool extract --all -c "postgresql://..." -o supabase/schemas
285
285
 
286
286
  ## Changelog
287
287
 
288
+ ### v0.3.4
289
+
290
+ - **FIXED**: Corrected RLS policy to proper format
291
+ - **FIXED**: Ensured semicolon (;) is properly appended to function definitions
292
+ - **FIXED**: Removed trailing whitespace from RLS template files
293
+
288
294
  ### v0.3.3
289
295
 
290
296
  - **ENHANCED**: Improved SQL comment placement (moved to end of each SQL statement)
@@ -157,11 +157,8 @@ async function fetchRlsPolicies(client, spinner, progress, schemas = ['public'])
157
157
  if (Array.isArray(policy.roles)) {
158
158
  roles = policy.roles.join(', ');
159
159
  }
160
- else if (typeof policy.roles === 'string') {
161
- roles = policy.roles;
162
- }
163
160
  else {
164
- // PostgreSQLの配列リテラル形式 "{role1,role2}" の場合
161
+ // PostgreSQLの配列リテラル形式 "{role1,role2}" または単純な文字列を処理
165
162
  roles = String(policy.roles)
166
163
  .replace(/[{}]/g, '') // 中括弧を除去
167
164
  .replace(/"/g, ''); // ダブルクォートを除去
@@ -234,8 +231,12 @@ async function fetchFunctions(client, spinner, progress, schemas = ['public']) {
234
231
  else {
235
232
  ddl += `-- ${row.comment}\n`;
236
233
  }
237
- // 関数定義を追加
238
- ddl += row.definition + '\n\n';
234
+ // 関数定義を追加(セミコロンを確実に付与)
235
+ let functionDef = row.definition;
236
+ if (!functionDef.trim().endsWith(';')) {
237
+ functionDef += ';';
238
+ }
239
+ ddl += functionDef + '\n\n';
239
240
  // COMMENT ON文を追加
240
241
  if (!row.comment) {
241
242
  ddl += `-- COMMENT ON FUNCTION ${functionSignature} IS '_your_comment_here_';\n\n`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supatool",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "A CLI tool for Supabase schema extraction and TypeScript CRUD generation with declarative database schema support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",