openloops 0.1.27 → 0.1.28
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/common/base/current-session.js +4 -5
- package/dist/common/base/current-session.mjs +4 -9
- package/dist/common/base/current-user.js +2 -2
- package/dist/common/base/current-user.mjs +2 -2
- package/dist/services/users/entities/user-country.js +2 -2
- package/dist/services/users/entities/user-country.mjs +2 -2
- package/dist/services/users/entities/user-language.js +2 -2
- package/dist/services/users/entities/user-language.mjs +2 -2
- package/dist/services/users/entities/user-timezone.js +2 -2
- package/dist/services/users/entities/user-timezone.mjs +2 -2
- package/dist/services/users/entities/user.entity.js +3 -3
- package/dist/services/users/entities/user.entity.mjs +3 -3
- package/package.json +4 -3
|
@@ -22,7 +22,7 @@ __export(current_session_exports, {
|
|
|
22
22
|
CurrentSession: () => CurrentSession
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(current_session_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class CurrentSession {
|
|
27
27
|
constructor(clientType, environment, app, device, preferences, location, request) {
|
|
28
28
|
this.clientType = clientType;
|
|
@@ -44,11 +44,10 @@ class CurrentSession {
|
|
|
44
44
|
return this.preferences?.locale?.split("_")[0];
|
|
45
45
|
}
|
|
46
46
|
get timezoneOffset() {
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, import_iso_data.getTimezone)(this.location?.timezone)?.offset;
|
|
48
48
|
}
|
|
49
49
|
get currencyCode() {
|
|
50
|
-
|
|
51
|
-
return currentCountryData?.currency?.isoCode;
|
|
50
|
+
return (0, import_iso_data.getCountry)(this.location?.country)?.currency.isoCode;
|
|
52
51
|
}
|
|
53
52
|
static fromJSON(json) {
|
|
54
53
|
return new CurrentSession(
|
|
@@ -89,7 +88,7 @@ class CurrentSession {
|
|
|
89
88
|
};
|
|
90
89
|
session.location = session.location?.timezone ? {
|
|
91
90
|
...session.location,
|
|
92
|
-
country: (0,
|
|
91
|
+
country: (0, import_iso_data.getTimezone)(session.location?.timezone)?.countryCode
|
|
93
92
|
} : session.location;
|
|
94
93
|
return session;
|
|
95
94
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import "../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import {
|
|
3
|
-
getCountryDataFromCountryCode,
|
|
4
|
-
getCountryISOCodeFromTimezone,
|
|
5
|
-
getTimezoneOffset
|
|
6
|
-
} from "countries-and-currencies-utils";
|
|
2
|
+
import { getCountry, getTimezone } from "iso-data";
|
|
7
3
|
class CurrentSession {
|
|
8
4
|
constructor(clientType, environment, app, device, preferences, location, request) {
|
|
9
5
|
this.clientType = clientType;
|
|
@@ -25,11 +21,10 @@ class CurrentSession {
|
|
|
25
21
|
return this.preferences?.locale?.split("_")[0];
|
|
26
22
|
}
|
|
27
23
|
get timezoneOffset() {
|
|
28
|
-
return
|
|
24
|
+
return getTimezone(this.location?.timezone)?.offset;
|
|
29
25
|
}
|
|
30
26
|
get currencyCode() {
|
|
31
|
-
|
|
32
|
-
return currentCountryData?.currency?.isoCode;
|
|
27
|
+
return getCountry(this.location?.country)?.currency.isoCode;
|
|
33
28
|
}
|
|
34
29
|
static fromJSON(json) {
|
|
35
30
|
return new CurrentSession(
|
|
@@ -70,7 +65,7 @@ class CurrentSession {
|
|
|
70
65
|
};
|
|
71
66
|
session.location = session.location?.timezone ? {
|
|
72
67
|
...session.location,
|
|
73
|
-
country:
|
|
68
|
+
country: getTimezone(session.location?.timezone)?.countryCode
|
|
74
69
|
} : session.location;
|
|
75
70
|
return session;
|
|
76
71
|
}
|
|
@@ -22,7 +22,7 @@ __export(current_user_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(current_user_exports);
|
|
24
24
|
var import_mongodb = require("mongodb");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
var import_mongo_db = require("../repositories/mongo-db.client.js");
|
|
27
27
|
var import_secret_manager = require("../utils/secret-manager.js");
|
|
28
28
|
var import_logger = require("../logger/index.js");
|
|
@@ -63,7 +63,7 @@ class CurrentUser extends import_user.User {
|
|
|
63
63
|
return this.permissions?.notifications ?? false;
|
|
64
64
|
}
|
|
65
65
|
get timezoneOffset() {
|
|
66
|
-
return (0,
|
|
66
|
+
return (0, import_iso_data.getTimezone)(this.preferences?.timezone?.ianaIdentifier)?.offset ?? 0;
|
|
67
67
|
}
|
|
68
68
|
setIsPremium(value) {
|
|
69
69
|
this._isPremium = value;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { ObjectId } from "mongodb";
|
|
3
|
-
import {
|
|
3
|
+
import { getTimezone } from "iso-data";
|
|
4
4
|
import { getMongoDBClient } from "../repositories/mongo-db.client.js";
|
|
5
5
|
import { secretManager } from "../utils/secret-manager.js";
|
|
6
6
|
import { logger } from "../logger/index.js";
|
|
@@ -41,7 +41,7 @@ class CurrentUser extends User {
|
|
|
41
41
|
return this.permissions?.notifications ?? false;
|
|
42
42
|
}
|
|
43
43
|
get timezoneOffset() {
|
|
44
|
-
return
|
|
44
|
+
return getTimezone(this.preferences?.timezone?.ianaIdentifier)?.offset ?? 0;
|
|
45
45
|
}
|
|
46
46
|
setIsPremium(value) {
|
|
47
47
|
this._isPremium = value;
|
|
@@ -21,7 +21,7 @@ __export(user_country_exports, {
|
|
|
21
21
|
Country: () => Country
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_country_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_iso_data = require("iso-data");
|
|
25
25
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
26
26
|
class Country {
|
|
27
27
|
constructor(isoCode) {
|
|
@@ -29,7 +29,7 @@ class Country {
|
|
|
29
29
|
}
|
|
30
30
|
isoCode;
|
|
31
31
|
get label() {
|
|
32
|
-
return this.isoCode ? (0,
|
|
32
|
+
return this.isoCode ? (0, import_iso_data.getCountry)(this.isoCode)?.name : void 0;
|
|
33
33
|
}
|
|
34
34
|
static fromJSON(props) {
|
|
35
35
|
return new Country((0, import_helpers.sanitizeString)(props.isoCode));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { getCountry } from "iso-data";
|
|
3
3
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
4
4
|
class Country {
|
|
5
5
|
constructor(isoCode) {
|
|
@@ -7,7 +7,7 @@ class Country {
|
|
|
7
7
|
}
|
|
8
8
|
isoCode;
|
|
9
9
|
get label() {
|
|
10
|
-
return this.isoCode ?
|
|
10
|
+
return this.isoCode ? getCountry(this.isoCode)?.name : void 0;
|
|
11
11
|
}
|
|
12
12
|
static fromJSON(props) {
|
|
13
13
|
return new Country(sanitizeString(props.isoCode));
|
|
@@ -22,14 +22,14 @@ __export(user_language_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_language_exports);
|
|
24
24
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class Language {
|
|
27
27
|
constructor(isoCode) {
|
|
28
28
|
this.isoCode = isoCode;
|
|
29
29
|
}
|
|
30
30
|
isoCode;
|
|
31
31
|
get label() {
|
|
32
|
-
return this.isoCode ? (0,
|
|
32
|
+
return this.isoCode ? (0, import_iso_data.getLanguage)(this.isoCode)?.nativeName : void 0;
|
|
33
33
|
}
|
|
34
34
|
static fromJSON(props) {
|
|
35
35
|
return new Language((0, import_helpers.sanitizeString)(props.isoCode));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getLanguage } from "iso-data";
|
|
4
4
|
class Language {
|
|
5
5
|
constructor(isoCode) {
|
|
6
6
|
this.isoCode = isoCode;
|
|
7
7
|
}
|
|
8
8
|
isoCode;
|
|
9
9
|
get label() {
|
|
10
|
-
return this.isoCode ?
|
|
10
|
+
return this.isoCode ? getLanguage(this.isoCode)?.nativeName : void 0;
|
|
11
11
|
}
|
|
12
12
|
static fromJSON(props) {
|
|
13
13
|
return new Language(sanitizeString(props.isoCode));
|
|
@@ -22,7 +22,7 @@ __export(user_timezone_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_timezone_exports);
|
|
24
24
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class Timezone {
|
|
27
27
|
constructor(ianaIdentifier) {
|
|
28
28
|
this.ianaIdentifier = ianaIdentifier;
|
|
@@ -32,7 +32,7 @@ class Timezone {
|
|
|
32
32
|
return new Timezone((0, import_helpers.sanitizeString)(props.ianaIdentifier));
|
|
33
33
|
}
|
|
34
34
|
get offsetInMinutes() {
|
|
35
|
-
return
|
|
35
|
+
return (0, import_iso_data.getTimezone)(this.ianaIdentifier)?.offset;
|
|
36
36
|
}
|
|
37
37
|
toJSON() {
|
|
38
38
|
return { ianaIdentifier: this.ianaIdentifier, offsetInMinutes: this.offsetInMinutes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getTimezone } from "iso-data";
|
|
4
4
|
class Timezone {
|
|
5
5
|
constructor(ianaIdentifier) {
|
|
6
6
|
this.ianaIdentifier = ianaIdentifier;
|
|
@@ -10,7 +10,7 @@ class Timezone {
|
|
|
10
10
|
return new Timezone(sanitizeString(props.ianaIdentifier));
|
|
11
11
|
}
|
|
12
12
|
get offsetInMinutes() {
|
|
13
|
-
return
|
|
13
|
+
return getTimezone(this.ianaIdentifier)?.offset;
|
|
14
14
|
}
|
|
15
15
|
toJSON() {
|
|
16
16
|
return { ianaIdentifier: this.ianaIdentifier, offsetInMinutes: this.offsetInMinutes };
|
|
@@ -31,7 +31,7 @@ __export(user_entity_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(user_entity_exports);
|
|
33
33
|
var import_decorators = require("../../../common/decorators/index.js");
|
|
34
|
-
var
|
|
34
|
+
var import_iso_data = require("iso-data");
|
|
35
35
|
var import_base = require("../../../common/base/base.entity.js");
|
|
36
36
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
37
37
|
var import_user_password = require("./user-password.value-object");
|
|
@@ -101,8 +101,8 @@ const _User = class _User extends import_base.BaseEntity {
|
|
|
101
101
|
}
|
|
102
102
|
static async create(props) {
|
|
103
103
|
if (props.preferences?.currency?.isoCode) {
|
|
104
|
-
const currencyData =
|
|
105
|
-
props.preferences.currency.label = currencyData?.
|
|
104
|
+
const currencyData = (0, import_iso_data.getCurrency)(props.preferences.currency.isoCode);
|
|
105
|
+
props.preferences.currency.label = currencyData?.name;
|
|
106
106
|
props.preferences.currency.symbol = currencyData?.symbol;
|
|
107
107
|
}
|
|
108
108
|
if (props.password && !import_user_password.UserPassword.isHashed(props.password)) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__decorateClass
|
|
3
3
|
} from "../../../chunk-CF3WOMB3.mjs";
|
|
4
4
|
import { MaskInLogs, AdminOnly } from "../../../common/decorators/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getCurrency } from "iso-data";
|
|
6
6
|
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
7
7
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
8
8
|
import { UserPassword } from "./user-password.value-object";
|
|
@@ -72,8 +72,8 @@ const _User = class _User extends BaseEntity {
|
|
|
72
72
|
}
|
|
73
73
|
static async create(props) {
|
|
74
74
|
if (props.preferences?.currency?.isoCode) {
|
|
75
|
-
const currencyData =
|
|
76
|
-
props.preferences.currency.label = currencyData?.
|
|
75
|
+
const currencyData = getCurrency(props.preferences.currency.isoCode);
|
|
76
|
+
props.preferences.currency.label = currencyData?.name;
|
|
77
77
|
props.preferences.currency.symbol = currencyData?.symbol;
|
|
78
78
|
}
|
|
79
79
|
if (props.password && !UserPassword.isHashed(props.password)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openloops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Framework to build AI Agents",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jose Barcos",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"build": "tsup && tsc-alias",
|
|
72
72
|
"prepublishOnly": "yarn build",
|
|
73
73
|
"check-size": "npm pack --dry-run",
|
|
74
|
-
"release": "npm version patch && npm publish --access public"
|
|
74
|
+
"release": "npm version patch && npm publish --access public",
|
|
75
|
+
"push": "git push --follow-tags"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
78
|
"@mariozechner/pi-ai": "^0.73.1",
|
|
@@ -79,10 +80,10 @@
|
|
|
79
80
|
"@sentry/node": "^11.0.0",
|
|
80
81
|
"axios": "^1.20.0",
|
|
81
82
|
"bcryptjs": "^3.0.3",
|
|
82
|
-
"countries-and-currencies-utils": "^0.1.9",
|
|
83
83
|
"cryptr": "^6.4.0",
|
|
84
84
|
"dotenv": "^18.0.3",
|
|
85
85
|
"html-to-text": "^10.0.1",
|
|
86
|
+
"iso-data": "^0.1.0",
|
|
86
87
|
"jsonwebtoken": "^9.0.3",
|
|
87
88
|
"langfuse": "^3.39.2",
|
|
88
89
|
"mongodb": "^7.6.0",
|