@hexaijs/contracts 0.1.1 → 0.1.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.
@@ -0,0 +1,6 @@
1
+ import { Message } from "@hexaijs/core";
2
+ export declare class Command<Payload = unknown, ResultType = unknown> extends Message<Payload> {
3
+ readonly ResultType: ResultType;
4
+ static getIntent(): string;
5
+ }
6
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,UAAU,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;IAClF,SAAiB,UAAU,EAAE,UAAU,CAAC;IAExC,OAAgB,SAAS,IAAI,MAAM,CAElC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import { Message } from "@hexaijs/core";
2
+ export class Command extends Message {
3
+ static getIntent() {
4
+ return "command";
5
+ }
6
+ }
7
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,OAAiD,SAAQ,OAAgB;IAGlF,MAAM,CAAU,SAAS;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ"}
@@ -1,4 +1,4 @@
1
- interface PublicEventOptions {
1
+ export interface PublicEventOptions {
2
2
  /**
3
3
  * Event version for versioned events
4
4
  * @example @PublicEvent({ version: 2 })
@@ -11,7 +11,7 @@ interface PublicEventOptions {
11
11
  */
12
12
  context?: string;
13
13
  }
14
- interface PublicCommandOptions {
14
+ export interface PublicCommandOptions {
15
15
  /**
16
16
  * Business context this command belongs to.
17
17
  * If not specified, inferred from package name.
@@ -25,7 +25,7 @@ interface PublicCommandOptions {
25
25
  */
26
26
  response?: string;
27
27
  }
28
- interface PublicQueryOptions {
28
+ export interface PublicQueryOptions {
29
29
  /**
30
30
  * Business context this query belongs to.
31
31
  * If not specified, inferred from package name.
@@ -39,8 +39,7 @@ interface PublicQueryOptions {
39
39
  */
40
40
  response?: string;
41
41
  }
42
- declare function PublicEvent(_options?: PublicEventOptions): ClassDecorator;
43
- declare function PublicCommand(_options?: PublicCommandOptions): ClassDecorator;
44
- declare function PublicQuery(_options?: PublicQueryOptions): ClassDecorator;
45
-
46
- export { PublicCommand, type PublicCommandOptions, PublicEvent, type PublicEventOptions, PublicQuery, type PublicQueryOptions };
42
+ export declare function PublicEvent(_options?: PublicEventOptions): ClassDecorator;
43
+ export declare function PublicCommand(_options?: PublicCommandOptions): ClassDecorator;
44
+ export declare function PublicQuery(_options?: PublicQueryOptions): ClassDecorator;
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,QAAQ,GAAE,kBAAuB,GAAG,cAAc,CAE7E;AAED,wBAAgB,aAAa,CAC3B,QAAQ,GAAE,oBAAyB,GAClC,cAAc,CAEhB;AAED,wBAAgB,WAAW,CAAC,QAAQ,GAAE,kBAAuB,GAAG,cAAc,CAE7E"}
@@ -1,14 +1,10 @@
1
- // src/decorators/index.ts
2
- function PublicEvent(_options = {}) {
3
- return (target) => target;
1
+ export function PublicEvent(_options = {}) {
2
+ return (target) => target;
4
3
  }
5
- function PublicCommand(_options = {}) {
6
- return (target) => target;
4
+ export function PublicCommand(_options = {}) {
5
+ return (target) => target;
7
6
  }
8
- function PublicQuery(_options = {}) {
9
- return (target) => target;
7
+ export function PublicQuery(_options = {}) {
8
+ return (target) => target;
10
9
  }
11
-
12
- export { PublicCommand, PublicEvent, PublicQuery };
13
- //# sourceMappingURL=index.js.map
14
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/decorators/index.ts"],"names":[],"mappings":";AA+CO,SAAS,WAAA,CAAY,QAAA,GAA+B,EAAC,EAAmB;AAC7E,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB;AAEO,SAAS,aAAA,CACd,QAAA,GAAiC,EAAC,EAClB;AAChB,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB;AAEO,SAAS,WAAA,CAAY,QAAA,GAA+B,EAAC,EAAmB;AAC7E,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB","file":"index.js","sourcesContent":["export interface PublicEventOptions {\n /**\n * Event version for versioned events\n * @example @PublicEvent({ version: 2 })\n */\n version?: number;\n\n /**\n * Business context this event belongs to.\n * If not specified, inferred from package name.\n * @example @PublicEvent({ context: 'lecture' })\n */\n context?: string;\n}\n\nexport interface PublicCommandOptions {\n /**\n * Business context this command belongs to.\n * If not specified, inferred from package name.\n * @example @PublicCommand({ context: 'auth' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this command.\n * If specified, the parser will look for this type in the same file.\n * @example @PublicCommand({ response: 'CreateUserResult' })\n */\n response?: string;\n}\n\nexport interface PublicQueryOptions {\n /**\n * Business context this query belongs to.\n * If not specified, inferred from package name.\n * @example @PublicQuery({ context: 'catalog' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this query.\n * If specified, the parser will look for this type in the same file.\n * @example @PublicQuery({ response: 'UserProfile' })\n */\n response?: string;\n}\n\nexport function PublicEvent(_options: PublicEventOptions = {}): ClassDecorator {\n return (target) => target;\n}\n\nexport function PublicCommand(\n _options: PublicCommandOptions = {}\n): ClassDecorator {\n return (target) => target;\n}\n\nexport function PublicQuery(_options: PublicQueryOptions = {}): ClassDecorator {\n return (target) => target;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AA+CA,MAAM,UAAU,WAAW,CAAC,QAAQ,GAAuB,EAAE;IAC3D,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,QAAQ,GAAyB,EAAE;IAEnC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAQ,GAAuB,EAAE;IAC3D,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;AAC5B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,4 @@
1
- export { PublicCommand, PublicCommandOptions, PublicEvent, PublicEventOptions, PublicQuery, PublicQueryOptions } from './decorators/index.js';
2
- import { Message } from '@hexaijs/core';
3
-
4
- declare class Command<Payload = unknown, ResultType = unknown> extends Message<Payload> {
5
- readonly ResultType: ResultType;
6
- static getIntent(): string;
7
- }
8
-
9
- declare class Query<Payload = unknown, ResultType = unknown> extends Message<Payload> {
10
- readonly ResultType: ResultType;
11
- static getIntent(): string;
12
- }
13
-
14
- export { Command, Query };
1
+ export { PublicEvent, PublicCommand, PublicQuery, type PublicEventOptions, type PublicCommandOptions, type PublicQueryOptions, } from "./decorators/index.js";
2
+ export { Command } from "./command.js";
3
+ export { Query } from "./query.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,26 +1,4 @@
1
- import { Message } from '@hexaijs/core';
2
-
3
- // src/decorators/index.ts
4
- function PublicEvent(_options = {}) {
5
- return (target) => target;
6
- }
7
- function PublicCommand(_options = {}) {
8
- return (target) => target;
9
- }
10
- function PublicQuery(_options = {}) {
11
- return (target) => target;
12
- }
13
- var Command = class extends Message {
14
- static getIntent() {
15
- return "command";
16
- }
17
- };
18
- var Query = class extends Message {
19
- static getIntent() {
20
- return "query";
21
- }
22
- };
23
-
24
- export { Command, PublicCommand, PublicEvent, PublicQuery, Query };
25
- //# sourceMappingURL=index.js.map
1
+ export { PublicEvent, PublicCommand, PublicQuery, } from "./decorators/index.js";
2
+ export { Command } from "./command.js";
3
+ export { Query } from "./query.js";
26
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/decorators/index.ts","../src/command.ts","../src/query.ts"],"names":["Message"],"mappings":";;;AA+CO,SAAS,WAAA,CAAY,QAAA,GAA+B,EAAC,EAAmB;AAC7E,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB;AAEO,SAAS,aAAA,CACd,QAAA,GAAiC,EAAC,EAClB;AAChB,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB;AAEO,SAAS,WAAA,CAAY,QAAA,GAA+B,EAAC,EAAmB;AAC7E,EAAA,OAAO,CAAC,MAAA,KAAW,MAAA;AACrB;ACzDO,IAAM,OAAA,GAAN,cAA+D,OAAA,CAAiB;AAAA,EAGnF,OAAgB,SAAA,GAAoB;AAChC,IAAA,OAAO,SAAA;AAAA,EACX;AACJ;ACNO,IAAM,KAAA,GAAN,cAA6DA,OAAAA,CAAiB;AAAA,EAGjF,OAAgB,SAAA,GAAoB;AAChC,IAAA,OAAO,OAAA;AAAA,EACX;AACJ","file":"index.js","sourcesContent":["export interface PublicEventOptions {\n /**\n * Event version for versioned events\n * @example @PublicEvent({ version: 2 })\n */\n version?: number;\n\n /**\n * Business context this event belongs to.\n * If not specified, inferred from package name.\n * @example @PublicEvent({ context: 'lecture' })\n */\n context?: string;\n}\n\nexport interface PublicCommandOptions {\n /**\n * Business context this command belongs to.\n * If not specified, inferred from package name.\n * @example @PublicCommand({ context: 'auth' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this command.\n * If specified, the parser will look for this type in the same file.\n * @example @PublicCommand({ response: 'CreateUserResult' })\n */\n response?: string;\n}\n\nexport interface PublicQueryOptions {\n /**\n * Business context this query belongs to.\n * If not specified, inferred from package name.\n * @example @PublicQuery({ context: 'catalog' })\n */\n context?: string;\n\n /**\n * Explicit response type name for this query.\n * If specified, the parser will look for this type in the same file.\n * @example @PublicQuery({ response: 'UserProfile' })\n */\n response?: string;\n}\n\nexport function PublicEvent(_options: PublicEventOptions = {}): ClassDecorator {\n return (target) => target;\n}\n\nexport function PublicCommand(\n _options: PublicCommandOptions = {}\n): ClassDecorator {\n return (target) => target;\n}\n\nexport function PublicQuery(_options: PublicQueryOptions = {}): ClassDecorator {\n return (target) => target;\n}\n","import { Message } from \"@hexaijs/core\";\n\nexport class Command<Payload = unknown, ResultType = unknown> extends Message<Payload> {\n declare readonly ResultType: ResultType;\n\n static override getIntent(): string {\n return \"command\";\n }\n}\n","import { Message } from \"@hexaijs/core\";\n\nexport class Query<Payload = unknown, ResultType = unknown> extends Message<Payload> {\n declare readonly ResultType: ResultType;\n\n static override getIntent(): string {\n return \"query\";\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,GAIZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Message } from "@hexaijs/core";
2
+ export declare class Query<Payload = unknown, ResultType = unknown> extends Message<Payload> {
3
+ readonly ResultType: ResultType;
4
+ static getIntent(): string;
5
+ }
6
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,KAAK,CAAC,OAAO,GAAG,OAAO,EAAE,UAAU,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;IAChF,SAAiB,UAAU,EAAE,UAAU,CAAC;IAExC,OAAgB,SAAS,IAAI,MAAM,CAElC;CACJ"}
package/dist/query.js ADDED
@@ -0,0 +1,7 @@
1
+ import { Message } from "@hexaijs/core";
2
+ export class Query extends Message {
3
+ static getIntent() {
4
+ return "query";
5
+ }
6
+ }
7
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,KAA+C,SAAQ,OAAgB;IAGhF,MAAM,CAAU,SAAS;QACrB,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.1",
6
+ "version": "0.1.2",
7
7
  "type": "module",
8
8
  "description": "Zero-dependency marker decorators for hexai contract definitions",
9
9
  "license": "MIT",
@@ -42,14 +42,15 @@
42
42
  "./package.json": "./package.json"
43
43
  },
44
44
  "peerDependencies": {
45
- "@hexaijs/core": "^0.8.0"
45
+ "@hexaijs/core": "^0.9.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@hexaijs/core": "^0.8.0",
48
+ "@typescript/native-preview": "^7.0.0-dev",
49
+ "@hexaijs/core": "^0.9.1",
49
50
  "@hexaijs/tooling": "0.1.0"
50
51
  },
51
52
  "scripts": {
52
53
  "test": "vitest run",
53
- "build": "tsup"
54
+ "build": "tsgo -p tsconfig.build.json"
54
55
  }
55
56
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Sangwoo Hyun
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.