@azlib/cms 0.3.0 → 0.5.0
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/README.md +257 -38
- package/dist/index.cjs +2905 -6
- package/dist/index.d.cts +933 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +933 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2886 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -516,7 +516,7 @@ interface CMSPlugin {
|
|
|
516
516
|
/**
|
|
517
517
|
* Type-safe helper for authoring reusable CMS plugins and plugin factories.
|
|
518
518
|
*/
|
|
519
|
-
declare function definePlugin<TOptions = void>(factory: (options: TOptions) => CMSPlugin): (options: TOptions) => CMSPlugin;
|
|
519
|
+
declare function definePlugin<TOptions = void>(factory: (options: TOptions) => CMSPlugin): void extends TOptions ? (options?: TOptions) => CMSPlugin : undefined extends TOptions ? (options?: TOptions) => CMSPlugin : (options: TOptions) => CMSPlugin;
|
|
520
520
|
//#endregion
|
|
521
521
|
//#region src/core/types.d.ts
|
|
522
522
|
type ContentStatus = "draft" | "pending_review" | "scheduled" | "published" | "private" | "trash";
|
|
@@ -946,6 +946,10 @@ declare class CMSClient {
|
|
|
946
946
|
private fetchFn;
|
|
947
947
|
private headers;
|
|
948
948
|
constructor(options: CMSClientOptions);
|
|
949
|
+
/**
|
|
950
|
+
* Access underlying CMSEngine instance when in in-process mode.
|
|
951
|
+
*/
|
|
952
|
+
getEngine(): CMSEngine | undefined;
|
|
949
953
|
collection<TData extends Record<string, unknown> = Record<string, unknown>>(slug: string): ClientCollectionApi<TData>;
|
|
950
954
|
readonly taxonomies: {
|
|
951
955
|
getTerms: (taxonomy: string) => Promise<TermItem[]>;
|
|
@@ -961,9 +965,935 @@ declare class CMSClient {
|
|
|
961
965
|
readonly options: {
|
|
962
966
|
get: <T = unknown>(key: string, defaultValue?: T) => Promise<T | undefined>;
|
|
963
967
|
};
|
|
964
|
-
|
|
968
|
+
/**
|
|
969
|
+
* Perform an HTTP request against the CMS API (available in remote mode).
|
|
970
|
+
*/
|
|
971
|
+
request<T>(endpoint: string, init?: RequestInit): Promise<T>;
|
|
965
972
|
}
|
|
966
973
|
declare function createCmsClient(options: CMSClientOptions): CMSClient;
|
|
967
974
|
//#endregion
|
|
968
|
-
|
|
975
|
+
//#region src/plugins/ecommerce/types.d.ts
|
|
976
|
+
type ProductStatus = "draft" | "published" | "out_of_stock" | "archived";
|
|
977
|
+
interface ProductVariant {
|
|
978
|
+
readonly id: string;
|
|
979
|
+
readonly title: string;
|
|
980
|
+
readonly sku?: string;
|
|
981
|
+
readonly price?: number;
|
|
982
|
+
readonly compareAtPrice?: number;
|
|
983
|
+
readonly stock?: number;
|
|
984
|
+
readonly attributes?: Record<string, string>;
|
|
985
|
+
readonly image?: string;
|
|
986
|
+
}
|
|
987
|
+
interface ProductImage {
|
|
988
|
+
readonly id?: string;
|
|
989
|
+
readonly url: string;
|
|
990
|
+
readonly altText?: string;
|
|
991
|
+
readonly caption?: string;
|
|
992
|
+
readonly width?: number;
|
|
993
|
+
readonly height?: number;
|
|
994
|
+
}
|
|
995
|
+
interface ProductData extends Record<string, unknown> {
|
|
996
|
+
sku?: string;
|
|
997
|
+
price: number;
|
|
998
|
+
compareAtPrice?: number;
|
|
999
|
+
costPrice?: number;
|
|
1000
|
+
currency?: string;
|
|
1001
|
+
stock: number;
|
|
1002
|
+
trackInventory?: boolean;
|
|
1003
|
+
status: ProductStatus;
|
|
1004
|
+
description?: string;
|
|
1005
|
+
shortDescription?: string;
|
|
1006
|
+
featuredImage?: string;
|
|
1007
|
+
gallery?: ProductImage[];
|
|
1008
|
+
variants?: ProductVariant[];
|
|
1009
|
+
attributes?: Record<string, unknown>;
|
|
1010
|
+
weight?: number;
|
|
1011
|
+
}
|
|
1012
|
+
type ProductItem = ContentItem<ProductData>;
|
|
1013
|
+
type DiscountType = "percentage" | "fixed_amount" | "free_shipping";
|
|
1014
|
+
type DiscountStatus = "active" | "disabled" | "expired";
|
|
1015
|
+
interface DiscountData extends Record<string, unknown> {
|
|
1016
|
+
code: string;
|
|
1017
|
+
discountType: DiscountType;
|
|
1018
|
+
value: number;
|
|
1019
|
+
minOrderAmount?: number;
|
|
1020
|
+
maxDiscountAmount?: number;
|
|
1021
|
+
maxUses?: number;
|
|
1022
|
+
usedCount: number;
|
|
1023
|
+
startDate?: string;
|
|
1024
|
+
endDate?: string;
|
|
1025
|
+
status: DiscountStatus;
|
|
1026
|
+
appliesToProductIds?: string[];
|
|
1027
|
+
appliesToCategoryIds?: string[];
|
|
1028
|
+
}
|
|
1029
|
+
type DiscountItem = ContentItem<DiscountData>;
|
|
1030
|
+
type OrderStatus = "pending" | "paid" | "processing" | "shipped" | "delivered" | "cancelled" | "refunded";
|
|
1031
|
+
interface OrderLineItem {
|
|
1032
|
+
productId: string;
|
|
1033
|
+
variantId?: string;
|
|
1034
|
+
title: string;
|
|
1035
|
+
sku?: string;
|
|
1036
|
+
price: number;
|
|
1037
|
+
quantity: number;
|
|
1038
|
+
subtotal: number;
|
|
1039
|
+
image?: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface OrderAddress {
|
|
1042
|
+
firstName?: string;
|
|
1043
|
+
lastName?: string;
|
|
1044
|
+
company?: string;
|
|
1045
|
+
address1: string;
|
|
1046
|
+
address2?: string;
|
|
1047
|
+
city: string;
|
|
1048
|
+
province?: string;
|
|
1049
|
+
country: string;
|
|
1050
|
+
postalCode: string;
|
|
1051
|
+
phone?: string;
|
|
1052
|
+
}
|
|
1053
|
+
interface OrderData extends Record<string, unknown> {
|
|
1054
|
+
orderNumber: string;
|
|
1055
|
+
customerEmail: string;
|
|
1056
|
+
customerName?: string;
|
|
1057
|
+
status: OrderStatus;
|
|
1058
|
+
currency: string;
|
|
1059
|
+
items: OrderLineItem[];
|
|
1060
|
+
subtotal: number;
|
|
1061
|
+
discountTotal: number;
|
|
1062
|
+
discountCode?: string;
|
|
1063
|
+
shippingTotal: number;
|
|
1064
|
+
taxTotal: number;
|
|
1065
|
+
total: number;
|
|
1066
|
+
shippingAddress?: OrderAddress;
|
|
1067
|
+
billingAddress?: OrderAddress;
|
|
1068
|
+
paymentMethod?: string;
|
|
1069
|
+
notes?: string;
|
|
1070
|
+
}
|
|
1071
|
+
type OrderItem = ContentItem<OrderData>;
|
|
1072
|
+
interface EcommercePluginOptions {
|
|
1073
|
+
/**
|
|
1074
|
+
* Slug for the products collection. Default: "products"
|
|
1075
|
+
*/
|
|
1076
|
+
readonly productCollectionSlug?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Slug for the discounts collection. Default: "discounts"
|
|
1079
|
+
*/
|
|
1080
|
+
readonly discountCollectionSlug?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* Slug for the orders collection. Default: "orders"
|
|
1083
|
+
*/
|
|
1084
|
+
readonly orderCollectionSlug?: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Slug for the categories taxonomy. Default: "product_categories"
|
|
1087
|
+
*/
|
|
1088
|
+
readonly categoriesTaxonomySlug?: string;
|
|
1089
|
+
/**
|
|
1090
|
+
* Slug for the tags taxonomy. Default: "product_tags"
|
|
1091
|
+
*/
|
|
1092
|
+
readonly tagsTaxonomySlug?: string;
|
|
1093
|
+
/**
|
|
1094
|
+
* Slug for the brands taxonomy. Default: "product_brands"
|
|
1095
|
+
*/
|
|
1096
|
+
readonly brandsTaxonomySlug?: string;
|
|
1097
|
+
/**
|
|
1098
|
+
* Default currency code. Default: "USD"
|
|
1099
|
+
*/
|
|
1100
|
+
readonly defaultCurrency?: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* REST API route prefix. Default: "/api/ecommerce"
|
|
1103
|
+
*/
|
|
1104
|
+
readonly apiPrefix?: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* Enable inventory management (decrement stock on orders, check availability). Default: true
|
|
1107
|
+
*/
|
|
1108
|
+
readonly inventoryManagement?: boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* Enable orders collection and order routes. Default: true
|
|
1111
|
+
*/
|
|
1112
|
+
readonly enableOrders?: boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* Enable discounts collection and discount calculation. Default: true
|
|
1115
|
+
*/
|
|
1116
|
+
readonly enableDiscounts?: boolean;
|
|
1117
|
+
/**
|
|
1118
|
+
* Default flat tax rate multiplier (e.g. 0.08 for 8%). Default: 0
|
|
1119
|
+
*/
|
|
1120
|
+
readonly defaultTaxRate?: number;
|
|
1121
|
+
/**
|
|
1122
|
+
* Default flat shipping cost. Default: 0
|
|
1123
|
+
*/
|
|
1124
|
+
readonly defaultShippingCost?: number;
|
|
1125
|
+
}
|
|
1126
|
+
interface CreateProductInput {
|
|
1127
|
+
title: string;
|
|
1128
|
+
slug?: string;
|
|
1129
|
+
price: number;
|
|
1130
|
+
compareAtPrice?: number;
|
|
1131
|
+
costPrice?: number;
|
|
1132
|
+
sku?: string;
|
|
1133
|
+
currency?: string;
|
|
1134
|
+
stock?: number;
|
|
1135
|
+
trackInventory?: boolean;
|
|
1136
|
+
status?: ProductStatus;
|
|
1137
|
+
description?: string;
|
|
1138
|
+
shortDescription?: string;
|
|
1139
|
+
featuredImage?: string;
|
|
1140
|
+
gallery?: ProductImage[];
|
|
1141
|
+
variants?: ProductVariant[];
|
|
1142
|
+
attributes?: Record<string, unknown>;
|
|
1143
|
+
weight?: number;
|
|
1144
|
+
categoryIds?: string[];
|
|
1145
|
+
tagIds?: string[];
|
|
1146
|
+
brandIds?: string[];
|
|
1147
|
+
}
|
|
1148
|
+
interface UpdateProductInput {
|
|
1149
|
+
title?: string;
|
|
1150
|
+
slug?: string;
|
|
1151
|
+
price?: number;
|
|
1152
|
+
compareAtPrice?: number;
|
|
1153
|
+
costPrice?: number;
|
|
1154
|
+
sku?: string;
|
|
1155
|
+
currency?: string;
|
|
1156
|
+
stock?: number;
|
|
1157
|
+
trackInventory?: boolean;
|
|
1158
|
+
status?: ProductStatus;
|
|
1159
|
+
description?: string;
|
|
1160
|
+
shortDescription?: string;
|
|
1161
|
+
featuredImage?: string;
|
|
1162
|
+
gallery?: ProductImage[];
|
|
1163
|
+
variants?: ProductVariant[];
|
|
1164
|
+
attributes?: Record<string, unknown>;
|
|
1165
|
+
weight?: number;
|
|
1166
|
+
categoryIds?: string[];
|
|
1167
|
+
tagIds?: string[];
|
|
1168
|
+
brandIds?: string[];
|
|
1169
|
+
}
|
|
1170
|
+
interface CreateDiscountInput {
|
|
1171
|
+
title: string;
|
|
1172
|
+
code: string;
|
|
1173
|
+
discountType: DiscountType;
|
|
1174
|
+
value: number;
|
|
1175
|
+
minOrderAmount?: number;
|
|
1176
|
+
maxDiscountAmount?: number;
|
|
1177
|
+
maxUses?: number;
|
|
1178
|
+
startDate?: string;
|
|
1179
|
+
endDate?: string;
|
|
1180
|
+
status?: DiscountStatus;
|
|
1181
|
+
appliesToProductIds?: string[];
|
|
1182
|
+
appliesToCategoryIds?: string[];
|
|
1183
|
+
}
|
|
1184
|
+
interface CartItemInput {
|
|
1185
|
+
productId: string;
|
|
1186
|
+
variantId?: string;
|
|
1187
|
+
quantity: number;
|
|
1188
|
+
}
|
|
1189
|
+
interface CartCalculationInput {
|
|
1190
|
+
items: CartItemInput[];
|
|
1191
|
+
discountCode?: string;
|
|
1192
|
+
shippingCost?: number;
|
|
1193
|
+
taxRate?: number;
|
|
1194
|
+
}
|
|
1195
|
+
interface CartCalculationResult {
|
|
1196
|
+
items: OrderLineItem[];
|
|
1197
|
+
subtotal: number;
|
|
1198
|
+
discountTotal: number;
|
|
1199
|
+
discountCode?: string;
|
|
1200
|
+
shippingTotal: number;
|
|
1201
|
+
taxTotal: number;
|
|
1202
|
+
total: number;
|
|
1203
|
+
currency: string;
|
|
1204
|
+
}
|
|
1205
|
+
interface DiscountValidationResult {
|
|
1206
|
+
valid: boolean;
|
|
1207
|
+
code: string;
|
|
1208
|
+
message?: string;
|
|
1209
|
+
discountAmount: number;
|
|
1210
|
+
discountType?: DiscountType;
|
|
1211
|
+
discount?: DiscountItem;
|
|
1212
|
+
}
|
|
1213
|
+
interface CreateOrderInput {
|
|
1214
|
+
customerEmail: string;
|
|
1215
|
+
customerName?: string;
|
|
1216
|
+
items: CartItemInput[];
|
|
1217
|
+
discountCode?: string;
|
|
1218
|
+
shippingCost?: number;
|
|
1219
|
+
taxRate?: number;
|
|
1220
|
+
shippingAddress?: OrderAddress;
|
|
1221
|
+
billingAddress?: OrderAddress;
|
|
1222
|
+
paymentMethod?: string;
|
|
1223
|
+
notes?: string;
|
|
1224
|
+
}
|
|
1225
|
+
interface EcommerceProductQuery {
|
|
1226
|
+
categorySlug?: string;
|
|
1227
|
+
categoryId?: string;
|
|
1228
|
+
tagSlug?: string;
|
|
1229
|
+
brandSlug?: string;
|
|
1230
|
+
minPrice?: number;
|
|
1231
|
+
maxPrice?: number;
|
|
1232
|
+
inStock?: boolean;
|
|
1233
|
+
status?: ProductStatus | ProductStatus[];
|
|
1234
|
+
search?: string;
|
|
1235
|
+
orderBy?: "price" | "createdAt" | "title" | "stock";
|
|
1236
|
+
orderDirection?: "asc" | "desc";
|
|
1237
|
+
limit?: number;
|
|
1238
|
+
offset?: number;
|
|
1239
|
+
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/plugins/ecommerce/service.d.ts
|
|
1242
|
+
declare class EcommerceService {
|
|
1243
|
+
readonly engine: CMSEngine;
|
|
1244
|
+
readonly options: EcommercePluginOptions;
|
|
1245
|
+
readonly productSlug: string;
|
|
1246
|
+
readonly discountSlug: string;
|
|
1247
|
+
readonly orderSlug: string;
|
|
1248
|
+
readonly categoriesTaxonomy: string;
|
|
1249
|
+
readonly tagsTaxonomy: string;
|
|
1250
|
+
readonly brandsTaxonomy: string;
|
|
1251
|
+
readonly defaultCurrency: string;
|
|
1252
|
+
readonly inventoryManagement: boolean;
|
|
1253
|
+
constructor(engine: CMSEngine, options?: EcommercePluginOptions);
|
|
1254
|
+
private get productsCollection();
|
|
1255
|
+
private get discountsCollection();
|
|
1256
|
+
private get ordersCollection();
|
|
1257
|
+
/**
|
|
1258
|
+
* Create a new product in the catalog.
|
|
1259
|
+
*/
|
|
1260
|
+
createProduct(input: CreateProductInput, authorId?: string | null): Promise<ProductItem>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Update an existing product.
|
|
1263
|
+
*/
|
|
1264
|
+
updateProduct(id: string, input: UpdateProductInput, authorId?: string | null): Promise<ProductItem | null>;
|
|
1265
|
+
/**
|
|
1266
|
+
* Get a product by ID.
|
|
1267
|
+
*/
|
|
1268
|
+
getProduct(id: string): Promise<ProductItem | null>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Get a product by its URL slug.
|
|
1271
|
+
*/
|
|
1272
|
+
getProductBySlug(slug: string): Promise<ProductItem | null>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Delete a product by ID.
|
|
1275
|
+
*/
|
|
1276
|
+
deleteProduct(id: string): Promise<boolean>;
|
|
1277
|
+
/**
|
|
1278
|
+
* List and filter catalog products.
|
|
1279
|
+
*/
|
|
1280
|
+
listProducts(query?: EcommerceProductQuery): Promise<PaginatedResult<ProductItem>>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Upload and link a product image to its gallery and featured slot.
|
|
1283
|
+
*/
|
|
1284
|
+
uploadProductImage(productId: string, file: {
|
|
1285
|
+
filename: string;
|
|
1286
|
+
mimeType: string;
|
|
1287
|
+
sizeBytes: number;
|
|
1288
|
+
url?: string;
|
|
1289
|
+
altText?: string;
|
|
1290
|
+
caption?: string;
|
|
1291
|
+
width?: number;
|
|
1292
|
+
height?: number;
|
|
1293
|
+
isFeatured?: boolean;
|
|
1294
|
+
}, authorId?: string | null): Promise<{
|
|
1295
|
+
media: MediaItem;
|
|
1296
|
+
product: ProductItem;
|
|
1297
|
+
}>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Adjust inventory stock for a product or variant.
|
|
1300
|
+
*/
|
|
1301
|
+
adjustStock(productId: string, delta: number, variantId?: string): Promise<ProductItem | null>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Create a catalog category in the hierarchical category taxonomy.
|
|
1304
|
+
*/
|
|
1305
|
+
createCategory(input: {
|
|
1306
|
+
name: string;
|
|
1307
|
+
slug?: string;
|
|
1308
|
+
parentId?: string | null;
|
|
1309
|
+
description?: string;
|
|
1310
|
+
meta?: Record<string, unknown>;
|
|
1311
|
+
}): Promise<TermItem>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Get all catalog categories.
|
|
1314
|
+
*/
|
|
1315
|
+
getCategories(options?: {
|
|
1316
|
+
parentId?: string | null;
|
|
1317
|
+
}): Promise<TermItem[]>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Get full hierarchical catalog category tree.
|
|
1320
|
+
*/
|
|
1321
|
+
getCategoryTree(): Promise<TermTreeItem[]>;
|
|
1322
|
+
/**
|
|
1323
|
+
* Assign category IDs to a product.
|
|
1324
|
+
*/
|
|
1325
|
+
assignProductCategory(productId: string, categoryIds: string | string[]): Promise<void>;
|
|
1326
|
+
/**
|
|
1327
|
+
* Get assigned categories for a product.
|
|
1328
|
+
*/
|
|
1329
|
+
getProductCategories(productId: string): Promise<TermItem[]>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Create a promotional coupon / discount code.
|
|
1332
|
+
*/
|
|
1333
|
+
createDiscount(input: CreateDiscountInput, authorId?: string | null): Promise<DiscountItem>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Find a discount code.
|
|
1336
|
+
*/
|
|
1337
|
+
getDiscountByCode(code: string): Promise<DiscountItem | null>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Validate a discount coupon against cart items and order subtotal.
|
|
1340
|
+
*/
|
|
1341
|
+
validateDiscount(code: string, cartSubtotal: number, productIds?: string[]): Promise<DiscountValidationResult>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Calculate cart subtotals, apply discounts, shipping, and taxes.
|
|
1344
|
+
*/
|
|
1345
|
+
calculateCart(input: CartCalculationInput): Promise<CartCalculationResult>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Place a new order with cart validation, inventory deduction, and coupon counter updates.
|
|
1348
|
+
*/
|
|
1349
|
+
createOrder(input: CreateOrderInput, authorId?: string | null): Promise<OrderItem>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Get order by ID.
|
|
1352
|
+
*/
|
|
1353
|
+
getOrder(id: string): Promise<OrderItem | null>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Get order by order number.
|
|
1356
|
+
*/
|
|
1357
|
+
getOrderByNumber(orderNumber: string): Promise<OrderItem | null>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Update the status of an order (e.g. pending -> paid -> shipped).
|
|
1360
|
+
*/
|
|
1361
|
+
updateOrderStatus(id: string, status: OrderStatus, note?: string): Promise<OrderItem | null>;
|
|
1362
|
+
}
|
|
1363
|
+
//#endregion
|
|
1364
|
+
//#region src/plugins/ecommerce/schemas.d.ts
|
|
1365
|
+
/**
|
|
1366
|
+
* Creates the collection configuration for Products.
|
|
1367
|
+
*/
|
|
1368
|
+
declare function createProductCollection(options?: EcommercePluginOptions): CollectionConfig;
|
|
1369
|
+
/**
|
|
1370
|
+
* Creates the collection configuration for Discounts / Coupons.
|
|
1371
|
+
*/
|
|
1372
|
+
declare function createDiscountCollection(options?: EcommercePluginOptions): CollectionConfig;
|
|
1373
|
+
/**
|
|
1374
|
+
* Creates the collection configuration for Orders.
|
|
1375
|
+
*/
|
|
1376
|
+
declare function createOrderCollection(options?: EcommercePluginOptions): CollectionConfig;
|
|
1377
|
+
/**
|
|
1378
|
+
* Creates the standard e-commerce taxonomies: product categories, tags, and brands.
|
|
1379
|
+
*/
|
|
1380
|
+
declare function createEcommerceTaxonomies(options?: EcommercePluginOptions): TaxonomyConfig[];
|
|
1381
|
+
//#endregion
|
|
1382
|
+
//#region src/plugins/ecommerce/client.d.ts
|
|
1383
|
+
declare class EcommerceClient {
|
|
1384
|
+
private client;
|
|
1385
|
+
private options;
|
|
1386
|
+
private service?;
|
|
1387
|
+
private prefix;
|
|
1388
|
+
constructor(client: CMSClient, options?: EcommercePluginOptions);
|
|
1389
|
+
readonly products: {
|
|
1390
|
+
find: (query?: EcommerceProductQuery) => Promise<PaginatedResult<ProductItem>>;
|
|
1391
|
+
get: (idOrSlug: string, by?: "id" | "slug") => Promise<ProductItem | null>;
|
|
1392
|
+
create: (data: CreateProductInput) => Promise<ProductItem>;
|
|
1393
|
+
update: (id: string, data: UpdateProductInput) => Promise<ProductItem | null>;
|
|
1394
|
+
delete: (id: string) => Promise<boolean>;
|
|
1395
|
+
uploadImage: (productId: string, file: {
|
|
1396
|
+
filename: string;
|
|
1397
|
+
mimeType: string;
|
|
1398
|
+
sizeBytes: number;
|
|
1399
|
+
url?: string;
|
|
1400
|
+
altText?: string;
|
|
1401
|
+
caption?: string;
|
|
1402
|
+
width?: number;
|
|
1403
|
+
height?: number;
|
|
1404
|
+
isFeatured?: boolean;
|
|
1405
|
+
}) => Promise<{
|
|
1406
|
+
media: MediaItem;
|
|
1407
|
+
product: ProductItem;
|
|
1408
|
+
}>;
|
|
1409
|
+
};
|
|
1410
|
+
readonly categories: {
|
|
1411
|
+
list: (options?: {
|
|
1412
|
+
parentId?: string | null;
|
|
1413
|
+
}) => Promise<TermItem[]>;
|
|
1414
|
+
tree: () => Promise<TermTreeItem[]>;
|
|
1415
|
+
create: (input: {
|
|
1416
|
+
name: string;
|
|
1417
|
+
slug?: string;
|
|
1418
|
+
parentId?: string | null;
|
|
1419
|
+
description?: string;
|
|
1420
|
+
}) => Promise<TermItem>;
|
|
1421
|
+
};
|
|
1422
|
+
readonly discounts: {
|
|
1423
|
+
validate: (code: string, subtotal: number, productIds?: string[]) => Promise<DiscountValidationResult>;
|
|
1424
|
+
create: (input: CreateDiscountInput) => Promise<DiscountItem>;
|
|
1425
|
+
};
|
|
1426
|
+
readonly cart: {
|
|
1427
|
+
calculate: (input: CartCalculationInput) => Promise<CartCalculationResult>;
|
|
1428
|
+
};
|
|
1429
|
+
readonly orders: {
|
|
1430
|
+
create: (input: CreateOrderInput) => Promise<OrderItem>;
|
|
1431
|
+
get: (idOrNumber: string, by?: "id" | "number") => Promise<OrderItem | null>;
|
|
1432
|
+
updateStatus: (id: string, status: OrderStatus, note?: string) => Promise<OrderItem | null>;
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Get or create an EcommerceClient adapter for a CMSClient.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function getEcommerceClient(client: CMSClient, options?: EcommercePluginOptions): EcommerceClient;
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/plugins/ecommerce/index.d.ts
|
|
1441
|
+
/**
|
|
1442
|
+
* Built-in E-commerce plugin factory for @azlib/cms.
|
|
1443
|
+
* Equips the CMS engine with product catalogs, hierarchical categories,
|
|
1444
|
+
* image uploading, discount coupons, cart calculation, and order tracking.
|
|
1445
|
+
*/
|
|
1446
|
+
declare const ecommercePlugin: (options?: void | EcommercePluginOptions | undefined) => CMSPlugin;
|
|
1447
|
+
/**
|
|
1448
|
+
* Retrieve the active EcommerceService instance associated with a CMSEngine.
|
|
1449
|
+
*/
|
|
1450
|
+
declare function getEcommerceService(engine: CMSEngine, options?: EcommercePluginOptions): EcommerceService;
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region src/plugins/hrms/types.d.ts
|
|
1453
|
+
type EmployerStatus = "active" | "inactive";
|
|
1454
|
+
interface EmployerWorkSchedule {
|
|
1455
|
+
readonly startTime: string;
|
|
1456
|
+
readonly endTime: string;
|
|
1457
|
+
readonly standardHoursPerDay: number;
|
|
1458
|
+
readonly gracePeriodMinutes?: number;
|
|
1459
|
+
readonly workDays?: number[];
|
|
1460
|
+
}
|
|
1461
|
+
interface EmployerData extends Record<string, unknown> {
|
|
1462
|
+
companyName: string;
|
|
1463
|
+
legalName?: string;
|
|
1464
|
+
taxId?: string;
|
|
1465
|
+
email?: string;
|
|
1466
|
+
phone?: string;
|
|
1467
|
+
website?: string;
|
|
1468
|
+
logo?: string;
|
|
1469
|
+
address?: string | Record<string, unknown>;
|
|
1470
|
+
timezone?: string;
|
|
1471
|
+
workSchedule?: EmployerWorkSchedule;
|
|
1472
|
+
status: EmployerStatus;
|
|
1473
|
+
}
|
|
1474
|
+
type EmployerItem = ContentItem<EmployerData>;
|
|
1475
|
+
type EmploymentType = "full_time" | "part_time" | "contractor" | "intern";
|
|
1476
|
+
type EmployeeStatus = "active" | "on_leave" | "terminated" | "suspended";
|
|
1477
|
+
interface EmployeeEmergencyContact {
|
|
1478
|
+
readonly name: string;
|
|
1479
|
+
readonly relationship: string;
|
|
1480
|
+
readonly phone: string;
|
|
1481
|
+
readonly email?: string;
|
|
1482
|
+
}
|
|
1483
|
+
interface EmployeeDocument {
|
|
1484
|
+
readonly id?: string;
|
|
1485
|
+
readonly title: string;
|
|
1486
|
+
readonly fileUrl: string;
|
|
1487
|
+
readonly category?: string;
|
|
1488
|
+
readonly uploadedAt?: string;
|
|
1489
|
+
}
|
|
1490
|
+
interface EmployeeData extends Record<string, unknown> {
|
|
1491
|
+
employerId: string;
|
|
1492
|
+
userId?: string;
|
|
1493
|
+
employeeNumber: string;
|
|
1494
|
+
firstName: string;
|
|
1495
|
+
lastName: string;
|
|
1496
|
+
email: string;
|
|
1497
|
+
phone?: string;
|
|
1498
|
+
avatar?: string;
|
|
1499
|
+
jobTitle?: string;
|
|
1500
|
+
employmentType: EmploymentType;
|
|
1501
|
+
status: EmployeeStatus;
|
|
1502
|
+
hireDate: string;
|
|
1503
|
+
terminationDate?: string;
|
|
1504
|
+
managerId?: string;
|
|
1505
|
+
emergencyContact?: EmployeeEmergencyContact;
|
|
1506
|
+
documents?: EmployeeDocument[];
|
|
1507
|
+
salary?: number;
|
|
1508
|
+
notes?: string;
|
|
1509
|
+
}
|
|
1510
|
+
type EmployeeItem = ContentItem<EmployeeData>;
|
|
1511
|
+
type AttendanceStatus = "present" | "late" | "half_day" | "absent" | "on_leave";
|
|
1512
|
+
interface AttendanceData extends Record<string, unknown> {
|
|
1513
|
+
employerId: string;
|
|
1514
|
+
employeeId: string;
|
|
1515
|
+
date: string;
|
|
1516
|
+
checkInAt: string;
|
|
1517
|
+
checkOutAt?: string;
|
|
1518
|
+
totalHours?: number;
|
|
1519
|
+
overtimeHours?: number;
|
|
1520
|
+
status: AttendanceStatus;
|
|
1521
|
+
location?: string;
|
|
1522
|
+
notes?: string;
|
|
1523
|
+
}
|
|
1524
|
+
type AttendanceItem = ContentItem<AttendanceData>;
|
|
1525
|
+
interface LeaveTypeData extends Record<string, unknown> {
|
|
1526
|
+
employerId?: string;
|
|
1527
|
+
name: string;
|
|
1528
|
+
code: string;
|
|
1529
|
+
daysAllowedPerYear: number;
|
|
1530
|
+
paid: boolean;
|
|
1531
|
+
requiresApproval: boolean;
|
|
1532
|
+
color?: string;
|
|
1533
|
+
description?: string;
|
|
1534
|
+
}
|
|
1535
|
+
type LeaveTypeItem = ContentItem<LeaveTypeData>;
|
|
1536
|
+
type LeaveRequestStatus = "pending" | "approved" | "rejected" | "cancelled";
|
|
1537
|
+
interface LeaveRequestData extends Record<string, unknown> {
|
|
1538
|
+
employerId: string;
|
|
1539
|
+
employeeId: string;
|
|
1540
|
+
leaveTypeId: string;
|
|
1541
|
+
startDate: string;
|
|
1542
|
+
endDate: string;
|
|
1543
|
+
daysCount: number;
|
|
1544
|
+
reason?: string;
|
|
1545
|
+
status: LeaveRequestStatus;
|
|
1546
|
+
approvedBy?: string;
|
|
1547
|
+
approvedAt?: string;
|
|
1548
|
+
rejectionReason?: string;
|
|
1549
|
+
}
|
|
1550
|
+
type LeaveRequestItem = ContentItem<LeaveRequestData>;
|
|
1551
|
+
interface LeaveBalanceItem {
|
|
1552
|
+
readonly leaveTypeId: string;
|
|
1553
|
+
readonly leaveTypeName: string;
|
|
1554
|
+
readonly leaveTypeCode: string;
|
|
1555
|
+
readonly allocatedDays: number;
|
|
1556
|
+
readonly usedDays: number;
|
|
1557
|
+
readonly pendingDays: number;
|
|
1558
|
+
readonly remainingDays: number;
|
|
1559
|
+
}
|
|
1560
|
+
interface EmployeeLeaveBalanceReport {
|
|
1561
|
+
readonly employeeId: string;
|
|
1562
|
+
readonly year: number;
|
|
1563
|
+
readonly balances: readonly LeaveBalanceItem[];
|
|
1564
|
+
readonly totalAllocated: number;
|
|
1565
|
+
readonly totalUsed: number;
|
|
1566
|
+
readonly totalRemaining: number;
|
|
1567
|
+
}
|
|
1568
|
+
interface CreateEmployerInput {
|
|
1569
|
+
companyName: string;
|
|
1570
|
+
legalName?: string;
|
|
1571
|
+
taxId?: string;
|
|
1572
|
+
email?: string;
|
|
1573
|
+
phone?: string;
|
|
1574
|
+
website?: string;
|
|
1575
|
+
logo?: string;
|
|
1576
|
+
address?: string | Record<string, unknown>;
|
|
1577
|
+
timezone?: string;
|
|
1578
|
+
workSchedule?: EmployerWorkSchedule;
|
|
1579
|
+
status?: EmployerStatus;
|
|
1580
|
+
}
|
|
1581
|
+
interface UpdateEmployerInput {
|
|
1582
|
+
companyName?: string;
|
|
1583
|
+
legalName?: string;
|
|
1584
|
+
taxId?: string;
|
|
1585
|
+
email?: string;
|
|
1586
|
+
phone?: string;
|
|
1587
|
+
website?: string;
|
|
1588
|
+
logo?: string;
|
|
1589
|
+
address?: string | Record<string, unknown>;
|
|
1590
|
+
timezone?: string;
|
|
1591
|
+
workSchedule?: EmployerWorkSchedule;
|
|
1592
|
+
status?: EmployerStatus;
|
|
1593
|
+
}
|
|
1594
|
+
interface CreateEmployeeInput {
|
|
1595
|
+
employerId: string;
|
|
1596
|
+
userId?: string;
|
|
1597
|
+
employeeNumber: string;
|
|
1598
|
+
firstName: string;
|
|
1599
|
+
lastName: string;
|
|
1600
|
+
email: string;
|
|
1601
|
+
phone?: string;
|
|
1602
|
+
avatar?: string;
|
|
1603
|
+
jobTitle?: string;
|
|
1604
|
+
departmentSlug?: string;
|
|
1605
|
+
employmentType?: EmploymentType;
|
|
1606
|
+
status?: EmployeeStatus;
|
|
1607
|
+
hireDate: string;
|
|
1608
|
+
managerId?: string;
|
|
1609
|
+
emergencyContact?: EmployeeEmergencyContact;
|
|
1610
|
+
documents?: EmployeeDocument[];
|
|
1611
|
+
salary?: number;
|
|
1612
|
+
notes?: string;
|
|
1613
|
+
}
|
|
1614
|
+
interface UpdateEmployeeInput {
|
|
1615
|
+
employerId?: string;
|
|
1616
|
+
userId?: string;
|
|
1617
|
+
employeeNumber?: string;
|
|
1618
|
+
firstName?: string;
|
|
1619
|
+
lastName?: string;
|
|
1620
|
+
email?: string;
|
|
1621
|
+
phone?: string;
|
|
1622
|
+
avatar?: string;
|
|
1623
|
+
jobTitle?: string;
|
|
1624
|
+
departmentSlug?: string;
|
|
1625
|
+
employmentType?: EmploymentType;
|
|
1626
|
+
status?: EmployeeStatus;
|
|
1627
|
+
hireDate?: string;
|
|
1628
|
+
terminationDate?: string;
|
|
1629
|
+
managerId?: string;
|
|
1630
|
+
emergencyContact?: EmployeeEmergencyContact;
|
|
1631
|
+
documents?: EmployeeDocument[];
|
|
1632
|
+
salary?: number;
|
|
1633
|
+
notes?: string;
|
|
1634
|
+
}
|
|
1635
|
+
interface CheckInInput {
|
|
1636
|
+
employeeId: string;
|
|
1637
|
+
timestamp?: string | Date;
|
|
1638
|
+
location?: string;
|
|
1639
|
+
notes?: string;
|
|
1640
|
+
}
|
|
1641
|
+
interface CheckOutInput {
|
|
1642
|
+
employeeId: string;
|
|
1643
|
+
timestamp?: string | Date;
|
|
1644
|
+
location?: string;
|
|
1645
|
+
notes?: string;
|
|
1646
|
+
}
|
|
1647
|
+
interface RecordAttendanceManualInput {
|
|
1648
|
+
employerId: string;
|
|
1649
|
+
employeeId: string;
|
|
1650
|
+
date: string;
|
|
1651
|
+
checkInAt: string;
|
|
1652
|
+
checkOutAt?: string;
|
|
1653
|
+
totalHours?: number;
|
|
1654
|
+
overtimeHours?: number;
|
|
1655
|
+
status?: AttendanceStatus;
|
|
1656
|
+
location?: string;
|
|
1657
|
+
notes?: string;
|
|
1658
|
+
}
|
|
1659
|
+
interface CreateLeaveTypeInput {
|
|
1660
|
+
employerId?: string;
|
|
1661
|
+
name: string;
|
|
1662
|
+
code: string;
|
|
1663
|
+
daysAllowedPerYear: number;
|
|
1664
|
+
paid?: boolean;
|
|
1665
|
+
requiresApproval?: boolean;
|
|
1666
|
+
color?: string;
|
|
1667
|
+
description?: string;
|
|
1668
|
+
}
|
|
1669
|
+
interface CreateLeaveRequestInput {
|
|
1670
|
+
employerId?: string;
|
|
1671
|
+
employeeId: string;
|
|
1672
|
+
leaveTypeId: string;
|
|
1673
|
+
startDate: string;
|
|
1674
|
+
endDate: string;
|
|
1675
|
+
daysCount?: number;
|
|
1676
|
+
reason?: string;
|
|
1677
|
+
}
|
|
1678
|
+
interface ApproveLeaveInput {
|
|
1679
|
+
requestId: string;
|
|
1680
|
+
approverId: string;
|
|
1681
|
+
}
|
|
1682
|
+
interface RejectLeaveInput {
|
|
1683
|
+
requestId: string;
|
|
1684
|
+
approverId: string;
|
|
1685
|
+
reason?: string;
|
|
1686
|
+
}
|
|
1687
|
+
interface HRMSEmployeeQuery {
|
|
1688
|
+
employerId?: string;
|
|
1689
|
+
department?: string;
|
|
1690
|
+
employmentType?: EmploymentType;
|
|
1691
|
+
status?: EmployeeStatus;
|
|
1692
|
+
search?: string;
|
|
1693
|
+
page?: number;
|
|
1694
|
+
limit?: number;
|
|
1695
|
+
}
|
|
1696
|
+
interface HRMSAttendanceQuery {
|
|
1697
|
+
employerId?: string;
|
|
1698
|
+
employeeId?: string;
|
|
1699
|
+
date?: string;
|
|
1700
|
+
startDate?: string;
|
|
1701
|
+
endDate?: string;
|
|
1702
|
+
status?: AttendanceStatus;
|
|
1703
|
+
page?: number;
|
|
1704
|
+
limit?: number;
|
|
1705
|
+
}
|
|
1706
|
+
interface HRMSLeaveQuery {
|
|
1707
|
+
employerId?: string;
|
|
1708
|
+
employeeId?: string;
|
|
1709
|
+
leaveTypeId?: string;
|
|
1710
|
+
status?: LeaveRequestStatus;
|
|
1711
|
+
year?: number;
|
|
1712
|
+
page?: number;
|
|
1713
|
+
limit?: number;
|
|
1714
|
+
}
|
|
1715
|
+
interface HRMSPluginOptions {
|
|
1716
|
+
employerCollectionSlug?: string;
|
|
1717
|
+
employeeCollectionSlug?: string;
|
|
1718
|
+
attendanceCollectionSlug?: string;
|
|
1719
|
+
leaveTypeCollectionSlug?: string;
|
|
1720
|
+
leaveRequestCollectionSlug?: string;
|
|
1721
|
+
departmentsTaxonomySlug?: string;
|
|
1722
|
+
designationsTaxonomySlug?: string;
|
|
1723
|
+
apiPrefix?: string;
|
|
1724
|
+
standardWorkDayHours?: number;
|
|
1725
|
+
workScheduleStart?: string;
|
|
1726
|
+
workScheduleEnd?: string;
|
|
1727
|
+
gracePeriodMinutes?: number;
|
|
1728
|
+
enableEmployers?: boolean;
|
|
1729
|
+
enableAttendance?: boolean;
|
|
1730
|
+
enableLeaves?: boolean;
|
|
1731
|
+
}
|
|
1732
|
+
//#endregion
|
|
1733
|
+
//#region src/plugins/hrms/service.d.ts
|
|
1734
|
+
declare class HRMSService {
|
|
1735
|
+
readonly engine: CMSEngine;
|
|
1736
|
+
readonly options: HRMSPluginOptions;
|
|
1737
|
+
readonly employerSlug: string;
|
|
1738
|
+
readonly employeeSlug: string;
|
|
1739
|
+
readonly attendanceSlug: string;
|
|
1740
|
+
readonly leaveTypeSlug: string;
|
|
1741
|
+
readonly leaveRequestSlug: string;
|
|
1742
|
+
readonly departmentsTaxonomy: string;
|
|
1743
|
+
readonly designationsTaxonomy: string;
|
|
1744
|
+
readonly standardWorkDayHours: number;
|
|
1745
|
+
readonly workScheduleStart: string;
|
|
1746
|
+
readonly workScheduleEnd: string;
|
|
1747
|
+
readonly gracePeriodMinutes: number;
|
|
1748
|
+
constructor(engine: CMSEngine, options?: HRMSPluginOptions);
|
|
1749
|
+
private get employersCollection();
|
|
1750
|
+
private get employeesCollection();
|
|
1751
|
+
private get attendanceCollection();
|
|
1752
|
+
private get leaveTypesCollection();
|
|
1753
|
+
private get leaveRequestsCollection();
|
|
1754
|
+
createEmployer(input: CreateEmployerInput, authorId?: string | null): Promise<EmployerItem>;
|
|
1755
|
+
getEmployer(id: string): Promise<EmployerItem | null>;
|
|
1756
|
+
getEmployerBySlug(slug: string): Promise<EmployerItem | null>;
|
|
1757
|
+
updateEmployer(id: string, input: UpdateEmployerInput, authorId?: string | null): Promise<EmployerItem | null>;
|
|
1758
|
+
listEmployers(query?: {
|
|
1759
|
+
status?: "active" | "inactive";
|
|
1760
|
+
page?: number;
|
|
1761
|
+
limit?: number;
|
|
1762
|
+
}): Promise<PaginatedResult<EmployerItem>>;
|
|
1763
|
+
createEmployee(input: CreateEmployeeInput, authorId?: string | null): Promise<EmployeeItem>;
|
|
1764
|
+
getEmployee(id: string): Promise<EmployeeItem | null>;
|
|
1765
|
+
getEmployeeByNumber(employerId: string, employeeNumber: string): Promise<EmployeeItem | null>;
|
|
1766
|
+
updateEmployee(id: string, input: UpdateEmployeeInput, authorId?: string | null): Promise<EmployeeItem | null>;
|
|
1767
|
+
deleteEmployee(id: string): Promise<boolean>;
|
|
1768
|
+
listEmployees(query?: HRMSEmployeeQuery): Promise<PaginatedResult<EmployeeItem>>;
|
|
1769
|
+
getDirectReports(managerId: string): Promise<EmployeeItem[]>;
|
|
1770
|
+
private parseTimeToMinutes;
|
|
1771
|
+
private formatDateString;
|
|
1772
|
+
private getHoursAndMinutes;
|
|
1773
|
+
/**
|
|
1774
|
+
* Check in an employee for today (or specified timestamp).
|
|
1775
|
+
*/
|
|
1776
|
+
checkIn(input: CheckInInput): Promise<AttendanceItem>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Check out an employee for today (or specified timestamp).
|
|
1779
|
+
*/
|
|
1780
|
+
checkOut(input: CheckOutInput): Promise<AttendanceItem>;
|
|
1781
|
+
getDailyAttendance(employeeId: string, date: string): Promise<AttendanceItem | null>;
|
|
1782
|
+
recordAttendanceManual(input: RecordAttendanceManualInput): Promise<AttendanceItem>;
|
|
1783
|
+
listAttendance(query?: HRMSAttendanceQuery): Promise<PaginatedResult<AttendanceItem>>;
|
|
1784
|
+
createLeaveType(input: CreateLeaveTypeInput, authorId?: string | null): Promise<LeaveTypeItem>;
|
|
1785
|
+
getLeaveType(id: string): Promise<LeaveTypeItem | null>;
|
|
1786
|
+
listLeaveTypes(employerId?: string): Promise<LeaveTypeItem[]>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Calculate leave balance report for an employee for a given year.
|
|
1789
|
+
*/
|
|
1790
|
+
calculateLeaveBalance(employeeId: string, year?: number): Promise<EmployeeLeaveBalanceReport>;
|
|
1791
|
+
/**
|
|
1792
|
+
* Submit a new leave request.
|
|
1793
|
+
*/
|
|
1794
|
+
requestLeave(input: CreateLeaveRequestInput, authorId?: string | null): Promise<LeaveRequestItem>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Approve a pending leave request.
|
|
1797
|
+
*/
|
|
1798
|
+
approveLeave(input: ApproveLeaveInput): Promise<LeaveRequestItem>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Reject a pending leave request.
|
|
1801
|
+
*/
|
|
1802
|
+
rejectLeave(input: RejectLeaveInput): Promise<LeaveRequestItem>;
|
|
1803
|
+
/**
|
|
1804
|
+
* Cancel a leave request.
|
|
1805
|
+
*/
|
|
1806
|
+
cancelLeave(requestId: string): Promise<LeaveRequestItem>;
|
|
1807
|
+
listLeaveRequests(query?: HRMSLeaveQuery): Promise<PaginatedResult<LeaveRequestItem>>;
|
|
1808
|
+
}
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/plugins/hrms/schemas.d.ts
|
|
1811
|
+
/**
|
|
1812
|
+
* Creates the collection configuration for Employers (Organizations / Companies).
|
|
1813
|
+
*/
|
|
1814
|
+
declare function createEmployerCollection(options?: HRMSPluginOptions): CollectionConfig;
|
|
1815
|
+
/**
|
|
1816
|
+
* Creates the collection configuration for Employees.
|
|
1817
|
+
*/
|
|
1818
|
+
declare function createEmployeeCollection(options?: HRMSPluginOptions): CollectionConfig;
|
|
1819
|
+
/**
|
|
1820
|
+
* Creates the collection configuration for Daily Attendance.
|
|
1821
|
+
*/
|
|
1822
|
+
declare function createAttendanceCollection(options?: HRMSPluginOptions): CollectionConfig;
|
|
1823
|
+
/**
|
|
1824
|
+
* Creates the collection configuration for Leave Types.
|
|
1825
|
+
*/
|
|
1826
|
+
declare function createLeaveTypeCollection(options?: HRMSPluginOptions): CollectionConfig;
|
|
1827
|
+
/**
|
|
1828
|
+
* Creates the collection configuration for Leave Requests.
|
|
1829
|
+
*/
|
|
1830
|
+
declare function createLeaveRequestCollection(options?: HRMSPluginOptions): CollectionConfig;
|
|
1831
|
+
/**
|
|
1832
|
+
* Creates the standard HRMS taxonomies: departments and designations.
|
|
1833
|
+
*/
|
|
1834
|
+
declare function createHRMSTaxonomies(options?: HRMSPluginOptions): TaxonomyConfig[];
|
|
1835
|
+
//#endregion
|
|
1836
|
+
//#region src/plugins/hrms/client.d.ts
|
|
1837
|
+
declare class HRMSClient {
|
|
1838
|
+
private client;
|
|
1839
|
+
private options;
|
|
1840
|
+
private service?;
|
|
1841
|
+
private prefix;
|
|
1842
|
+
constructor(client: CMSClient, options?: HRMSPluginOptions);
|
|
1843
|
+
readonly employers: {
|
|
1844
|
+
find: (query?: {
|
|
1845
|
+
status?: "active" | "inactive";
|
|
1846
|
+
page?: number;
|
|
1847
|
+
limit?: number;
|
|
1848
|
+
}) => Promise<PaginatedResult<EmployerItem>>;
|
|
1849
|
+
get: (id: string) => Promise<EmployerItem | null>;
|
|
1850
|
+
create: (input: CreateEmployerInput) => Promise<EmployerItem>;
|
|
1851
|
+
update: (id: string, input: UpdateEmployerInput) => Promise<EmployerItem | null>;
|
|
1852
|
+
};
|
|
1853
|
+
readonly employees: {
|
|
1854
|
+
find: (query?: HRMSEmployeeQuery) => Promise<PaginatedResult<EmployeeItem>>;
|
|
1855
|
+
get: (id: string) => Promise<EmployeeItem | null>;
|
|
1856
|
+
getByNumber: (employerId: string, employeeNumber: string) => Promise<EmployeeItem | null>;
|
|
1857
|
+
create: (input: CreateEmployeeInput) => Promise<EmployeeItem>;
|
|
1858
|
+
update: (id: string, input: UpdateEmployeeInput) => Promise<EmployeeItem | null>;
|
|
1859
|
+
delete: (id: string) => Promise<boolean>;
|
|
1860
|
+
getLeaveBalance: (employeeId: string, year?: number) => Promise<EmployeeLeaveBalanceReport>;
|
|
1861
|
+
getDirectReports: (managerId: string) => Promise<EmployeeItem[]>;
|
|
1862
|
+
};
|
|
1863
|
+
readonly attendance: {
|
|
1864
|
+
checkIn: (input: CheckInInput) => Promise<AttendanceItem>;
|
|
1865
|
+
checkOut: (input: CheckOutInput) => Promise<AttendanceItem>;
|
|
1866
|
+
getDaily: (employeeId: string, date: string) => Promise<AttendanceItem | null>;
|
|
1867
|
+
find: (query?: HRMSAttendanceQuery) => Promise<PaginatedResult<AttendanceItem>>;
|
|
1868
|
+
recordManual: (input: RecordAttendanceManualInput) => Promise<AttendanceItem>;
|
|
1869
|
+
};
|
|
1870
|
+
readonly leaves: {
|
|
1871
|
+
listTypes: (employerId?: string) => Promise<LeaveTypeItem[]>;
|
|
1872
|
+
createType: (input: CreateLeaveTypeInput) => Promise<LeaveTypeItem>;
|
|
1873
|
+
getType: (id: string) => Promise<LeaveTypeItem | null>;
|
|
1874
|
+
findRequests: (query?: HRMSLeaveQuery) => Promise<PaginatedResult<LeaveRequestItem>>;
|
|
1875
|
+
request: (input: CreateLeaveRequestInput) => Promise<LeaveRequestItem>;
|
|
1876
|
+
approve: (input: ApproveLeaveInput) => Promise<LeaveRequestItem>;
|
|
1877
|
+
reject: (input: RejectLeaveInput) => Promise<LeaveRequestItem>;
|
|
1878
|
+
cancel: (requestId: string) => Promise<LeaveRequestItem>;
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Get or create an HRMSClient adapter for a CMSClient.
|
|
1883
|
+
*/
|
|
1884
|
+
declare function getHRMSClient(client: CMSClient, options?: HRMSPluginOptions): HRMSClient;
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region src/plugins/hrms/index.d.ts
|
|
1887
|
+
/**
|
|
1888
|
+
* Built-in HRMS plugin factory for @azlib/cms.
|
|
1889
|
+
* Equips the CMS engine with multi-tenant employers, employee profiles,
|
|
1890
|
+
* daily attendance check-in/out tracking, and leave quota approval workflows.
|
|
1891
|
+
*/
|
|
1892
|
+
declare const hrmsPlugin: (options?: void | HRMSPluginOptions | undefined) => CMSPlugin;
|
|
1893
|
+
/**
|
|
1894
|
+
* Retrieve the active HRMSService instance associated with a CMSEngine.
|
|
1895
|
+
*/
|
|
1896
|
+
declare function getHRMSService(engine: CMSEngine, options?: HRMSPluginOptions): HRMSService;
|
|
1897
|
+
//#endregion
|
|
1898
|
+
export { type ActionCallback, ApproveLeaveInput, AttendanceData, AttendanceItem, AttendanceStatus, type BooleanFieldOptions, CMSCapability, CMSClient, type CMSClientOptions, CMSConfig, CMSEngine, type CMSPlugin, type CMSPluginContext, CMSRouter, type CMSStorageAdapter, CMSUser, CartCalculationInput, CartCalculationResult, CartItemInput, CheckInInput, CheckOutInput, type ClientCollectionApi, CollectionConfig, type CollectionOptions, type CollectionService, ContentItem, ContentLifecycle, ContentQueryOptions, ContentStatus, type CreateContentInput, CreateDiscountInput, CreateEmployeeInput, CreateEmployerInput, CreateLeaveRequestInput, CreateLeaveTypeInput, CreateOrderInput, CreateProductInput, type CustomRouteHandler, DEFAULT_COLLECTIONS, DEFAULT_ROLE_CAPABILITIES, type DateFieldOptions, DiscountData, DiscountItem, DiscountStatus, DiscountType, DiscountValidationResult, EcommerceClient, EcommercePluginOptions, EcommerceProductQuery, EcommerceService, EmployeeData, EmployeeDocument, EmployeeEmergencyContact, EmployeeItem, EmployeeLeaveBalanceReport, EmployeeStatus, EmployerData, EmployerItem, EmployerStatus, EmployerWorkSchedule, EmploymentType, FieldDefinition, FieldType, type FilterCallback, HRMSAttendanceQuery, HRMSClient, HRMSEmployeeQuery, HRMSLeaveQuery, HRMSPluginOptions, HRMSService, type HookEntry, HooksManager, type ImageFieldOptions, type JsonFieldOptions, LeaveBalanceItem, LeaveRequestData, LeaveRequestItem, LeaveRequestStatus, LeaveTypeData, LeaveTypeItem, MediaItem, MediaManager, type MediaUploadInput, MemoryStorageAdapter, type NumberFieldOptions, OptionItem, OptionsManager, OrderAddress, OrderData, OrderItem, OrderLineItem, OrderStatus, PaginatedResult, ProductData, ProductImage, ProductItem, ProductStatus, ProductVariant, RBACManager, RecordAttendanceManualInput, RejectLeaveInput, type RelationshipFieldOptions, type RepeaterFieldOptions, RevisionDiff, RevisionDiffField, RevisionManager, RevisionRecord, type RichTextFieldOptions, type RouteContext, type SelectFieldOptions, SelectOption, SiteConfig, type SlugFieldOptions, type SyncFilterCallback, TaxonomyConfig, type TaxonomyFieldOptions, TaxonomyManager, TermItem, TermTreeItem, type TextFieldOptions, type UpdateContentInput, UpdateEmployeeInput, UpdateEmployerInput, UpdateProductInput, UserRole, VALID_STATUS_TRANSITIONS, collection, createAttendanceCollection, createCMSEngine, createCMSRouter, createCmsClient, createDiscountCollection, createEcommerceTaxonomies, createEmployeeCollection, createEmployerCollection, createHRMSTaxonomies, createLeaveRequestCollection, createLeaveTypeCollection, createOrderCollection, createProductCollection, defaultHooks, defineConfig, definePlugin, ecommercePlugin, fields, getEcommerceClient, getEcommerceService, getHRMSClient, getHRMSService, hrmsPlugin, normalizeConfig, resolveUniqueSlug, slugify, validateAndNormalizeData };
|
|
969
1899
|
//# sourceMappingURL=index.d.mts.map
|