@merkaly/api 0.6.1 → 0.6.3

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.
@@ -5,6 +5,11 @@ export declare class AccountUserEntity extends AbstractEntity {
5
5
  picture: string;
6
6
  email: string;
7
7
  phone?: string;
8
- isMember?: boolean;
9
8
  role?: string;
9
+ status: string;
10
+ verified?: boolean;
11
+ providers: string[];
12
+ locale?: string;
13
+ lastIp?: string;
14
+ loginAt?: Date;
10
15
  }
@@ -0,0 +1,54 @@
1
+ export declare abstract class AppSchemas {
2
+ static get account(): {
3
+ addresses: string;
4
+ payments: string;
5
+ users: string;
6
+ };
7
+ static get assets(): {
8
+ files: string;
9
+ };
10
+ static get finance(): {
11
+ invoices: string;
12
+ payments: string;
13
+ refunds: string;
14
+ subscriptions: string;
15
+ taxes: string;
16
+ };
17
+ static get inventory(): {
18
+ catalog: {
19
+ attributes: string;
20
+ brands: string;
21
+ categories: string;
22
+ collections: string;
23
+ products: string;
24
+ variants: string;
25
+ };
26
+ configuration: {
27
+ measurements: string;
28
+ };
29
+ stock: {
30
+ balances: string;
31
+ transfers: string;
32
+ warehouses: string;
33
+ };
34
+ };
35
+ static get order(): {
36
+ purchase: {
37
+ items: string;
38
+ transactions: string;
39
+ vendors: string;
40
+ };
41
+ sale: {
42
+ customers: string;
43
+ items: string;
44
+ transactions: string;
45
+ };
46
+ service: {
47
+ items: string;
48
+ transactions: string;
49
+ };
50
+ };
51
+ static get settings(): {
52
+ organizations: string;
53
+ };
54
+ }
@@ -0,0 +1,20 @@
1
+ export interface Auth0JwtPayload {
2
+ sub: string;
3
+ iat: number;
4
+ exp: number;
5
+ iss: string;
6
+ aud: string | string[];
7
+ org_id?: string;
8
+ 'https://merka.ly/authorization'?: {
9
+ roles: string[];
10
+ permissions?: string[];
11
+ };
12
+ }
13
+ export interface AppAuth {
14
+ expiresAt: Date;
15
+ issuedAt: Date;
16
+ orgId?: string;
17
+ role: string;
18
+ userId: string;
19
+ }
20
+ export declare const SESSION_COOKIE = "merkaly.sid";
package/dist/index.d.ts CHANGED
@@ -1,10 +1,35 @@
1
+ export * from './app.types';
2
+ export * from './app.schemas';
3
+ export * from './status.plugin';
4
+ export * from './address.validator';
5
+ export * from './address.entity';
6
+ export * from './transaction.entity';
1
7
  export * from './abstract.entity';
2
8
  export * from './abstract.transition';
3
9
  export * from './abstract.validator';
4
- export * from './abstract.repository';
5
- export * from './not-equal-to.decorator';
6
- export * from './address.entity';
7
- export * from './transaction.entity';
8
- export * from './address.validator';
9
- export type { StatusEntity } from './status.plugin';
10
- export type { CreateEntityArgs } from './repository.types';
10
+ export * from './account/address';
11
+ export * from './account/payment';
12
+ export * from './account/user';
13
+ export * from './assets/asset';
14
+ export * from './finance/invoice';
15
+ export * from './finance/payment';
16
+ export * from './finance/refund';
17
+ export * from './inventory/catalog/attribute';
18
+ export * from './inventory/catalog/brand';
19
+ export * from './inventory/catalog/category';
20
+ export * from './inventory/catalog/collection';
21
+ export * from './inventory/catalog/product';
22
+ export * from './inventory/catalog/variant';
23
+ export * from './inventory/configuration/measurement';
24
+ export * from './inventory/configuration/unit';
25
+ export * from './inventory/stock/balance';
26
+ export * from './inventory/stock/transfer';
27
+ export * from './inventory/stock/warehouse';
28
+ export * from './order/purchase/item';
29
+ export * from './order/purchase/transaction';
30
+ export * from './order/purchase/vendor';
31
+ export * from './order/sale/customer';
32
+ export * from './order/sale/item';
33
+ export * from './order/sale/transaction';
34
+ export * from './settings/organization';
35
+ export type { SaveEntityArgs } from './repository.types';
package/dist/index.js CHANGED
@@ -1,4 +1,28 @@
1
+ export * from './address.validator.js';
1
2
  export * from './abstract.transition.js';
