@ductape/sdk 0.1.123 → 0.1.124
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/dist/features/feature-executor.d.ts +5 -0
- package/dist/features/feature-executor.js +52 -0
- package/dist/features/feature-executor.js.map +1 -1
- package/dist/features/features.service.js +18 -0
- package/dist/features/features.service.js.map +1 -1
- package/dist/features/types/features.types.d.ts +31 -0
- package/dist/features/types/features.types.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/productsBuilder.types.d.ts +4 -0
- package/dist/types/productsBuilder.types.js +2 -0
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ export declare class FeatureExecutor {
|
|
|
30
30
|
private _brokersService;
|
|
31
31
|
private _storageService;
|
|
32
32
|
private _vectorService;
|
|
33
|
+
private _sessionsService;
|
|
33
34
|
private _quotaService;
|
|
34
35
|
private _fallbackService;
|
|
35
36
|
private state;
|
|
@@ -88,6 +89,8 @@ export declare class FeatureExecutor {
|
|
|
88
89
|
private getStorageService;
|
|
89
90
|
/** Lazy-initialized vector service. Used for vector steps (query/upsert/delete/execute action). */
|
|
90
91
|
private getVectorService;
|
|
92
|
+
/** Lazy-initialized session service for ctx.sessions lifecycle steps. */
|
|
93
|
+
private getSessionsService;
|
|
91
94
|
/** Lazy-initialized quota service. */
|
|
92
95
|
private getQuotaService;
|
|
93
96
|
/** Lazy-initialized fallback service. */
|
|
@@ -155,6 +158,8 @@ export declare class FeatureExecutor {
|
|
|
155
158
|
* Execute a vector step (query, upsert, deleteVectors, or custom action via execute).
|
|
156
159
|
*/
|
|
157
160
|
private executeVectorStep;
|
|
161
|
+
/** Execute a product session lifecycle step. */
|
|
162
|
+
private executeSessionStep;
|
|
158
163
|
/** Execute a portable application function through a local handler or signed HTTP transport. */
|
|
159
164
|
private executeFunctionStep;
|
|
160
165
|
/**
|
|
@@ -25,6 +25,7 @@ const brokers_1 = require("../brokers");
|
|
|
25
25
|
const storage_1 = require("../storage");
|
|
26
26
|
const vector_1 = require("../vector");
|
|
27
27
|
const resilience_1 = require("../resilience");
|
|
28
|
+
const sessions_1 = require("../sessions");
|
|
28
29
|
const logs_service_1 = __importDefault(require("../logs/logs.service"));
|
|
29
30
|
const logs_types_1 = require("../logs/logs.types");
|
|
30
31
|
const types_1 = require("../types");
|
|
@@ -141,6 +142,7 @@ class FeatureExecutor {
|
|
|
141
142
|
this._brokersService = null;
|
|
142
143
|
this._storageService = null;
|
|
143
144
|
this._vectorService = null;
|
|
145
|
+
this._sessionsService = null;
|
|
144
146
|
this._quotaService = null;
|
|
145
147
|
this._fallbackService = null;
|
|
146
148
|
this.productId = null;
|
|
@@ -344,6 +346,24 @@ class FeatureExecutor {
|
|
|
344
346
|
}
|
|
345
347
|
return this._vectorService;
|
|
346
348
|
}
|
|
349
|
+
/** Lazy-initialized session service for ctx.sessions lifecycle steps. */
|
|
350
|
+
getSessionsService() {
|
|
351
|
+
if (!this._sessionsService) {
|
|
352
|
+
this._sessionsService = new sessions_1.SessionsService({
|
|
353
|
+
workspace_id: this.config.workspace_id,
|
|
354
|
+
public_key: this.config.public_key,
|
|
355
|
+
user_id: this.config.user_id,
|
|
356
|
+
token: this.config.token,
|
|
357
|
+
env_type: this.config.env_type,
|
|
358
|
+
redis_client: this.config.redis_client,
|
|
359
|
+
access_key: this.config.access_key,
|
|
360
|
+
workspace_private_key: this._privateKey,
|
|
361
|
+
default_product: this.state.product,
|
|
362
|
+
default_env: this.state.env,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return this._sessionsService;
|
|
366
|
+
}
|
|
347
367
|
/** Lazy-initialized quota service. */
|
|
348
368
|
getQuotaService() {
|
|
349
369
|
if (!this._quotaService) {
|
|
@@ -847,6 +867,9 @@ class FeatureExecutor {
|
|
|
847
867
|
case types_1.FeatureStepType.VECTOR:
|
|
848
868
|
output = await this.executeVectorStep(step, resolvedInput);
|
|
849
869
|
break;
|
|
870
|
+
case types_1.FeatureStepType.SESSION:
|
|
871
|
+
output = await this.executeSessionStep(step, resolvedInput);
|
|
872
|
+
break;
|
|
850
873
|
case types_1.FeatureStepType.FUNCTION:
|
|
851
874
|
output = await this.executeFunctionStep(step, resolvedInput);
|
|
852
875
|
break;
|
|
@@ -1214,6 +1237,35 @@ class FeatureExecutor {
|
|
|
1214
1237
|
}
|
|
1215
1238
|
}
|
|
1216
1239
|
}
|
|
1240
|
+
/** Execute a product session lifecycle step. */
|
|
1241
|
+
async executeSessionStep(step, input) {
|
|
1242
|
+
const sessionTag = step.session;
|
|
1243
|
+
if (!sessionTag)
|
|
1244
|
+
throw new Error(`Session step "${step.tag}" has no session tag`);
|
|
1245
|
+
const options = Object.assign({ product: this.state.product, env: this.state.env, tag: sessionTag }, input);
|
|
1246
|
+
this.trace('session.request.preparing', {
|
|
1247
|
+
step_tag: step.tag,
|
|
1248
|
+
event: step.event,
|
|
1249
|
+
session_tag: sessionTag,
|
|
1250
|
+
payload: input,
|
|
1251
|
+
});
|
|
1252
|
+
switch ((step.event || '').toLowerCase()) {
|
|
1253
|
+
case 'start':
|
|
1254
|
+
case 'create':
|
|
1255
|
+
return this.getSessionsService().create(options);
|
|
1256
|
+
case 'verify':
|
|
1257
|
+
return this.getSessionsService().verify(options);
|
|
1258
|
+
case 'refresh':
|
|
1259
|
+
return this.getSessionsService().refresh(options);
|
|
1260
|
+
case 'revoke':
|
|
1261
|
+
return this.getSessionsService().revoke(options);
|
|
1262
|
+
case 'list':
|
|
1263
|
+
case 'listactive':
|
|
1264
|
+
return this.getSessionsService().list(options);
|
|
1265
|
+
default:
|
|
1266
|
+
throw new Error(`Unsupported session Feature operation: ${step.event}`);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1217
1269
|
/** Execute a portable application function through a local handler or signed HTTP transport. */
|
|
1218
1270
|
async executeFunctionStep(step, input) {
|
|
1219
1271
|
var _a, _b, _c;
|