@classytic/supplier-performance 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 — kit refresh (peer floors: mongokit >=3.22.0, repo-core >=0.13.0, primitives >=0.11.0)
package/dist/index.js CHANGED
@@ -32,7 +32,6 @@ function injectTenantField(schema, tenant) {
32
32
  schema.add({ [tenant.tenantField]: {
33
33
  type: isObjectId ? mongoose.Schema.Types.ObjectId : String,
34
34
  ...tenant.enabled && tenant.required ? { required: true } : {},
35
- index: true,
36
35
  ...isObjectId && tenant.ref ? { ref: tenant.ref } : {}
37
36
  } });
38
37
  if (!tenant.enabled || !isFieldStrategy) return;
@@ -44,6 +43,7 @@ function injectTenantField(schema, tenant) {
44
43
  for (const [key, val] of Object.entries(fields)) newFields[key] = val;
45
44
  indexEntry[0] = newFields;
46
45
  }
46
+ if (!(existingIndexes ?? []).some(([fields]) => Object.keys(fields)[0] === tenant.tenantField)) schema.index({ [tenant.tenantField]: 1 });
47
47
  }
48
48
  //#endregion
49
49
  //#region src/models/performance-event.model.ts
package/package.json CHANGED
@@ -1,82 +1,82 @@
1
- {
2
- "name": "@classytic/supplier-performance",
3
- "version": "0.3.0",
4
- "description": "Framework-agnostic supplier performance engine \u00e2\u20ac\u201d on-time-delivery, defect, and price-variance tracking with append-only event log + cached scorecards. Powered by MongoDB via @classytic/mongokit. Zero framework deps \u00e2\u20ac\u201d usable from Arc, Express, Nest, Next.js, or raw Node.",
5
- "author": "Classytic",
6
- "license": "MIT",
7
- "homepage": "https://www.npmjs.com/package/@classytic/supplier-performance",
8
- "bugs": {
9
- "url": "https://github.com/classytic/supplier-performance/issues"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/classytic/supplier-performance.git"
14
- },
15
- "keywords": [
16
- "supplier",
17
- "performance",
18
- "scorecard",
19
- "vendor",
20
- "procurement",
21
- "on-time-delivery",
22
- "defect-rate",
23
- "price-variance",
24
- "mongodb",
25
- "classytic"
26
- ],
27
- "type": "module",
28
- "sideEffects": false,
29
- "engines": {
30
- "node": ">=22"
31
- },
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
- "exports": {
36
- ".": {
37
- "types": "./dist/index.d.ts",
38
- "default": "./dist/index.js"
39
- },
40
- "./events": {
41
- "types": "./dist/events.d.ts",
42
- "default": "./dist/events.js"
43
- }
44
- },
45
- "main": "./dist/index.js",
46
- "types": "./dist/index.d.ts",
47
- "files": [
48
- "dist",
49
- "README.md",
50
- "CHANGELOG.md",
51
- "LICENSE"
52
- ],
53
- "scripts": {
54
- "build": "tsdown",
55
- "typecheck": "tsc --noEmit",
56
- "test": "vitest run",
57
- "prepublishOnly": "npm run typecheck && npm run test && npm run build",
58
- "push": "classytic-push",
59
- "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
60
- "release": "npm run push -- main && npm run release:tag && npm publish"
61
- },
62
- "peerDependencies": {
63
- "@classytic/mongokit": ">=3.22.0",
64
- "@classytic/repo-core": ">=0.13.0",
65
- "@classytic/primitives": ">=0.11.0",
66
- "mongoose": ">=9.4.1",
67
- "zod": ">=4.0.0"
68
- },
69
- "devDependencies": {
70
- "@classytic/dev-tools": "^0.2.0",
71
- "@classytic/mongokit": "^3.22.1",
72
- "@classytic/repo-core": "^0.13.0",
73
- "@classytic/primitives": "^0.11.0",
74
- "@types/node": "^25.5.0",
75
- "mongodb-memory-server": "^10.2.3",
76
- "mongoose": "^9.4.1",
77
- "tsdown": "^0.14.2",
78
- "typescript": "^5.8.2",
79
- "vitest": "^3.2.4",
80
- "zod": "^4.0.0"
81
- }
82
- }
1
+ {
2
+ "name": "@classytic/supplier-performance",
3
+ "version": "0.3.1",
4
+ "description": "Framework-agnostic supplier performance engine — on-time-delivery, defect, and price-variance tracking with append-only event log + cached scorecards. Powered by MongoDB via @classytic/mongokit. Zero framework deps — usable from Arc, Express, Nest, Next.js, or raw Node.",
5
+ "author": "Classytic",
6
+ "license": "MIT",
7
+ "homepage": "https://www.npmjs.com/package/@classytic/supplier-performance",
8
+ "bugs": {
9
+ "url": "https://github.com/classytic/supplier-performance/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/classytic/supplier-performance.git"
14
+ },
15
+ "keywords": [
16
+ "supplier",
17
+ "performance",
18
+ "scorecard",
19
+ "vendor",
20
+ "procurement",
21
+ "on-time-delivery",
22
+ "defect-rate",
23
+ "price-variance",
24
+ "mongodb",
25
+ "classytic"
26
+ ],
27
+ "type": "module",
28
+ "sideEffects": false,
29
+ "engines": {
30
+ "node": ">=22"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "./events": {
41
+ "types": "./dist/events.d.ts",
42
+ "default": "./dist/events.js"
43
+ }
44
+ },
45
+ "main": "./dist/index.js",
46
+ "types": "./dist/index.d.ts",
47
+ "files": [
48
+ "dist",
49
+ "README.md",
50
+ "CHANGELOG.md",
51
+ "LICENSE"
52
+ ],
53
+ "scripts": {
54
+ "build": "tsdown",
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "vitest run",
57
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build",
58
+ "push": "classytic-push",
59
+ "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
60
+ "release": "npm run push -- main && npm run release:tag && npm publish"
61
+ },
62
+ "peerDependencies": {
63
+ "@classytic/mongokit": ">=3.22.0",
64
+ "@classytic/repo-core": ">=0.13.0",
65
+ "@classytic/primitives": ">=0.11.0",
66
+ "mongoose": ">=9.4.1",
67
+ "zod": ">=4.0.0"
68
+ },
69
+ "devDependencies": {
70
+ "@classytic/dev-tools": "^0.2.0",
71
+ "@classytic/mongokit": "^3.22.1",
72
+ "@classytic/repo-core": "^0.13.0",
73
+ "@classytic/primitives": "^0.11.0",
74
+ "@types/node": "^25.5.0",
75
+ "mongodb-memory-server": "^10.2.3",
76
+ "mongoose": "^9.4.1",
77
+ "tsdown": "^0.14.2",
78
+ "typescript": "^5.8.2",
79
+ "vitest": "^3.2.4",
80
+ "zod": "^4.0.0"
81
+ }
82
+ }