@wandzai/utils 1.0.38 → 1.0.39
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/package.json +1 -1
- package/src/common.d.ts +2 -0
- package/src/common.js +9 -1
- package/src/common.js.map +1 -1
- package/src/wandz.d.ts +6 -0
- package/src/wandz.js +27 -1
- package/src/wandz.js.map +1 -1
package/package.json
CHANGED
package/src/common.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export declare const fakeDelay: (milliSec: number) => Promise<unknown>;
|
|
|
2
2
|
export declare const convertCamelCaeToUnderscore: (term: string) => string;
|
|
3
3
|
export declare const convertUnderscoreToCamelCase: (underscoreString: string) => string;
|
|
4
4
|
export declare const kebabToDisplayName: (kebabCase: string) => string;
|
|
5
|
+
export declare const upperCaseFirstChar: (word: string) => string;
|
|
6
|
+
export declare const upperCaseFirstCharOfEachWord: (str: string) => string;
|
package/src/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kebabToDisplayName = exports.convertUnderscoreToCamelCase = exports.convertCamelCaeToUnderscore = exports.fakeDelay = void 0;
|
|
3
|
+
exports.upperCaseFirstCharOfEachWord = exports.upperCaseFirstChar = exports.kebabToDisplayName = exports.convertUnderscoreToCamelCase = exports.convertCamelCaeToUnderscore = exports.fakeDelay = void 0;
|
|
4
4
|
const fakeDelay = (milliSec) => new Promise((resolve) => {
|
|
5
5
|
setTimeout(resolve, milliSec);
|
|
6
6
|
});
|
|
@@ -18,4 +18,12 @@ const kebabToDisplayName = (kebabCase) => kebabCase
|
|
|
18
18
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
19
19
|
.join(' ');
|
|
20
20
|
exports.kebabToDisplayName = kebabToDisplayName;
|
|
21
|
+
const upperCaseFirstChar = (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
22
|
+
exports.upperCaseFirstChar = upperCaseFirstChar;
|
|
23
|
+
const upperCaseFirstCharOfEachWord = (str) => {
|
|
24
|
+
return str.replace(/\b\w/g, function (match) {
|
|
25
|
+
return match.toUpperCase();
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.upperCaseFirstCharOfEachWord = upperCaseFirstCharOfEachWord;
|
|
21
29
|
//# sourceMappingURL=common.js.map
|
package/src/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../libs/utils/src/common.ts"],"names":[],"mappings":";;;AAAO,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE,CAC7C,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACvB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAHS,QAAA,SAAS,aAGlB;AAGG,MAAM,2BAA2B,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAA3G,QAAA,2BAA2B,+BAAgF;AACjH,MAAM,4BAA4B,GAAG,CAAC,gBAAwB,EAAU,EAAE;IAChF,OAAO,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,MAAc,EAAE,KAAK,EAAE,EAAE;QACtE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAA;AAJY,QAAA,4BAA4B,gCAIxC;AAEM,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS;KAChE,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,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,CAAC,CAAC,WAAW,EAAE,CAAC;AAAlG,QAAA,kBAAkB,sBAAgF;AAExG,MAAM,4BAA4B,GAAG,CAAC,GAAW,EAAE,EAAE;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,KAAK;QAC1C,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC"}
|
package/src/wandz.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
+
import { AiFeatureDistributionType, ICustomAiFeature, IEventBasedCustomAiFeatureConfig, IAffinityBasedCustomAiFeatureConfig, IStorageBasedCustomAiFeatureConfig, IAiFeaturesBasicConfig } from '@wandzai/wandz-interfaces';
|
|
1
2
|
export declare const entityTechNameBuilder: (entityName: string) => string;
|
|
3
|
+
export declare const isCustomAiFeature: (feature: IAiFeaturesBasicConfig) => feature is ICustomAiFeature;
|
|
4
|
+
export declare function isAffinityBasedCustomAiFeature(feature: ICustomAiFeature): feature is IAffinityBasedCustomAiFeatureConfig;
|
|
5
|
+
export declare function isStorageBasedCustomAiFeature(feature: ICustomAiFeature): feature is IStorageBasedCustomAiFeatureConfig;
|
|
6
|
+
export declare function isEventBasedCustomAiFeature(feature: ICustomAiFeature): feature is IEventBasedCustomAiFeatureConfig;
|
|
7
|
+
export declare const getCustomAiFeatureType: (feature: ICustomAiFeature) => AiFeatureDistributionType;
|
package/src/wandz.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityTechNameBuilder = void 0;
|
|
3
|
+
exports.getCustomAiFeatureType = exports.isEventBasedCustomAiFeature = exports.isStorageBasedCustomAiFeature = exports.isAffinityBasedCustomAiFeature = exports.isCustomAiFeature = exports.entityTechNameBuilder = void 0;
|
|
4
4
|
const entityTechNameBuilder = (entityName) => {
|
|
5
5
|
return entityName
|
|
6
6
|
.toLowerCase()
|
|
@@ -8,4 +8,30 @@ const entityTechNameBuilder = (entityName) => {
|
|
|
8
8
|
.replace(/[^\w_.]+/g, '');
|
|
9
9
|
};
|
|
10
10
|
exports.entityTechNameBuilder = entityTechNameBuilder;
|
|
11
|
+
const isCustomAiFeature = (feature) => {
|
|
12
|
+
return (feature.hasOwnProperty('createdBy'));
|
|
13
|
+
};
|
|
14
|
+
exports.isCustomAiFeature = isCustomAiFeature;
|
|
15
|
+
function isAffinityBasedCustomAiFeature(feature) {
|
|
16
|
+
return (feature.affinityType != null);
|
|
17
|
+
}
|
|
18
|
+
exports.isAffinityBasedCustomAiFeature = isAffinityBasedCustomAiFeature;
|
|
19
|
+
function isStorageBasedCustomAiFeature(feature) {
|
|
20
|
+
return (feature.storageLogic != null);
|
|
21
|
+
}
|
|
22
|
+
exports.isStorageBasedCustomAiFeature = isStorageBasedCustomAiFeature;
|
|
23
|
+
function isEventBasedCustomAiFeature(feature) {
|
|
24
|
+
return feature.eventLogic != null;
|
|
25
|
+
}
|
|
26
|
+
exports.isEventBasedCustomAiFeature = isEventBasedCustomAiFeature;
|
|
27
|
+
const getCustomAiFeatureType = (feature) => {
|
|
28
|
+
if (isEventBasedCustomAiFeature(feature)) {
|
|
29
|
+
return 'event';
|
|
30
|
+
}
|
|
31
|
+
else if (isAffinityBasedCustomAiFeature(feature)) {
|
|
32
|
+
return feature.affinityType;
|
|
33
|
+
}
|
|
34
|
+
return 'storage';
|
|
35
|
+
};
|
|
36
|
+
exports.getCustomAiFeatureType = getCustomAiFeatureType;
|
|
11
37
|
//# sourceMappingURL=wandz.js.map
|
package/src/wandz.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wandz.js","sourceRoot":"","sources":["../../../../libs/utils/src/wandz.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wandz.js","sourceRoot":"","sources":["../../../../libs/utils/src/wandz.ts"],"names":[],"mappings":";;;AAUO,MAAM,qBAAqB,GAAG,CAAC,UAAkB,EAAE,EAAE;IAK3D,OAAO,UAAU;SACf,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC,CAAC;AATW,QAAA,qBAAqB,yBAShC;AAEK,MAAM,iBAAiB,GAAG,CAChC,OAA+B,EACD,EAAE;IAChC,OAAO,CACN,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CACnC,CAAC;AACH,CAAC,CAAA;AANY,QAAA,iBAAiB,qBAM7B;AAED,SAAgB,8BAA8B,CAC7C,OAAyB;IAEzB,OAAO,CACL,OAA+C,CAAC,YAAY,IAAI,IAAI,CACrE,CAAC;AACH,CAAC;AAND,wEAMC;AAED,SAAgB,6BAA6B,CAC5C,OAAyB;IAEzB,OAAO,CACL,OAA8C,CAAC,YAAY,IAAI,IAAI,CACpE,CAAC;AACH,CAAC;AAND,sEAMC;AAED,SAAgB,2BAA2B,CAC1C,OAAyB;IAEzB,OAAQ,OAA4C,CAAC,UAAU,IAAI,IAAI,CAAC;AACzE,CAAC;AAJD,kEAIC;AAEM,MAAM,sBAAsB,GAAG,CAAC,OAAyB,EAA6B,EAAE;IAC9F,IAAI,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC;IAChB,CAAC;SAAM,IAAI,8BAA8B,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAA;AAPY,QAAA,sBAAsB,0BAOlC"}
|