2
3
  export * from './abstract.validator.js';
3
- export * from './not-equal-to.decorator.js';
4
- export * from './address.validator.js';
4
+ export * from './account/address/index.js';
5
+ export * from './account/payment/index.js';
6
+ export * from './account/user/index.js';
7
+ export * from './assets/asset/index.js';
8
+ export * from './finance/invoice/index.js';
9
+ export * from './finance/payment/index.js';
10
+ export * from './finance/refund/index.js';
11
+ export * from './inventory/catalog/attribute/index.js';
12
+ export * from './inventory/catalog/brand/index.js';
13
+ export * from './inventory/catalog/category/index.js';
14
+ export * from './inventory/catalog/collection/index.js';
15
+ export * from './inventory/catalog/product/index.js';
16
+ export * from './inventory/catalog/variant/index.js';
17
+ export * from './inventory/configuration/measurement/index.js';
18
+ export * from './inventory/configuration/unit/index.js';
19
+ export * from './inventory/stock/balance/index.js';
20
+ export * from './inventory/stock/transfer/index.js';
21
+ export * from './inventory/stock/warehouse/index.js';
22
+ export * from './order/purchase/item/index.js';
23
+ export * from './order/purchase/transaction/index.js';
24
+ export * from './order/purchase/vendor/index.js';
25
+ export * from './order/sale/customer/index.js';
26
+ export * from './order/sale/item/index.js';
27
+ export * from './order/sale/transaction/index.js';
28
+ export * from './settings/organization/index.js';
@@ -1,2 +1,3 @@
1
1
  export * from './organization.entity';
2
2
  export * from './organization.enum';
3
+ export * from './request.validator';
@@ -1 +1,2 @@
1
1
  export * from './organization.enum.js';
2
+ export * from './request.validator.js';
@@ -1,14 +1,10 @@
1
1
  export declare enum SettingsOrganizationEnum {
2
- APP_WORKSPACE = "app.workspace",
3
- APP_CONTACT = "app.contact",
4
- APP_REGIONAL = "app.regional",
5
- APP_ADDRESS = "app.address",
6
- INVENTORY_STOCK_TRANSFER_SEQUENCE = "inventory.stock.transfer.sequence",
7
- ORDER_SALE_TRANSACTION_SEQUENCE = "order.sale.transaction.sequence",
8
- ORDER_PURCHASE_TRANSACTION_SEQUENCE = "order.purchase.transaction.sequence",
9
- ORDER_SERVICE_TRANSACTION_SEQUENCE = "order.service.transaction.sequence",
10
- FINANCE_INVOICE_SEQUENCE = "finance.invoice.sequence",
11
- FINANCE_PAYMENT_SEQUENCE = "finance.payment.sequence",
12
- FINANCE_REFUND_SEQUENCE = "finance.refund.sequence",
13
- FINANCE_SUBSCRIPTION_SEQUENCE = "finance.subscription.sequence"
2
+ ORGANIZATION_ADDRESS = "organization.address",
3
+ ORGANIZATION_BILLING = "organization.billing",
4
+ ORGANIZATION_BRANDING = "organization.branding",
5
+ ORGANIZATION_CONTACT = "organization.contact",
6
+ ORGANIZATION_IDENTITY = "organization.identity",
7
+ ORGANIZATION_LOCALIZATION = "organization.localization",
8
+ ORGANIZATION_SECURITY = "organization.security",
9
+ ORGANIZATION_SEQUENCE = "organization.sequence"
14
10
  }
