@steerprotocol/data-connector-loader 5.0.0-next.3 → 5.0.0-next.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.
@@ -136,7 +136,8 @@ class BundleBase {
136
136
  }
137
137
  }
138
138
  setExecutionContextStrategyExecution(executionContext, forceDeposit) {
139
- var _a;
139
+ if (!this.module)
140
+ throw new Error("Module not initialized");
140
141
  // Determine the timestamp for epoch
141
142
  const timestamp = this.subtractDate(executionContext.executionTimestamp, Number(executionContext.epochLength)).getTime();
142
143
  // Divide milliseconds data to seconds for transformation bundle
@@ -146,20 +147,27 @@ class BundleBase {
146
147
  if (completeConfig.triggerStyle && forceDeposit === true) {
147
148
  completeConfig.triggerStyle = "None";
148
149
  }
149
- (_a = this.module) === null || _a === void 0 ? void 0 : _a.initialize(JSON.stringify(completeConfig, bigIntReplacer));
150
+ if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
151
+ false) {
152
+ throw new Error("Strategy initialization failed");
153
+ }
150
154
  }
151
155
  /**
152
156
  * Initializes a strategy from an already resolved SDK context. Unlike the
153
157
  * legacy setter this deliberately does not derive a timestamp or block.
154
158
  */
155
159
  initializeStrategyWithContext(executionContext, forceDeposit) {
156
- var _a;
160
+ if (!this.module)
161
+ throw new Error("Module not initialized");
157
162
  this.executionContext = executionContext;
158
163
  const completeConfig = Object.assign(Object.assign({}, JSON.parse(this.config)), executionContext);
159
164
  if (completeConfig.triggerStyle && forceDeposit === true) {
160
165
  completeConfig.triggerStyle = "None";
161
166
  }
162
- (_a = this.module) === null || _a === void 0 ? void 0 : _a.initialize(JSON.stringify(completeConfig, bigIntReplacer));
167
+ if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
168
+ false) {
169
+ throw new Error("Strategy initialization failed");
170
+ }
163
171
  }
164
172
  setExecutionContextDataConnector(executionContext) {
165
173
  var _a;
@@ -114,6 +114,8 @@ export class BundleBase {
114
114
  }
115
115
  }
116
116
  setExecutionContextStrategyExecution(executionContext, forceDeposit) {
117
+ if (!this.module)
118
+ throw new Error("Module not initialized");
117
119
  // Determine the timestamp for epoch
118
120
  const timestamp = this.subtractDate(executionContext.executionTimestamp, Number(executionContext.epochLength)).getTime();
119
121
  // Divide milliseconds data to seconds for transformation bundle
@@ -129,13 +131,18 @@ export class BundleBase {
129
131
  if (completeConfig.triggerStyle && forceDeposit === true) {
130
132
  completeConfig.triggerStyle = "None";
131
133
  }
132
- this.module?.initialize(JSON.stringify(completeConfig, bigIntReplacer));
134
+ if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
135
+ false) {
136
+ throw new Error("Strategy initialization failed");
137
+ }
133
138
  }
134
139
  /**
135
140
  * Initializes a strategy from an already resolved SDK context. Unlike the
136
141
  * legacy setter this deliberately does not derive a timestamp or block.
137
142
  */
138
143
  initializeStrategyWithContext(executionContext, forceDeposit) {
144
+ if (!this.module)
145
+ throw new Error("Module not initialized");
139
146
  this.executionContext = executionContext;
140
147
  const completeConfig = {
141
148
  ...JSON.parse(this.config),
@@ -144,7 +151,10 @@ export class BundleBase {
144
151
  if (completeConfig.triggerStyle && forceDeposit === true) {
145
152
  completeConfig.triggerStyle = "None";
146
153
  }
147
- this.module?.initialize(JSON.stringify(completeConfig, bigIntReplacer));
154
+ if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
155
+ false) {
156
+ throw new Error("Strategy initialization failed");
157
+ }
148
158
  }
149
159
  setExecutionContextDataConnector(executionContext) {
150
160
  // Determine the timestamp for epoch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerprotocol/data-connector-loader",
3
- "version": "5.0.0-next.3",
3
+ "version": "5.0.0-next.4",
4
4
  "description": "App Loader for Steer Protocol",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",