@social-mail/social-mail-web-server 1.5.360 → 1.5.361
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/protocols/core/RegExpExtra.d.ts +1 -0
- package/dist/protocols/core/RegExpExtra.d.ts.map +1 -1
- package/dist/protocols/core/RegExpExtra.js +10 -0
- package/dist/protocols/core/RegExpExtra.js.map +1 -1
- package/dist/server/services/name-tokens/NameTokenService.d.ts.map +1 -1
- package/dist/server/services/name-tokens/NameTokenService.js +2 -11
- package/dist/server/services/name-tokens/NameTokenService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/protocols/core/RegExpExtra.ts +12 -1
- package/src/server/services/name-tokens/NameTokenService.ts +3 -12
|
@@ -5,5 +5,6 @@ export type regExpTokens = {
|
|
|
5
5
|
export declare const RegExpExtra: {
|
|
6
6
|
replaceAll(text: string, regExp: RegExp, transformer: (item: regExpTokens) => string): string;
|
|
7
7
|
replaceTimeAndEmail(input: string): string;
|
|
8
|
+
splitNames(name: string, includeNumbers?: boolean): Generator<string, void, unknown>;
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=RegExpExtra.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegExpExtra.d.ts","sourceRoot":"","sources":["../../../src/protocols/core/RegExpExtra.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,WAAW;qBAEH,MAAM,UAAU,MAAM,eAAe,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM;+BAQzD,MAAM;
|
|
1
|
+
{"version":3,"file":"RegExpExtra.d.ts","sourceRoot":"","sources":["../../../src/protocols/core/RegExpExtra.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,WAAW;qBAEH,MAAM,UAAU,MAAM,eAAe,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM;+BAQzD,MAAM;qBAkBf,MAAM;CAW3B,CAAC"}
|
|
@@ -20,6 +20,16 @@ export const RegExpExtra = {
|
|
|
20
20
|
const t = (m[0].padEnd(m.length, "*") + "@");
|
|
21
21
|
return t;
|
|
22
22
|
});
|
|
23
|
+
},
|
|
24
|
+
*splitNames(name, includeNumbers = false) {
|
|
25
|
+
const regex = includeNumbers
|
|
26
|
+
? /[\p{L}\d]{2,50}/igmu
|
|
27
|
+
: /[\p{L}]{2,50}/igmu;
|
|
28
|
+
for (const { match } of tokenizeRegexAll(name, regex)) {
|
|
29
|
+
if (match) {
|
|
30
|
+
yield match[0];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
34
|
};
|
|
25
35
|
//# sourceMappingURL=RegExpExtra.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegExpExtra.js","sourceRoot":"","sources":["../../../src/protocols/core/RegExpExtra.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RegExpExtra.js","sourceRoot":"","sources":["../../../src/protocols/core/RegExpExtra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIjE,MAAM,CAAC,MAAM,WAAW,GAAG;IAEvB,UAAU,CAAC,IAAY,EAAE,MAAc,EAAE,WAA2C;QAChF,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,KAAI,MAAM,KAAK,IAAI,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;YAChD,CAAC,IAAI,WAAW,CAAC,KAAY,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IAED,mBAAmB,CAAC,KAAa;QAC7B,OAAO,WAAW,CAAC,UAAU,CACzB,KAAK,EACL,wFAAwF,EACxF,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAChB,IAAI,IAAI,EAAE,CAAC;gBACP,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,EAAE,CAAC;gBACP,OAAO,mBAAmB,IAAI,KAAK,CAAC,SAAS,CAAC;YAClD,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;YAC7C,OAAO,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,CAAC,UAAU,CAAC,IAAY,EAAE,cAAc,GAAG,KAAK;QAC5C,MAAM,KAAK,GAAG,cAAc;YAC5B,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,mBAAmB,CAAC;QACtB,KAAI,MAAM,EAAE,KAAK,EAAE,IAAI,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YACnD,IAAI,KAAK,EAAE,CAAC;gBACR,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NameTokenService.d.ts","sourceRoot":"","sources":["../../../../src/server/services/name-tokens/NameTokenService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NameTokenService.d.ts","sourceRoot":"","sources":["../../../../src/server/services/name-tokens/NameTokenService.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAE3B,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE;;KAAA,EAAE,cAAc,UAAQ;YAqB3D,cAAc;CAI/B"}
|
|
@@ -53,6 +53,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
53
53
|
});
|
|
54
54
|
import { RegisterSingleton, ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
|
|
55
55
|
import SocialMailContext from "../../model/SocialMailContext.js";
|
|
56
|
+
import { RegExpExtra } from "../../../protocols/core/RegExpExtra.js";
|
|
56
57
|
let NameTokenService = class NameTokenService {
|
|
57
58
|
async updateName(name, { emailAddressID }, includeNumbers = false) {
|
|
58
59
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
@@ -63,19 +64,9 @@ let NameTokenService = class NameTokenService {
|
|
|
63
64
|
}
|
|
64
65
|
name = name.toLowerCase();
|
|
65
66
|
const ids = [];
|
|
66
|
-
const regex = includeNumbers
|
|
67
|
-
? /[^\p{L}\d]+/igmu
|
|
68
|
-
: /[^\p{L}]+/igmu;
|
|
69
|
-
const tokens = name.split(regex);
|
|
70
67
|
const scope = __addDisposableResource(env_1, ServiceProvider.createScope(this), false);
|
|
71
68
|
const db = scope.resolve(SocialMailContext);
|
|
72
|
-
for (const token of
|
|
73
|
-
if (!token) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (token.length < 2) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
69
|
+
for (const token of RegExpExtra.splitNames(name, includeNumbers)) {
|
|
79
70
|
const nameTokenID = await this.getOrSaveToken(db, token);
|
|
80
71
|
if (emailAddressID) {
|
|
81
72
|
// save tokens..
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NameTokenService.js","sourceRoot":"","sources":["../../../../src/server/services/name-tokens/NameTokenService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,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