@winible/winible-typed 2.3.1 → 2.3.2

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/src/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserRole = exports.UserStatus = void 0;
3
+ exports.TemporalUnit = exports.DiscountType = exports.UserRole = exports.UserStatus = void 0;
4
4
  var UserStatus;
5
5
  (function (UserStatus) {
6
6
  UserStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
@@ -12,4 +12,17 @@ var UserRole;
12
12
  UserRole["CREATOR"] = "CREATOR";
13
13
  UserRole["USER"] = "USER";
14
14
  })(UserRole = exports.UserRole || (exports.UserRole = {}));
15
+ var DiscountType;
16
+ (function (DiscountType) {
17
+ DiscountType["percent"] = "percent";
18
+ DiscountType["dollars"] = "dollars";
19
+ DiscountType["free_trial"] = "free_trial";
20
+ })(DiscountType = exports.DiscountType || (exports.DiscountType = {}));
21
+ var TemporalUnit;
22
+ (function (TemporalUnit) {
23
+ TemporalUnit["day"] = "day";
24
+ TemporalUnit["week"] = "week";
25
+ TemporalUnit["month"] = "month";
26
+ TemporalUnit["year"] = "year";
27
+ })(TemporalUnit = exports.TemporalUnit || (exports.TemporalUnit = {}));
15
28
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAyCA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+CAAiC,CAAA;IACjC,mCAAqB,CAAA;IACrB,+BAAiB,CAAA;AACnB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AAED,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAyCA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+CAAiC,CAAA;IACjC,mCAAqB,CAAA;IACrB,+BAAiB,CAAA;AACnB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AAED,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;AAC3B,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const sequelize_1 = require("sequelize");
7
7
  const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
8
8
  const subscription_plan_1 = __importDefault(require("./subscription-plan"));
9
+ const types_1 = require("../src/types");
9
10
  // order of InferAttributes & InferCreationAttributes is important.
10
11
  class SubscriptionCoupon extends sequelize_1.Model {
11
12
  }
@@ -32,6 +33,30 @@ SubscriptionCoupon.init({
32
33
  type: sequelize_1.DataTypes.STRING,
33
34
  field: "code",
34
35
  },
36
+ discountType: {
37
+ type: sequelize_1.DataTypes.ENUM(...Object.values(types_1.DiscountType)),
38
+ field: "discount_type",
39
+ },
40
+ discountPercent: {
41
+ type: sequelize_1.DataTypes.BIGINT,
42
+ field: "discount_percent",
43
+ },
44
+ maxRedemptions: {
45
+ type: sequelize_1.DataTypes.BIGINT,
46
+ field: "max_redemptions",
47
+ },
48
+ redemptions: {
49
+ type: sequelize_1.DataTypes.BIGINT,
50
+ field: "redemptions",
51
+ },
52
+ temporalAmount: {
53
+ type: sequelize_1.DataTypes.BIGINT,
54
+ field: "temporal_amount",
55
+ },
56
+ temporalUnit: {
57
+ type: sequelize_1.DataTypes.ENUM(...Object.values(types_1.TemporalUnit)),
58
+ field: "temporal_unit",
59
+ },
35
60
  createdAt: sequelize_1.DataTypes.DATE,
36
61
  updatedAt: sequelize_1.DataTypes.DATE,
37
62
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-coupon.js","sourceRoot":"","sources":["../../typed-model/subscription-coupon.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,4EAAmD;AAMnD,mEAAmE;AACnE,MAAM,kBAAmB,SAAQ,iBAGhC;CAeA;AAED,kBAAkB,CAAC,IAAI,CACrB;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,kBAAkB,EAAE;QAClB,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,sBAAsB;QAC7B,UAAU,EAAE;YACV,KAAK,EAAE,2BAAgB;SACxB;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,MAAM;KACd;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"subscription-coupon.js","sourceRoot":"","sources":["../../typed-model/subscription-coupon.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,4EAAmD;AAEnD,wCAA0D;AAE1D,mEAAmE;AACnE,MAAM,kBAAmB,SAAQ,iBAGhC;CAeA;AAED,kBAAkB,CAAC,IAAI,CACrB;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,kBAAkB,EAAE;QAClB,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,sBAAsB;QAC7B,UAAU,EAAE;YACV,KAAK,EAAE,2BAAgB;SACxB;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,MAAM;KACd;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,MAAM;KACd;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;QACpD,KAAK,EAAE,eAAe;KACvB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,kBAAkB;KAC1B;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,iBAAiB;KACzB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,aAAa;KACrB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,iBAAiB;KACzB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;QACpD,KAAK,EAAE,eAAe;KACvB;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winible/winible-typed",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/types.ts CHANGED
@@ -49,3 +49,16 @@ export enum UserRole {
49
49
  CREATOR = "CREATOR",
50
50
  USER = "USER",
51
51
  }
52
+
53
+ export enum DiscountType {
54
+ percent = "percent",
55
+ dollars = "dollars",
56
+ free_trial = "free_trial",
57
+ }
58
+
59
+ export enum TemporalUnit {
60
+ day = "day",
61
+ week = "week",
62
+ month = "month",
63
+ year = "year",
64
+ }
@@ -9,9 +9,7 @@ import {
9
9
  import sequelize from "./pb-sequelize";
10
10
  import SubscriptionPlan from "./subscription-plan";
11
11
 
12
- type TemporalUnitType = "day" | "week" | "month" | "year";
13
-
14
- type DiscountType = "percent" | "dollars" | "free_trial";
12
+ import { DiscountType, TemporalUnit } from "../src/types";
15
13
 
16
14
  // order of InferAttributes & InferCreationAttributes is important.
17
15
  class SubscriptionCoupon extends Model<
@@ -29,7 +27,7 @@ class SubscriptionCoupon extends Model<
29
27
  declare maxRedemptions?: number;
30
28
  declare redemptions?: number;
31
29
  declare temporalAmount?: number;
32
- declare temporalUnit?: TemporalUnitType;
30
+ declare temporalUnit?: TemporalUnit;
33
31
  declare createdAt: CreationOptional<Date>;
34
32
  declare updatedAt: CreationOptional<Date>;
35
33
  }
@@ -58,6 +56,30 @@ SubscriptionCoupon.init(
58
56
  type: DataTypes.STRING,
59
57
  field: "code",
60
58
  },
59
+ discountType: {
60
+ type: DataTypes.ENUM(...Object.values(DiscountType)),
61
+ field: "discount_type",
62
+ },
63
+ discountPercent: {
64
+ type: DataTypes.BIGINT,
65
+ field: "discount_percent",
66
+ },
67
+ maxRedemptions: {
68
+ type: DataTypes.BIGINT,
69
+ field: "max_redemptions",
70
+ },
71
+ redemptions: {
72
+ type: DataTypes.BIGINT,
73
+ field: "redemptions",
74
+ },
75
+ temporalAmount: {
76
+ type: DataTypes.BIGINT,
77
+ field: "temporal_amount",
78
+ },
79
+ temporalUnit: {
80
+ type: DataTypes.ENUM(...Object.values(TemporalUnit)),
81
+ field: "temporal_unit",
82
+ },
61
83
  createdAt: DataTypes.DATE,
62
84
  updatedAt: DataTypes.DATE,
63
85
  },