@hed-hog/address 0.0.350 → 0.0.351

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 +1 @@
1
- {"version":3,"file":"address.module.d.ts","sourceRoot":"","sources":["../src/address.module.ts"],"names":[],"mappings":"AAQA,qBAWa,aAAa;CAAG"}
1
+ {"version":3,"file":"address.module.d.ts","sourceRoot":"","sources":["../src/address.module.ts"],"names":[],"mappings":"AASA,qBAWa,aAAa;CAAG"}
@@ -14,6 +14,7 @@ const api_pagination_1 = require("@hed-hog/api-pagination");
14
14
  const api_prisma_1 = require("@hed-hog/api-prisma");
15
15
  const address_controller_1 = require("./address.controller");
16
16
  const address_service_1 = require("./address.service");
17
+ const address_mcp_tools_1 = require("./mcp-tools/address.mcp-tools");
17
18
  let AddressModule = class AddressModule {
18
19
  };
19
20
  exports.AddressModule = AddressModule;
@@ -26,7 +27,7 @@ exports.AddressModule = AddressModule = __decorate([
26
27
  (0, common_1.forwardRef)(() => api_locale_1.LocaleModule)
27
28
  ],
28
29
  controllers: [address_controller_1.AddressController],
29
- providers: [address_service_1.AddressService],
30
+ providers: [address_service_1.AddressService, address_mcp_tools_1.AddressMcpTools],
30
31
  exports: [address_service_1.AddressService]
31
32
  })
32
33
  ], AddressModule);
