@cloudcommerce/api 0.0.114 → 0.0.116
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/.turbo/turbo-build.log +4 -5
- package/.turbo/turbo-test.log +21 -21
- package/lib/types.d.ts +14 -3
- package/package.json +1 -1
- package/src/types.ts +35 -12
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[35m@cloudcommerce/api:build: [0m
|
|
1
|
+
|
|
2
|
+
> @cloudcommerce/api@0.0.115 build /home/leo/code/ecomplus/cloud-commerce/packages/api
|
|
3
|
+
> sh ../../scripts/build-lib.sh && cp -r src/types lib/
|
|
4
|
+
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
> @cloudcommerce/api@0.0.115 test /home/leo/code/ecomplus/cloud-commerce/packages/api
|
|
3
|
+
> tsc -p ../../tsconfig.test.json && vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RUN v0.24.3 /home/leo/code/ecomplus/cloud-commerce/packages/api
|
|
7
|
+
|
|
8
|
+
✓ tests/index.test.ts > Read product and typecheck SKU
|
|
9
|
+
✓ tests/index.test.ts > 404 with different Store ID from env
|
|
10
|
+
(node:83274) [https://github.com/node-fetch/node-fetch/issues/1000 (response)] DeprecationWarning: data doesn't exist, use json(), text(), arrayBuffer(), or body instead
|
|
11
|
+
(Use `node --trace-deprecation ...` to show where the warning was created)
|
|
12
|
+
✓ tests/index.test.ts > List categories and typecheck result
|
|
13
|
+
✓ tests/index.test.ts > 401 trying to list API events
|
|
14
|
+
✓ tests/index.test.ts > 401 to create category and body typecheck
|
|
15
|
+
|
|
16
|
+
Test Files 1 passed (1)
|
|
17
|
+
Tests 5 passed (5)
|
|
18
|
+
Start at 01:18:04
|
|
19
|
+
Duration 8.33s (transform 3.92s, setup 1ms, collect 543ms, tests 1.37s)
|
|
20
|
+
|
|
21
|
+
close timed out after 1000ms
|
package/lib/types.d.ts
CHANGED
|
@@ -41,12 +41,23 @@ declare type BaseListResultMeta = {
|
|
|
41
41
|
limit: number;
|
|
42
42
|
fields: Array<string>;
|
|
43
43
|
};
|
|
44
|
-
declare type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
|
|
45
44
|
declare type ListResultDocs<Document extends any> = Array<Partial<Document> & {
|
|
46
45
|
_id: ResourceId;
|
|
47
46
|
}>;
|
|
47
|
+
declare type ProductsList = ListResultDocs<Products>;
|
|
48
|
+
declare type CategoriesList = ListResultDocs<Categories>;
|
|
49
|
+
declare type BrandsList = ListResultDocs<Brands>;
|
|
50
|
+
declare type CollectionsList = ListResultDocs<Collections>;
|
|
51
|
+
declare type GridsList = ListResultDocs<Grids>;
|
|
52
|
+
declare type CartsList = ListResultDocs<Carts>;
|
|
53
|
+
declare type OrdersList = ListResultDocs<Orders>;
|
|
54
|
+
declare type CustomersList = ListResultDocs<Customers>;
|
|
55
|
+
declare type StoresList = ListResultDocs<Stores>;
|
|
56
|
+
declare type ApplicationsList = ListResultDocs<Applications>;
|
|
57
|
+
declare type AuthenticationsList = ListResultDocs<Authentications>;
|
|
58
|
+
declare type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
|
|
48
59
|
declare type ResourceListResult<TEndpoint extends ResourceOpQuery> = {
|
|
49
|
-
result: TEndpoint extends ListEndpoint<'products'> ?
|
|
60
|
+
result: TEndpoint extends ListEndpoint<'products'> ? ProductsList : TEndpoint extends ListEndpoint<'categories'> ? CategoriesList : TEndpoint extends ListEndpoint<'brands'> ? BrandsList : TEndpoint extends ListEndpoint<'collections'> ? CollectionsList : TEndpoint extends ListEndpoint<'grids'> ? GridsList : TEndpoint extends ListEndpoint<'carts'> ? CartsList : TEndpoint extends ListEndpoint<'orders'> ? OrdersList : TEndpoint extends ListEndpoint<'customers'> ? CustomersList : TEndpoint extends ListEndpoint<'stores'> ? StoresList : TEndpoint extends ListEndpoint<'applications'> ? ApplicationsList : TEndpoint extends ListEndpoint<'authentications'> ? AuthenticationsList : never;
|
|
50
61
|
meta: BaseListResultMeta & {
|
|
51
62
|
count?: number;
|
|
52
63
|
sort: Array<{
|
|
@@ -118,4 +129,4 @@ declare type ErrorBody = {
|
|
|
118
129
|
};
|
|
119
130
|
more_info?: string;
|
|
120
131
|
};
|
|
121
|
-
export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, ProductSet, CategorySet, BrandSet, CollectionSet, GridSet, CartSet, OrderSet, CustomerSet, StoreSet, ApplicationSet, AuthenticationSet, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, ErrorBody, };
|
|
132
|
+
export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, ProductSet, CategorySet, BrandSet, CollectionSet, GridSet, CartSet, OrderSet, CustomerSet, StoreSet, ApplicationSet, AuthenticationSet, ProductsList, CategoriesList, BrandsList, CollectionsList, GridsList, CartsList, OrdersList, CustomersList, StoresList, ApplicationsList, AuthenticationsList, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, ErrorBody, };
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -72,21 +72,33 @@ type BaseListResultMeta = {
|
|
|
72
72
|
fields: Array<string>,
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
|
|
76
75
|
type ListResultDocs<Document extends any> = Array<Partial<Document> & { _id: ResourceId }>;
|
|
76
|
+
type ProductsList = ListResultDocs<Products>;
|
|
77
|
+
type CategoriesList = ListResultDocs<Categories>;
|
|
78
|
+
type BrandsList = ListResultDocs<Brands>;
|
|
79
|
+
type CollectionsList = ListResultDocs<Collections>;
|
|
80
|
+
type GridsList = ListResultDocs<Grids>;
|
|
81
|
+
type CartsList = ListResultDocs<Carts>;
|
|
82
|
+
type OrdersList = ListResultDocs<Orders>;
|
|
83
|
+
type CustomersList = ListResultDocs<Customers>;
|
|
84
|
+
type StoresList = ListResultDocs<Stores>;
|
|
85
|
+
type ApplicationsList = ListResultDocs<Applications>;
|
|
86
|
+
type AuthenticationsList = ListResultDocs<Authentications>;
|
|
87
|
+
|
|
88
|
+
type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
|
|
77
89
|
type ResourceListResult<TEndpoint extends ResourceOpQuery> = {
|
|
78
90
|
result:
|
|
79
|
-
TEndpoint extends ListEndpoint<'products'> ?
|
|
80
|
-
TEndpoint extends ListEndpoint<'categories'> ?
|
|
81
|
-
TEndpoint extends ListEndpoint<'brands'> ?
|
|
82
|
-
TEndpoint extends ListEndpoint<'collections'> ?
|
|
83
|
-
TEndpoint extends ListEndpoint<'grids'> ?
|
|
84
|
-
TEndpoint extends ListEndpoint<'carts'> ?
|
|
85
|
-
TEndpoint extends ListEndpoint<'orders'> ?
|
|
86
|
-
TEndpoint extends ListEndpoint<'customers'> ?
|
|
87
|
-
TEndpoint extends ListEndpoint<'stores'> ?
|
|
88
|
-
TEndpoint extends ListEndpoint<'applications'> ?
|
|
89
|
-
TEndpoint extends ListEndpoint<'authentications'> ?
|
|
91
|
+
TEndpoint extends ListEndpoint<'products'> ? ProductsList :
|
|
92
|
+
TEndpoint extends ListEndpoint<'categories'> ? CategoriesList :
|
|
93
|
+
TEndpoint extends ListEndpoint<'brands'> ? BrandsList :
|
|
94
|
+
TEndpoint extends ListEndpoint<'collections'> ? CollectionsList :
|
|
95
|
+
TEndpoint extends ListEndpoint<'grids'> ? GridsList :
|
|
96
|
+
TEndpoint extends ListEndpoint<'carts'> ? CartsList :
|
|
97
|
+
TEndpoint extends ListEndpoint<'orders'> ? OrdersList :
|
|
98
|
+
TEndpoint extends ListEndpoint<'customers'> ? CustomersList :
|
|
99
|
+
TEndpoint extends ListEndpoint<'stores'> ? StoresList :
|
|
100
|
+
TEndpoint extends ListEndpoint<'applications'> ? ApplicationsList :
|
|
101
|
+
TEndpoint extends ListEndpoint<'authentications'> ? AuthenticationsList :
|
|
90
102
|
never,
|
|
91
103
|
meta: BaseListResultMeta & {
|
|
92
104
|
count?: number,
|
|
@@ -219,6 +231,17 @@ export type {
|
|
|
219
231
|
StoreSet,
|
|
220
232
|
ApplicationSet,
|
|
221
233
|
AuthenticationSet,
|
|
234
|
+
ProductsList,
|
|
235
|
+
CategoriesList,
|
|
236
|
+
BrandsList,
|
|
237
|
+
CollectionsList,
|
|
238
|
+
GridsList,
|
|
239
|
+
CartsList,
|
|
240
|
+
OrdersList,
|
|
241
|
+
CustomersList,
|
|
242
|
+
StoresList,
|
|
243
|
+
ApplicationsList,
|
|
244
|
+
AuthenticationsList,
|
|
222
245
|
Resource,
|
|
223
246
|
ResourceId,
|
|
224
247
|
ResourceAndId,
|