@pocketstock/types 0.1.0 → 0.2.1
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 +17 -2
- package/dist/asset.d.ts +16 -0
- package/dist/asset.d.ts.map +1 -0
- package/dist/asset.js +2 -0
- package/dist/asset.js.map +1 -0
- package/dist/auth.d.ts +46 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +2 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/product.d.ts +71 -0
- package/dist/product.d.ts.map +1 -0
- package/dist/product.js +2 -0
- package/dist/product.js.map +1 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -2,17 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Shared contracts package for PocketStock repositories.
|
|
4
4
|
|
|
5
|
+
## Week 3-4 Contract Set
|
|
6
|
+
|
|
7
|
+
- `core` primitives
|
|
8
|
+
- API envelopes
|
|
9
|
+
- sync metadata/contracts
|
|
10
|
+
- auth contracts (`register`, `pin-login`, `refresh`, `logout`, `session`)
|
|
11
|
+
- product/category contracts
|
|
12
|
+
- asset upload metadata contracts
|
|
13
|
+
|
|
5
14
|
## Release Policy
|
|
6
15
|
|
|
7
16
|
- Semver is required.
|
|
8
17
|
- Breaking contract changes require a major version bump.
|
|
9
|
-
- `pocketstock-api` and `pocketstock-mobile` must pin exact versions.
|
|
18
|
+
- `pocketstock-api` and `pocketstock-mobile` must pin exact versions (no ranges).
|
|
19
|
+
- Every release must include a matching `CHANGELOG.md` entry.
|
|
10
20
|
|
|
11
21
|
## Publish
|
|
12
22
|
|
|
13
23
|
1. Bump version (`npm version patch|minor|major`).
|
|
14
24
|
2. Push commit and tag.
|
|
15
|
-
3.
|
|
25
|
+
3. Validate package:
|
|
26
|
+
- `npm run typecheck`
|
|
27
|
+
- `npm run build`
|
|
28
|
+
- `npm test`
|
|
29
|
+
- `npm run pack:check`
|
|
30
|
+
4. CI publish workflow runs on `v*` tags.
|
|
16
31
|
|
|
17
32
|
## Versioning Order
|
|
18
33
|
|
package/dist/asset.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type WorkerUploadMetadata = {
|
|
2
|
+
key: string;
|
|
3
|
+
url: string;
|
|
4
|
+
etag?: string;
|
|
5
|
+
size: number;
|
|
6
|
+
contentType: string;
|
|
7
|
+
};
|
|
8
|
+
export type UploadProductImageRequest = {
|
|
9
|
+
filename: string;
|
|
10
|
+
contentType: string;
|
|
11
|
+
size: number;
|
|
12
|
+
};
|
|
13
|
+
export type UploadProductImageResponse = {
|
|
14
|
+
image: WorkerUploadMetadata;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=asset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../src/asset.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC"}
|
package/dist/asset.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../src/asset.ts"],"names":[],"mappings":""}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IsoDateTime, ShopId, UserId } from "./core.js";
|
|
2
|
+
export type RegisterRequest = {
|
|
3
|
+
shopName: string;
|
|
4
|
+
ownerName: string;
|
|
5
|
+
pin: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
};
|
|
9
|
+
export type PinLoginRequest = {
|
|
10
|
+
shopCode: string;
|
|
11
|
+
pin: string;
|
|
12
|
+
deviceName?: string;
|
|
13
|
+
platform?: string;
|
|
14
|
+
};
|
|
15
|
+
export type RefreshRequest = {
|
|
16
|
+
refreshToken: string;
|
|
17
|
+
};
|
|
18
|
+
export type LogoutRequest = {
|
|
19
|
+
refreshToken: string;
|
|
20
|
+
};
|
|
21
|
+
export type AuthShop = {
|
|
22
|
+
id: ShopId;
|
|
23
|
+
code: string;
|
|
24
|
+
name: string;
|
|
25
|
+
currency: string;
|
|
26
|
+
timezone: string;
|
|
27
|
+
};
|
|
28
|
+
export type AuthUser = {
|
|
29
|
+
id: UserId;
|
|
30
|
+
shopId: ShopId;
|
|
31
|
+
role: "OWNER" | "MANAGER" | "CASHIER" | "STOCKIST";
|
|
32
|
+
displayName: string;
|
|
33
|
+
phone?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
};
|
|
36
|
+
export type AuthSession = {
|
|
37
|
+
accessToken: string;
|
|
38
|
+
refreshToken: string;
|
|
39
|
+
expiresAt: IsoDateTime;
|
|
40
|
+
};
|
|
41
|
+
export type AuthResponse = {
|
|
42
|
+
shop: AuthShop;
|
|
43
|
+
user: AuthUser;
|
|
44
|
+
session: AuthSession;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAA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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CurrencyCode, IsoDateTime, PageInfo, ProductId } from "./core.js";
|
|
2
|
+
export type CategoryDto = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
createdAt: IsoDateTime;
|
|
8
|
+
updatedAt: IsoDateTime;
|
|
9
|
+
};
|
|
10
|
+
export type CreateCategoryRequest = {
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
export type UpdateCategoryRequest = {
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ProductDto = {
|
|
20
|
+
id: ProductId;
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
sku?: string;
|
|
24
|
+
barcode?: string;
|
|
25
|
+
categoryId?: string;
|
|
26
|
+
buyPriceMinor: number;
|
|
27
|
+
sellPriceMinor: number;
|
|
28
|
+
currency: CurrencyCode;
|
|
29
|
+
quantityOnHand: number;
|
|
30
|
+
reorderLevel: number;
|
|
31
|
+
trackExpiry: boolean;
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
imageUrl?: string;
|
|
34
|
+
imageKey?: string;
|
|
35
|
+
createdAt: IsoDateTime;
|
|
36
|
+
updatedAt: IsoDateTime;
|
|
37
|
+
};
|
|
38
|
+
export type CreateProductRequest = {
|
|
39
|
+
name: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
sku?: string;
|
|
42
|
+
barcode?: string;
|
|
43
|
+
categoryId?: string;
|
|
44
|
+
buyPriceMinor: number;
|
|
45
|
+
sellPriceMinor: number;
|
|
46
|
+
reorderLevel?: number;
|
|
47
|
+
trackExpiry?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type UpdateProductRequest = {
|
|
50
|
+
name?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
sku?: string;
|
|
53
|
+
barcode?: string;
|
|
54
|
+
categoryId?: string;
|
|
55
|
+
buyPriceMinor?: number;
|
|
56
|
+
sellPriceMinor?: number;
|
|
57
|
+
reorderLevel?: number;
|
|
58
|
+
trackExpiry?: boolean;
|
|
59
|
+
isActive?: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type ProductListQuery = {
|
|
62
|
+
q?: string;
|
|
63
|
+
categoryId?: string;
|
|
64
|
+
page?: number;
|
|
65
|
+
pageSize?: number;
|
|
66
|
+
};
|
|
67
|
+
export type ProductListResponse = {
|
|
68
|
+
data: ProductDto[];
|
|
69
|
+
pageInfo: PageInfo;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEhF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,SAAS,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,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ACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC"}
|
package/dist/product.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocketstock/types",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Shared contracts for PocketStock mobile and API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,9 +20,13 @@
|
|
|
20
20
|
"build": "tsc -p tsconfig.build.json",
|
|
21
21
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
22
22
|
"lint": "tsc --noEmit -p tsconfig.json",
|
|
23
|
-
"test": "
|
|
23
|
+
"test:runtime": "npm run build && vitest run tests/runtime-smoke.test.ts",
|
|
24
|
+
"test:types": "tsc --noEmit -p tests/tsconfig.json",
|
|
25
|
+
"test": "npm run test:runtime && npm run test:types",
|
|
26
|
+
"pack:check": "npm pack --dry-run --cache ../.npm-cache"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"typescript": "^5.6.3"
|
|
29
|
+
"typescript": "^5.6.3",
|
|
30
|
+
"vitest": "^4.0.8"
|
|
27
31
|
}
|
|
28
32
|
}
|