@@ -1 +1 @@
1
- {"version":3,"file":"address.module.js","sourceRoot":"","sources":["../src/address.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,2CAA8C;AAC9C,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,6DAAyD;AACzD,uDAAmD;AAa5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAXzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,EAAE;YACtB,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;SAC/B;QACD,WAAW,EAAE,CAAC,sCAAiB,CAAC;QAChC,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
1
+ {"version":3,"file":"address.module.js","sourceRoot":"","sources":["../src/address.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,2CAA8C;AAC9C,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,6DAAyD;AACzD,uDAAmD;AACnD,qEAAgE;AAazD,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAXzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,EAAE;YACtB,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;SAC/B;QACD,WAAW,EAAE,CAAC,sCAAiB,CAAC;QAChC,SAAS,EAAE,CAAC,gCAAc,EAAE,mCAAe,CAAC;QAC5C,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
@@ -0,0 +1,12 @@
1
+ import { McpContext } from '@hed-hog/core';
2
+ import { AddressService } from '../address.service';
3
+ export declare class AddressMcpTools {
4
+ private readonly addressService;
5
+ constructor(addressService: AddressService);
6
+ list(args: Record<string, any>, _context: McpContext): Promise<any>;
7
+ get(args: Record<string, any>, context: McpContext): Promise<any>;
8
+ create(args: Record<string, any>, context: McpContext): Promise<any>;
9
+ update(args: Record<string, any>, context: McpContext): Promise<any>;
10
+ delete(args: Record<string, any>, context: McpContext): Promise<any>;
11
+ }
12
+ //# sourceMappingURL=address.mcp-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mcp-tools.d.ts","sourceRoot":"","sources":["../../src/mcp-tools/address.mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBACa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAerD,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAoBnE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BjE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IA2BpE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAgBpE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;CAG3E"}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.AddressMcpTools = void 0;
24
+ const core_1 = require("@hed-hog/core");
25
+ const common_1 = require("@nestjs/common");
26
+ const address_service_1 = require("../address.service");
27
+ let AddressMcpTools = class AddressMcpTools {
28
+ constructor(addressService) {
29
+ this.addressService = addressService;
30
+ }
31
+ async list(args, _context) {
32
+ var _a, _b, _c;
33
+ return this.addressService.list({
34
+ page: (_a = args.page) !== null && _a !== void 0 ? _a : 1,
35
+ pageSize: (_b = args.pageSize) !== null && _b !== void 0 ? _b : 20,
36
+ search: (_c = args.search) !== null && _c !== void 0 ? _c : '',
37
+ });
38
+ }
39
+ async get(args, context) {
40
+ return this.addressService.get(args.id, context.locale);
41
+ }
42
+ async create(args, context) {
43
+ return this.addressService.create(args, context.locale);
44
+ }
45
+ async update(args, context) {
46
+ const { id } = args, data = __rest(args, ["id"]);
47
+ return this.addressService.update(id, data, context.locale);
48
+ }
49
+ async delete(args, context) {
50
+ return this.addressService.delete({ ids: args.ids }, context.locale);
51
+ }
52
+ };
53
+ exports.AddressMcpTools = AddressMcpTools;
54
+ __decorate([
55
+ (0, core_1.McpTool)({
56
+ name: 'address.list',
57
+ description: 'Lists addresses with pagination and optional search.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ page: { type: 'number', description: 'Page number (default: 1)' },
62
+ pageSize: { type: 'number', description: 'Items per page (default: 20)' },
63
+ search: { type: 'string', description: 'Search term' },
64
+ },
65
+ },
66
+ readOnly: true,
67
+ }),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [Object, Object]),
70
+ __metadata("design:returntype", Promise)
71
+ ], AddressMcpTools.prototype, "list", null);
72
+ __decorate([
73
+ (0, core_1.McpTool)({
74
+ name: 'address.get',
75
+ description: 'Returns a single address by ID.',
76
+ inputSchema: {
77
+ type: 'object',
78
+ properties: {
79
+ id: { type: 'number', description: 'Address ID' },
80
+ },
81
+ required: ['id'],
82
+ },
83
+ readOnly: true,
84
+ }),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [Object, Object]),
87
+ __metadata("design:returntype", Promise)
88
+ ], AddressMcpTools.prototype, "get", null);
89
+ __decorate([
90
+ (0, core_1.McpTool)({
91
+ name: 'address.create',
92
+ description: 'Creates a new address.',
93
+ inputSchema: {
94
+ type: 'object',
95
+ properties: {
96
+ address_type: {
97
+ type: 'string',
98
+ enum: ['RESIDENTIAL', 'COMMERCIAL', 'CORRESPONDENCE', 'ALTERNATIVE', 'WORK', 'BILLING', 'SHIPPING'],
99
+ description: 'Address type',
100
+ },
101
+ country_code: { type: 'string', description: 'Country code (e.g. BR, US)' },
102
+ state: { type: 'string', description: 'State or province' },
103
+ city: { type: 'string', description: 'City' },
104
+ postal_code: { type: 'string', description: 'Postal / ZIP code' },
105
+ line1: { type: 'string', description: 'Address line 1' },
106
+ line2: { type: 'string', description: 'Address line 2 (optional)' },
107
+ is_primary: { type: 'boolean', description: 'Whether this is the primary address for its type' },
108
+ },
109
+ required: ['address_type', 'country_code', 'state', 'city', 'postal_code', 'line1'],
110
+ },
111
+ }),
112
+ __metadata("design:type", Function),
113
+ __metadata("design:paramtypes", [Object, Object]),
114
+ __metadata("design:returntype", Promise)
115
+ ], AddressMcpTools.prototype, "create", null);
116
+ __decorate([
117
+ (0, core_1.McpTool)({
118
+ name: 'address.update',
119
+ description: 'Updates an existing address by ID.',
120
+ inputSchema: {
121
+ type: 'object',
122
+ properties: {
123
+ id: { type: 'number', description: 'Address ID' },
124
+ address_type: {
125
+ type: 'string',
126
+ enum: ['RESIDENTIAL', 'COMMERCIAL', 'CORRESPONDENCE', 'ALTERNATIVE', 'WORK', 'BILLING', 'SHIPPING'],
127
+ description: 'Address type',
128
+ },
129
+ country_code: { type: 'string', description: 'Country code' },
130
+ state: { type: 'string', description: 'State or province' },
131
+ city: { type: 'string', description: 'City' },
132
+ postal_code: { type: 'string', description: 'Postal / ZIP code' },
133
+ line1: { type: 'string', description: 'Address line 1' },
134
+ line2: { type: 'string', description: 'Address line 2' },
135
+ is_primary: { type: 'boolean', description: 'Whether this is the primary address for its type' },
136
+ },
137
+ required: ['id'],
138
+ },
139
+ }),
140
+ __metadata("design:type", Function),
141
+ __metadata("design:paramtypes", [Object, Object]),
142
+ __metadata("design:returntype", Promise)
143
+ ], AddressMcpTools.prototype, "update", null);
144
+ __decorate([
145
+ (0, core_1.McpTool)({
146
+ name: 'address.delete',
147
+ description: 'Deletes one or more addresses by their IDs.',
148
+ inputSchema: {
149
+ type: 'object',
150
+ properties: {
151
+ ids: { type: 'array', items: { type: 'number' }, description: 'Address IDs to delete' },
152
+ },
153
+ required: ['ids'],
154
+ },
155
+ }),
156
+ __metadata("design:type", Function),
157
+ __metadata("design:paramtypes", [Object, Object]),
158
+ __metadata("design:returntype", Promise)
159
+ ], AddressMcpTools.prototype, "delete", null);
160
+ exports.AddressMcpTools = AddressMcpTools = __decorate([
161
+ (0, common_1.Injectable)(),
162
+ __metadata("design:paramtypes", [address_service_1.AddressService])
163
+ ], AddressMcpTools);
164
+ //# sourceMappingURL=address.mcp-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mcp-tools.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WAAW,EAAE,MAAM,EAAE;gBAC7C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;gBACjE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE;gBACxD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE;gBACxD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,kDAAkD,EAAE;aACjG;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF,CAAC;;;;6CAID;AAaK;IAXL,IAAA,cAAO,EAAC;QACP,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,6CAA6C;QAC1D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE;aACxF;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;KACF,CAAC;;;;6CAGD;0BA3GU,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAEkC,gCAAc;GADhD,eAAe,CA4G3B"}
@@ -18,3 +18,47 @@
18
18
  - url: /address
