@classytic/pos 0.3.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.1] — 2026-07-16
4
+
5
+ ### Fixed
6
+
7
+ - injectTenantField no longer force-indexes the tenant field: the compound
8
+ prepend makes the tenant the leading key of every index, so the bare single
9
+ was a redundant prefix paid on every insert (PACKAGE_RULES P11.1, fleet
10
+ index audit). A dedicated tenant index is still created when a schema
11
+ declares no compounds to prepend. Index-declaration change only.
12
+
3
13
  ## [0.3.0] — unpublished (2026-07-15)
4
14
 
5
15
  ### Changed — mongokit 3.22 `applyTransition()` adopted (peer floors: mongokit >=3.22.0, repo-core >=0.13.0, primitives >=0.11.0)
@@ -31,7 +31,6 @@ function injectTenantField(schema, tenant) {
31
31
  schema.add({ [tenant.tenantField]: {
32
32
  type: isObjectId ? mongoose.Schema.Types.ObjectId : String,
33
33
  ...tenant.enabled && tenant.required ? { required: true } : {},
34
- index: true,
35
34
  ...isObjectId && tenant.ref ? { ref: tenant.ref } : {}
36
35
  } });
37
36
  if (!tenant.enabled || !isFieldStrategy) return;
@@ -43,6 +42,7 @@ function injectTenantField(schema, tenant) {
43
42
  for (const [key, val] of Object.entries(fields)) newFields[key] = val;
44
43
  indexEntry[0] = newFields;
45
44
  }
45
+ if (!(existingIndexes ?? []).some(([fields]) => Object.keys(fields)[0] === tenant.tenantField)) schema.index({ [tenant.tenantField]: 1 });
46
46
  }
47
47
  //#endregion
48
48
  export { injectTenantField, resolvePosTenant };
