@classytic/promo 0.2.0 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { a as PROGRAM_TYPES, c as TRIGGER_MODES, l as VOUCHER_STATUSES, n as DISCOUNT_SCOPES, o as REWARD_TYPES, r as PROGRAM_STATUSES, s as STACKING_MODES, t as DISCOUNT_MODES } from "../constants-D0Rntp2f.mjs";
1
+ import { a as PROGRAM_TYPES, c as TRIGGER_MODES, i as PROGRAM_STATUSES, l as VOUCHER_STATUSES, n as DISCOUNT_SCOPES, o as REWARD_TYPES, s as STACKING_MODES, t as DISCOUNT_MODES } from "../constants-BB5O8zlN.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/schemas/index.ts
4
4
  /**
@@ -15,7 +15,6 @@ const metadataSchema = z.record(z.string(), z.unknown()).optional();
15
15
  const nonEmptyString = z.string().min(1);
16
16
  const optionalStringArray = z.array(z.string()).optional();
17
17
  const nonNegativeInt = z.number().int().min(0);
18
- z.number().min(0).max(100);
19
18
  /** Currency amount in smallest unit (paisa for BDT, cents for USD). */
20
19
  const paisaAmount = z.number().int().min(0);
21
20
  const programCreateSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/promo",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Production-grade promotion, coupon, and discount engine for MongoDB — programs, rules, rewards, vouchers, gift cards, buy-x-get-y",
5
5
  "author": "Classytic",
6
6
  "homepage": "https://www.npmjs.com/package/@classytic/promo",
@@ -51,21 +51,22 @@
51
51
  "lint:fix": "biome check --write src/ tests/",
52
52
  "format": "biome format --write src/ tests/",
53
53
  "check": "biome check --write --unsafe src/ tests/",
54
- "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build",
55
- "release": "npm run build && npm run typecheck && npm publish --access public"
54
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test:unit && npm run build",
55
+ "push": "classytic-push",
56
+ "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
57
+ "release": "npm run push -- main && npm run release:tag && npm publish"
56
58
  },
57
59
  "peerDependencies": {
58
60
  "@classytic/mongokit": ">=3.11.0",
59
- "@classytic/primitives": ">=0.1.0",
60
- "@classytic/repo-core": ">=0.2.0",
61
+ "@classytic/primitives": ">=0.2.0",
61
62
  "mongoose": ">=9.4.1",
62
63
  "zod": ">=4.0.0"
63
64
  },
64
65
  "devDependencies": {
65
66
  "@biomejs/biome": "^2.4.9",
67
+ "@classytic/dev-tools": "^0.2.0",
66
68
  "@classytic/mongokit": ">=3.11.0",
67
- "@classytic/primitives": ">=0.1.0",
68
- "@classytic/repo-core": ">=0.2.0",
69
+ "@classytic/primitives": ">=0.2.0",
69
70
  "@types/node": "^25.5.0",
70
71
  "@vitest/coverage-v8": "^3.2.4",
71
72
  "knip": "^6.3.0",
@@ -1,43 +0,0 @@
1
- //#region src/constants.ts
2
- const PROGRAM_TYPES = [
3
- "promotion",
4
- "coupon",
5
- "discount_code",
6
- "buy_x_get_y",
7
- "gift_card"
8
- ];
9
- const TRIGGER_MODES = ["auto", "code"];
10
- const PROGRAM_STATUSES = [
11
- "draft",
12
- "active",
13
- "paused",
14
- "expired",
15
- "archived"
16
- ];
17
- const STACKING_MODES = ["exclusive", "stackable"];
18
- const REWARD_TYPES = ["discount", "free_product"];
19
- const DISCOUNT_MODES = ["percentage", "fixed"];
20
- const DISCOUNT_SCOPES = [
21
- "order",
22
- "cheapest",
23
- "specific_products"
24
- ];
25
- const VOUCHER_STATUSES = [
26
- "active",
27
- "used",
28
- "expired",
29
- "cancelled"
30
- ];
31
- const PROGRAM_TRANSITIONS = {
32
- draft: ["active", "archived"],
33
- active: [
34
- "paused",
35
- "expired",
36
- "archived"
37
- ],
38
- paused: ["active", "archived"],
39
- expired: ["archived"],
40
- archived: []
41
- };
42
- //#endregion
43
- export { PROGRAM_TYPES as a, TRIGGER_MODES as c, PROGRAM_TRANSITIONS as i, VOUCHER_STATUSES as l, DISCOUNT_SCOPES as n, REWARD_TYPES as o, PROGRAM_STATUSES as r, STACKING_MODES as s, DISCOUNT_MODES as t };