19
19
  method: DELETE
20
20
  relations: *a1
21
+
22
+ - tool_name: address.list
23
+ type: MCP
24
+ name: Address List
25
+ relations:
26
+ role:
27
+ - where:
28
+ slug: admin
29
+ - where:
30
+ slug: admin-address
31
+
32
+ - tool_name: address.get
33
+ type: MCP
34
+ name: Address Get
35
+ relations:
36
+ role:
37
+ - where:
38
+ slug: admin
39
+ - where:
40
+ slug: admin-address
41
+
42
+ - tool_name: address.create
43
+ type: MCP
44
+ name: Address Create
45
+ relations:
46
+ role:
47
+ - where:
48
+ slug: admin
49
+
50
+ - tool_name: address.update
51
+ type: MCP
52
+ name: Address Update
53
+ relations:
54
+ role:
55
+ - where:
56
+ slug: admin
57
+
58
+ - tool_name: address.delete
59
+ type: MCP
60
+ name: Address Delete
61
+ relations:
62
+ role:
63
+ - where:
64
+ slug: admin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/address",
3
- "version": "0.0.350",
3
+ "version": "0.0.351",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -11,10 +11,10 @@
11
11
  "@nestjs/mapped-types": "*",
12
12
  "@hed-hog/api": "0.0.8",
13
13
  "@hed-hog/api-locale": "0.0.14",
14
+ "@hed-hog/core": "0.0.351",
14
15
  "@hed-hog/api-pagination": "0.0.7",
15
- "@hed-hog/api-prisma": "0.0.6",
16
- "@hed-hog/core": "0.0.350",
17
- "@hed-hog/api-types": "0.0.1"
16
+ "@hed-hog/api-types": "0.0.1",
17
+ "@hed-hog/api-prisma": "0.0.6"
18
18
  },
