@kosdev-code/kos-ui-sdk 3.0.16 → 3.0.17
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/core/core/decorators/index.d.ts +1 -0
- package/core/core/decorators/index.d.ts.map +1 -1
- package/core/core/decorators/kos-execute-service-request.d.ts +37 -0
- package/core/core/decorators/kos-execute-service-request.d.ts.map +1 -0
- package/core/core/decorators/kos-execution-context.d.ts +8 -0
- package/core/core/decorators/kos-execution-context.d.ts.map +1 -1
- package/core/core/decorators/kos-service-request.d.ts.map +1 -1
- package/index.cjs +23 -1
- package/index.cjs.map +1 -1
- package/index.js +23 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1208,6 +1208,25 @@ function kosContext(_target, _propertyKey, descriptor) {
|
|
|
1208
1208
|
return originalMethod.apply(this, args);
|
|
1209
1209
|
};
|
|
1210
1210
|
}
|
|
1211
|
+
async function executeServiceRequest(host, $ctx, params2) {
|
|
1212
|
+
const name = $ctx?.$name ?? "service request";
|
|
1213
|
+
if (!$ctx?.$request) {
|
|
1214
|
+
host.logger.error(
|
|
1215
|
+
`${name}: missing execution context — executeServiceRequest is for method-driven requests; a @kosServiceRequest with a lifecycle receives (error, data) instead and needs no helper`
|
|
1216
|
+
);
|
|
1217
|
+
return void 0;
|
|
1218
|
+
}
|
|
1219
|
+
const [error, data] = await $ctx.$request(params2);
|
|
1220
|
+
if (error) {
|
|
1221
|
+
host.logger.error(`${name}: request failed`, error);
|
|
1222
|
+
return void 0;
|
|
1223
|
+
}
|
|
1224
|
+
if (data == null) {
|
|
1225
|
+
host.logger.error(`${name}: no data returned`);
|
|
1226
|
+
return void 0;
|
|
1227
|
+
}
|
|
1228
|
+
return data;
|
|
1229
|
+
}
|
|
1211
1230
|
const KOS_EXECUTION_CONTEXT = /* @__PURE__ */ Symbol("KosExecutionContext");
|
|
1212
1231
|
function isKosExecutionContext(obj) {
|
|
1213
1232
|
return obj && typeof obj === "object" && KOS_EXECUTION_CONTEXT in obj;
|
|
@@ -1582,11 +1601,13 @@ function kosServiceRequest$9(params2) {
|
|
|
1582
1601
|
};
|
|
1583
1602
|
if (isKosExecutionContext(lastArg)) {
|
|
1584
1603
|
lastArg.$request = executor;
|
|
1604
|
+
lastArg.$name = String(propertyKey);
|
|
1585
1605
|
return originalHandler.apply(this, args);
|
|
1586
1606
|
} else {
|
|
1587
1607
|
const context = {
|
|
1588
1608
|
[KOS_EXECUTION_CONTEXT]: true,
|
|
1589
|
-
$request: executor
|
|
1609
|
+
$request: executor,
|
|
1610
|
+
$name: String(propertyKey)
|
|
1590
1611
|
};
|
|
1591
1612
|
return originalHandler.apply(this, [...args, context]);
|
|
1592
1613
|
}
|
|
@@ -29208,6 +29229,7 @@ export {
|
|
|
29208
29229
|
executeChildrenModelLifecycle,
|
|
29209
29230
|
executeDependentModelLifecycle,
|
|
29210
29231
|
executeListLifecycle,
|
|
29232
|
+
executeServiceRequest,
|
|
29211
29233
|
fetchModel,
|
|
29212
29234
|
findModel,
|
|
29213
29235
|
findModels,
|