package/package.json CHANGED
@@ -1,110 +1,110 @@
1
- {
2
- "name": "@classytic/pos",
3
- "version": "0.3.0",
4
- "description": "Multi-vertical POS / register-session kernel for MongoDB \u2014 shift lifecycle, cash-drawer reconciliation, payment-method breakdown, variance detection, FSM. Works for retail, restaurant, clinic, service-booking, car-wash and any vertical with a 'shift opens, shift closes, money is reconciled' workflow.",
5
- "author": "Classytic",
6
- "type": "module",
7
- "sideEffects": false,
8
- "engines": {
9
- "node": ">=22"
10
- },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.mts",
17
- "default": "./dist/index.mjs"
18
- },
19
- "./engine": {
20
- "types": "./dist/engine/index.d.mts",
21
- "default": "./dist/engine/index.mjs"
22
- },
23
- "./events": {
24
- "types": "./dist/events/index.d.mts",
25
- "default": "./dist/events/index.mjs"
26
- },
27
- "./domain": {
28
- "types": "./dist/domain/index.d.mts",
29
- "default": "./dist/domain/index.mjs"
30
- },
31
- "./schemas": {
32
- "types": "./dist/schemas/index.d.mts",
33
- "default": "./dist/schemas/index.mjs"
34
- },
35
- "./testing": {
36
- "types": "./dist/testing/index.d.mts",
37
- "default": "./dist/testing/index.mjs"
38
- }
39
- },
40
- "main": "./dist/index.mjs",
41
- "types": "./dist/index.d.mts",
42
- "files": [
43
- "dist",
44
- "CHANGELOG.md",
45
- "README.md",
46
- "LICENSE"
47
- ],
48
- "repository": {
49
- "type": "git",
50
- "url": "git+https://github.com/classytic/pos.git"
51
- },
52
- "bugs": {
53
- "url": "https://github.com/classytic/pos/issues"
54
- },
55
- "homepage": "https://github.com/classytic/pos#readme",
56
- "scripts": {
57
- "build": "tsdown",
58
- "dev": "tsdown --watch",
59
- "typecheck": "tsc --noEmit",
60
- "test": "vitest run --project unit --project integration",
61
- "test:unit": "vitest run --project unit",
62
- "test:integration": "vitest run --project integration",
63
- "test:e2e": "vitest run --project e2e",
64
- "test:all": "vitest run",
65
- "test:watch": "vitest --project unit --project integration",
66
- "test:coverage": "vitest run --project unit --project integration --coverage",
67
- "test:ci": "vitest run --project unit --project integration",
68
- "push": "classytic-push",
69
- "prepublishOnly": "npm run typecheck && npm run build && npm run test:ci",
70
- "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
71
- "release": "npm run push -- main && npm run release:tag && npm publish"
72
- },
73
- "peerDependencies": {
74
- "@classytic/mongokit": ">=3.22.0",
75
- "@classytic/primitives": ">=0.11.0",
76
- "@classytic/repo-core": ">=0.13.0",
77
- "mongoose": ">=9.4.1",
78
- "zod": ">=4.0.0"
79
- },
80
- "devDependencies": {
81
- "@classytic/dev-tools": "^0.2.0",
82
- "@classytic/mongokit": "^3.22.0",
83
- "@classytic/primitives": "^0.11.0",
84
- "@classytic/repo-core": "^0.13.0",
85
- "@types/node": "^25.5.0",
86
- "@vitest/coverage-v8": "^3.2.4",
87
- "mongodb-memory-server": "^10.2.3",
88
- "mongoose": "^9.4.1",
89
- "tsdown": "^0.21.5",
90
- "typescript": "^5.7.0",
91
- "vitest": "^3.0.0",
92
- "zod": "^4.3.6"
93
- },
94
- "keywords": [
95
- "pos",
96
- "point-of-sale",
97
- "shift",
98
- "session",
99
- "cash-drawer",
100
- "register",
101
- "reconciliation",
102
- "retail",
103
- "restaurant",
104
- "clinic",
105
- "booking",
106
- "mongodb",
107
- "mongoose"
108
- ],
109
- "license": "MIT"
110
- }
1
+ {
2
+ "name": "@classytic/pos",
3
+ "version": "0.3.1",
4
+ "description": "Multi-vertical POS / register-session kernel for MongoDB — shift lifecycle, cash-drawer reconciliation, payment-method breakdown, variance detection, FSM. Works for retail, restaurant, clinic, service-booking, car-wash and any vertical with a 'shift opens, shift closes, money is reconciled' workflow.",
5
+ "author": "Classytic",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "node": ">=22"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.mts",
17
+ "default": "./dist/index.mjs"
18
+ },
19
+ "./engine": {
20
+ "types": "./dist/engine/index.d.mts",
21
+ "default": "./dist/engine/index.mjs"
22
+ },
23
+ "./events": {
24
+ "types": "./dist/events/index.d.mts",
25
+ "default": "./dist/events/index.mjs"
26
+ },
27
+ "./domain": {
28
+ "types": "./dist/domain/index.d.mts",
29
+ "default": "./dist/domain/index.mjs"
30
+ },
31
+ "./schemas": {
32
+ "types": "./dist/schemas/index.d.mts",
33
+ "default": "./dist/schemas/index.mjs"
34
+ },
35
+ "./testing": {
36
+ "types": "./dist/testing/index.d.mts",
37
+ "default": "./dist/testing/index.mjs"
38
+ }
39
+ },
40
+ "main": "./dist/index.mjs",
41
+ "types": "./dist/index.d.mts",
42
+ "files": [
43
+ "dist",
44
+ "CHANGELOG.md",
45
+ "README.md",
46
+ "LICENSE"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/classytic/pos.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/classytic/pos/issues"
54
+ },
55
+ "homepage": "https://github.com/classytic/pos#readme",
56
+ "scripts": {
57
+ "build": "tsdown",
58
+ "dev": "tsdown --watch",
59
+ "typecheck": "tsc --noEmit",
60
+ "test": "vitest run --project unit --project integration",
61
+ "test:unit": "vitest run --project unit",
62
+ "test:integration": "vitest run --project integration",
63
+ "test:e2e": "vitest run --project e2e",
64
+ "test:all": "vitest run",
65
+ "test:watch": "vitest --project unit --project integration",
66
+ "test:coverage": "vitest run --project unit --project integration --coverage",
67
+ "test:ci": "vitest run --project unit --project integration",
68
+ "push": "classytic-push",
69
+ "prepublishOnly": "npm run typecheck && npm run build && npm run test:ci",
70
+ "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
71
+ "release": "npm run push -- main && npm run release:tag && npm publish"
72
+ },
73
+ "peerDependencies": {
74
+ "@classytic/mongokit": ">=3.22.0",
75
+ "@classytic/primitives": ">=0.11.0",
76
+ "@classytic/repo-core": ">=0.13.0",
77
+ "mongoose": ">=9.4.1",
78
+ "zod": ">=4.0.0"
79
+ },
80
+ "devDependencies": {
81
+ "@classytic/dev-tools": "^0.2.0",
82
+ "@classytic/mongokit": "^3.22.0",
83
+ "@classytic/primitives": "^0.11.0",
84
+ "@classytic/repo-core": "^0.13.0",
85
+ "@types/node": "^25.5.0",
86
+ "@vitest/coverage-v8": "^3.2.4",
87
+ "mongodb-memory-server": "^10.2.3",
88
+ "mongoose": "^9.4.1",
89
+ "tsdown": "^0.21.5",
90
+ "typescript": "^5.7.0",
91
+ "vitest": "^3.0.0",
92
+ "zod": "^4.3.6"
93
+ },
94
+ "keywords": [
95
+ "pos",
96
+ "point-of-sale",
97
+ "shift",
98
+ "session",
99
+ "cash-drawer",
100
+ "register",
101
+ "reconciliation",
102
+ "retail",
103
+ "restaurant",
104
+ "clinic",
105
+ "booking",
106
+ "mongodb",
107
+ "mongoose"
108
+ ],
109
+ "license": "MIT"
110
+ }