@winible/winible-typed 2.70.0 → 2.70.1

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.
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sequelize_1 = require("sequelize");
7
+ const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
8
+ const user_1 = __importDefault(require("./user"));
9
+ // order of InferAttributes & InferCreationAttributes is important.
10
+ class FeaturedCapper extends sequelize_1.Model {
11
+ }
12
+ FeaturedCapper.init({
13
+ id: {
14
+ type: sequelize_1.DataTypes.BIGINT,
15
+ primaryKey: true,
16
+ allowNull: false,
17
+ defaultValue: pb_sequelize_1.default.fn("next_id"),
18
+ },
19
+ userId: {
20
+ type: sequelize_1.DataTypes.BIGINT,
21
+ allowNull: false,
22
+ field: "user_id",
23
+ references: {
24
+ model: user_1.default,
25
+ },
26
+ },
27
+ priority: {
28
+ type: sequelize_1.DataTypes.SMALLINT,
29
+ field: "priority",
30
+ },
31
+ customLabel: {
32
+ type: sequelize_1.DataTypes.STRING,
33
+ field: "custom_label",
34
+ },
35
+ createdAt: sequelize_1.DataTypes.DATE,
36
+ updatedAt: sequelize_1.DataTypes.DATE,
37
+ }, {
38
+ tableName: "featured_cappers",
39
+ sequelize: pb_sequelize_1.default,
40
+ });
41
+ user_1.default.hasOne(FeaturedCapper, {
42
+ foreignKey: "userId",
43
+ sourceKey: "id",
44
+ });
45
+ FeaturedCapper.hasOne(user_1.default, {
46
+ foreignKey: "id",
47
+ sourceKey: "userId",
48
+ onDelete: "NO ACTION",
49
+ });
50
+ exports.default = FeaturedCapper;
51
+ //# sourceMappingURL=featured-capper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featured-capper.js","sourceRoot":"","sources":["../../typed-model/featured-capper.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAE1B,mEAAmE;AACnE,MAAM,cAAe,SAAQ,iBAG5B;CAUA;AAED,cAAc,CAAC,IAAI,CACjB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,QAAQ;QACxB,KAAK,EAAE,UAAU;KAClB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,cAAc;KACtB;IAED,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,cAAI,CAAC,MAAM,CAAC,cAAc,EAAE;IAC1B,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,cAAc,CAAC,MAAM,CAAC,cAAI,EAAE;IAC1B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC;AAEH,kBAAe,cAAc,CAAC"}
@@ -29,6 +29,10 @@ PhoneNumberAssignment.init({
29
29
  type: sequelize_1.DataTypes.STRING,
30
30
  field: "sms_creator_name",
31
31
  },
32
+ smsCooldownDays: {
33
+ type: sequelize_1.DataTypes.INTEGER,
34
+ field: "sms_cooldown_days",
35
+ },
32
36
  createdAt: sequelize_1.DataTypes.DATE,
33
37
  updatedAt: sequelize_1.DataTypes.DATE,
34
38
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"phone-number-assignment.js","sourceRoot":"","sources":["../../typed-model/phone-number-assignment.ts"],"names":[],"mappings":";;;;;AAAA,yCAOqB;AAEnB,kEAAuC;AACvC,kDAA0B;AAG1B,MAAM,qBAAsB,SAAQ,iBAGnC;CAOA;AAED,qBAAqB,CAAC,IAAI,CACxB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,IAAA,cAAE,EAAC,SAAS,CAAC;KAC5B;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,iBAAiB;KACzB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,YAAY;KACpB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,kBAAkB;KAC1B;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,kBAAkB;AAClB,qBAAqB,CAAC,SAAS,CAAC,cAAI,EAAE;IACpC,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEL,4DAA4D;AAC5D,mCAAmC;AACnC,uBAAuB;AACvB,QAAQ;AACR,0DAA0D;AAC1D,mCAAmC;AACnC,uBAAuB;AACvB,QAAQ;AAEN,kBAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"phone-number-assignment.js","sourceRoot":"","sources":["../../typed-model/phone-number-assignment.ts"],"names":[],"mappings":";;;;;AAAA,yCAOmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAG1B,MAAM,qBAAsB,SAAQ,iBAGnC;CAQA;AAED,qBAAqB,CAAC,IAAI,CACxB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,IAAA,cAAE,EAAC,SAAS,CAAC;KAC5B;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,iBAAiB;KACzB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,YAAY;KACpB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,kBAAkB;KAC1B;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,KAAK,EAAE,mBAAmB;KAC3B;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,kBAAkB;AAClB,qBAAqB,CAAC,SAAS,CAAC,cAAI,EAAE;IACpC,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,4DAA4D;AAC5D,mCAAmC;AACnC,uBAAuB;AACvB,QAAQ;AACR,0DAA0D;AAC1D,mCAAmC;AACnC,uBAAuB;AACvB,QAAQ;AAER,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * @param message The log message
5
+ * @param options Additional context for the log entry
6
+ *
7
+ * @example
8
+ * // Basic usage
9
+ * logger("User login successful");
10
+ *
11
+ * @example
12
+ * // With user ID
13
+ * logger("User login successful", { userId: "123456" });
14
+ *
15
+ * @example
16
+ * // With error tracking (standard Error)
17
+ * try {
18
+ * throw new Error("Something went wrong");
19
+ * } catch (error) {
20
+ * logger("Operation failed", {
21
+ * userId: "user123",
22
+ * level: "error",
23
+ * endpoint: "/auth",
24
+ * method: "processPayment",
25
+ * error
26
+ * });
27
+ * }
28
+ *
29
+ * @example
30
+ * // With object-like error (e.g., from an API)
31
+ * const apiError = { status: 403, message: "Forbidden", code: "ACCESS_DENIED" };
32
+ * logger("API request failed", { error: apiError, level: "error" });
33
+ *
34
+ * @example
35
+ * // With primitive error
36
+ * logger("Validation failed", { error: "Invalid input", level: "warn" });
37
+ *
38
+ * @example
39
+ * // With request tracking
40
+ * logger("API request received", {
41
+ * requestId: req.headers['x-request-id'],
42
+ * endpoint: "/auth",
43
+ * method: "validateToken"
44
+ * action: "validateToken"
45
+ * });
46
+ */
47
+ const logger = (message, options) => {
48
+ const timestamp = new Date().toISOString();
49
+ const environment = process.env.ENVIRONMENT || "development";
50
+ const logEntry = Object.assign(Object.assign({ message, requestId: (options === null || options === void 0 ? void 0 : options.requestId) || "", timestamp, level: (options === null || options === void 0 ? void 0 : options.level) || "info", environment, endpoint: (options === null || options === void 0 ? void 0 : options.endpoint) || "", method: (options === null || options === void 0 ? void 0 : options.method) || "", action: (options === null || options === void 0 ? void 0 : options.action) || "", userId: (options === null || options === void 0 ? void 0 : options.userId) || "" }, ((options === null || options === void 0 ? void 0 : options.error)
51
+ ? {
52
+ error: (() => {
53
+ var _a, _b, _c;
54
+ // Handle different error types
55
+ if (options.error instanceof Error) {
56
+ // Standard Error object
57
+ return {
58
+ name: (_a = options.error) === null || _a === void 0 ? void 0 : _a.name,
59
+ message: (_b = options.error) === null || _b === void 0 ? void 0 : _b.message,
60
+ stack: (_c = options.error) === null || _c === void 0 ? void 0 : _c.stack,
61
+ };
62
+ }
63
+ else if (typeof options.error === "object" &&
64
+ options.error !== null) {
65
+ // Object-like error but not an Error instance
66
+ const errorObj = options.error;
67
+ return {
68
+ name: (errorObj === null || errorObj === void 0 ? void 0 : errorObj.name) || "UnknownError",
69
+ message: (errorObj === null || errorObj === void 0 ? void 0 : errorObj.message) || String(errorObj),
70
+ details: errorObj,
71
+ };
72
+ }
73
+ else {
74
+ // Primitive or other non-object error
75
+ return {
76
+ name: "UnknownError",
77
+ message: String(options.error),
78
+ };
79
+ }
80
+ })(),
81
+ }
82
+ : {})), ((options === null || options === void 0 ? void 0 : options.additionalData) ? { data: options.additionalData } : {}));
83
+ // Log as JSON string on production for easier parsing in CloudWatch
84
+ const outputLog = environment === "production"
85
+ ? JSON.stringify(logEntry)
86
+ : JSON.stringify(logEntry, null, 2);
87
+ console.log(outputLog);
88
+ };
89
+ exports.default = logger;
90
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../utils/lambdaUtils/logger.ts"],"names":[],"mappings":";;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,OAAuB,EAAE,EAAE;IAC1D,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,CAAC;IAE7D,MAAM,QAAQ,iCACZ,OAAO,EACP,SAAS,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,EAAE,EACnC,SAAS,EACT,KAAK,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,KAAI,MAAM,EAC/B,WAAW,EACX,QAAQ,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,EAAE,EACjC,M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GACJ,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACrE,CAAC;IAEF,oEAAoE;IACpE,MAAM,SAAS,GACb,WAAW,KAAK,YAAY;QAC1B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC1B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAExC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winible/winible-typed",
3
- "version": "2.70.0",
3
+ "version": "2.70.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,64 +1,69 @@
1
1
  import {
2
- Model,
3
- InferAttributes,
4
- InferCreationAttributes,
5
- CreationOptional,
6
- DataTypes,
7
- fn,
8
- } from "sequelize";
9
-
10
- import sequelize from "./pb-sequelize";
11
- import User from "./user";
12
- import MarketingPhoneNumber from "./marketing-phone-number";
13
-
14
- class PhoneNumberAssignment extends Model<
15
- InferAttributes<PhoneNumberAssignment>,
16
- InferCreationAttributes<PhoneNumberAssignment>
17
- > {
18
- declare id: CreationOptional<string>;
19
- declare phoneNumberId: string;
20
- declare creatorId: string;
21
- declare smsCreatorName: string;
22
- declare createdAt: CreationOptional<Date>;
23
- declare updatedAt: CreationOptional<Date>;
24
- }
25
-
26
- PhoneNumberAssignment.init(
27
- {
28
- id: {
29
- type: DataTypes.BIGINT,
30
- primaryKey: true,
31
- allowNull: false,
32
- defaultValue: fn("next_id"),
33
- },
34
- phoneNumberId: {
35
- type: DataTypes.BIGINT,
36
- allowNull: false,
37
- field: "phone_number_id",
38
- },
39
- creatorId: {
40
- type: DataTypes.BIGINT,
41
- allowNull: false,
42
- field: "creator_id",
43
- },
44
- smsCreatorName: {
45
- type: DataTypes.STRING,
46
- field: "sms_creator_name",
47
- },
48
- createdAt: DataTypes.DATE,
49
- updatedAt: DataTypes.DATE,
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ CreationOptional,
6
+ DataTypes,
7
+ fn,
8
+ } from "sequelize";
9
+
10
+ import sequelize from "./pb-sequelize";
11
+ import User from "./user";
12
+ import MarketingPhoneNumber from "./marketing-phone-number";
13
+
14
+ class PhoneNumberAssignment extends Model<
15
+ InferAttributes<PhoneNumberAssignment>,
16
+ InferCreationAttributes<PhoneNumberAssignment>
17
+ > {
18
+ declare id: CreationOptional<string>;
19
+ declare phoneNumberId: string;
20
+ declare creatorId: string;
21
+ declare smsCreatorName: string;
22
+ declare smsCooldownDays: string;
23
+ declare createdAt: CreationOptional<Date>;
24
+ declare updatedAt: CreationOptional<Date>;
25
+ }
26
+
27
+ PhoneNumberAssignment.init(
28
+ {
29
+ id: {
30
+ type: DataTypes.BIGINT,
31
+ primaryKey: true,
32
+ allowNull: false,
33
+ defaultValue: fn("next_id"),
34
+ },
35
+ phoneNumberId: {
36
+ type: DataTypes.BIGINT,
37
+ allowNull: false,
38
+ field: "phone_number_id",
39
+ },
40
+ creatorId: {
41
+ type: DataTypes.BIGINT,
42
+ allowNull: false,
43
+ field: "creator_id",
50
44
  },
51
- {
52
- tableName: "phone_number_assignments",
53
- sequelize,
54
- }
55
- );
56
-
57
- /* associations */
58
- PhoneNumberAssignment.belongsTo(User, {
59
- foreignKey: "creatorId",
60
- targetKey: "id",
61
- });
45
+ smsCreatorName: {
46
+ type: DataTypes.STRING,
47
+ field: "sms_creator_name",
48
+ },
49
+ smsCooldownDays: {
50
+ type: DataTypes.INTEGER,
51
+ field: "sms_cooldown_days",
52
+ },
53
+ createdAt: DataTypes.DATE,
54
+ updatedAt: DataTypes.DATE,
55
+ },
56
+ {
57
+ tableName: "phone_number_assignments",
58
+ sequelize,
59
+ }
60
+ );
61
+
62
+ /* associations */
63
+ PhoneNumberAssignment.belongsTo(User, {
64
+ foreignKey: "creatorId",
65
+ targetKey: "id",
66
+ });
62
67
 
63
68
  // PhoneNumberAssignment.belongsTo(MarketingPhoneNumber, {
64
69
  // foreignKey: "phoneNumberId",
@@ -68,6 +73,5 @@ import {
68
73
  // foreignKey: "phoneNumberId",
69
74
  // sourceKey: "id",
70
75
  // });
71
-
72
- export default PhoneNumberAssignment;
73
-
76
+
77
+ export default PhoneNumberAssignment;