@viu/emporix-sdk 1.0.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/CHANGELOG.md +407 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/cart.cjs +214 -0
- package/dist/cart.cjs.map +1 -0
- package/dist/cart.d.cts +1807 -0
- package/dist/cart.d.ts +1807 -0
- package/dist/cart.js +4 -0
- package/dist/cart.js.map +1 -0
- package/dist/category.cjs +97 -0
- package/dist/category.cjs.map +1 -0
- package/dist/category.d.cts +313 -0
- package/dist/category.d.ts +313 -0
- package/dist/category.js +4 -0
- package/dist/category.js.map +1 -0
- package/dist/checkout.cjs +98 -0
- package/dist/checkout.cjs.map +1 -0
- package/dist/checkout.d.cts +252 -0
- package/dist/checkout.d.ts +252 -0
- package/dist/checkout.js +4 -0
- package/dist/checkout.js.map +1 -0
- package/dist/chunk-4BJUCCKJ.js +86 -0
- package/dist/chunk-4BJUCCKJ.js.map +1 -0
- package/dist/chunk-6UNFMCHZ.js +95 -0
- package/dist/chunk-6UNFMCHZ.js.map +1 -0
- package/dist/chunk-B56JZNI7.js +49 -0
- package/dist/chunk-B56JZNI7.js.map +1 -0
- package/dist/chunk-BFQ732VZ.js +11 -0
- package/dist/chunk-BFQ732VZ.js.map +1 -0
- package/dist/chunk-F3WAQH2E.js +120 -0
- package/dist/chunk-F3WAQH2E.js.map +1 -0
- package/dist/chunk-GWJ2U2CP.js +14 -0
- package/dist/chunk-GWJ2U2CP.js.map +1 -0
- package/dist/chunk-HEO34WLO.js +47 -0
- package/dist/chunk-HEO34WLO.js.map +1 -0
- package/dist/chunk-HKPZI7Y5.js +30 -0
- package/dist/chunk-HKPZI7Y5.js.map +1 -0
- package/dist/chunk-IEZHGU7F.js +171 -0
- package/dist/chunk-IEZHGU7F.js.map +1 -0
- package/dist/chunk-KTODT6DV.js +86 -0
- package/dist/chunk-KTODT6DV.js.map +1 -0
- package/dist/chunk-NM7VDXBR.js +57 -0
- package/dist/chunk-NM7VDXBR.js.map +1 -0
- package/dist/chunk-OMYVOOSX.js +57 -0
- package/dist/chunk-OMYVOOSX.js.map +1 -0
- package/dist/chunk-QDABAMVN.js +89 -0
- package/dist/chunk-QDABAMVN.js.map +1 -0
- package/dist/chunk-RXVVFNYN.js +56 -0
- package/dist/chunk-RXVVFNYN.js.map +1 -0
- package/dist/chunk-SKX7KCMH.js +23 -0
- package/dist/chunk-SKX7KCMH.js.map +1 -0
- package/dist/chunk-TLH6SLAF.js +215 -0
- package/dist/chunk-TLH6SLAF.js.map +1 -0
- package/dist/chunk-Z6PNI5VT.js +142 -0
- package/dist/chunk-Z6PNI5VT.js.map +1 -0
- package/dist/companies.cjs +58 -0
- package/dist/companies.cjs.map +1 -0
- package/dist/companies.d.cts +31 -0
- package/dist/companies.d.ts +31 -0
- package/dist/companies.js +3 -0
- package/dist/companies.js.map +1 -0
- package/dist/contacts.cjs +51 -0
- package/dist/contacts.cjs.map +1 -0
- package/dist/contacts.d.cts +28 -0
- package/dist/contacts.d.ts +28 -0
- package/dist/contacts.js +3 -0
- package/dist/contacts.js.map +1 -0
- package/dist/context-vKgzZ-5f.d.cts +329 -0
- package/dist/context-vKgzZ-5f.d.ts +329 -0
- package/dist/customer-groups.cjs +25 -0
- package/dist/customer-groups.cjs.map +1 -0
- package/dist/customer-groups.d.cts +36 -0
- package/dist/customer-groups.d.ts +36 -0
- package/dist/customer-groups.js +3 -0
- package/dist/customer-groups.js.map +1 -0
- package/dist/customer.cjs +262 -0
- package/dist/customer.cjs.map +1 -0
- package/dist/customer.d.cts +386 -0
- package/dist/customer.d.ts +386 -0
- package/dist/customer.js +5 -0
- package/dist/customer.js.map +1 -0
- package/dist/index.cjs +2075 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +218 -0
- package/dist/index.d.ts +218 -0
- package/dist/index.js +791 -0
- package/dist/index.js.map +1 -0
- package/dist/locations.cjs +59 -0
- package/dist/locations.cjs.map +1 -0
- package/dist/locations.d.cts +30 -0
- package/dist/locations.d.ts +30 -0
- package/dist/locations.js +3 -0
- package/dist/locations.js.map +1 -0
- package/dist/media.cjs +123 -0
- package/dist/media.cjs.map +1 -0
- package/dist/media.d.cts +219 -0
- package/dist/media.d.ts +219 -0
- package/dist/media.js +3 -0
- package/dist/media.js.map +1 -0
- package/dist/orders.cjs +98 -0
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +167 -0
- package/dist/orders.d.ts +167 -0
- package/dist/orders.js +3 -0
- package/dist/orders.js.map +1 -0
- package/dist/payment.cjs +77 -0
- package/dist/payment.cjs.map +1 -0
- package/dist/payment.d.cts +110 -0
- package/dist/payment.d.ts +110 -0
- package/dist/payment.js +5 -0
- package/dist/payment.js.map +1 -0
- package/dist/price.cjs +88 -0
- package/dist/price.cjs.map +1 -0
- package/dist/price.d.cts +445 -0
- package/dist/price.d.ts +445 -0
- package/dist/price.js +4 -0
- package/dist/price.js.map +1 -0
- package/dist/product.cjs +100 -0
- package/dist/product.cjs.map +1 -0
- package/dist/product.d.cts +400 -0
- package/dist/product.d.ts +400 -0
- package/dist/product.js +4 -0
- package/dist/product.js.map +1 -0
- package/dist/segment.cjs +189 -0
- package/dist/segment.cjs.map +1 -0
- package/dist/segment.d.cts +241 -0
- package/dist/segment.d.ts +241 -0
- package/dist/segment.js +5 -0
- package/dist/segment.js.map +1 -0
- package/dist/types.gen-D1QuqPLs.d.cts +166 -0
- package/dist/types.gen-D1QuqPLs.d.ts +166 -0
- package/package.json +141 -0
package/dist/media.d.cts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.cjs';
|
|
2
|
+
|
|
3
|
+
type MetadataUpdate = {
|
|
4
|
+
/**
|
|
5
|
+
* Version of the document.
|
|
6
|
+
*/
|
|
7
|
+
version: number;
|
|
8
|
+
};
|
|
9
|
+
type MetadataGet = MetadataUpdate & {
|
|
10
|
+
/**
|
|
11
|
+
* Date and time when the document was created.
|
|
12
|
+
*/
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Date and time when the document was last modified.
|
|
16
|
+
*/
|
|
17
|
+
modifiedAt?: string;
|
|
18
|
+
};
|
|
19
|
+
type RefId = {
|
|
20
|
+
/**
|
|
21
|
+
* Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
type?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Reference Id.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
};
|
|
30
|
+
type Asset$1 = {
|
|
31
|
+
/**
|
|
32
|
+
* Access type of the asset. This property is immutable.
|
|
33
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
34
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
access?: 'PUBLIC' | 'PRIVATE';
|
|
38
|
+
/**
|
|
39
|
+
* List of references.
|
|
40
|
+
*/
|
|
41
|
+
refIds?: Array<RefId>;
|
|
42
|
+
};
|
|
43
|
+
type AssetDetailsCreate = {
|
|
44
|
+
/**
|
|
45
|
+
* Asset filename.
|
|
46
|
+
*/
|
|
47
|
+
filename?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The MIME (media) type of the asset.
|
|
50
|
+
*/
|
|
51
|
+
mimeType?: string;
|
|
52
|
+
};
|
|
53
|
+
type AssetDetailsGet = AssetDetailsCreate & {
|
|
54
|
+
/**
|
|
55
|
+
* Size of the content associated with the asset in bytes.
|
|
56
|
+
*/
|
|
57
|
+
bytes?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The ETAG digest for the asset.
|
|
60
|
+
*/
|
|
61
|
+
etag?: string;
|
|
62
|
+
};
|
|
63
|
+
type AssetCreateLink = Asset$1 & {
|
|
64
|
+
/**
|
|
65
|
+
* Unique identifier of an asset.
|
|
66
|
+
*/
|
|
67
|
+
id?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Asset type. This property is immutable.
|
|
70
|
+
*/
|
|
71
|
+
type: 'LINK';
|
|
72
|
+
/**
|
|
73
|
+
* Resource link.
|
|
74
|
+
*/
|
|
75
|
+
url: string;
|
|
76
|
+
/**
|
|
77
|
+
* Access type of the asset. This property is immutable.
|
|
78
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
79
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
83
|
+
};
|
|
84
|
+
type AssetCreateBlob = Asset$1 & {
|
|
85
|
+
/**
|
|
86
|
+
* Unique identifier of an asset.
|
|
87
|
+
*/
|
|
88
|
+
id?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Asset type. This property is immutable.
|
|
91
|
+
*/
|
|
92
|
+
type: 'BLOB';
|
|
93
|
+
details?: AssetDetailsCreate;
|
|
94
|
+
/**
|
|
95
|
+
* Access type of the asset. This property is immutable.
|
|
96
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
97
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
101
|
+
};
|
|
102
|
+
type GetAsset = Asset$1 & {
|
|
103
|
+
/**
|
|
104
|
+
* Unique identifier of an asset.
|
|
105
|
+
*/
|
|
106
|
+
id?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Asset type. This property is immutable.
|
|
109
|
+
*/
|
|
110
|
+
type?: 'BLOB' | 'LINK';
|
|
111
|
+
/**
|
|
112
|
+
* Id of a vendor to which the asset belongs.
|
|
113
|
+
*/
|
|
114
|
+
vendorId?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Resource link.
|
|
117
|
+
*/
|
|
118
|
+
url?: string;
|
|
119
|
+
details?: AssetDetailsGet;
|
|
120
|
+
metadata?: MetadataGet;
|
|
121
|
+
};
|
|
122
|
+
type AssetUpdateLink = Asset$1 & {
|
|
123
|
+
/**
|
|
124
|
+
* Resource link.
|
|
125
|
+
*/
|
|
126
|
+
url: string;
|
|
127
|
+
/**
|
|
128
|
+
* Asset type. This property is immutable.
|
|
129
|
+
*/
|
|
130
|
+
type: 'LINK';
|
|
131
|
+
metadata?: MetadataUpdate;
|
|
132
|
+
/**
|
|
133
|
+
* Access type of the asset. This property is immutable.
|
|
134
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
135
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
139
|
+
};
|
|
140
|
+
type AssetUpdateBlob = Asset$1 & {
|
|
141
|
+
/**
|
|
142
|
+
* Asset type. This property is immutable.
|
|
143
|
+
*/
|
|
144
|
+
type: 'BLOB';
|
|
145
|
+
details?: AssetDetailsCreate;
|
|
146
|
+
metadata?: MetadataUpdate;
|
|
147
|
+
/**
|
|
148
|
+
* Access type of the asset. This property is immutable.
|
|
149
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
150
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** Generated media types (caller sends the exact wire shape). */
|
|
157
|
+
type AssetCreateBlobInput = AssetCreateBlob;
|
|
158
|
+
type AssetCreateLinkInput = AssetCreateLink;
|
|
159
|
+
type AssetUpdateInput = AssetUpdateBlob | AssetUpdateLink;
|
|
160
|
+
type Asset = GetAsset;
|
|
161
|
+
type AssetRefId = RefId;
|
|
162
|
+
declare function isProductRef(r: AssetRefId, productId: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Media assets (BLOB/LINK). All endpoints require a backend-only scope
|
|
165
|
+
* (`media.asset_manage` / `media.asset_read`) — default auth: service.
|
|
166
|
+
*/
|
|
167
|
+
declare class MediaService {
|
|
168
|
+
private readonly ctx;
|
|
169
|
+
constructor(ctx: ClientContext);
|
|
170
|
+
private base;
|
|
171
|
+
/** Create an asset. BLOB uploads via multipart; LINK via JSON. */
|
|
172
|
+
create(input: {
|
|
173
|
+
kind: "blob";
|
|
174
|
+
file: Blob;
|
|
175
|
+
body: AssetCreateBlobInput;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "link";
|
|
178
|
+
body: AssetCreateLinkInput;
|
|
179
|
+
}, auth?: AuthContext): Promise<{
|
|
180
|
+
id: string;
|
|
181
|
+
}>;
|
|
182
|
+
/** List assets. Optional `query` is passed through to Emporix verbatim. */
|
|
183
|
+
list(query?: Record<string, string | number | undefined>, auth?: AuthContext): Promise<Asset[]>;
|
|
184
|
+
/** Fetch an asset by id. */
|
|
185
|
+
get(assetId: string, auth?: AuthContext): Promise<Asset>;
|
|
186
|
+
/** Update an asset (e.g. swap `refIds` or `access`). */
|
|
187
|
+
update(assetId: string, patch: AssetUpdateInput, auth?: AuthContext): Promise<Asset>;
|
|
188
|
+
/** Remove an asset. */
|
|
189
|
+
remove(assetId: string, auth?: AuthContext): Promise<void>;
|
|
190
|
+
/** Multipart upload sugar: builds `AssetCreateBlob` from input. */
|
|
191
|
+
uploadFile(input: {
|
|
192
|
+
file: Blob;
|
|
193
|
+
productId?: string;
|
|
194
|
+
filename?: string;
|
|
195
|
+
mimeType?: string;
|
|
196
|
+
access?: "PUBLIC" | "PRIVATE";
|
|
197
|
+
}, auth?: AuthContext): Promise<{
|
|
198
|
+
id: string;
|
|
199
|
+
}>;
|
|
200
|
+
/** External-URL sugar: builds `AssetCreateLink`. */
|
|
201
|
+
link(input: {
|
|
202
|
+
url: string;
|
|
203
|
+
productId?: string;
|
|
204
|
+
access?: "PUBLIC" | "PRIVATE";
|
|
205
|
+
}, auth?: AuthContext): Promise<{
|
|
206
|
+
id: string;
|
|
207
|
+
}>;
|
|
208
|
+
/** Idempotently add a PRODUCT refId to an asset. */
|
|
209
|
+
attachToProduct(assetId: string, productId: string, auth?: AuthContext): Promise<Asset>;
|
|
210
|
+
/** Remove a PRODUCT refId from an asset (no-op if absent). */
|
|
211
|
+
detachFromProduct(assetId: string, productId: string, auth?: AuthContext): Promise<Asset>;
|
|
212
|
+
/** Convenience: list assets attached to a product (server-side filter). */
|
|
213
|
+
listForProduct(productId: string, auth?: AuthContext): Promise<Asset[]>;
|
|
214
|
+
}
|
|
215
|
+
declare const _internalMedia: {
|
|
216
|
+
isProductRef: typeof isProductRef;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export { type Asset, type AssetCreateBlobInput, type AssetCreateLinkInput, type AssetRefId, type AssetUpdateInput, MediaService, _internalMedia };
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
|
|
2
|
+
|
|
3
|
+
type MetadataUpdate = {
|
|
4
|
+
/**
|
|
5
|
+
* Version of the document.
|
|
6
|
+
*/
|
|
7
|
+
version: number;
|
|
8
|
+
};
|
|
9
|
+
type MetadataGet = MetadataUpdate & {
|
|
10
|
+
/**
|
|
11
|
+
* Date and time when the document was created.
|
|
12
|
+
*/
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Date and time when the document was last modified.
|
|
16
|
+
*/
|
|
17
|
+
modifiedAt?: string;
|
|
18
|
+
};
|
|
19
|
+
type RefId = {
|
|
20
|
+
/**
|
|
21
|
+
* Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
type?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Reference Id.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
};
|
|
30
|
+
type Asset$1 = {
|
|
31
|
+
/**
|
|
32
|
+
* Access type of the asset. This property is immutable.
|
|
33
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
34
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
access?: 'PUBLIC' | 'PRIVATE';
|
|
38
|
+
/**
|
|
39
|
+
* List of references.
|
|
40
|
+
*/
|
|
41
|
+
refIds?: Array<RefId>;
|
|
42
|
+
};
|
|
43
|
+
type AssetDetailsCreate = {
|
|
44
|
+
/**
|
|
45
|
+
* Asset filename.
|
|
46
|
+
*/
|
|
47
|
+
filename?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The MIME (media) type of the asset.
|
|
50
|
+
*/
|
|
51
|
+
mimeType?: string;
|
|
52
|
+
};
|
|
53
|
+
type AssetDetailsGet = AssetDetailsCreate & {
|
|
54
|
+
/**
|
|
55
|
+
* Size of the content associated with the asset in bytes.
|
|
56
|
+
*/
|
|
57
|
+
bytes?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The ETAG digest for the asset.
|
|
60
|
+
*/
|
|
61
|
+
etag?: string;
|
|
62
|
+
};
|
|
63
|
+
type AssetCreateLink = Asset$1 & {
|
|
64
|
+
/**
|
|
65
|
+
* Unique identifier of an asset.
|
|
66
|
+
*/
|
|
67
|
+
id?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Asset type. This property is immutable.
|
|
70
|
+
*/
|
|
71
|
+
type: 'LINK';
|
|
72
|
+
/**
|
|
73
|
+
* Resource link.
|
|
74
|
+
*/
|
|
75
|
+
url: string;
|
|
76
|
+
/**
|
|
77
|
+
* Access type of the asset. This property is immutable.
|
|
78
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
79
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
83
|
+
};
|
|
84
|
+
type AssetCreateBlob = Asset$1 & {
|
|
85
|
+
/**
|
|
86
|
+
* Unique identifier of an asset.
|
|
87
|
+
*/
|
|
88
|
+
id?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Asset type. This property is immutable.
|
|
91
|
+
*/
|
|
92
|
+
type: 'BLOB';
|
|
93
|
+
details?: AssetDetailsCreate;
|
|
94
|
+
/**
|
|
95
|
+
* Access type of the asset. This property is immutable.
|
|
96
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
97
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
101
|
+
};
|
|
102
|
+
type GetAsset = Asset$1 & {
|
|
103
|
+
/**
|
|
104
|
+
* Unique identifier of an asset.
|
|
105
|
+
*/
|
|
106
|
+
id?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Asset type. This property is immutable.
|
|
109
|
+
*/
|
|
110
|
+
type?: 'BLOB' | 'LINK';
|
|
111
|
+
/**
|
|
112
|
+
* Id of a vendor to which the asset belongs.
|
|
113
|
+
*/
|
|
114
|
+
vendorId?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Resource link.
|
|
117
|
+
*/
|
|
118
|
+
url?: string;
|
|
119
|
+
details?: AssetDetailsGet;
|
|
120
|
+
metadata?: MetadataGet;
|
|
121
|
+
};
|
|
122
|
+
type AssetUpdateLink = Asset$1 & {
|
|
123
|
+
/**
|
|
124
|
+
* Resource link.
|
|
125
|
+
*/
|
|
126
|
+
url: string;
|
|
127
|
+
/**
|
|
128
|
+
* Asset type. This property is immutable.
|
|
129
|
+
*/
|
|
130
|
+
type: 'LINK';
|
|
131
|
+
metadata?: MetadataUpdate;
|
|
132
|
+
/**
|
|
133
|
+
* Access type of the asset. This property is immutable.
|
|
134
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
135
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
139
|
+
};
|
|
140
|
+
type AssetUpdateBlob = Asset$1 & {
|
|
141
|
+
/**
|
|
142
|
+
* Asset type. This property is immutable.
|
|
143
|
+
*/
|
|
144
|
+
type: 'BLOB';
|
|
145
|
+
details?: AssetDetailsCreate;
|
|
146
|
+
metadata?: MetadataUpdate;
|
|
147
|
+
/**
|
|
148
|
+
* Access type of the asset. This property is immutable.
|
|
149
|
+
* - PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.
|
|
150
|
+
* - PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
access: 'PUBLIC' | 'PRIVATE';
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** Generated media types (caller sends the exact wire shape). */
|
|
157
|
+
type AssetCreateBlobInput = AssetCreateBlob;
|
|
158
|
+
type AssetCreateLinkInput = AssetCreateLink;
|
|
159
|
+
type AssetUpdateInput = AssetUpdateBlob | AssetUpdateLink;
|
|
160
|
+
type Asset = GetAsset;
|
|
161
|
+
type AssetRefId = RefId;
|
|
162
|
+
declare function isProductRef(r: AssetRefId, productId: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Media assets (BLOB/LINK). All endpoints require a backend-only scope
|
|
165
|
+
* (`media.asset_manage` / `media.asset_read`) — default auth: service.
|
|
166
|
+
*/
|
|
167
|
+
declare class MediaService {
|
|
168
|
+
private readonly ctx;
|
|
169
|
+
constructor(ctx: ClientContext);
|
|
170
|
+
private base;
|
|
171
|
+
/** Create an asset. BLOB uploads via multipart; LINK via JSON. */
|
|
172
|
+
create(input: {
|
|
173
|
+
kind: "blob";
|
|
174
|
+
file: Blob;
|
|
175
|
+
body: AssetCreateBlobInput;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "link";
|
|
178
|
+
body: AssetCreateLinkInput;
|
|
179
|
+
}, auth?: AuthContext): Promise<{
|
|
180
|
+
id: string;
|
|
181
|
+
}>;
|
|
182
|
+
/** List assets. Optional `query` is passed through to Emporix verbatim. */
|
|
183
|
+
list(query?: Record<string, string | number | undefined>, auth?: AuthContext): Promise<Asset[]>;
|
|
184
|
+
/** Fetch an asset by id. */
|
|
185
|
+
get(assetId: string, auth?: AuthContext): Promise<Asset>;
|
|
186
|
+
/** Update an asset (e.g. swap `refIds` or `access`). */
|
|
187
|
+
update(assetId: string, patch: AssetUpdateInput, auth?: AuthContext): Promise<Asset>;
|
|
188
|
+
/** Remove an asset. */
|
|
189
|
+
remove(assetId: string, auth?: AuthContext): Promise<void>;
|
|
190
|
+
/** Multipart upload sugar: builds `AssetCreateBlob` from input. */
|
|
191
|
+
uploadFile(input: {
|
|
192
|
+
file: Blob;
|
|
193
|
+
productId?: string;
|
|
194
|
+
filename?: string;
|
|
195
|
+
mimeType?: string;
|
|
196
|
+
access?: "PUBLIC" | "PRIVATE";
|
|
197
|
+
}, auth?: AuthContext): Promise<{
|
|
198
|
+
id: string;
|
|
199
|
+
}>;
|
|
200
|
+
/** External-URL sugar: builds `AssetCreateLink`. */
|
|
201
|
+
link(input: {
|
|
202
|
+
url: string;
|
|
203
|
+
productId?: string;
|
|
204
|
+
access?: "PUBLIC" | "PRIVATE";
|
|
205
|
+
}, auth?: AuthContext): Promise<{
|
|
206
|
+
id: string;
|
|
207
|
+
}>;
|
|
208
|
+
/** Idempotently add a PRODUCT refId to an asset. */
|
|
209
|
+
attachToProduct(assetId: string, productId: string, auth?: AuthContext): Promise<Asset>;
|
|
210
|
+
/** Remove a PRODUCT refId from an asset (no-op if absent). */
|
|
211
|
+
detachFromProduct(assetId: string, productId: string, auth?: AuthContext): Promise<Asset>;
|
|
212
|
+
/** Convenience: list assets attached to a product (server-side filter). */
|
|
213
|
+
listForProduct(productId: string, auth?: AuthContext): Promise<Asset[]>;
|
|
214
|
+
}
|
|
215
|
+
declare const _internalMedia: {
|
|
216
|
+
isProductRef: typeof isProductRef;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export { type Asset, type AssetCreateBlobInput, type AssetCreateLinkInput, type AssetRefId, type AssetUpdateInput, MediaService, _internalMedia };
|
package/dist/media.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"media.js"}
|
package/dist/orders.cjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/services/orders.ts
|
|
4
|
+
function setIfDefined(q, key, value) {
|
|
5
|
+
if (value !== void 0 && value !== "") {
|
|
6
|
+
q[key] = value;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
var OrdersService = class {
|
|
10
|
+
constructor(ctx) {
|
|
11
|
+
this.ctx = ctx;
|
|
12
|
+
}
|
|
13
|
+
ctx;
|
|
14
|
+
base() {
|
|
15
|
+
return `/order-v2/${this.ctx.tenant}/orders`;
|
|
16
|
+
}
|
|
17
|
+
saasHeader(saasToken) {
|
|
18
|
+
return saasToken ? { "saas-token": saasToken } : void 0;
|
|
19
|
+
}
|
|
20
|
+
/** Lists the calling customer's orders. */
|
|
21
|
+
async listMine(auth, opts = {}) {
|
|
22
|
+
const query = {};
|
|
23
|
+
setIfDefined(query, "pageNumber", opts.pageNumber);
|
|
24
|
+
setIfDefined(query, "pageSize", opts.pageSize);
|
|
25
|
+
setIfDefined(query, "status", opts.status);
|
|
26
|
+
setIfDefined(query, "legalEntityId", opts.legalEntityId);
|
|
27
|
+
setIfDefined(query, "siteCode", opts.siteCode);
|
|
28
|
+
const headers = this.saasHeader(opts.saasToken);
|
|
29
|
+
return this.ctx.http.request({
|
|
30
|
+
method: "GET",
|
|
31
|
+
path: this.base(),
|
|
32
|
+
query,
|
|
33
|
+
auth,
|
|
34
|
+
...headers ? { headers } : {}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** Fetches one of the calling customer's orders by id. */
|
|
38
|
+
async get(orderId, auth, opts = {}) {
|
|
39
|
+
const headers = this.saasHeader(opts.saasToken);
|
|
40
|
+
return this.ctx.http.request({
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: `${this.base()}/${orderId}`,
|
|
43
|
+
auth,
|
|
44
|
+
...headers ? { headers } : {}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Transitions an order to a new status. Server enforces legal transitions. */
|
|
48
|
+
async transition(orderId, status, auth, opts = {}) {
|
|
49
|
+
const body = { status };
|
|
50
|
+
if (opts.comment !== void 0) body.comment = opts.comment;
|
|
51
|
+
const headers = this.saasHeader(opts.saasToken);
|
|
52
|
+
await this.ctx.http.request({
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: `${this.base()}/${orderId}/transitions`,
|
|
55
|
+
auth,
|
|
56
|
+
body,
|
|
57
|
+
...headers ? { headers } : {}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Convenience: transitions to `DECLINED` (customer cancel). */
|
|
61
|
+
async cancel(orderId, auth, opts = {}) {
|
|
62
|
+
await this.transition(orderId, "DECLINED", auth, opts);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var SalesOrdersService = class {
|
|
66
|
+
constructor(ctx) {
|
|
67
|
+
this.ctx = ctx;
|
|
68
|
+
}
|
|
69
|
+
ctx;
|
|
70
|
+
base() {
|
|
71
|
+
return `/order-v2/${this.ctx.tenant}/salesorders`;
|
|
72
|
+
}
|
|
73
|
+
/** Fetches a single sales-order by id. */
|
|
74
|
+
async get(orderId, auth) {
|
|
75
|
+
return this.ctx.http.request({
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: `${this.base()}/${orderId}`,
|
|
78
|
+
auth
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Patches an existing order (status, mixins, customAttributes, metadata). */
|
|
82
|
+
async update(orderId, patch, auth, opts = {}) {
|
|
83
|
+
const query = {};
|
|
84
|
+
if (opts.recalculate === false) query.recalculate = "false";
|
|
85
|
+
return this.ctx.http.request({
|
|
86
|
+
method: "PATCH",
|
|
87
|
+
path: `${this.base()}/${orderId}`,
|
|
88
|
+
auth,
|
|
89
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
90
|
+
body: patch
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.OrdersService = OrdersService;
|
|
96
|
+
exports.SalesOrdersService = SalesOrdersService;
|
|
97
|
+
//# sourceMappingURL=orders.cjs.map
|
|
98
|
+
//# sourceMappingURL=orders.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1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;AAAA,EACH;AACF","file":"orders.cjs","sourcesContent":["import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n Order,\n OrderStatus,\n SalesOrderPatch,\n} from \"../generated/order-v2\";\n\n/** Optional fields supported by the order-v2 list endpoint. */\nexport interface ListMyOrdersOptions {\n pageNumber?: number;\n pageSize?: number;\n status?: OrderStatus;\n legalEntityId?: string;\n siteCode?: string;\n saasToken?: string;\n}\n\n/** Options for single-order reads (saas-token only). */\nexport interface GetOrderOptions {\n saasToken?: string;\n}\n\n/** Options for status transitions. */\nexport interface OrderTransitionOptions {\n saasToken?: string;\n comment?: string;\n}\n\n/** Options for `salesOrders.update`. */\nexport interface UpdateSalesOrderOptions {\n /** Forwarded as `?recalculate=`. Omit to use the server default (true). */\n recalculate?: boolean;\n}\n\nfunction setIfDefined<V>(\n q: Record<string, string | number | undefined>,\n key: string,\n value: V | undefined,\n): void {\n if (value !== undefined && value !== \"\") {\n q[key] = value as unknown as string | number;\n }\n}\n\n/**\n * Storefront-customer access to Order-v2's customer endpoints.\n *\n * `listMine`/`get` require `order.order_read_own`; transitions require\n * `order.order_manage_own`. All methods accept an optional `saasToken` that\n * is passed as the `saas-token` header (mirrors `checkout.placeOrder`).\n */\nexport class OrdersService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/order-v2/${this.ctx.tenant}/orders`;\n }\n\n private saasHeader(saasToken: string | undefined): Record<string, string> | undefined {\n return saasToken ? { \"saas-token\": saasToken } : undefined;\n }\n\n /** Lists the calling customer's orders. */\n async listMine(\n auth: AuthContext,\n opts: ListMyOrdersOptions = {},\n ): Promise<PaginatedItems<Order>> {\n const query: Record<string, string | number | undefined> = {};\n setIfDefined(query, \"pageNumber\", opts.pageNumber);\n setIfDefined(query, \"pageSize\", opts.pageSize);\n setIfDefined(query, \"status\", opts.status);\n setIfDefined(query, \"legalEntityId\", opts.legalEntityId);\n setIfDefined(query, \"siteCode\", opts.siteCode);\n const headers = this.saasHeader(opts.saasToken);\n return this.ctx.http.request<PaginatedItems<Order>>({\n method: \"GET\",\n path: this.base(),\n query,\n auth,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Fetches one of the calling customer's orders by id. */\n async get(\n orderId: string,\n auth: AuthContext,\n opts: GetOrderOptions = {},\n ): Promise<Order> {\n const headers = this.saasHeader(opts.saasToken);\n return this.ctx.http.request<Order>({\n method: \"GET\",\n path: `${this.base()}/${orderId}`,\n auth,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Transitions an order to a new status. Server enforces legal transitions. */\n async transition(\n orderId: string,\n status: OrderStatus,\n auth: AuthContext,\n opts: OrderTransitionOptions = {},\n ): Promise<void> {\n const body: { status: OrderStatus; comment?: string } = { status };\n if (opts.comment !== undefined) body.comment = opts.comment;\n const headers = this.saasHeader(opts.saasToken);\n await this.ctx.http.request<void>({\n method: \"POST\",\n path: `${this.base()}/${orderId}/transitions`,\n auth,\n body,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Convenience: transitions to `DECLINED` (customer cancel). */\n async cancel(\n orderId: string,\n auth: AuthContext,\n opts: { saasToken?: string } = {},\n ): Promise<void> {\n await this.transition(orderId, \"DECLINED\", auth, opts);\n }\n}\n\n/**\n * Backend / service-account access to the merchant-facing\n * `/salesorders/{id}` resource. Requires `order.order_read` (read) /\n * `order.order_manage` (update) scopes on a service token.\n *\n * The full admin list + filter surface is deferred to a follow-up\n * sub-spec. This service ships only single-resource read + patch — the\n * common backend use case (e.g. mixin updates after fulfilment).\n */\nexport class SalesOrdersService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/order-v2/${this.ctx.tenant}/salesorders`;\n }\n\n /** Fetches a single sales-order by id. */\n async get(orderId: string, auth: AuthContext): Promise<Order> {\n return this.ctx.http.request<Order>({\n method: \"GET\",\n path: `${this.base()}/${orderId}`,\n auth,\n });\n }\n\n /** Patches an existing order (status, mixins, customAttributes, metadata). */\n async update(\n orderId: string,\n patch: SalesOrderPatch,\n auth: AuthContext,\n opts: UpdateSalesOrderOptions = {},\n ): Promise<Order> {\n const query: Record<string, string> = {};\n if (opts.recalculate === false) query.recalculate = \"false\";\n return this.ctx.http.request<Order>({\n method: \"PATCH\",\n path: `${this.base()}/${orderId}`,\n auth,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n body: patch,\n });\n }\n}\n"]}
|