@mohasinac/contracts 0.1.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.
@@ -0,0 +1,65 @@
1
+ export interface ShippingAddress {
2
+ name: string;
3
+ phone: string;
4
+ addressLine1: string;
5
+ addressLine2?: string;
6
+ city: string;
7
+ state: string;
8
+ pincode: string;
9
+ country: string;
10
+ }
11
+ export interface CreateShipmentInput {
12
+ orderId: string;
13
+ dimensions: {
14
+ weight: number;
15
+ length: number;
16
+ width: number;
17
+ height: number;
18
+ };
19
+ pickup: ShippingAddress;
20
+ delivery: ShippingAddress;
21
+ codAmount?: number;
22
+ isCod?: boolean;
23
+ }
24
+ export interface Shipment {
25
+ id: string;
26
+ trackingId: string;
27
+ orderId: string;
28
+ status: string;
29
+ courier?: string;
30
+ estimatedDelivery?: string;
31
+ createdAt: string;
32
+ }
33
+ export interface TrackingEvent {
34
+ status: string;
35
+ location: string;
36
+ timestamp: string;
37
+ description?: string;
38
+ }
39
+ export interface TrackingInfo {
40
+ trackingId: string;
41
+ currentStatus: string;
42
+ estimatedDelivery?: string;
43
+ events: TrackingEvent[];
44
+ }
45
+ export interface ServiceabilityResult {
46
+ isServiceable: boolean;
47
+ couriers: Array<{
48
+ name: string;
49
+ estimatedDays: number;
50
+ rate: number;
51
+ }>;
52
+ }
53
+ /**
54
+ * Shipping carrier adapter contract.
55
+ * Implemented by @mohasinac/shipping-shiprocket, @mohasinac/shipping-shippo,
56
+ * @mohasinac/shipping-easypost.
57
+ */
58
+ export interface IShippingProvider {
59
+ createShipment(data: CreateShipmentInput): Promise<Shipment>;
60
+ trackShipment(trackingId: string): Promise<TrackingInfo>;
61
+ cancelShipment(shipmentId: string): Promise<void>;
62
+ checkServiceability(pincode: string, weight: number): Promise<ServiceabilityResult>;
63
+ generateLabel(shipmentId: string): Promise<ArrayBuffer>;
64
+ }
65
+ //# sourceMappingURL=shipping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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E,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAID;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACzD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,mBAAmB,CACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACzD"}
@@ -0,0 +1,28 @@
1
+ export interface UploadOptions {
2
+ contentType?: string;
3
+ cacheControl?: string;
4
+ /** Make the file publicly accessible (default: true) */
5
+ isPublic?: boolean;
6
+ metadata?: Record<string, string>;
7
+ }
8
+ export interface StorageFile {
9
+ path: string;
10
+ url: string;
11
+ contentType: string;
12
+ size: number;
13
+ updatedAt: string;
14
+ }
15
+ /**
16
+ * File storage adapter contract.
17
+ * Implemented by @mohasinac/storage-firebase, @mohasinac/storage-s3,
18
+ * @mohasinac/storage-cloudinary, @mohasinac/storage-uploadthing.
19
+ */
20
+ export interface IStorageProvider {
21
+ upload(file: Buffer, path: string, options?: UploadOptions): Promise<StorageFile>;
22
+ delete(path: string): Promise<void>;
23
+ getPublicUrl(path: string): string;
24
+ getSignedUrl(path: string, expiresInSeconds?: number): Promise<string>;
25
+ copy(from: string, to: string): Promise<StorageFile>;
26
+ list(prefix: string): Promise<StorageFile[]>;
27
+ }
28
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAC9C"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * CSS framework adapter contract.
3
+ * UI components call cn()/token() through this adapter, making them
4
+ * CSS-framework-agnostic.
5
+ *
6
+ * Implemented by:
7
+ * @mohasinac/css-tailwind — twMerge + clsx
8
+ * @mohasinac/css-vanilla — plain string join
9
+ * @mohasinac/css-emotion — Emotion cx()
10
+ * @mohasinac/css-modules — CSS Modules
11
+ */
12
+ export interface IStyleAdapter {
13
+ /**
14
+ * Merges and deduplicates class names.
15
+ * Equivalent to twMerge(clsx(...)) in Tailwind projects.
16
+ */
17
+ cn(...classes: Array<string | undefined | null | false>): string;
18
+ /**
19
+ * Resolves a design token name to a CSS custom property reference.
20
+ * e.g. token("color-primary") → "var(--lir-color-primary)"
21
+ */
22
+ token(name: string): string;
23
+ }
24
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;IACjE;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@mohasinac/contracts",
3
+ "version": "0.1.0",
4
+ "description": "All TypeScript interfaces and shared types for @mohasinac/* packages — no concrete code",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsup src/index.ts --format esm,cjs --dts",
24
+ "lint": "eslint src"
25
+ },
26
+ "devDependencies": {
27
+ "tsup": "^8.5.0",
28
+ "typescript": "^5.9.3",
29
+ "eslint": "^9.37.0"
30
+ }
31
+ }