@@ -1,15 +1,11 @@
1
1
  export var SettingsOrganizationEnum;
2
2
  (function (SettingsOrganizationEnum) {
3
- SettingsOrganizationEnum["APP_WORKSPACE"] = "app.workspace";
4
- SettingsOrganizationEnum["APP_CONTACT"] = "app.contact";
5
- SettingsOrganizationEnum["APP_REGIONAL"] = "app.regional";
6
- SettingsOrganizationEnum["APP_ADDRESS"] = "app.address";
7
- SettingsOrganizationEnum["INVENTORY_STOCK_TRANSFER_SEQUENCE"] = "inventory.stock.transfer.sequence";
8
- SettingsOrganizationEnum["ORDER_SALE_TRANSACTION_SEQUENCE"] = "order.sale.transaction.sequence";
9
- SettingsOrganizationEnum["ORDER_PURCHASE_TRANSACTION_SEQUENCE"] = "order.purchase.transaction.sequence";
10
- SettingsOrganizationEnum["ORDER_SERVICE_TRANSACTION_SEQUENCE"] = "order.service.transaction.sequence";
11
- SettingsOrganizationEnum["FINANCE_INVOICE_SEQUENCE"] = "finance.invoice.sequence";
12
- SettingsOrganizationEnum["FINANCE_PAYMENT_SEQUENCE"] = "finance.payment.sequence";
13
- SettingsOrganizationEnum["FINANCE_REFUND_SEQUENCE"] = "finance.refund.sequence";
14
- SettingsOrganizationEnum["FINANCE_SUBSCRIPTION_SEQUENCE"] = "finance.subscription.sequence";
3
+ SettingsOrganizationEnum["ORGANIZATION_ADDRESS"] = "organization.address";
4
+ SettingsOrganizationEnum["ORGANIZATION_BILLING"] = "organization.billing";
5
+ SettingsOrganizationEnum["ORGANIZATION_BRANDING"] = "organization.branding";
6
+ SettingsOrganizationEnum["ORGANIZATION_CONTACT"] = "organization.contact";
7
+ SettingsOrganizationEnum["ORGANIZATION_IDENTITY"] = "organization.identity";
8
+ SettingsOrganizationEnum["ORGANIZATION_LOCALIZATION"] = "organization.localization";
9
+ SettingsOrganizationEnum["ORGANIZATION_SECURITY"] = "organization.security";
10
+ SettingsOrganizationEnum["ORGANIZATION_SEQUENCE"] = "organization.sequence";
15
11
  })(SettingsOrganizationEnum || (SettingsOrganizationEnum = {}));
