Package app.ductape.sdk.database
Class DatabaseService
java.lang.Object
app.ductape.sdk.database.DatabaseService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConstraint(Map<String, Object> options) TSaggregate(IAggregateOptions)whenoptionscontainsoperations.voidalterTable(Map<String, Object> options) TSbeginTransaction(ITransactionOptions).beginTransaction(Map<String, Object> options) Map-based overload for parity with existing Java map API style.voidcloseAll()TS-style connection object facade (DatabaseConnection).connectScoped(Map<String, Object> config) Map-based variant returning scoped facade while preserving existingconnect(Map)behavior.voidTSDatabaseService.create: persist database component with cloud-linked env materialization.voidcreateAction(Map<String, Object> options) createCollection(Map<String, Object> options) voidcreateIndex(Map<String, Object> options) voidcreateMigration(String productId, Map<String, Object> data) TScreateMigration.voidcreateMigration(String productId, Map<String, Object> data, boolean throwErrorIfExists) voidcreateTable(Map<String, Object> options) voidcreateTrigger(String productId, Map<String, Object> data) TSDatabaseService.createTrigger→ product API (component: database_trigger,action: create).voidcreateTrigger(String productId, Map<String, Object> data, boolean throwErrorIfExists) delete(WriteTypes.DeleteOptions options) voiddeleteAction(String tag) voiddeleteMigration(String productId, String compositeTag) TSdeleteMigration.voiddeleteTrigger(String productId, String compositeTag) TSDatabaseService.deleteTrigger.voiddispatchAction(Map<String, Object> data) TS parity fordatabase.action.dispatch: schedule database action events.dropCollection(Map<String, Object> options) dropConstraint(Map<String, Object> options) voidvoidexecuteAction(Map<String, Object> options) executeTriggers(TriggerTypes.TriggerEvent event, TriggerTypes.TriggerContext context) TSDatabaseConnection.triggers.executewith a fully built context.executeTriggers(TriggerTypes.TriggerEvent event, Map<String, Object> connectionOptions, Map<String, Object> partialContext) TSDatabaseConnection.triggers.execute— suppliesdatabaseandenv(andproduct) from connection-scoped options, likeconnection._database/connection._envin TypeScript.fetchAction(String tag) fetchActions(String tag) fetchAllDatabases(String productTag) fetchConfig(String productTag, String databaseTag) fetchConfigs(String productTag) fetchDashboard(Map<String, Object> options) fetchDatabase(String productTag, String databaseTag) fetchMigration(String productId, String compositeTag) TSfetchMigration; composite tag format:database_tag:migration_tag.fetchMigrations(String productId, String databaseTag) TSfetchMigrations.fetchPersistedActionForExecute(String product, String database, String action) fetchTrigger(String productId, String compositeTag) TSDatabaseService.fetchTrigger;tagisdatabase_tag:trigger_tag.fetchTriggers(String productId, String databaseTag) TSDatabaseService.fetchTriggers.getAdapterByContextKey(String contextKey) TSgetAdapterByContextKeyused byDatabaseConnection.getAdapter().getCollectionInfo(Map<String, Object> options) getIndexStatistics(Map<String, Object> options) getMigrationStatus(Map<String, Object> options) getSchemaSnapshot(String productTag, String env, String databaseTag) getSchemaSnapshot(Map<String, Object> options) getTableSchema(Map<String, Object> options) getToken()Session + persisted trigger registry (TriggerTypes.TriggerManager).getTriggersForEvent(String table, TriggerTypes.TriggerEvent event) TSDatabaseConnection.triggers.getTriggersForEvent.groupBy(AggregationTypes.GroupByOptions options) TSDatabaseService.groupBy.TSgroupBy(IGroupByOptions).insert(WriteTypes.InsertOptions options) voidTSTriggerProcessor.setDuctapeInstanceequivalent: routedatabase.*trigger actions to this service’sinsert(app.ductape.sdk.database.types.WriteTypes.InsertOptions),update(app.ductape.sdk.database.types.WriteTypes.UpdateOptions),delete(app.ductape.sdk.database.types.WriteTypes.DeleteOptions),query(app.ductape.sdk.database.types.QueryTypes.QueryOptions)usingproduct/database/envfrom the triggerTriggerTypes.TriggerContext.listIndexes(Map<String, Object> options) listTables(Map<String, Object> options) listTablesWithInfo(Map<String, Object> options) voidloadTriggersFromBackend(String productId, String databaseTag) TSDatabaseConnection.triggers.load: pull triggers from the product payload and register them ongetTriggerProcessor().modifyField(Map<String, Object> options) query(QueryTypes.QueryOptions options) queryStats(Map<String, Object> options) Local multi-metric helper; TS exposescount/sum/… separately — not one combined call.raw(QueryTypes.RawQueryOptions options) TSraw(IRawQueryOptions).TSraw(IRawQueryOptions)map variant.voidregisterDatabase(String productTag, Map<String, Object> data) voidregisterTrigger(String table, TriggerTypes.TriggerDefinition definition) TSDatabaseConnection.triggers.register: in-memory session trigger for this service.voidTSDatabaseConnection.triggers.registerAll.renameCollection(Map<String, Object> options) renameField(Map<String, Object> options) rollbackMigration(Map<String, Object> options) runMigration(Map<String, Object> options) voidsetCloudApiService(CloudApiService cloudApiService) TS parity: setting aCloudApiServiceenables runtime credential resolution (ResolveCloudLinkedEnvConfig-equivalent) forcloud_connection-authMode databases right before the adapter connects — refreshes ephemeral credentials and detects VPC connector tunnel mode (mirrors TSdatabases.service.ts).voidsetLogApiService(LogApiService logApiService) TS parity: setting aLogApiServiceenables structured connect-log emission (Database connect - initiated/success/failed) with theCONNECT_LOG_DEBOUNCE_MS(15s) suppression window.voidsetRuntimeDefaults(RuntimeDefaults runtimeDefaults) booleantableExists(Map<String, Object> options) testConnection(Map<String, Object> config) <T> Ttransaction(TransactionTypes.TransactionOptions options, TransactionTypes.TransactionCallback<T> callback) TStransaction(options, callback)callback flow with auto-commit/rollback.<T> Ttransaction(Map<String, Object> options, TransactionTypes.TransactionCallback<T> callback) booleanunregisterTrigger(String table, String triggerName) TSDatabaseConnection.triggers.unregister.update(WriteTypes.UpdateOptions options) voidupdateAction(Map<String, Object> options) voidupdateConfig(Map<String, Object> config) voidvoidupdateLocalConfig(String tag, Map<String, Object> updates) voidupdateMigration(String productId, Map<String, Object> data) TSupdateMigration.voidupdateTrigger(String productId, Map<String, Object> data) TSDatabaseService.updateTrigger.upsert(WriteTypes.UpsertOptions options)
-
Constructor Details
-
DatabaseService
-
-
Method Details
-
setLogApiService
TS parity: setting aLogApiServiceenables structured connect-log emission (Database connect - initiated/success/failed) with theCONNECT_LOG_DEBOUNCE_MS(15s) suppression window. -
setCloudApiService
TS parity: setting aCloudApiServiceenables runtime credential resolution (ResolveCloudLinkedEnvConfig-equivalent) forcloud_connection-authMode databases right before the adapter connects — refreshes ephemeral credentials and detects VPC connector tunnel mode (mirrors TSdatabases.service.ts). -
setRuntimeDefaults
-
updateConfig
-
getWorkspaceId
-
getUserId
-
getToken
-
getEnvType
-
create
TSDatabaseService.create: persist database component with cloud-linked env materialization. -
registerDatabase
-
fetchConfigs
-
fetchConfig
-
fetchAllDatabases
-
fetchDatabase
-
updateDatabase
-
connect
-
connect
TS-style connection object facade (DatabaseConnection). -
connectScoped
Map-based variant returning scoped facade while preserving existingconnect(Map)behavior. -
testConnection
-
disconnect
public void disconnect() -
closeAll
public void closeAll() -
fetchAll
-
fetch
-
updateLocalConfig
-
query
-
query
-
raw
TSraw(IRawQueryOptions). -
raw
TSraw(IRawQueryOptions)map variant. -
insert
-
insert
-
update
-
update
-
delete
-
delete
-
upsert
-
upsert
-
count
-
sum
-
avg
-
min
-
max
-
aggregate
-
aggregate
TSaggregate(IAggregateOptions)whenoptionscontainsoperations. Ifoperationsis absent, delegates toqueryStats(Map)(local convenience, not a single TS method). -
queryStats
Local multi-metric helper; TS exposescount/sum/… separately — not one combined call. -
groupBy
TSDatabaseService.groupBy. -
groupBy
TSgroupBy(IGroupByOptions). -
beginTransaction
TSbeginTransaction(ITransactionOptions). -
beginTransaction
Map-based overload for parity with existing Java map API style. -
transaction
public <T> T transaction(TransactionTypes.TransactionOptions options, TransactionTypes.TransactionCallback<T> callback) throws Exception TStransaction(options, callback)callback flow with auto-commit/rollback.- Throws:
Exception
-
transaction
public <T> T transaction(Map<String, Object> options, TransactionTypes.TransactionCallback<T> callback) throws Exception- Throws:
Exception
-
createTable
-
alterTable
-
dropTable
-
listTables
-
listTablesWithInfo
-
tableExists
-
getTableSchema
-
getCollectionInfo
-
createCollection
-
dropCollection
-
renameCollection
-
addField
-
dropField
-
renameField
-
modifyField
-
addConstraint
-
dropConstraint
-
createIndex
-
dropIndex
-
listIndexes
-
getIndexStatistics
-
getSchemaSnapshot
-
getSchemaSnapshot
-
runMigration
-
rollbackMigration
-
getMigrationHistory
-
getMigrationStatus
-
dispatch
-
dispatchAction
TS parity fordatabase.action.dispatch: schedule database action events. -
createAction
-
updateAction
-
fetchAction
-
fetchActions
-
deleteAction
-
executeAction
-
getCurrentContext
-
fetchDashboard
-
getTriggerProcessor
Session + persisted trigger registry (TriggerTypes.TriggerManager). CallTriggerProcessor.setDefaultContext(java.lang.String, java.lang.String)when product/database are known. -
getAdapterByContextKey
TSgetAdapterByContextKeyused byDatabaseConnection.getAdapter(). -
registerTrigger
TSDatabaseConnection.triggers.register: in-memory session trigger for this service. -
registerTriggers
TSDatabaseConnection.triggers.registerAll. -
unregisterTrigger
TSDatabaseConnection.triggers.unregister. -
getTriggersForEvent
public List<TriggerTypes.TriggerDefinition> getTriggersForEvent(String table, TriggerTypes.TriggerEvent event) TSDatabaseConnection.triggers.getTriggersForEvent. -
executeTriggers
public List<TriggerTypes.TriggerResult> executeTriggers(TriggerTypes.TriggerEvent event, TriggerTypes.TriggerContext context) TSDatabaseConnection.triggers.executewith a fully built context. -
executeTriggers
public List<TriggerTypes.TriggerResult> executeTriggers(TriggerTypes.TriggerEvent event, Map<String, Object> connectionOptions, Map<String, Object> partialContext) TSDatabaseConnection.triggers.execute— suppliesdatabaseandenv(andproduct) from connection-scoped options, likeconnection._database/connection._envin TypeScript.partialContextshould include at leasttable,record, andoperation(e.g.insert). -
installDatabaseTriggerActionRunner
public void installDatabaseTriggerActionRunner()TSTriggerProcessor.setDuctapeInstanceequivalent: routedatabase.*trigger actions to this service’sinsert(app.ductape.sdk.database.types.WriteTypes.InsertOptions),update(app.ductape.sdk.database.types.WriteTypes.UpdateOptions),delete(app.ductape.sdk.database.types.WriteTypes.DeleteOptions),query(app.ductape.sdk.database.types.QueryTypes.QueryOptions)usingproduct/database/envfrom the triggerTriggerTypes.TriggerContext. -
createTrigger
TSDatabaseService.createTrigger→ product API (component: database_trigger,action: create). -
createTrigger
-
updateTrigger
TSDatabaseService.updateTrigger. -
fetchTrigger
TSDatabaseService.fetchTrigger;tagisdatabase_tag:trigger_tag. -
fetchTriggers
TSDatabaseService.fetchTriggers. -
deleteTrigger
TSDatabaseService.deleteTrigger. -
createMigration
TScreateMigration. -
createMigration
-
updateMigration
TSupdateMigration. -
fetchMigration
TSfetchMigration; composite tag format:database_tag:migration_tag. -
fetchMigrations
TSfetchMigrations. -
deleteMigration
TSdeleteMigration. -
loadTriggersFromBackend
TSDatabaseConnection.triggers.load: pull triggers from the product payload and register them ongetTriggerProcessor(). -
fetchPersistedActionForExecute
-