@odatano/core 2.0.0-rc.17 → 2.0.0-rc.18

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/srv/server.js +14 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatano/core",
3
- "version": "2.0.0-rc.17",
3
+ "version": "2.0.0-rc.18",
4
4
  "description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
5
5
  "imports": {
6
6
  "#cds-models/*": "./@cds-models/*/index.js"
package/srv/server.js CHANGED
@@ -78,6 +78,20 @@ let bootstrapError = null;
78
78
  */
79
79
  async function initializeAppContext(config, protocolParams, hsmConfig) {
80
80
  logger.debug('Initializing blockchain components...');
81
+ // Database first, on every start path: the standalone served hook and the
82
+ // plugin's initializeFromConfig both come through here (rc.17 had these in
83
+ // initializeFromConfig only, so the standalone image never ran them).
84
+ // ORDER BY on Postgres without a NULLS clause for key / NOT NULL columns, so
85
+ // the indexes serve `$top` and `$orderby` reads (srv/utils/pg-order-nulls.ts).
86
+ (0, pg_order_nulls_1.installPostgresOrderNulls)();
87
+ // The secondary indexes the model cannot declare (srv/utils/db-indexes.ts):
88
+ // idempotent, never fatal, before anything reads.
89
+ try {
90
+ await (0, db_indexes_1.ensureDbIndexes)();
91
+ }
92
+ catch (err) {
93
+ logger.warn('secondary indexes not ensured (non-fatal):', err);
94
+ }
81
95
  // Create CardanoClient from configuration
82
96
  const cardanoClient = new cardano_client_1.CardanoClient(config);
83
97
  // Publish the active network for leaf utilities (e.g. network-aware validators)
@@ -182,17 +196,6 @@ async function initializeFromConfig(config, protocolParams, hsmConfig) {
182
196
  return;
183
197
  }
184
198
  hsmConfigInstance = hsmConfig;
185
- // ORDER BY on Postgres without a NULLS clause for key / NOT NULL columns, so
186
- // the indexes below serve `$top` and `$orderby` reads (srv/utils/pg-order-nulls.ts).
187
- (0, pg_order_nulls_1.installPostgresOrderNulls)();
188
- // The secondary indexes the model cannot declare (srv/utils/db-indexes.ts):
189
- // idempotent, never fatal, before anything reads.
190
- try {
191
- await (0, db_indexes_1.ensureDbIndexes)();
192
- }
193
- catch (err) {
194
- logger.warn('secondary indexes not ensured (non-fatal):', err);
195
- }
196
199
  try {
197
200
  appContext = await initializeAppContext(config, protocolParams, hsmConfig);
198
201
  bootstrapError = null;