tnp-core 21.0.155 → 21.0.157
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/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/bin/start.js +1 -1
- package/browser/fesm2022/tnp-core-browser.mjs +74 -1
- package/browser/fesm2022/tnp-core-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/tnp-core-browser.d.ts +24 -2
- package/browser-prod/fesm2022/tnp-core-browser-prod.mjs +74 -1
- package/browser-prod/fesm2022/tnp-core-browser-prod.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/tnp-core-browser-prod.d.ts +24 -2
- package/cli.backend.js +2 -2
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/helpers.js +7 -7
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/taon-state-machine.d.ts +20 -0
- package/lib/taon-state-machine.js +54 -0
- package/lib/taon-state-machine.js.map +1 -0
- package/lib/taon-state-machine.test.d.ts +1 -0
- package/lib/utils-md-docs.d.ts +2 -0
- package/lib/utils-md-docs.js +25 -3
- package/lib/utils-md-docs.js.map +1 -1
- package/lib-esm/app.hosts.d.ts +2 -2
- package/lib-esm/app.hosts.js +4 -4
- package/lib-esm/app.js +1 -1
- package/lib-esm/app.js.map +1 -1
- package/lib-esm/cli.backend.d.ts +1 -1
- package/lib-esm/cli.backend.js +1 -1
- package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-esm/lib/helpers.js +7 -7
- package/lib-esm/lib/helpers.js.map +1 -1
- package/lib-esm/lib/index.d.ts +1 -0
- package/lib-esm/lib/index.js +1 -0
- package/lib-esm/lib/index.js.map +1 -1
- package/lib-esm/lib/taon-state-machine.d.ts +20 -0
- package/lib-esm/lib/taon-state-machine.js +50 -0
- package/lib-esm/lib/taon-state-machine.js.map +1 -0
- package/lib-esm/lib/utils-md-docs.d.ts +2 -0
- package/lib-esm/lib/utils-md-docs.js +25 -3
- package/lib-esm/lib/utils-md-docs.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/helpers.js +7 -7
- package/lib-prod/helpers.js.map +1 -1
- package/lib-prod/index.d.ts +1 -0
- package/lib-prod/index.js +1 -0
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/taon-state-machine.d.ts +20 -0
- package/lib-prod/taon-state-machine.js +50 -0
- package/lib-prod/taon-state-machine.js.map +1 -0
- package/lib-prod/utils-md-docs.d.ts +2 -0
- package/lib-prod/utils-md-docs.js +25 -3
- package/lib-prod/utils-md-docs.js.map +1 -1
- package/package.json +3 -2
- package/websql/fesm2022/tnp-core-websql.mjs +74 -1
- package/websql/fesm2022/tnp-core-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/tnp-core-websql.d.ts +24 -2
- package/websql-prod/fesm2022/tnp-core-websql-prod.mjs +74 -1
- package/websql-prod/fesm2022/tnp-core-websql-prod.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/tnp-core-websql-prod.d.ts +24 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commitHash": "
|
|
3
|
-
"commitName": "
|
|
4
|
-
"commitDate": "
|
|
2
|
+
"commitHash": "94558c47b9063bdde21f5f3aaae567dc739c1304",
|
|
3
|
+
"commitName": "feat: state machine current value observable",
|
|
4
|
+
"commitDate": "26-08-2026 00:33:19"
|
|
5
5
|
}
|
package/bin/start.js
CHANGED
|
@@ -13345,6 +13345,35 @@ var UtilsMdDocs;
|
|
|
13345
13345
|
/* */
|
|
13346
13346
|
/* */
|
|
13347
13347
|
/* */
|
|
13348
|
+
/* */
|
|
13349
|
+
/* */
|
|
13350
|
+
/* */
|
|
13351
|
+
/* */
|
|
13352
|
+
/* */
|
|
13353
|
+
/* */
|
|
13354
|
+
/* */
|
|
13355
|
+
/* */
|
|
13356
|
+
/* */
|
|
13357
|
+
/* */
|
|
13358
|
+
/* */
|
|
13359
|
+
/* */
|
|
13360
|
+
/* */
|
|
13361
|
+
/* */
|
|
13362
|
+
/* */
|
|
13363
|
+
/* */
|
|
13364
|
+
/* */
|
|
13365
|
+
/* */
|
|
13366
|
+
/* */
|
|
13367
|
+
/* */
|
|
13368
|
+
/* */
|
|
13369
|
+
/* */
|
|
13370
|
+
/* */
|
|
13371
|
+
/* */
|
|
13372
|
+
/* */
|
|
13373
|
+
/* */
|
|
13374
|
+
/* */
|
|
13375
|
+
/* */
|
|
13376
|
+
/* */
|
|
13348
13377
|
return (void 0);
|
|
13349
13378
|
}
|
|
13350
13379
|
UtilsMdDocs.getRenderImports = getRenderImports;
|
|
@@ -13420,6 +13449,50 @@ var UtilsMdDocs;
|
|
|
13420
13449
|
//#endregion
|
|
13421
13450
|
})(UtilsMdDocs || (UtilsMdDocs = {}));
|
|
13422
13451
|
|
|
13452
|
+
class TaonStateMachine {
|
|
13453
|
+
constructor(config) {
|
|
13454
|
+
this.config = config;
|
|
13455
|
+
this._currentValue = config.defaultValue;
|
|
13456
|
+
this.currentStateSubject = new BehaviorSubject(config.defaultValue);
|
|
13457
|
+
this.currentState$ = this.currentStateSubject.asObservable();
|
|
13458
|
+
}
|
|
13459
|
+
get debugMode() {
|
|
13460
|
+
return !!this.config?.debugMode;
|
|
13461
|
+
}
|
|
13462
|
+
get currentValue() {
|
|
13463
|
+
return this._currentValue;
|
|
13464
|
+
}
|
|
13465
|
+
canSet(nextStateRaw) {
|
|
13466
|
+
const nextState = this.config.modifyStateBeforeSetting?.(nextStateRaw, this._currentValue, this.debugMode) ?? nextStateRaw;
|
|
13467
|
+
if (!_.isMap(this.config.allowedStateMap)) {
|
|
13468
|
+
return true;
|
|
13469
|
+
}
|
|
13470
|
+
const allowed = this.config.allowedStateMap.get(this._currentValue) ?? [];
|
|
13471
|
+
return allowed.includes(nextState);
|
|
13472
|
+
}
|
|
13473
|
+
set(nextStateRaw) {
|
|
13474
|
+
const previousState = this._currentValue;
|
|
13475
|
+
const nextState = this.config.modifyStateBeforeSetting?.(nextStateRaw, previousState, this.debugMode) ?? nextStateRaw;
|
|
13476
|
+
if (_.isMap(this.config.allowedStateMap)) {
|
|
13477
|
+
const allowed = this.config.allowedStateMap.get(previousState) ?? [];
|
|
13478
|
+
if (!allowed.includes(nextState)) {
|
|
13479
|
+
const message = `Invalid state transition: ` +
|
|
13480
|
+
`${String(previousState)} -> ${String(nextState)}`;
|
|
13481
|
+
if (this.config.throwOnInvalidTransition) {
|
|
13482
|
+
throw new Error(message);
|
|
13483
|
+
}
|
|
13484
|
+
this.debugMode && console.warn(message);
|
|
13485
|
+
return false;
|
|
13486
|
+
}
|
|
13487
|
+
}
|
|
13488
|
+
this._currentValue = nextState;
|
|
13489
|
+
// Notify observers only after successful transition.
|
|
13490
|
+
this.currentStateSubject.next(nextState);
|
|
13491
|
+
void this.config.effect?.(nextState, previousState, this.debugMode);
|
|
13492
|
+
return true;
|
|
13493
|
+
}
|
|
13494
|
+
}
|
|
13495
|
+
|
|
13423
13496
|
const jsoncFormattingOptions = {
|
|
13424
13497
|
insertSpaces: true,
|
|
13425
13498
|
tabSize: 2,
|
|
@@ -13951,5 +14024,5 @@ var index = {};
|
|
|
13951
14024
|
* Generated bundle index. Do not edit.
|
|
13952
14025
|
*/
|
|
13953
14026
|
|
|
13954
|
-
export { $, BaselineSiteJoinprefix, CLI, CoreConfig, CoreModels, DbBinaryFormatEnum, ExecAsyncVscodeError, FilePathMetaData, FilesNames, GlobalLibTypeName, GlobalStorage, GlobalTaskManager, GlobalTaskManagerClass, Helpers, LibTypeArr, LibTypeEnum, PREFIXES, REGEX_REGION, TAGS, Utils, UtilsBinary, UtilsCli, UtilsCliClassMethod, UtilsDotFile, UtilsEtcHosts, UtilsExecProc, UtilsFilesFolders, UtilsFilesFoldersSync, UtilsI18n, UtilsJson, UtilsMdDocs, UtilsMessages, UtilsMigrations, UtilsNetwork, UtilsOs, UtilsProcess, UtilsProcessLogger, UtilsProgress, UtilsProjects, UtilsStdinStdoutLogger, UtilsString, UtilsStringRegex, UtilsSudo, UtilsTerminal, UtilsTime, UtilsWaitNotifier, UtilsYaml, _, appRelatedFiles, areTrustedForPatchUpdate, axios, backendNodejsOnlyFiles, backendWebsqlNodejsFiles, baseTaonDevProjectsNames, chalk, child_process, chokidar, config, crossPlatformPath, dateformat, dockerTemplates, dotTaonFolder, dotTnpFolder, encoding, execAsyncVscode, extAllowedToExportAndReplaceTSJSCodeFiles, extAllowedToReplace, extForSassLikeFiles, extForStyles, extTemplatesFiles, fg, fileName, filesNotAllowedToClean, folderName, frameworkName, frameworkNameBe, frontEndOnly, frontendFiles, fse, glob, globalSpinner, http, https, isCloudflareWorker, isElevated, micromatch, mkdirp, ncp, notAllowedNames, notAllowedProjectNames, notNeededForExportFiles, os, path, ps, psList, requireDefault, requiredForDev, rimraf, spawn, startAsync, taonActionFromParent, taonBasePathToGlobalDockerTemplatesFn, taonContainers, taonCutNextLineCut, taonPackageName, taonProjects, taonRepoPathUserInUserDirFn, taonSkipCut, tempFoldersName, tnpPackageName, updateJsoncContent, urlRepoTaon, urlRepoTaonContainers, win32Path };
|
|
14027
|
+
export { $, BaselineSiteJoinprefix, CLI, CoreConfig, CoreModels, DbBinaryFormatEnum, ExecAsyncVscodeError, FilePathMetaData, FilesNames, GlobalLibTypeName, GlobalStorage, GlobalTaskManager, GlobalTaskManagerClass, Helpers, LibTypeArr, LibTypeEnum, PREFIXES, REGEX_REGION, TAGS, TaonStateMachine, Utils, UtilsBinary, UtilsCli, UtilsCliClassMethod, UtilsDotFile, UtilsEtcHosts, UtilsExecProc, UtilsFilesFolders, UtilsFilesFoldersSync, UtilsI18n, UtilsJson, UtilsMdDocs, UtilsMessages, UtilsMigrations, UtilsNetwork, UtilsOs, UtilsProcess, UtilsProcessLogger, UtilsProgress, UtilsProjects, UtilsStdinStdoutLogger, UtilsString, UtilsStringRegex, UtilsSudo, UtilsTerminal, UtilsTime, UtilsWaitNotifier, UtilsYaml, _, appRelatedFiles, areTrustedForPatchUpdate, axios, backendNodejsOnlyFiles, backendWebsqlNodejsFiles, baseTaonDevProjectsNames, chalk, child_process, chokidar, config, crossPlatformPath, dateformat, dockerTemplates, dotTaonFolder, dotTnpFolder, encoding, execAsyncVscode, extAllowedToExportAndReplaceTSJSCodeFiles, extAllowedToReplace, extForSassLikeFiles, extForStyles, extTemplatesFiles, fg, fileName, filesNotAllowedToClean, folderName, frameworkName, frameworkNameBe, frontEndOnly, frontendFiles, fse, glob, globalSpinner, http, https, isCloudflareWorker, isElevated, micromatch, mkdirp, ncp, notAllowedNames, notAllowedProjectNames, notNeededForExportFiles, os, path, ps, psList, requireDefault, requiredForDev, rimraf, spawn, startAsync, taonActionFromParent, taonBasePathToGlobalDockerTemplatesFn, taonContainers, taonCutNextLineCut, taonPackageName, taonProjects, taonRepoPathUserInUserDirFn, taonSkipCut, tempFoldersName, tnpPackageName, updateJsoncContent, urlRepoTaon, urlRepoTaonContainers, win32Path };
|
|
13955
14028
|
//# sourceMappingURL=tnp-core-browser.mjs.map
|