@pgpmjs/export 0.12.3 → 0.13.1

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.
@@ -87,9 +87,9 @@ export const exportGraphQLMeta = async ({ client, database_id }) => {
87
87
  // metaschema_public tables
88
88
  await Promise.all([
89
89
  queryAndParse('database'),
90
- queryAndParse('database_extension'),
91
90
  queryAndParse('schema'),
92
91
  queryAndParse('function'),
92
+ queryAndParse('spatial_relation'),
93
93
  queryAndParse('table'),
94
94
  queryAndParse('field'),
95
95
  queryAndParse('policy'),
@@ -152,7 +152,21 @@ export const exportGraphQLMeta = async ({ client, database_id }) => {
152
152
  queryAndParse('secure_table_provision'),
153
153
  queryAndParse('uuid_module'),
154
154
  queryAndParse('default_ids_module'),
155
- queryAndParse('denormalized_table_field')
155
+ queryAndParse('denormalized_table_field'),
156
+ queryAndParse('relation_provision'),
157
+ queryAndParse('entity_type_provision'),
158
+ queryAndParse('rate_limits_module'),
159
+ queryAndParse('storage_module'),
160
+ queryAndParse('billing_module'),
161
+ queryAndParse('billing_provider_module'),
162
+ queryAndParse('devices_module'),
163
+ queryAndParse('identity_providers_module'),
164
+ queryAndParse('notifications_module'),
165
+ queryAndParse('plans_module'),
166
+ queryAndParse('realtime_module'),
167
+ queryAndParse('session_secrets_module'),
168
+ queryAndParse('webauthn_auth_module'),
169
+ queryAndParse('webauthn_credentials_module')
156
170
  ]);
157
171
  return sql;
158
172
  };
@@ -99,9 +99,9 @@ export const exportMeta = async ({ opts, dbname, database_id }) => {
99
99
  // metaschema_public tables
100
100
  // =============================================================================
101
101
  await queryAndParse('database', `SELECT * FROM metaschema_public.database WHERE id = $1 ORDER BY id`);
102
- await queryAndParse('database_extension', `SELECT * FROM metaschema_public.database_extension WHERE database_id = $1 ORDER BY id`);
103
102
  await queryAndParse('schema', `SELECT * FROM metaschema_public.schema WHERE database_id = $1 ORDER BY id`);
104
103
  await queryAndParse('function', `SELECT * FROM metaschema_public.function WHERE database_id = $1 ORDER BY id`);
104
+ await queryAndParse('spatial_relation', `SELECT * FROM metaschema_public.spatial_relation WHERE database_id = $1 ORDER BY id`);
105
105
  await queryAndParse('table', `SELECT * FROM metaschema_public.table WHERE database_id = $1 ORDER BY id`);
106
106
  await queryAndParse('field', `SELECT * FROM metaschema_public.field WHERE database_id = $1 ORDER BY id`);
107
107
  await queryAndParse('policy', `SELECT * FROM metaschema_public.policy WHERE database_id = $1 ORDER BY id`);
@@ -165,5 +165,19 @@ export const exportMeta = async ({ opts, dbname, database_id }) => {
165
165
  await queryAndParse('uuid_module', `SELECT * FROM metaschema_modules_public.uuid_module WHERE database_id = $1 ORDER BY id`);
166
166
  await queryAndParse('default_ids_module', `SELECT * FROM metaschema_modules_public.default_ids_module WHERE database_id = $1 ORDER BY id`);
167
167
  await queryAndParse('denormalized_table_field', `SELECT * FROM metaschema_modules_public.denormalized_table_field WHERE database_id = $1 ORDER BY id`);
168
+ await queryAndParse('relation_provision', `SELECT * FROM metaschema_modules_public.relation_provision WHERE database_id = $1 ORDER BY id`);
169
+ await queryAndParse('entity_type_provision', `SELECT * FROM metaschema_modules_public.entity_type_provision WHERE database_id = $1 ORDER BY id`);
170
+ await queryAndParse('rate_limits_module', `SELECT * FROM metaschema_modules_public.rate_limits_module WHERE database_id = $1 ORDER BY id`);
171
+ await queryAndParse('storage_module', `SELECT * FROM metaschema_modules_public.storage_module WHERE database_id = $1 ORDER BY id`);
172
+ await queryAndParse('billing_module', `SELECT * FROM metaschema_modules_public.billing_module WHERE database_id = $1 ORDER BY id`);
173
+ await queryAndParse('billing_provider_module', `SELECT * FROM metaschema_modules_public.billing_provider_module WHERE database_id = $1 ORDER BY id`);
174
+ await queryAndParse('devices_module', `SELECT * FROM metaschema_modules_public.devices_module WHERE database_id = $1 ORDER BY id`);
175
+ await queryAndParse('identity_providers_module', `SELECT * FROM metaschema_modules_public.identity_providers_module WHERE database_id = $1 ORDER BY id`);
176
+ await queryAndParse('notifications_module', `SELECT * FROM metaschema_modules_public.notifications_module WHERE database_id = $1 ORDER BY id`);
177
+ await queryAndParse('plans_module', `SELECT * FROM metaschema_modules_public.plans_module WHERE database_id = $1 ORDER BY id`);
178
+ await queryAndParse('realtime_module', `SELECT * FROM metaschema_modules_public.realtime_module WHERE database_id = $1 ORDER BY id`);
179
+ await queryAndParse('session_secrets_module', `SELECT * FROM metaschema_modules_public.session_secrets_module WHERE database_id = $1 ORDER BY id`);
180
+ await queryAndParse('webauthn_auth_module', `SELECT * FROM metaschema_modules_public.webauthn_auth_module WHERE database_id = $1 ORDER BY id`);
181
+ await queryAndParse('webauthn_credentials_module', `SELECT * FROM metaschema_modules_public.webauthn_credentials_module WHERE database_id = $1 ORDER BY id`);
168
182
  return sql;
169
183
  };
@@ -118,6 +118,7 @@ export const META_TABLE_ORDER = [
118
118
  'function',
119
119
  'table',
120
120
  'field',
121
+ 'spatial_relation',
121
122
  'policy',
122
123
  'index',
123
124
  'trigger',
@@ -172,7 +173,21 @@ export const META_TABLE_ORDER = [
172
173
  'uuid_module',
173
174
  'default_ids_module',
174
175
  'denormalized_table_field',
175
- 'table_template_module'
176
+ 'table_template_module',
177
+ 'relation_provision',
178
+ 'entity_type_provision',
179
+ 'rate_limits_module',
180
+ 'storage_module',
181
+ 'billing_module',
182
+ 'billing_provider_module',
183
+ 'devices_module',
184
+ 'identity_providers_module',
185
+ 'notifications_module',
186
+ 'plans_module',
187
+ 'realtime_module',
188
+ 'session_secrets_module',
189
+ 'webauthn_auth_module',
190
+ 'webauthn_credentials_module'
176
191
  ];
177
192
  /**
178
193
  * Shared metadata table configuration.
@@ -199,16 +214,6 @@ export const META_TABLE_CONFIG = {
199
214
  hash: 'uuid'
200
215
  }
201
216
  },
202
- database_extension: {
203
- schema: 'metaschema_public',
204
- table: 'database_extension',
205
- fields: {
206
- id: 'uuid',
207
- database_id: 'uuid',
208
- name: 'text',
209
- schema_id: 'uuid'
210
- }
211
- },
212
217
  schema: {
213
218
  schema: 'metaschema_public',
214
219
  table: 'schema',
@@ -1080,9 +1085,8 @@ export const META_TABLE_CONFIG = {
1080
1085
  schema_id: 'uuid',
1081
1086
  table_id: 'uuid',
1082
1087
  table_name: 'text',
1083
- node_type: 'text',
1088
+ nodes: 'jsonb',
1084
1089
  use_rls: 'boolean',
1085
- node_data: 'jsonb',
1086
1090
  fields: 'jsonb[]',
1087
1091
  grants: 'jsonb',
1088
1092
  policies: 'jsonb',
@@ -1125,6 +1129,314 @@ export const META_TABLE_CONFIG = {
1125
1129
  func_name: 'text',
1126
1130
  func_order: 'int'
1127
1131
  }
1132
+ },
1133
+ relation_provision: {
1134
+ schema: 'metaschema_modules_public',
1135
+ table: 'relation_provision',
1136
+ fields: {
1137
+ id: 'uuid',
1138
+ database_id: 'uuid',
1139
+ relation_type: 'text',
1140
+ source_table_id: 'uuid',
1141
+ target_table_id: 'uuid',
1142
+ field_name: 'text',
1143
+ delete_action: 'text',
1144
+ is_required: 'boolean',
1145
+ api_required: 'boolean',
1146
+ junction_table_id: 'uuid',
1147
+ junction_table_name: 'text',
1148
+ junction_schema_id: 'uuid',
1149
+ source_field_name: 'text',
1150
+ target_field_name: 'text',
1151
+ use_composite_key: 'boolean',
1152
+ create_index: 'boolean',
1153
+ expose_in_api: 'boolean',
1154
+ nodes: 'jsonb',
1155
+ grants: 'jsonb',
1156
+ policies: 'jsonb',
1157
+ out_field_id: 'uuid',
1158
+ out_junction_table_id: 'uuid',
1159
+ out_source_field_id: 'uuid',
1160
+ out_target_field_id: 'uuid'
1161
+ }
1162
+ },
1163
+ rate_limits_module: {
1164
+ schema: 'metaschema_modules_public',
1165
+ table: 'rate_limits_module',
1166
+ fields: {
1167
+ id: 'uuid',
1168
+ database_id: 'uuid',
1169
+ schema_id: 'uuid',
1170
+ rate_limit_settings_table_id: 'uuid',
1171
+ ip_rate_limits_table_id: 'uuid',
1172
+ rate_limits_table_id: 'uuid',
1173
+ rate_limit_settings_table: 'text',
1174
+ ip_rate_limits_table: 'text',
1175
+ rate_limits_table: 'text'
1176
+ }
1177
+ },
1178
+ storage_module: {
1179
+ schema: 'metaschema_modules_public',
1180
+ table: 'storage_module',
1181
+ fields: {
1182
+ id: 'uuid',
1183
+ database_id: 'uuid',
1184
+ schema_id: 'uuid',
1185
+ private_schema_id: 'uuid',
1186
+ buckets_table_id: 'uuid',
1187
+ files_table_id: 'uuid',
1188
+ buckets_table_name: 'text',
1189
+ files_table_name: 'text',
1190
+ membership_type: 'int',
1191
+ policies: 'jsonb',
1192
+ skip_default_policy_tables: 'text[]',
1193
+ entity_table_id: 'uuid',
1194
+ endpoint: 'text',
1195
+ public_url_prefix: 'text',
1196
+ provider: 'text',
1197
+ allowed_origins: 'text[]',
1198
+ restrict_reads: 'boolean',
1199
+ has_path_shares: 'boolean',
1200
+ path_shares_table_id: 'uuid',
1201
+ upload_url_expiry_seconds: 'int',
1202
+ download_url_expiry_seconds: 'int',
1203
+ max_filename_length: 'int',
1204
+ cache_ttl_seconds: 'int',
1205
+ max_bulk_files: 'int',
1206
+ has_versioning: 'boolean',
1207
+ has_content_hash: 'boolean',
1208
+ has_custom_keys: 'boolean',
1209
+ has_audit_log: 'boolean',
1210
+ file_events_table_id: 'uuid'
1211
+ }
1212
+ },
1213
+ entity_type_provision: {
1214
+ schema: 'metaschema_modules_public',
1215
+ table: 'entity_type_provision',
1216
+ fields: {
1217
+ id: 'uuid',
1218
+ database_id: 'uuid',
1219
+ name: 'text',
1220
+ prefix: 'text',
1221
+ description: 'text',
1222
+ parent_entity: 'text',
1223
+ table_name: 'text',
1224
+ is_visible: 'boolean',
1225
+ has_limits: 'boolean',
1226
+ has_profiles: 'boolean',
1227
+ has_levels: 'boolean',
1228
+ has_storage: 'boolean',
1229
+ has_invites: 'boolean',
1230
+ storage_config: 'jsonb',
1231
+ skip_entity_policies: 'boolean',
1232
+ table_provision: 'jsonb',
1233
+ out_membership_type: 'int',
1234
+ out_entity_table_id: 'uuid',
1235
+ out_entity_table_name: 'text',
1236
+ out_installed_modules: 'text[]',
1237
+ out_storage_module_id: 'uuid',
1238
+ out_buckets_table_id: 'uuid',
1239
+ out_files_table_id: 'uuid',
1240
+ out_path_shares_table_id: 'uuid',
1241
+ out_invites_module_id: 'uuid'
1242
+ }
1243
+ },
1244
+ billing_module: {
1245
+ schema: 'metaschema_modules_public',
1246
+ table: 'billing_module',
1247
+ fields: {
1248
+ id: 'uuid',
1249
+ database_id: 'uuid',
1250
+ schema_id: 'uuid',
1251
+ private_schema_id: 'uuid',
1252
+ meters_table_id: 'uuid',
1253
+ meters_table_name: 'text',
1254
+ plan_subscriptions_table_id: 'uuid',
1255
+ plan_subscriptions_table_name: 'text',
1256
+ ledger_table_id: 'uuid',
1257
+ ledger_table_name: 'text',
1258
+ balances_table_id: 'uuid',
1259
+ balances_table_name: 'text',
1260
+ record_usage_function: 'text',
1261
+ prefix: 'text'
1262
+ }
1263
+ },
1264
+ billing_provider_module: {
1265
+ schema: 'metaschema_modules_public',
1266
+ table: 'billing_provider_module',
1267
+ fields: {
1268
+ id: 'uuid',
1269
+ database_id: 'uuid',
1270
+ schema_id: 'uuid',
1271
+ private_schema_id: 'uuid',
1272
+ provider: 'text',
1273
+ products_table_id: 'uuid',
1274
+ prices_table_id: 'uuid',
1275
+ subscriptions_table_id: 'uuid',
1276
+ billing_customers_table_id: 'uuid',
1277
+ billing_customers_table_name: 'text',
1278
+ billing_products_table_id: 'uuid',
1279
+ billing_products_table_name: 'text',
1280
+ billing_prices_table_id: 'uuid',
1281
+ billing_prices_table_name: 'text',
1282
+ billing_subscriptions_table_id: 'uuid',
1283
+ billing_subscriptions_table_name: 'text',
1284
+ billing_webhook_events_table_id: 'uuid',
1285
+ billing_webhook_events_table_name: 'text',
1286
+ process_billing_event_function: 'text',
1287
+ prefix: 'text'
1288
+ }
1289
+ },
1290
+ devices_module: {
1291
+ schema: 'metaschema_modules_public',
1292
+ table: 'devices_module',
1293
+ fields: {
1294
+ id: 'uuid',
1295
+ database_id: 'uuid',
1296
+ schema_id: 'uuid',
1297
+ user_devices_table_id: 'uuid',
1298
+ device_settings_table_id: 'uuid',
1299
+ user_devices_table: 'text',
1300
+ device_settings_table: 'text'
1301
+ }
1302
+ },
1303
+ identity_providers_module: {
1304
+ schema: 'metaschema_modules_public',
1305
+ table: 'identity_providers_module',
1306
+ fields: {
1307
+ id: 'uuid',
1308
+ database_id: 'uuid',
1309
+ schema_id: 'uuid',
1310
+ private_schema_id: 'uuid',
1311
+ table_id: 'uuid',
1312
+ table_name: 'text'
1313
+ }
1314
+ },
1315
+ notifications_module: {
1316
+ schema: 'metaschema_modules_public',
1317
+ table: 'notifications_module',
1318
+ fields: {
1319
+ id: 'uuid',
1320
+ database_id: 'uuid',
1321
+ schema_id: 'uuid',
1322
+ private_schema_id: 'uuid',
1323
+ notifications_table_id: 'uuid',
1324
+ read_state_table_id: 'uuid',
1325
+ preferences_table_id: 'uuid',
1326
+ channels_table_id: 'uuid',
1327
+ delivery_log_table_id: 'uuid',
1328
+ owner_table_id: 'uuid',
1329
+ user_settings_table_id: 'uuid',
1330
+ organization_settings_table_id: 'uuid',
1331
+ has_channels: 'boolean',
1332
+ has_preferences: 'boolean',
1333
+ has_settings_extension: 'boolean',
1334
+ has_digest_metadata: 'boolean',
1335
+ has_subscriptions: 'boolean'
1336
+ }
1337
+ },
1338
+ plans_module: {
1339
+ schema: 'metaschema_modules_public',
1340
+ table: 'plans_module',
1341
+ fields: {
1342
+ id: 'uuid',
1343
+ database_id: 'uuid',
1344
+ schema_id: 'uuid',
1345
+ private_schema_id: 'uuid',
1346
+ plans_table_id: 'uuid',
1347
+ plans_table_name: 'text',
1348
+ plan_limits_table_id: 'uuid',
1349
+ plan_limits_table_name: 'text',
1350
+ plan_pricing_table_id: 'uuid',
1351
+ plan_overrides_table_id: 'uuid',
1352
+ apply_plan_function: 'text',
1353
+ apply_plan_aggregate_function: 'text',
1354
+ prefix: 'text'
1355
+ }
1356
+ },
1357
+ realtime_module: {
1358
+ schema: 'metaschema_modules_public',
1359
+ table: 'realtime_module',
1360
+ fields: {
1361
+ id: 'uuid',
1362
+ database_id: 'uuid',
1363
+ schema_id: 'uuid',
1364
+ private_schema_id: 'uuid',
1365
+ subscriptions_schema_id: 'uuid',
1366
+ change_log_table_id: 'uuid',
1367
+ listener_node_table_id: 'uuid',
1368
+ source_registry_table_id: 'uuid',
1369
+ retention_hours: 'int',
1370
+ lookahead_hours: 'int',
1371
+ partition_interval: 'text',
1372
+ notify_channel: 'text'
1373
+ }
1374
+ },
1375
+ session_secrets_module: {
1376
+ schema: 'metaschema_modules_public',
1377
+ table: 'session_secrets_module',
1378
+ fields: {
1379
+ id: 'uuid',
1380
+ database_id: 'uuid',
1381
+ schema_id: 'uuid',
1382
+ table_id: 'uuid',
1383
+ table_name: 'text',
1384
+ sessions_table_id: 'uuid'
1385
+ }
1386
+ },
1387
+ webauthn_auth_module: {
1388
+ schema: 'metaschema_modules_public',
1389
+ table: 'webauthn_auth_module',
1390
+ fields: {
1391
+ id: 'uuid',
1392
+ database_id: 'uuid',
1393
+ schema_id: 'uuid',
1394
+ users_table_id: 'uuid',
1395
+ credentials_table_id: 'uuid',
1396
+ sessions_table_id: 'uuid',
1397
+ session_credentials_table_id: 'uuid',
1398
+ session_secrets_table_id: 'uuid',
1399
+ auth_settings_table_id: 'uuid',
1400
+ rp_id: 'text',
1401
+ rp_name: 'text',
1402
+ origin_allowlist: 'text[]',
1403
+ attestation_type: 'text',
1404
+ require_user_verification: 'boolean',
1405
+ resident_key: 'text',
1406
+ challenge_expiry: 'interval'
1407
+ }
1408
+ },
1409
+ webauthn_credentials_module: {
1410
+ schema: 'metaschema_modules_public',
1411
+ table: 'webauthn_credentials_module',
1412
+ fields: {
1413
+ id: 'uuid',
1414
+ database_id: 'uuid',
1415
+ schema_id: 'uuid',
1416
+ private_schema_id: 'uuid',
1417
+ table_id: 'uuid',
1418
+ owner_table_id: 'uuid',
1419
+ table_name: 'text'
1420
+ }
1421
+ },
1422
+ spatial_relation: {
1423
+ schema: 'metaschema_public',
1424
+ table: 'spatial_relation',
1425
+ fields: {
1426
+ id: 'uuid',
1427
+ database_id: 'uuid',
1428
+ table_id: 'uuid',
1429
+ field_id: 'uuid',
1430
+ ref_table_id: 'uuid',
1431
+ ref_field_id: 'uuid',
1432
+ name: 'text',
1433
+ operator: 'text',
1434
+ param_name: 'text',
1435
+ category: 'text',
1436
+ module: 'text',
1437
+ scope: 'int',
1438
+ tags: 'text[]'
1439
+ }
1128
1440
  }
1129
1441
  };
1130
1442
  // =============================================================================
@@ -90,9 +90,9 @@ const exportGraphQLMeta = async ({ client, database_id }) => {
90
90
  // metaschema_public tables
91
91
  await Promise.all([
92
92
  queryAndParse('database'),
93
- queryAndParse('database_extension'),
94
93
  queryAndParse('schema'),
95
94
  queryAndParse('function'),
95
+ queryAndParse('spatial_relation'),
96
96
  queryAndParse('table'),
97
97
  queryAndParse('field'),
98
98
  queryAndParse('policy'),
@@ -155,7 +155,21 @@ const exportGraphQLMeta = async ({ client, database_id }) => {
155
155
  queryAndParse('secure_table_provision'),
156
156
  queryAndParse('uuid_module'),
157
157
  queryAndParse('default_ids_module'),
158
- queryAndParse('denormalized_table_field')
158
+ queryAndParse('denormalized_table_field'),
159
+ queryAndParse('relation_provision'),
160
+ queryAndParse('entity_type_provision'),
161
+ queryAndParse('rate_limits_module'),
162
+ queryAndParse('storage_module'),
163
+ queryAndParse('billing_module'),
164
+ queryAndParse('billing_provider_module'),
165
+ queryAndParse('devices_module'),
166
+ queryAndParse('identity_providers_module'),
167
+ queryAndParse('notifications_module'),
168
+ queryAndParse('plans_module'),
169
+ queryAndParse('realtime_module'),
170
+ queryAndParse('session_secrets_module'),
171
+ queryAndParse('webauthn_auth_module'),
172
+ queryAndParse('webauthn_credentials_module')
159
173
  ]);
160
174
  return sql;
161
175
  };
package/export-meta.js CHANGED
@@ -102,9 +102,9 @@ const exportMeta = async ({ opts, dbname, database_id }) => {
102
102
  // metaschema_public tables
103
103
  // =============================================================================
104
104
  await queryAndParse('database', `SELECT * FROM metaschema_public.database WHERE id = $1 ORDER BY id`);
105
- await queryAndParse('database_extension', `SELECT * FROM metaschema_public.database_extension WHERE database_id = $1 ORDER BY id`);
106
105
  await queryAndParse('schema', `SELECT * FROM metaschema_public.schema WHERE database_id = $1 ORDER BY id`);
107
106
  await queryAndParse('function', `SELECT * FROM metaschema_public.function WHERE database_id = $1 ORDER BY id`);
107
+ await queryAndParse('spatial_relation', `SELECT * FROM metaschema_public.spatial_relation WHERE database_id = $1 ORDER BY id`);
108
108
  await queryAndParse('table', `SELECT * FROM metaschema_public.table WHERE database_id = $1 ORDER BY id`);
109
109
  await queryAndParse('field', `SELECT * FROM metaschema_public.field WHERE database_id = $1 ORDER BY id`);
110
110
  await queryAndParse('policy', `SELECT * FROM metaschema_public.policy WHERE database_id = $1 ORDER BY id`);
@@ -168,6 +168,20 @@ const exportMeta = async ({ opts, dbname, database_id }) => {
168
168
  await queryAndParse('uuid_module', `SELECT * FROM metaschema_modules_public.uuid_module WHERE database_id = $1 ORDER BY id`);
169
169
  await queryAndParse('default_ids_module', `SELECT * FROM metaschema_modules_public.default_ids_module WHERE database_id = $1 ORDER BY id`);
170
170
  await queryAndParse('denormalized_table_field', `SELECT * FROM metaschema_modules_public.denormalized_table_field WHERE database_id = $1 ORDER BY id`);
171
+ await queryAndParse('relation_provision', `SELECT * FROM metaschema_modules_public.relation_provision WHERE database_id = $1 ORDER BY id`);
172
+ await queryAndParse('entity_type_provision', `SELECT * FROM metaschema_modules_public.entity_type_provision WHERE database_id = $1 ORDER BY id`);
173
+ await queryAndParse('rate_limits_module', `SELECT * FROM metaschema_modules_public.rate_limits_module WHERE database_id = $1 ORDER BY id`);
174
+ await queryAndParse('storage_module', `SELECT * FROM metaschema_modules_public.storage_module WHERE database_id = $1 ORDER BY id`);
175
+ await queryAndParse('billing_module', `SELECT * FROM metaschema_modules_public.billing_module WHERE database_id = $1 ORDER BY id`);
176
+ await queryAndParse('billing_provider_module', `SELECT * FROM metaschema_modules_public.billing_provider_module WHERE database_id = $1 ORDER BY id`);
177
+ await queryAndParse('devices_module', `SELECT * FROM metaschema_modules_public.devices_module WHERE database_id = $1 ORDER BY id`);
178
+ await queryAndParse('identity_providers_module', `SELECT * FROM metaschema_modules_public.identity_providers_module WHERE database_id = $1 ORDER BY id`);
179
+ await queryAndParse('notifications_module', `SELECT * FROM metaschema_modules_public.notifications_module WHERE database_id = $1 ORDER BY id`);
180
+ await queryAndParse('plans_module', `SELECT * FROM metaschema_modules_public.plans_module WHERE database_id = $1 ORDER BY id`);
181
+ await queryAndParse('realtime_module', `SELECT * FROM metaschema_modules_public.realtime_module WHERE database_id = $1 ORDER BY id`);
182
+ await queryAndParse('session_secrets_module', `SELECT * FROM metaschema_modules_public.session_secrets_module WHERE database_id = $1 ORDER BY id`);
183
+ await queryAndParse('webauthn_auth_module', `SELECT * FROM metaschema_modules_public.webauthn_auth_module WHERE database_id = $1 ORDER BY id`);
184
+ await queryAndParse('webauthn_credentials_module', `SELECT * FROM metaschema_modules_public.webauthn_credentials_module WHERE database_id = $1 ORDER BY id`);
171
185
  return sql;
172
186
  };
173
187
  exports.exportMeta = exportMeta;
package/export-utils.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare const META_COMMON_FOOTER = "\nSET session_replication_role TO DEF
23
23
  * Ordered list of meta tables for export.
24
24
  * Tables are processed in this order to satisfy foreign key dependencies.
25
25
  */
26
- export declare const META_TABLE_ORDER: readonly ["database", "schema", "function", "table", "field", "policy", "index", "trigger", "trigger_function", "rls_function", "foreign_key_constraint", "primary_key_constraint", "unique_constraint", "check_constraint", "full_text_search", "schema_grant", "table_grant", "default_privilege", "domains", "sites", "apis", "apps", "site_modules", "site_themes", "site_metadata", "api_modules", "api_extensions", "api_schemas", "database_settings", "api_settings", "rls_settings", "cors_settings", "pubkey_settings", "webauthn_settings", "rls_module", "user_auth_module", "memberships_module", "permissions_module", "limits_module", "levels_module", "users_module", "hierarchy_module", "membership_types_module", "invites_module", "emails_module", "sessions_module", "secrets_module", "profiles_module", "encrypted_secrets_module", "connected_accounts_module", "phone_numbers_module", "crypto_addresses_module", "crypto_auth_module", "field_module", "table_module", "secure_table_provision", "uuid_module", "default_ids_module", "denormalized_table_field", "table_template_module"];
26
+ export declare const META_TABLE_ORDER: readonly ["database", "schema", "function", "table", "field", "spatial_relation", "policy", "index", "trigger", "trigger_function", "rls_function", "foreign_key_constraint", "primary_key_constraint", "unique_constraint", "check_constraint", "full_text_search", "schema_grant", "table_grant", "default_privilege", "domains", "sites", "apis", "apps", "site_modules", "site_themes", "site_metadata", "api_modules", "api_extensions", "api_schemas", "database_settings", "api_settings", "rls_settings", "cors_settings", "pubkey_settings", "webauthn_settings", "rls_module", "user_auth_module", "memberships_module", "permissions_module", "limits_module", "levels_module", "users_module", "hierarchy_module", "membership_types_module", "invites_module", "emails_module", "sessions_module", "secrets_module", "profiles_module", "encrypted_secrets_module", "connected_accounts_module", "phone_numbers_module", "crypto_addresses_module", "crypto_auth_module", "field_module", "table_module", "secure_table_provision", "uuid_module", "default_ids_module", "denormalized_table_field", "table_template_module", "relation_provision", "entity_type_provision", "rate_limits_module", "storage_module", "billing_module", "billing_provider_module", "devices_module", "identity_providers_module", "notifications_module", "plans_module", "realtime_module", "session_secrets_module", "webauthn_auth_module", "webauthn_credentials_module"];
27
27
  export type FieldType = 'uuid' | 'uuid[]' | 'text' | 'text[]' | 'boolean' | 'image' | 'upload' | 'url' | 'jsonb' | 'jsonb[]' | 'int' | 'interval' | 'timestamptz';
28
28
  export interface TableConfig {
29
29
  schema: string;
package/export-utils.js CHANGED
@@ -124,6 +124,7 @@ exports.META_TABLE_ORDER = [
124
124
  'function',
125
125
  'table',
126
126
  'field',
127
+ 'spatial_relation',
127
128
  'policy',
128
129
  'index',
129
130
  'trigger',
@@ -178,7 +179,21 @@ exports.META_TABLE_ORDER = [
178
179
  'uuid_module',
179
180
  'default_ids_module',
180
181
  'denormalized_table_field',
181
- 'table_template_module'
182
+ 'table_template_module',
183
+ 'relation_provision',
184
+ 'entity_type_provision',
185
+ 'rate_limits_module',
186
+ 'storage_module',
187
+ 'billing_module',
188
+ 'billing_provider_module',
189
+ 'devices_module',
190
+ 'identity_providers_module',
191
+ 'notifications_module',
192
+ 'plans_module',
193
+ 'realtime_module',
194
+ 'session_secrets_module',
195
+ 'webauthn_auth_module',
196
+ 'webauthn_credentials_module'
182
197
  ];
183
198
  /**
184
199
  * Shared metadata table configuration.
@@ -205,16 +220,6 @@ exports.META_TABLE_CONFIG = {
205
220
  hash: 'uuid'
206
221
  }
207
222
  },
208
- database_extension: {
209
- schema: 'metaschema_public',
210
- table: 'database_extension',
211
- fields: {
212
- id: 'uuid',
213
- database_id: 'uuid',
214
- name: 'text',
215
- schema_id: 'uuid'
216
- }
217
- },
218
223
  schema: {
219
224
  schema: 'metaschema_public',
220
225
  table: 'schema',
@@ -1086,9 +1091,8 @@ exports.META_TABLE_CONFIG = {
1086
1091
  schema_id: 'uuid',
1087
1092
  table_id: 'uuid',
1088
1093
  table_name: 'text',
1089
- node_type: 'text',
1094
+ nodes: 'jsonb',
1090
1095
  use_rls: 'boolean',
1091
- node_data: 'jsonb',
1092
1096
  fields: 'jsonb[]',
1093
1097
  grants: 'jsonb',
1094
1098
  policies: 'jsonb',
@@ -1131,6 +1135,314 @@ exports.META_TABLE_CONFIG = {
1131
1135
  func_name: 'text',
1132
1136
  func_order: 'int'
1133
1137
  }
1138
+ },
1139
+ relation_provision: {
1140
+ schema: 'metaschema_modules_public',
1141
+ table: 'relation_provision',
1142
+ fields: {
1143
+ id: 'uuid',
1144
+ database_id: 'uuid',
1145
+ relation_type: 'text',
1146
+ source_table_id: 'uuid',
1147
+ target_table_id: 'uuid',
1148
+ field_name: 'text',
1149
+ delete_action: 'text',
1150
+ is_required: 'boolean',
1151
+ api_required: 'boolean',
1152
+ junction_table_id: 'uuid',
1153
+ junction_table_name: 'text',
1154
+ junction_schema_id: 'uuid',
1155
+ source_field_name: 'text',
1156
+ target_field_name: 'text',
1157
+ use_composite_key: 'boolean',
1158
+ create_index: 'boolean',
1159
+ expose_in_api: 'boolean',
1160
+ nodes: 'jsonb',
1161
+ grants: 'jsonb',
1162
+ policies: 'jsonb',
1163
+ out_field_id: 'uuid',
1164
+ out_junction_table_id: 'uuid',
1165
+ out_source_field_id: 'uuid',
1166
+ out_target_field_id: 'uuid'
1167
+ }
1168
+ },
1169
+ rate_limits_module: {
1170
+ schema: 'metaschema_modules_public',
1171
+ table: 'rate_limits_module',
1172
+ fields: {
1173
+ id: 'uuid',
1174
+ database_id: 'uuid',
1175
+ schema_id: 'uuid',
1176
+ rate_limit_settings_table_id: 'uuid',
1177
+ ip_rate_limits_table_id: 'uuid',
1178
+ rate_limits_table_id: 'uuid',
1179
+ rate_limit_settings_table: 'text',
1180
+ ip_rate_limits_table: 'text',
1181
+ rate_limits_table: 'text'
1182
+ }
1183
+ },
1184
+ storage_module: {
1185
+ schema: 'metaschema_modules_public',
1186
+ table: 'storage_module',
1187
+ fields: {
1188
+ id: 'uuid',
1189
+ database_id: 'uuid',
1190
+ schema_id: 'uuid',
1191
+ private_schema_id: 'uuid',
1192
+ buckets_table_id: 'uuid',
1193
+ files_table_id: 'uuid',
1194
+ buckets_table_name: 'text',
1195
+ files_table_name: 'text',
1196
+ membership_type: 'int',
1197
+ policies: 'jsonb',
1198
+ skip_default_policy_tables: 'text[]',
1199
+ entity_table_id: 'uuid',
1200
+ endpoint: 'text',
1201
+ public_url_prefix: 'text',
1202
+ provider: 'text',
1203
+ allowed_origins: 'text[]',
1204
+ restrict_reads: 'boolean',
1205
+ has_path_shares: 'boolean',
1206
+ path_shares_table_id: 'uuid',
1207
+ upload_url_expiry_seconds: 'int',
1208
+ download_url_expiry_seconds: 'int',
1209
+ max_filename_length: 'int',
1210
+ cache_ttl_seconds: 'int',
1211
+ max_bulk_files: 'int',
1212
+ has_versioning: 'boolean',
1213
+ has_content_hash: 'boolean',
1214
+ has_custom_keys: 'boolean',
1215
+ has_audit_log: 'boolean',
1216
+ file_events_table_id: 'uuid'
1217
+ }
1218
+ },
1219
+ entity_type_provision: {
1220
+ schema: 'metaschema_modules_public',
1221
+ table: 'entity_type_provision',
1222
+ fields: {
1223
+ id: 'uuid',
1224
+ database_id: 'uuid',
1225
+ name: 'text',
1226
+ prefix: 'text',
1227
+ description: 'text',
1228
+ parent_entity: 'text',
1229
+ table_name: 'text',
1230
+ is_visible: 'boolean',
1231
+ has_limits: 'boolean',
1232
+ has_profiles: 'boolean',
1233
+ has_levels: 'boolean',
1234
+ has_storage: 'boolean',
1235
+ has_invites: 'boolean',
1236
+ storage_config: 'jsonb',
1237
+ skip_entity_policies: 'boolean',
1238
+ table_provision: 'jsonb',
1239
+ out_membership_type: 'int',
1240
+ out_entity_table_id: 'uuid',
1241
+ out_entity_table_name: 'text',
1242
+ out_installed_modules: 'text[]',
1243
+ out_storage_module_id: 'uuid',
1244
+ out_buckets_table_id: 'uuid',
1245
+ out_files_table_id: 'uuid',
1246
+ out_path_shares_table_id: 'uuid',
1247
+ out_invites_module_id: 'uuid'
1248
+ }
1249
+ },
1250
+ billing_module: {
1251
+ schema: 'metaschema_modules_public',
1252
+ table: 'billing_module',
1253
+ fields: {
1254
+ id: 'uuid',
1255
+ database_id: 'uuid',
1256
+ schema_id: 'uuid',
1257
+ private_schema_id: 'uuid',
1258
+ meters_table_id: 'uuid',
1259
+ meters_table_name: 'text',
1260
+ plan_subscriptions_table_id: 'uuid',
1261
+ plan_subscriptions_table_name: 'text',
1262
+ ledger_table_id: 'uuid',
1263
+ ledger_table_name: 'text',
1264
+ balances_table_id: 'uuid',
1265
+ balances_table_name: 'text',
1266
+ record_usage_function: 'text',
1267
+ prefix: 'text'
1268
+ }
1269
+ },
1270
+ billing_provider_module: {
1271
+ schema: 'metaschema_modules_public',
1272
+ table: 'billing_provider_module',
1273
+ fields: {
1274
+ id: 'uuid',
1275
+ database_id: 'uuid',
1276
+ schema_id: 'uuid',
1277
+ private_schema_id: 'uuid',
1278
+ provider: 'text',
1279
+ products_table_id: 'uuid',
1280
+ prices_table_id: 'uuid',
1281
+ subscriptions_table_id: 'uuid',
1282
+ billing_customers_table_id: 'uuid',
1283
+ billing_customers_table_name: 'text',
1284
+ billing_products_table_id: 'uuid',
1285
+ billing_products_table_name: 'text',
1286
+ billing_prices_table_id: 'uuid',
1287
+ billing_prices_table_name: 'text',
1288
+ billing_subscriptions_table_id: 'uuid',
1289
+ billing_subscriptions_table_name: 'text',
1290
+ billing_webhook_events_table_id: 'uuid',
1291
+ billing_webhook_events_table_name: 'text',
1292
+ process_billing_event_function: 'text',
1293
+ prefix: 'text'
1294
+ }
1295
+ },
1296
+ devices_module: {
1297
+ schema: 'metaschema_modules_public',
1298
+ table: 'devices_module',
1299
+ fields: {
1300
+ id: 'uuid',
1301
+ database_id: 'uuid',
1302
+ schema_id: 'uuid',
1303
+ user_devices_table_id: 'uuid',
1304
+ device_settings_table_id: 'uuid',
1305
+ user_devices_table: 'text',
1306
+ device_settings_table: 'text'
1307
+ }
1308
+ },
1309
+ identity_providers_module: {
1310
+ schema: 'metaschema_modules_public',
1311
+ table: 'identity_providers_module',
1312
+ fields: {
1313
+ id: 'uuid',
1314
+ database_id: 'uuid',
1315
+ schema_id: 'uuid',
1316
+ private_schema_id: 'uuid',
1317
+ table_id: 'uuid',
1318
+ table_name: 'text'
1319
+ }
1320
+ },
1321
+ notifications_module: {
1322
+ schema: 'metaschema_modules_public',
1323
+ table: 'notifications_module',
1324
+ fields: {
1325
+ id: 'uuid',
1326
+ database_id: 'uuid',
1327
+ schema_id: 'uuid',
1328
+ private_schema_id: 'uuid',
1329
+ notifications_table_id: 'uuid',
1330
+ read_state_table_id: 'uuid',
1331
+ preferences_table_id: 'uuid',
1332
+ channels_table_id: 'uuid',
1333
+ delivery_log_table_id: 'uuid',
1334
+ owner_table_id: 'uuid',
1335
+ user_settings_table_id: 'uuid',
1336
+ organization_settings_table_id: 'uuid',
1337
+ has_channels: 'boolean',
1338
+ has_preferences: 'boolean',
1339
+ has_settings_extension: 'boolean',
1340
+ has_digest_metadata: 'boolean',
1341
+ has_subscriptions: 'boolean'
1342
+ }
1343
+ },
1344
+ plans_module: {
1345
+ schema: 'metaschema_modules_public',
1346
+ table: 'plans_module',
1347
+ fields: {
1348
+ id: 'uuid',
1349
+ database_id: 'uuid',
1350
+ schema_id: 'uuid',
1351
+ private_schema_id: 'uuid',
1352
+ plans_table_id: 'uuid',
1353
+ plans_table_name: 'text',
1354
+ plan_limits_table_id: 'uuid',
1355
+ plan_limits_table_name: 'text',
1356
+ plan_pricing_table_id: 'uuid',
1357
+ plan_overrides_table_id: 'uuid',
1358
+ apply_plan_function: 'text',
1359
+ apply_plan_aggregate_function: 'text',
1360
+ prefix: 'text'
1361
+ }
1362
+ },
1363
+ realtime_module: {
1364
+ schema: 'metaschema_modules_public',
1365
+ table: 'realtime_module',
1366
+ fields: {
1367
+ id: 'uuid',
1368
+ database_id: 'uuid',
1369
+ schema_id: 'uuid',
1370
+ private_schema_id: 'uuid',
1371
+ subscriptions_schema_id: 'uuid',
1372
+ change_log_table_id: 'uuid',
1373
+ listener_node_table_id: 'uuid',
1374
+ source_registry_table_id: 'uuid',
1375
+ retention_hours: 'int',
1376
+ lookahead_hours: 'int',
1377
+ partition_interval: 'text',
1378
+ notify_channel: 'text'
1379
+ }
1380
+ },
1381
+ session_secrets_module: {
1382
+ schema: 'metaschema_modules_public',
1383
+ table: 'session_secrets_module',
1384
+ fields: {
1385
+ id: 'uuid',
1386
+ database_id: 'uuid',
1387
+ schema_id: 'uuid',
1388
+ table_id: 'uuid',
1389
+ table_name: 'text',
1390
+ sessions_table_id: 'uuid'
1391
+ }
1392
+ },
1393
+ webauthn_auth_module: {
1394
+ schema: 'metaschema_modules_public',
1395
+ table: 'webauthn_auth_module',
1396
+ fields: {
1397
+ id: 'uuid',
1398
+ database_id: 'uuid',
1399
+ schema_id: 'uuid',
1400
+ users_table_id: 'uuid',
1401
+ credentials_table_id: 'uuid',
1402
+ sessions_table_id: 'uuid',
1403
+ session_credentials_table_id: 'uuid',
1404
+ session_secrets_table_id: 'uuid',
1405
+ auth_settings_table_id: 'uuid',
1406
+ rp_id: 'text',
1407
+ rp_name: 'text',
1408
+ origin_allowlist: 'text[]',
1409
+ attestation_type: 'text',
1410
+ require_user_verification: 'boolean',
1411
+ resident_key: 'text',
1412
+ challenge_expiry: 'interval'
1413
+ }
1414
+ },
1415
+ webauthn_credentials_module: {
1416
+ schema: 'metaschema_modules_public',
1417
+ table: 'webauthn_credentials_module',
1418
+ fields: {
1419
+ id: 'uuid',
1420
+ database_id: 'uuid',
1421
+ schema_id: 'uuid',
1422
+ private_schema_id: 'uuid',
1423
+ table_id: 'uuid',
1424
+ owner_table_id: 'uuid',
1425
+ table_name: 'text'
1426
+ }
1427
+ },
1428
+ spatial_relation: {
1429
+ schema: 'metaschema_public',
1430
+ table: 'spatial_relation',
1431
+ fields: {
1432
+ id: 'uuid',
1433
+ database_id: 'uuid',
1434
+ table_id: 'uuid',
1435
+ field_id: 'uuid',
1436
+ ref_table_id: 'uuid',
1437
+ ref_field_id: 'uuid',
1438
+ name: 'text',
1439
+ operator: 'text',
1440
+ param_name: 'text',
1441
+ category: 'text',
1442
+ module: 'text',
1443
+ scope: 'int',
1444
+ tags: 'text[]'
1445
+ }
1134
1446
  }
1135
1447
  };
1136
1448
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/export",
3
- "version": "0.12.3",
3
+ "version": "0.13.1",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM export tools for SQL and GraphQL database migration extraction",
6
6
  "main": "index.js",
@@ -41,11 +41,11 @@
41
41
  "@pgsql/types": "^17.6.2",
42
42
  "@types/pg": "^8.18.0",
43
43
  "makage": "^0.3.0",
44
- "pgsql-test": "^4.13.1"
44
+ "pgsql-test": "^4.13.2"
45
45
  },
46
46
  "dependencies": {
47
47
  "@pgpmjs/core": "^6.17.1",
48
- "@pgpmjs/migrate-client": "^0.12.3",
48
+ "@pgpmjs/migrate-client": "^0.12.4",
49
49
  "@pgpmjs/types": "^2.26.1",
50
50
  "csv-to-pg": "^3.16.1",
51
51
  "glob": "^13.0.6",
@@ -55,5 +55,5 @@
55
55
  "pg-cache": "^3.9.1",
56
56
  "pg-env": "^1.13.1"
57
57
  },
58
- "gitHead": "a4774481064e5cc16ca64f83cd705931e2b58250"
58
+ "gitHead": "ea590e1b9e1ee38c267f8dbbb37aa3f83a5d3fb7"
59
59
  }