@@ -0,0 +1,51 @@
1
+ import { AbstractRequestValidator } from '../..';
2
+ import type { SettingsOrganizationAddressContract, SettingsOrganizationBillingContract, SettingsOrganizationBrandingContract, SettingsOrganizationContactContract, SettingsOrganizationIdentityContract, SettingsOrganizationLocalizationContract, SettingsOrganizationLocationContract, SettingsOrganizationProfileContract } from '../..';
3
+ export declare class UpdateOrganizationLocationRequestValidator extends AbstractRequestValidator {
4
+ lat?: number;
5
+ lng?: number;
6
+ constructor(location?: SettingsOrganizationLocationContract);
7
+ }
8
+ export declare class UpdateOrganizationAddressRequestValidator extends AbstractRequestValidator {
9
+ city?: string;
10
+ code?: string;
11
+ country?: string;
12
+ line1?: string;
13
+ line2?: string;
14
+ location: UpdateOrganizationLocationRequestValidator;
15
+ state?: string;
16
+ constructor(address?: SettingsOrganizationAddressContract);
17
+ }
18
+ export declare class UpdateOrganizationContactRequestValidator extends AbstractRequestValidator {
19
+ email?: string;
20
+ phone?: string;
21
+ website?: string;
22
+ constructor(contact?: SettingsOrganizationContactContract);
23
+ }
24
+ export declare class UpdateOrganizationLocalizationRequestValidator extends AbstractRequestValidator {
25
+ currency?: string;
26
+ constructor(localization?: SettingsOrganizationLocalizationContract);
27
+ }
28
+ export declare class UpdateOrganizationIdentityRequestValidator extends AbstractRequestValidator {
29
+ legalName?: string;
30
+ name?: string;
31
+ taxId?: string;
32
+ constructor(identity?: SettingsOrganizationIdentityContract);
33
+ }
34
+ export declare class UpdateOrganizationBrandingRequestValidator extends AbstractRequestValidator {
35
+ description?: string;
36
+ logo?: string;
37
+ constructor(branding?: SettingsOrganizationBrandingContract);
38
+ }
39
+ export declare class UpdateOrganizationBillingRequestValidator extends AbstractRequestValidator {
40
+ email?: string;
41
+ constructor(billing?: SettingsOrganizationBillingContract);
42
+ }
43
+ export declare class UpdateOrganizationProfileRequestValidator extends AbstractRequestValidator {
44
+ address: UpdateOrganizationAddressRequestValidator;
45
+ billing: UpdateOrganizationBillingRequestValidator;
46
+ branding: UpdateOrganizationBrandingRequestValidator;
47
+ contact: UpdateOrganizationContactRequestValidator;
48
+ identity: UpdateOrganizationIdentityRequestValidator;
49
+ localization: UpdateOrganizationLocalizationRequestValidator;
50
+ constructor(profile?: Partial<SettingsOrganizationProfileContract>);
51
+ }
@@ -0,0 +1,244 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import * as class_transformer_1 from "class-transformer";
11
+ import * as class_validator_1 from "class-validator";
12
+ import * as abstract_validator_1 from '../../index.js';
13
+ export class UpdateOrganizationLocationRequestValidator extends abstract_validator_1.AbstractRequestValidator {
14
+ lat;
15
+ lng;
16
+ constructor(location) {
17
+ super();
18
+ this.lat = location?.lat;
19
+ this.lng = location?.lng;
20
+ }
21
+ }
22
+ __decorate([
23
+ (0, class_validator_1.IsNumber)(),
24
+ (0, class_validator_1.IsOptional)(),
25
+ __metadata("design:type", Number)
26
+ ], UpdateOrganizationLocationRequestValidator.prototype, "lat", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsNumber)(),
29
+ (0, class_validator_1.IsOptional)(),
30
+ __metadata("design:type", Number)
31
+ ], UpdateOrganizationLocationRequestValidator.prototype, "lng", void 0);
32
+ export class UpdateOrganizationAddressRequestValidator extends abstract_validator_1.AbstractRequestValidator {
33
+ city;
34
+ code;
35
+ country;
36
+ line1;
37
+ line2;
38
+ location;
39
+ state;
40
+ constructor(address) {
41
+ super();
42
+ this.city = address?.city;
43
+ this.code = address?.code;
44
+ this.country = address?.country;
45
+ this.line1 = address?.line1;
46
+ this.line2 = address?.line2;
47
+ this.location = new UpdateOrganizationLocationRequestValidator(address?.location);
48
+ this.state = address?.state;
49
+ }
50
+ }
51
+ __decorate([
52
+ (0, class_validator_1.IsString)(),
53
+ (0, class_validator_1.Length)(0, 100),
54
+ (0, class_validator_1.IsOptional)(),
55
+ __metadata("design:type", String)
56
+ ], UpdateOrganizationAddressRequestValidator.prototype, "city", void 0);
57
+ __decorate([
58
+ (0, class_validator_1.IsString)(),
59
+ (0, class_validator_1.Length)(0, 20),
60
+ (0, class_validator_1.IsOptional)(),
61
+ __metadata("design:type", String)
62
+ ], UpdateOrganizationAddressRequestValidator.prototype, "code", void 0);
63
+ __decorate([
64
+ (0, class_validator_1.IsString)(),
65
+ (0, class_validator_1.Length)(0, 2),
66
+ (0, class_validator_1.IsOptional)(),
67
+ __metadata("design:type", String)
68
+ ], UpdateOrganizationAddressRequestValidator.prototype, "country", void 0);
69
+ __decorate([
70
+ (0, class_validator_1.IsString)(),
71
+ (0, class_validator_1.Length)(0, 200),
72
+ (0, class_validator_1.IsOptional)(),
73
+ __metadata("design:type", String)
74
+ ], UpdateOrganizationAddressRequestValidator.prototype, "line1", void 0);
75
+ __decorate([
76
+ (0, class_validator_1.IsString)(),
77
+ (0, class_validator_1.Length)(0, 200),
78
+ (0, class_validator_1.IsOptional)(),
79
+ __metadata("design:type", String)
80
+ ], UpdateOrganizationAddressRequestValidator.prototype, "line2", void 0);
81
+ __decorate([
82
+ (0, class_validator_1.ValidateNested)(),
83
+ (0, class_transformer_1.Type)(() => UpdateOrganizationLocationRequestValidator),
84
+ (0, class_validator_1.IsOptional)(),
85
+ __metadata("design:type", UpdateOrganizationLocationRequestValidator)
86
+ ], UpdateOrganizationAddressRequestValidator.prototype, "location", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.IsString)(),
89
+ (0, class_validator_1.Length)(0, 100),
90
+ (0, class_validator_1.IsOptional)(),
91
+ __metadata("design:type", String)
92
+ ], UpdateOrganizationAddressRequestValidator.prototype, "state", void 0);
93
+ export class UpdateOrganizationContactRequestValidator extends abstract_validator_1.AbstractRequestValidator {
94
+ email;
95
+ phone;
96
+ website;
97
+ constructor(contact) {
98
+ super();
99
+ this.email = contact?.email;
100
+ this.phone = contact?.phone;
101
+ this.website = contact?.website;
102
+ }
103
+ }
104
+ __decorate([
105
+ (0, class_validator_1.IsString)(),
106
+ (0, class_validator_1.Length)(0, 200),
107
+ (0, class_validator_1.IsOptional)(),
108
+ __metadata("design:type", String)
109
+ ], UpdateOrganizationContactRequestValidator.prototype, "email", void 0);
110
+ __decorate([
111
+ (0, class_validator_1.IsString)(),
112
+ (0, class_validator_1.Length)(0, 50),
113
+ (0, class_validator_1.IsOptional)(),
114
+ __metadata("design:type", String)
115
+ ], UpdateOrganizationContactRequestValidator.prototype, "phone", void 0);
116
+ __decorate([
117
+ (0, class_validator_1.IsString)(),
118
+ (0, class_validator_1.Length)(0, 2048),
119
+ (0, class_validator_1.IsOptional)(),
120
+ __metadata("design:type", String)
121
+ ], UpdateOrganizationContactRequestValidator.prototype, "website", void 0);
122
+ export class UpdateOrganizationLocalizationRequestValidator extends abstract_validator_1.AbstractRequestValidator {
123
+ currency;
124
+ constructor(localization) {
125
+ super();
126
+ this.currency = localization?.currency;
127
+ }
128
+ }
129
+ __decorate([
130
+ (0, class_validator_1.IsString)(),
131
+ (0, class_validator_1.Length)(0, 3),
132
+ (0, class_validator_1.IsOptional)(),
133
+ __metadata("design:type", String)
134
+ ], UpdateOrganizationLocalizationRequestValidator.prototype, "currency", void 0);
135
+ export class UpdateOrganizationIdentityRequestValidator extends abstract_validator_1.AbstractRequestValidator {
136
+ legalName;
137
+ name;
138
+ taxId;
139
+ constructor(identity) {
140
+ super();
141
+ this.legalName = identity?.legalName;
142
+ this.name = identity?.name;
143
+ this.taxId = identity?.taxId;
144
+ }
145
+ }
146
+ __decorate([
147
+ (0, class_validator_1.IsString)(),
148
+ (0, class_validator_1.Length)(0, 200),
149
+ (0, class_validator_1.IsOptional)(),
150
+ __metadata("design:type", String)
151
+ ], UpdateOrganizationIdentityRequestValidator.prototype, "legalName", void 0);
152
+ __decorate([
153
+ (0, class_validator_1.IsString)(),
154
+ (0, class_validator_1.Length)(0, 200),
155
+ (0, class_validator_1.IsOptional)(),
156
+ __metadata("design:type", String)
157
+ ], UpdateOrganizationIdentityRequestValidator.prototype, "name", void 0);
158
+ __decorate([
159
+ (0, class_validator_1.IsString)(),
160
+ (0, class_validator_1.Length)(0, 50),
161
+ (0, class_validator_1.IsOptional)(),
162
+ __metadata("design:type", String)
163
+ ], UpdateOrganizationIdentityRequestValidator.prototype, "taxId", void 0);
164
+ export class UpdateOrganizationBrandingRequestValidator extends abstract_validator_1.AbstractRequestValidator {
165
+ description;
166
+ logo;
167
+ constructor(branding) {
168
+ super();
169
+ this.description = branding?.description;
170
+ this.logo = branding?.logo;
171
+ }
172
+ }
173
+ __decorate([
174
+ (0, class_validator_1.IsString)(),
175
+ (0, class_validator_1.Length)(0, 1000),
176
+ (0, class_validator_1.IsOptional)(),
177
+ __metadata("design:type", String)
178
+ ], UpdateOrganizationBrandingRequestValidator.prototype, "description", void 0);
179
+ __decorate([
180
+ (0, class_validator_1.IsString)(),
181
+ (0, class_validator_1.Length)(0, 2048),
182
+ (0, class_validator_1.IsOptional)(),
183
+ __metadata("design:type", String)
184
+ ], UpdateOrganizationBrandingRequestValidator.prototype, "logo", void 0);
185
+ export class UpdateOrganizationBillingRequestValidator extends abstract_validator_1.AbstractRequestValidator {
186
+ email;
187
+ constructor(billing) {
188
+ super();
189
+ this.email = billing?.email;
190
+ }
191
+ }
192
+ __decorate([
193
+ (0, class_validator_1.IsString)(),
194
+ (0, class_validator_1.Length)(0, 200),
195
+ (0, class_validator_1.IsOptional)(),
196
+ __metadata("design:type", String)
197
+ ], UpdateOrganizationBillingRequestValidator.prototype, "email", void 0);
198
+ export class UpdateOrganizationProfileRequestValidator extends abstract_validator_1.AbstractRequestValidator {
199
+ address;
200
+ billing;
201
+ branding;
202
+ contact;
203
+ identity;
204
+ localization;
205
+ constructor(profile) {
206
+ super();
207
+ this.address = new UpdateOrganizationAddressRequestValidator(profile?.address);
208
+ this.billing = new UpdateOrganizationBillingRequestValidator(profile?.billing);
209
+ this.branding = new UpdateOrganizationBrandingRequestValidator(profile?.branding);
210
+ this.contact = new UpdateOrganizationContactRequestValidator(profile?.contact);
211
+ this.identity = new UpdateOrganizationIdentityRequestValidator(profile?.identity);
212
+ this.localization = new UpdateOrganizationLocalizationRequestValidator(profile?.localization);
213
+ }
214
+ }
215
+ __decorate([
216
+ (0, class_validator_1.ValidateNested)(),
217
+ (0, class_transformer_1.Type)(() => UpdateOrganizationAddressRequestValidator),
218
+ __metadata("design:type", UpdateOrganizationAddressRequestValidator)
219
+ ], UpdateOrganizationProfileRequestValidator.prototype, "address", void 0);
220
+ __decorate([
221
+ (0, class_validator_1.ValidateNested)(),
222
+ (0, class_transformer_1.Type)(() => UpdateOrganizationBillingRequestValidator),
223
+ __metadata("design:type", UpdateOrganizationBillingRequestValidator)
224
+ ], UpdateOrganizationProfileRequestValidator.prototype, "billing", void 0);
225
+ __decorate([
226
+ (0, class_validator_1.ValidateNested)(),
227
+ (0, class_transformer_1.Type)(() => UpdateOrganizationBrandingRequestValidator),
228
+ __metadata("design:type", UpdateOrganizationBrandingRequestValidator)
229
+ ], UpdateOrganizationProfileRequestValidator.prototype, "branding", void 0);
230
+ __decorate([
231
+ (0, class_validator_1.ValidateNested)(),
232
+ (0, class_transformer_1.Type)(() => UpdateOrganizationContactRequestValidator),
233
+ __metadata("design:type", UpdateOrganizationContactRequestValidator)
234
+ ], UpdateOrganizationProfileRequestValidator.prototype, "contact", void 0);
235
+ __decorate([
236
+ (0, class_validator_1.ValidateNested)(),
237
+ (0, class_transformer_1.Type)(() => UpdateOrganizationIdentityRequestValidator),
238
+ __metadata("design:type", UpdateOrganizationIdentityRequestValidator)
239
+ ], UpdateOrganizationProfileRequestValidator.prototype, "identity", void 0);
240
+ __decorate([
241
+ (0, class_validator_1.ValidateNested)(),
242
+ (0, class_transformer_1.Type)(() => UpdateOrganizationLocalizationRequestValidator),
243
+ __metadata("design:type", UpdateOrganizationLocalizationRequestValidator)
244
+ ], UpdateOrganizationProfileRequestValidator.prototype, "localization", void 0);
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript interfaces and enums for Merkaly API",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/merkaly-io/api"
9
+ },
6
10
  "exports": {
7
11
  ".": {
8
12
  "types": "./dist/index.d.ts",
@@ -17,18 +21,24 @@
17
21
  "files": [
18
22
  "dist"
19
23
  ],
24
+ "scripts": {
25
+ "build": "tsx build.ts",
26
+ "prepack": "pnpm build",
27
+ "sync": "bash scripts/sync-from-api-app.sh"
28
+ },
20
29
  "dependencies": {
21
30
  "class-transformer": "^0.5.1",
22
31
  "class-validator": "^0.14.2",
23
32
  "reflect-metadata": "^0.2.2"
24
33
  },
25
34
  "devDependencies": {
26
- "tsx": "^4.0.0"
35
+ "@types/node": "^25.9.1",
36
+ "changelogen": "^0.6.2",
37
+ "tsx": "^4.0.0",
38
+ "typescript": "^5.7.3"
27
39
  },
28
40
  "publishConfig": {
29
41
  "access": "public"
30
42
  },
31
- "scripts": {
32
- "build": "tsx build.ts"
33
- }
34
- }
43
+ "packageManager": "pnpm@10.28.2"
44
+ }
@@ -1,63 +0,0 @@
1
- import { EventEmitter2 } from '@nestjs/event-emitter';
2
- import { ClsService } from 'nestjs-cls';
3
- import { LoggerService } from './';
4
- import { MongoService } from './mongo.service.js';
5
- import { AbstractEntity } from './abstract.entity.js';
6
- import { AbstractSchema } from './abstract.schema.js';
7
- import { SearchValidator } from './abstract.validator.js';
8
- import type { ClientSession, Document, FilterQuery, Model, PipelineStage, PopulateOptions, RootFilterQuery, UpdateQuery } from 'mongoose';
9
- type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
10
- type SystemKeys = '_id' | 'createdAt' | 'updatedAt' | 'deletedAt' | keyof Document;
11
- export type SaveEntityArgs<T> = {
12
- [K in keyof T as K extends SystemKeys ? never : T[K] extends (...args: any[]) => unknown ? never : Equal<{
13
- [Q in K]: T[K];
14
- }, {
15
- -readonly [Q in K]: T[K];
16
- }> extends true ? K : never]: T[K] extends Array<infer U> ? U extends object ? SaveEntityArgs<U>[] : T[K] : T[K] extends object ? T[K] extends Date ? T[K] : SaveEntityArgs<T[K]> | string : T[K];
17
- };
18
- export type EntityLocator<E extends AbstractEntity = AbstractEntity> = string | RootFilterQuery<E>;
19
- export interface ReadMethodOptions {
20
- join?: PopulateOptions[];
21
- select?: string;
22
- }
23
- export interface DeleteMethodOptions {
24
- soft?: boolean;
25
- }
26
- export interface SaveMethodOptions<E extends AbstractEntity> {
27
- locator?: EntityLocator<E>;
28
- options?: ReadMethodOptions;
29
- payload: UpdateQuery<E>;
30
- }
31
- export declare abstract class AbstractRepository<E extends AbstractEntity = AbstractEntity> {
32
- protected abstract readonly $schema: AbstractSchema<E>;
33
- protected readonly $logger: LoggerService;
34
- protected readonly $mongo: MongoService<E>;
35
- protected readonly $event: EventEmitter2;
36
- protected readonly $cls: ClsService;
37
- get $builder(): Model<E>;
38
- get $auth(): import("../../app.types").AppAuth;
39
- get $identity(): string;
40
- count(filters?: FilterQuery<E>, session?: ClientSession): Promise<number>;
41
- search(validator?: SearchValidator<E>, session?: ClientSession): Promise<{
42
- data: import("mongoose").IfAny<E, any, Document<unknown, {}, E, {}, {}> & (import("mongoose").Require_id<E> extends infer T ? T extends import("mongoose").Require_id<E> ? T extends {
43
- __v?: infer U;
44
- } ? T : T & {
45
- __v: number;
46
- } : never : never)>[];
47
- limit: number;
48
- pages: number;
49
- total: number;
50
- }>;
51
- aggregate<P = any>(pipeline: PipelineStage[], session?: ClientSession): Promise<P[]>;
52
- read(locator: EntityLocator<E>, options?: ReadMethodOptions): Promise<E>;
53
- create(payload: UpdateQuery<E>, options: ReadMethodOptions): Promise<E>;
54
- update(locator: EntityLocator<E>, payload: UpdateQuery<E>, options?: ReadMethodOptions): Promise<E>;
55
- delete(locator: EntityLocator<E>, options?: DeleteMethodOptions): Promise<void>;
56
- protected save({ locator, payload, options }: SaveMethodOptions<E>): Promise<E>;
57
- private sanitizePaths;
58
- private applyPopulate;
59
- private handlePopulateError;
60
- private compactPayload;
61
- private hasUpdateOperators;
62
- }
63
- export {};
@@ -1,2 +0,0 @@
1
- import { ValidationOptions } from 'class-validator';
2
- export declare function IsNotEqualTo<T = any>(fn: (it: T) => any, validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
@@ -1,22 +0,0 @@
1
- import * as class_validator_1 from "class-validator";
2
- export function IsNotEqualTo(fn, validationOptions) {
3
- return function (object, propertyName) {
4
- (0, class_validator_1.registerDecorator)({
5
- name: 'isNotEqualTo',
6
- target: object.constructor,
7
- propertyName,
8
- constraints: [fn],
9
- options: validationOptions,
10
- validator: {
11
- validate(value, args) {
12
- const [resolver] = args.constraints;
13
- const relatedValue = resolver(args.object);
14
- return !value || !relatedValue || value !== relatedValue;
15
- },
16
- defaultMessage(args) {
17
- return `${args.property} must be different`;
18
- },
19
- },
20
- });
21
- };
22
- }