@turystack/entity 0.0.5 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  type Class = {
2
- new (...args: any[]): any;
2
+ new (...args: never[]): object;
3
3
  };
4
- export declare function Entity(): (Constructor: Class) => void;
4
+ export declare function Entity(identifier?: string): (Constructor: Class) => void;
5
5
  export {};
6
6
  //# sourceMappingURL=entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/entity/entity.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACZ,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;CACzB,CAAA;AAkBD,wBAAgB,MAAM,KACb,aAAa,KAAK,UAG1B"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/entity/entity.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACZ,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;CAC9B,CAAA;AAqBD,wBAAgB,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,iBACpB,KAAK,UAG1B"}
@@ -1,7 +1,7 @@
1
1
  import superjson from 'superjson';
2
- export function Entity() {
2
+ export function Entity(identifier) {
3
3
  return (Constructor) => {
4
- superjson.registerClass(Constructor);
4
+ superjson.registerClass(Constructor, identifier);
5
5
  };
6
6
  }
7
7
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/entity/entity.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAsBjC,MAAM,UAAU,MAAM;IACrB,OAAO,CAAC,WAAkB,EAAE,EAAE;QAC7B,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;IACrC,CAAC,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/entity/entity.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAyBjC,MAAM,UAAU,MAAM,CAAC,UAAmB;IACzC,OAAO,CAAC,WAAkB,EAAE,EAAE;QAC7B,SAAS,CAAC,aAAa,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;IACjD,CAAC,CAAA;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './entity/index.js';
2
- export * from './exceptions/index.js';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './entity/index.js';
2
- export * from './exceptions/index.js';
3
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@turystack/entity",
3
+ "description": "Type-safe domain entities with stable SuperJSON serialization identifiers.",
3
4
  "private": false,
4
- "version": "0.0.5",
5
+ "version": "1.0.1",
5
6
  "type": "module",
7
+ "sideEffects": false,
6
8
  "main": "./dist/index.js",
7
9
  "module": "./dist/index.js",
8
10
  "types": "./dist/index.d.ts",
@@ -16,6 +18,9 @@
16
18
  "publishConfig": {
17
19
  "access": "public"
18
20
  },
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
19
24
  "files": [
20
25
  "dist"
21
26
  ],
@@ -24,23 +29,26 @@
24
29
  "url": "https://github.com/turystack/entity.git"
25
30
  },
26
31
  "peerDependencies": {
27
- "superjson": "^2.0.0"
32
+ "superjson": "^2.2.6"
28
33
  },
29
34
  "devDependencies": {
30
- "@biomejs/biome": "2.2.2",
31
- "@vitest/coverage-v8": "^2.1.0",
35
+ "@biomejs/biome": "2.5.4",
36
+ "@vitest/coverage-v8": "^4.1.10",
32
37
  "reflect-metadata": "^0.2.2",
33
- "superjson": "^2.0.0",
34
- "tsc-alias": "^1.8.16",
35
- "typescript": "^5.5.0",
36
- "vitest": "^2.1.0"
38
+ "superjson": "^2.2.6",
39
+ "tsc-alias": "^1.9.1",
40
+ "typescript": "^7.0.2",
41
+ "vite": "^8.1.5",
42
+ "vitest": "^4.1.10"
37
43
  },
38
44
  "scripts": {
39
45
  "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
46
+ "typecheck": "tsc --noEmit",
40
47
  "test": "vitest run",
41
48
  "test:cov": "vitest run --coverage",
42
49
  "lint": "biome lint ./src",
43
50
  "format": "biome format --write ./src",
44
- "check": "biome check --write ./src"
51
+ "check": "biome check ./src",
52
+ "check:fix": "biome check --write ./src"
45
53
  }
46
54
  }
@@ -1,3 +0,0 @@
1
- import type { ExceptionBuilder } from './exceptions.types.js';
2
- export declare function createExceptions<T>(factory: (e: ExceptionBuilder) => T): T;
3
- //# sourceMappingURL=exceptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/exceptions/exceptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,uBAAuB,CAAA;AAsB9E,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,CAAC,GAAG,CAAC,CAmB1E"}
@@ -1,15 +0,0 @@
1
- export function createExceptions(factory) {
2
- const builder = {
3
- module: (prefix, codes) => {
4
- const result = {
5
- not_found: `${prefix}.not_found`,
6
- };
7
- for (const code of codes) {
8
- result[code] = `${prefix}.${code}`;
9
- }
10
- return result;
11
- },
12
- };
13
- return factory(builder);
14
- }
15
- //# sourceMappingURL=exceptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/exceptions/exceptions.ts"],"names":[],"mappings":"AAsBA,MAAM,UAAU,gBAAgB,CAAI,OAAmC;IACtE,MAAM,OAAO,GAAqB;QACjC,MAAM,EAAE,CACP,MAAS,EACT,KAAQ,EACgB,EAAE;YAC1B,MAAM,MAAM,GAAG;gBACd,SAAS,EAAE,GAAG,MAAM,YAAY;aACN,CAAA;YAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAA;YACnC,CAAC;YAED,OAAO,MAA+B,CAAA;QACvC,CAAC;KACD,CAAA;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC"}
@@ -1,9 +0,0 @@
1
- export type ExceptionModule<P extends string, T extends readonly string[]> = {
2
- not_found: `${P}.not_found`;
3
- } & {
4
- [K in T[number]]: `${P}.${K}`;
5
- };
6
- export type ExceptionBuilder = {
7
- module: <const P extends string, const T extends readonly string[]>(prefix: P, codes: T) => ExceptionModule<P, T>;
8
- };
9
- //# sourceMappingURL=exceptions.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exceptions.types.d.ts","sourceRoot":"","sources":["../../src/exceptions/exceptions.types.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI;IAC5E,SAAS,EAAE,GAAG,CAAC,YAAY,CAAA;CAC3B,GAAG;KAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE;CAAE,CAAA;AAGrC,MAAM,MAAM,gBAAgB,GAAG;IAO9B,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EACjE,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,CAAC,KACJ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;CAC1B,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=exceptions.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exceptions.types.js","sourceRoot":"","sources":["../../src/exceptions/exceptions.types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './exceptions.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './exceptions.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}