19
19
  "exports": {
20
20
  ".": {
@@ -5,6 +5,7 @@ import { PaginationModule } from '@hed-hog/api-pagination';
5
5
  import { PrismaModule } from '@hed-hog/api-prisma';
6
6
  import { AddressController } from './address.controller';
7
7
  import { AddressService } from './address.service';
8
+ import { AddressMcpTools } from './mcp-tools/address.mcp-tools';
8
9
 
9
10
  @Module({
10
11
  imports: [
@@ -14,7 +15,7 @@ import { AddressService } from './address.service';
14
15
  forwardRef(() => LocaleModule)
15
16
  ],
16
17
  controllers: [AddressController],
17
- providers: [AddressService],
18
+ providers: [AddressService, AddressMcpTools],
18
19
  exports: [AddressService]
19
20
  })
20
21
  export class AddressModule {}
@@ -0,0 +1,114 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { AddressService } from '../address.service';
4
+
5
+ @Injectable()
6
+ export class AddressMcpTools {
7
+ constructor(private readonly addressService: AddressService) {}
8
+
9
+ @McpTool({
10
+ name: 'address.list',
11
+ description: 'Lists addresses with pagination and optional search.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ page: { type: 'number', description: 'Page number (default: 1)' },
16
+ pageSize: { type: 'number', description: 'Items per page (default: 20)' },
17
+ search: { type: 'string', description: 'Search term' },
18
+ },
19
+ },
20
+ readOnly: true,
21
+ })
22
+ async list(args: Record<string, any>, _context: McpContext): Promise<any> {
23
+ return this.addressService.list({
24
+ page: args.page ?? 1,
25
+ pageSize: args.pageSize ?? 20,
26
+ search: args.search ?? '',
27
+ } as any);
28
+ }
29
+
30
+ @McpTool({
31
+ name: 'address.get',
32
+ description: 'Returns a single address by ID.',
33
+ inputSchema: {
34
+ type: 'object',
35
+ properties: {
36
+ id: { type: 'number', description: 'Address ID' },
37
+ },
38
+ required: ['id'],
39
+ },
40
+ readOnly: true,
41
+ })
42
+ async get(args: Record<string, any>, context: McpContext): Promise<any> {
43
+ return this.addressService.get(args.id, context.locale);
44
+ }
45
+
46
+ @McpTool({
47
+ name: 'address.create',
48
+ description: 'Creates a new address.',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {
52
+ address_type: {
53
+ type: 'string',
54
+ enum: ['RESIDENTIAL', 'COMMERCIAL', 'CORRESPONDENCE', 'ALTERNATIVE', 'WORK', 'BILLING', 'SHIPPING'],
55
+ description: 'Address type',
56
+ },
57
+ country_code: { type: 'string', description: 'Country code (e.g. BR, US)' },
58
+ state: { type: 'string', description: 'State or province' },
59
+ city: { type: 'string', description: 'City' },
60
+ postal_code: { type: 'string', description: 'Postal / ZIP code' },
61
+ line1: { type: 'string', description: 'Address line 1' },
62
+ line2: { type: 'string', description: 'Address line 2 (optional)' },
63
+ is_primary: { type: 'boolean', description: 'Whether this is the primary address for its type' },
64
+ },
65
+ required: ['address_type', 'country_code', 'state', 'city', 'postal_code', 'line1'],
66
+ },
67
+ })
68
+ async create(args: Record<string, any>, context: McpContext): Promise<any> {
69
+ return this.addressService.create(args as any, context.locale);
70
+ }
71
+
72
+ @McpTool({
73
+ name: 'address.update',
74
+ description: 'Updates an existing address by ID.',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: {
78
+ id: { type: 'number', description: 'Address ID' },
79
+ address_type: {
80
+ type: 'string',
81
+ enum: ['RESIDENTIAL', 'COMMERCIAL', 'CORRESPONDENCE', 'ALTERNATIVE', 'WORK', 'BILLING', 'SHIPPING'],
82
+ description: 'Address type',
83
+ },
84
+ country_code: { type: 'string', description: 'Country code' },
85
+ state: { type: 'string', description: 'State or province' },
86
+ city: { type: 'string', description: 'City' },
87
+ postal_code: { type: 'string', description: 'Postal / ZIP code' },
88
+ line1: { type: 'string', description: 'Address line 1' },
89
+ line2: { type: 'string', description: 'Address line 2' },
90
+ is_primary: { type: 'boolean', description: 'Whether this is the primary address for its type' },
91
+ },
92
+ required: ['id'],
93
+ },
94
+ })
95
+ async update(args: Record<string, any>, context: McpContext): Promise<any> {
96
+ const { id, ...data } = args;
97
+ return this.addressService.update(id, data as any, context.locale);
98
+ }
99
+
100
+ @McpTool({
101
+ name: 'address.delete',
102
+ description: 'Deletes one or more addresses by their IDs.',
103
+ inputSchema: {
104
+ type: 'object',
105
+ properties: {
106
+ ids: { type: 'array', items: { type: 'number' }, description: 'Address IDs to delete' },
107
+ },
108
+ required: ['ids'],
109
+ },
110
+ })
111
+ async delete(args: Record<string, any>, context: McpContext): Promise<any> {
112
+ return this.addressService.delete({ ids: args.ids }, context.locale);
113
+ }
114
+ }