@endora-commerce/contracts 0.100.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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/actor.d.ts +79 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +41 -0
- package/dist/actor.js.map +1 -0
- package/dist/addresses.d.ts +134 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +16 -0
- package/dist/addresses.js.map +1 -0
- package/dist/admin-actions.d.ts +367 -0
- package/dist/admin-actions.d.ts.map +1 -0
- package/dist/admin-actions.js +287 -0
- package/dist/admin-actions.js.map +1 -0
- package/dist/admin-contributions.d.ts +518 -0
- package/dist/admin-contributions.d.ts.map +1 -0
- package/dist/admin-contributions.js +495 -0
- package/dist/admin-contributions.js.map +1 -0
- package/dist/admin-i18n.d.ts +135 -0
- package/dist/admin-i18n.d.ts.map +1 -0
- package/dist/admin-i18n.js +72 -0
- package/dist/admin-i18n.js.map +1 -0
- package/dist/admin-notifications.d.ts +55 -0
- package/dist/admin-notifications.d.ts.map +1 -0
- package/dist/admin-notifications.js +16 -0
- package/dist/admin-notifications.js.map +1 -0
- package/dist/admin-roles.d.ts +125 -0
- package/dist/admin-roles.d.ts.map +1 -0
- package/dist/admin-roles.js +2 -0
- package/dist/admin-roles.js.map +1 -0
- package/dist/admin-users.d.ts +178 -0
- package/dist/admin-users.d.ts.map +1 -0
- package/dist/admin-users.js +14 -0
- package/dist/admin-users.js.map +1 -0
- package/dist/admin.d.ts +243 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +246 -0
- package/dist/admin.js.map +1 -0
- package/dist/analytics.d.ts +123 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +68 -0
- package/dist/analytics.js.map +1 -0
- package/dist/api-keys.d.ts +97 -0
- package/dist/api-keys.d.ts.map +1 -0
- package/dist/api-keys.js +64 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/assets-library.d.ts +684 -0
- package/dist/assets-library.d.ts.map +1 -0
- package/dist/assets-library.js +181 -0
- package/dist/assets-library.js.map +1 -0
- package/dist/audit-logs.d.ts +141 -0
- package/dist/audit-logs.d.ts.map +1 -0
- package/dist/audit-logs.js +31 -0
- package/dist/audit-logs.js.map +1 -0
- package/dist/auth.d.ts +174 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +27 -0
- package/dist/auth.js.map +1 -0
- package/dist/blog.d.ts +669 -0
- package/dist/blog.d.ts.map +1 -0
- package/dist/blog.js +360 -0
- package/dist/blog.js.map +1 -0
- package/dist/capabilities.d.ts +40 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +38 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/carts.d.ts +1367 -0
- package/dist/carts.d.ts.map +1 -0
- package/dist/carts.js +405 -0
- package/dist/carts.js.map +1 -0
- package/dist/catalog.d.ts +2855 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +1543 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cms.d.ts +872 -0
- package/dist/cms.d.ts.map +1 -0
- package/dist/cms.js +468 -0
- package/dist/cms.js.map +1 -0
- package/dist/common.d.ts +82 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +72 -0
- package/dist/common.js.map +1 -0
- package/dist/comparisons.d.ts +487 -0
- package/dist/comparisons.d.ts.map +1 -0
- package/dist/comparisons.js +221 -0
- package/dist/comparisons.js.map +1 -0
- package/dist/credentials.d.ts +292 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +142 -0
- package/dist/credentials.js.map +1 -0
- package/dist/credit-limits.d.ts +111 -0
- package/dist/credit-limits.d.ts.map +1 -0
- package/dist/credit-limits.js +35 -0
- package/dist/credit-limits.js.map +1 -0
- package/dist/currencies.d.ts +127 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +20 -0
- package/dist/currencies.js.map +1 -0
- package/dist/custom-fields.d.ts +345 -0
- package/dist/custom-fields.d.ts.map +1 -0
- package/dist/custom-fields.js +185 -0
- package/dist/custom-fields.js.map +1 -0
- package/dist/customer-accounts.d.ts +690 -0
- package/dist/customer-accounts.d.ts.map +1 -0
- package/dist/customer-accounts.js +41 -0
- package/dist/customer-accounts.js.map +1 -0
- package/dist/customers.d.ts +305 -0
- package/dist/customers.d.ts.map +1 -0
- package/dist/customers.js +158 -0
- package/dist/customers.js.map +1 -0
- package/dist/dictionary.d.ts +580 -0
- package/dist/dictionary.d.ts.map +1 -0
- package/dist/dictionary.js +297 -0
- package/dist/dictionary.js.map +1 -0
- package/dist/email-address.d.ts +62 -0
- package/dist/email-address.d.ts.map +1 -0
- package/dist/email-address.js +64 -0
- package/dist/email-address.js.map +1 -0
- package/dist/email.d.ts +175 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +45 -0
- package/dist/email.js.map +1 -0
- package/dist/envelopes.d.ts +15 -0
- package/dist/envelopes.d.ts.map +1 -0
- package/dist/envelopes.js +16 -0
- package/dist/envelopes.js.map +1 -0
- package/dist/environment-inputs.d.ts +306 -0
- package/dist/environment-inputs.d.ts.map +1 -0
- package/dist/environment-inputs.js +277 -0
- package/dist/environment-inputs.js.map +1 -0
- package/dist/erp-connector.d.ts +52 -0
- package/dist/erp-connector.d.ts.map +1 -0
- package/dist/erp-connector.js +34 -0
- package/dist/erp-connector.js.map +1 -0
- package/dist/errors.d.ts +455 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +532 -0
- package/dist/errors.js.map +1 -0
- package/dist/google-analytics.d.ts +181 -0
- package/dist/google-analytics.d.ts.map +1 -0
- package/dist/google-analytics.js +176 -0
- package/dist/google-analytics.js.map +1 -0
- package/dist/google-tag-manager.d.ts +111 -0
- package/dist/google-tag-manager.d.ts.map +1 -0
- package/dist/google-tag-manager.js +129 -0
- package/dist/google-tag-manager.js.map +1 -0
- package/dist/i18n.d.ts +69 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +59 -0
- package/dist/i18n.js.map +1 -0
- package/dist/import-export.d.ts +63 -0
- package/dist/import-export.d.ts.map +1 -0
- package/dist/import-export.js +37 -0
- package/dist/import-export.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory.d.ts +673 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +412 -0
- package/dist/inventory.js.map +1 -0
- package/dist/invoice-ledger.d.ts +366 -0
- package/dist/invoice-ledger.d.ts.map +1 -0
- package/dist/invoice-ledger.js +114 -0
- package/dist/invoice-ledger.js.map +1 -0
- package/dist/invoices.d.ts +845 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +314 -0
- package/dist/invoices.js.map +1 -0
- package/dist/kernel.d.ts +49 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +19 -0
- package/dist/kernel.js.map +1 -0
- package/dist/languages.d.ts +122 -0
- package/dist/languages.d.ts.map +1 -0
- package/dist/languages.js +24 -0
- package/dist/languages.js.map +1 -0
- package/dist/linkedin-ads.d.ts +167 -0
- package/dist/linkedin-ads.d.ts.map +1 -0
- package/dist/linkedin-ads.js +156 -0
- package/dist/linkedin-ads.js.map +1 -0
- package/dist/megamenu.d.ts +556 -0
- package/dist/megamenu.d.ts.map +1 -0
- package/dist/megamenu.js +186 -0
- package/dist/megamenu.js.map +1 -0
- package/dist/meta-ads.d.ts +126 -0
- package/dist/meta-ads.d.ts.map +1 -0
- package/dist/meta-ads.js +112 -0
- package/dist/meta-ads.js.map +1 -0
- package/dist/mfa.d.ts +274 -0
- package/dist/mfa.d.ts.map +1 -0
- package/dist/mfa.js +187 -0
- package/dist/mfa.js.map +1 -0
- package/dist/modules.d.ts +1706 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +1390 -0
- package/dist/modules.js.map +1 -0
- package/dist/newsletter.d.ts +611 -0
- package/dist/newsletter.d.ts.map +1 -0
- package/dist/newsletter.js +345 -0
- package/dist/newsletter.js.map +1 -0
- package/dist/orders.d.ts +1175 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +630 -0
- package/dist/orders.js.map +1 -0
- package/dist/organizations.d.ts +938 -0
- package/dist/organizations.d.ts.map +1 -0
- package/dist/organizations.js +418 -0
- package/dist/organizations.js.map +1 -0
- package/dist/pagination.d.ts +21 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +22 -0
- package/dist/pagination.js.map +1 -0
- package/dist/payment-methods.d.ts +472 -0
- package/dist/payment-methods.d.ts.map +1 -0
- package/dist/payment-methods.js +175 -0
- package/dist/payment-methods.js.map +1 -0
- package/dist/payment-return-url.d.ts +53 -0
- package/dist/payment-return-url.d.ts.map +1 -0
- package/dist/payment-return-url.js +35 -0
- package/dist/payment-return-url.js.map +1 -0
- package/dist/payments.d.ts +386 -0
- package/dist/payments.d.ts.map +1 -0
- package/dist/payments.js +84 -0
- package/dist/payments.js.map +1 -0
- package/dist/pim-connector.d.ts +60 -0
- package/dist/pim-connector.d.ts.map +1 -0
- package/dist/pim-connector.js +43 -0
- package/dist/pim-connector.js.map +1 -0
- package/dist/pim-field-path.d.ts +6 -0
- package/dist/pim-field-path.d.ts.map +1 -0
- package/dist/pim-field-path.js +101 -0
- package/dist/pim-field-path.js.map +1 -0
- package/dist/platform-language.d.ts +20 -0
- package/dist/platform-language.d.ts.map +1 -0
- package/dist/platform-language.js +22 -0
- package/dist/platform-language.js.map +1 -0
- package/dist/price-lists.d.ts +685 -0
- package/dist/price-lists.d.ts.map +1 -0
- package/dist/price-lists.js +330 -0
- package/dist/price-lists.js.map +1 -0
- package/dist/product-feeds.d.ts +2837 -0
- package/dist/product-feeds.d.ts.map +1 -0
- package/dist/product-feeds.js +1504 -0
- package/dist/product-feeds.js.map +1 -0
- package/dist/product-scope-overrides.d.ts +134 -0
- package/dist/product-scope-overrides.d.ts.map +1 -0
- package/dist/product-scope-overrides.js +82 -0
- package/dist/product-scope-overrides.js.map +1 -0
- package/dist/product-value-resolver.d.ts +88 -0
- package/dist/product-value-resolver.d.ts.map +1 -0
- package/dist/product-value-resolver.js +128 -0
- package/dist/product-value-resolver.js.map +1 -0
- package/dist/promotions.d.ts +678 -0
- package/dist/promotions.d.ts.map +1 -0
- package/dist/promotions.js +479 -0
- package/dist/promotions.js.map +1 -0
- package/dist/prompt-actions.d.ts +582 -0
- package/dist/prompt-actions.d.ts.map +1 -0
- package/dist/prompt-actions.js +221 -0
- package/dist/prompt-actions.js.map +1 -0
- package/dist/pwa.d.ts +293 -0
- package/dist/pwa.d.ts.map +1 -0
- package/dist/pwa.js +204 -0
- package/dist/pwa.js.map +1 -0
- package/dist/quick-order.d.ts +340 -0
- package/dist/quick-order.d.ts.map +1 -0
- package/dist/quick-order.js +177 -0
- package/dist/quick-order.js.map +1 -0
- package/dist/quote-requests.d.ts +538 -0
- package/dist/quote-requests.d.ts.map +1 -0
- package/dist/quote-requests.js +308 -0
- package/dist/quote-requests.js.map +1 -0
- package/dist/returns.d.ts +774 -0
- package/dist/returns.d.ts.map +1 -0
- package/dist/returns.js +389 -0
- package/dist/returns.js.map +1 -0
- package/dist/sales-channels.d.ts +392 -0
- package/dist/sales-channels.d.ts.map +1 -0
- package/dist/sales-channels.js +285 -0
- package/dist/sales-channels.js.map +1 -0
- package/dist/scope-notice.d.ts +60 -0
- package/dist/scope-notice.d.ts.map +1 -0
- package/dist/scope-notice.js +56 -0
- package/dist/scope-notice.js.map +1 -0
- package/dist/search.d.ts +321 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +160 -0
- package/dist/search.js.map +1 -0
- package/dist/seo.d.ts +113 -0
- package/dist/seo.d.ts.map +1 -0
- package/dist/seo.js +63 -0
- package/dist/seo.js.map +1 -0
- package/dist/settings.d.ts +453 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +337 -0
- package/dist/settings.js.map +1 -0
- package/dist/shipments.d.ts +140 -0
- package/dist/shipments.d.ts.map +1 -0
- package/dist/shipments.js +14 -0
- package/dist/shipments.js.map +1 -0
- package/dist/shipping-methods.d.ts +350 -0
- package/dist/shipping-methods.d.ts.map +1 -0
- package/dist/shipping-methods.js +99 -0
- package/dist/shipping-methods.js.map +1 -0
- package/dist/shopping-lists.d.ts +122 -0
- package/dist/shopping-lists.d.ts.map +1 -0
- package/dist/shopping-lists.js +92 -0
- package/dist/shopping-lists.js.map +1 -0
- package/dist/taxes.d.ts +106 -0
- package/dist/taxes.d.ts.map +1 -0
- package/dist/taxes.js +80 -0
- package/dist/taxes.js.map +1 -0
- package/dist/text-normalization.d.ts +199 -0
- package/dist/text-normalization.d.ts.map +1 -0
- package/dist/text-normalization.js +205 -0
- package/dist/text-normalization.js.map +1 -0
- package/dist/transactional-emails.d.ts +459 -0
- package/dist/transactional-emails.d.ts.map +1 -0
- package/dist/transactional-emails.js +212 -0
- package/dist/transactional-emails.js.map +1 -0
- package/dist/webhooks.d.ts +69 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +53 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const assetVisibilitySchema: z.ZodEnum<{
|
|
3
|
+
public: "public";
|
|
4
|
+
private: "private";
|
|
5
|
+
}>;
|
|
6
|
+
export type AssetVisibility = z.infer<typeof assetVisibilitySchema>;
|
|
7
|
+
/**
|
|
8
|
+
* Storage-backend identifier persisted on every Asset row so that switching the
|
|
9
|
+
* platform's *active* adapter does not orphan files uploaded under a previous
|
|
10
|
+
* adapter. `'legacy'` is a runtime-only escape hatch for rows whose pre-013
|
|
11
|
+
* `storage_url` is an absolute URL — see specs/013-assets-library/research.md R11.
|
|
12
|
+
*/
|
|
13
|
+
export declare const storageBackendCodeSchema: z.ZodEnum<{
|
|
14
|
+
local: "local";
|
|
15
|
+
s3: "s3";
|
|
16
|
+
gcs: "gcs";
|
|
17
|
+
legacy: "legacy";
|
|
18
|
+
}>;
|
|
19
|
+
export type StorageBackendCode = z.infer<typeof storageBackendCodeSchema>;
|
|
20
|
+
/** What kind of consumer pointed at a given Asset (used in delete-blocked dialogs). */
|
|
21
|
+
export declare const assetReferenceKindSchema: z.ZodEnum<{
|
|
22
|
+
product_gallery: "product_gallery";
|
|
23
|
+
product_attachment: "product_attachment";
|
|
24
|
+
product_virtual_download: "product_virtual_download";
|
|
25
|
+
category_main_image: "category_main_image";
|
|
26
|
+
cms_body_embed: "cms_body_embed";
|
|
27
|
+
megamenu_item_target: "megamenu_item_target";
|
|
28
|
+
blog_category_main_image: "blog_category_main_image";
|
|
29
|
+
blog_post_content: "blog_post_content";
|
|
30
|
+
blog_category_description: "blog_category_description";
|
|
31
|
+
}>;
|
|
32
|
+
export type AssetReferenceKind = z.infer<typeof assetReferenceKindSchema>;
|
|
33
|
+
export declare const assetReferenceSchema: z.ZodObject<{
|
|
34
|
+
kind: z.ZodEnum<{
|
|
35
|
+
product_gallery: "product_gallery";
|
|
36
|
+
product_attachment: "product_attachment";
|
|
37
|
+
product_virtual_download: "product_virtual_download";
|
|
38
|
+
category_main_image: "category_main_image";
|
|
39
|
+
cms_body_embed: "cms_body_embed";
|
|
40
|
+
megamenu_item_target: "megamenu_item_target";
|
|
41
|
+
blog_category_main_image: "blog_category_main_image";
|
|
42
|
+
blog_post_content: "blog_post_content";
|
|
43
|
+
blog_category_description: "blog_category_description";
|
|
44
|
+
}>;
|
|
45
|
+
entityId: z.ZodString;
|
|
46
|
+
label: z.ZodString;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type AssetReference = z.infer<typeof assetReferenceSchema>;
|
|
49
|
+
export declare const assetFolderSchema: z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
position: z.ZodNumber;
|
|
54
|
+
childIds: z.ZodArray<z.ZodString>;
|
|
55
|
+
createdAt: z.ZodString;
|
|
56
|
+
updatedAt: z.ZodString;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type AssetFolder = z.infer<typeof assetFolderSchema>;
|
|
59
|
+
export declare const listFoldersResponseSchema: z.ZodObject<{
|
|
60
|
+
data: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
position: z.ZodNumber;
|
|
65
|
+
childIds: z.ZodArray<z.ZodString>;
|
|
66
|
+
createdAt: z.ZodString;
|
|
67
|
+
updatedAt: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ListFoldersResponse = z.infer<typeof listFoldersResponseSchema>;
|
|
71
|
+
export declare const createFolderRequestSchema: z.ZodObject<{
|
|
72
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type CreateFolderRequest = z.infer<typeof createFolderRequestSchema>;
|
|
76
|
+
export declare const patchFolderRequestSchema: z.ZodObject<{
|
|
77
|
+
name: z.ZodOptional<z.ZodString>;
|
|
78
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type PatchFolderRequest = z.infer<typeof patchFolderRequestSchema>;
|
|
82
|
+
export declare const deleteFolderRequestSchema: z.ZodObject<{
|
|
83
|
+
ifNonEmpty: z.ZodDefault<z.ZodEnum<{
|
|
84
|
+
cancel: "cancel";
|
|
85
|
+
moveContentsToParent: "moveContentsToParent";
|
|
86
|
+
deleteRecursively: "deleteRecursively";
|
|
87
|
+
}>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type DeleteFolderRequest = z.infer<typeof deleteFolderRequestSchema>;
|
|
90
|
+
export declare const deleteFolderResponseSchema: z.ZodObject<{
|
|
91
|
+
data: z.ZodObject<{
|
|
92
|
+
deletedFolderId: z.ZodString;
|
|
93
|
+
softDeletedAssetIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export type DeleteFolderResponse = z.infer<typeof deleteFolderResponseSchema>;
|
|
97
|
+
/**
|
|
98
|
+
* Public asset summary — appears in the Library list, the picker, and embedded
|
|
99
|
+
* inside Catalog/CMS storefront responses. `url` is freshly produced by the
|
|
100
|
+
* active adapter on every read; for `private` assets it is a short-lived
|
|
101
|
+
* signed URL whose TTL is governed by the `assets.privateUrlTtlSec` setting.
|
|
102
|
+
*/
|
|
103
|
+
export declare const assetSummarySchema: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
106
|
+
filename: z.ZodString;
|
|
107
|
+
label: z.ZodNullable<z.ZodString>;
|
|
108
|
+
mimeType: z.ZodString;
|
|
109
|
+
sizeBytes: z.ZodNumber;
|
|
110
|
+
visibility: z.ZodEnum<{
|
|
111
|
+
public: "public";
|
|
112
|
+
private: "private";
|
|
113
|
+
}>;
|
|
114
|
+
storageBackend: z.ZodEnum<{
|
|
115
|
+
local: "local";
|
|
116
|
+
s3: "s3";
|
|
117
|
+
gcs: "gcs";
|
|
118
|
+
legacy: "legacy";
|
|
119
|
+
}>;
|
|
120
|
+
url: z.ZodString;
|
|
121
|
+
createdAt: z.ZodString;
|
|
122
|
+
updatedAt: z.ZodString;
|
|
123
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
124
|
+
pendingCleanup: z.ZodBoolean;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type AssetSummary = z.infer<typeof assetSummarySchema>;
|
|
127
|
+
/** Detail extends summary with multilingual alt text + the deletion-protection list. */
|
|
128
|
+
export declare const assetDetailSchema: z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
131
|
+
filename: z.ZodString;
|
|
132
|
+
label: z.ZodNullable<z.ZodString>;
|
|
133
|
+
mimeType: z.ZodString;
|
|
134
|
+
sizeBytes: z.ZodNumber;
|
|
135
|
+
visibility: z.ZodEnum<{
|
|
136
|
+
public: "public";
|
|
137
|
+
private: "private";
|
|
138
|
+
}>;
|
|
139
|
+
storageBackend: z.ZodEnum<{
|
|
140
|
+
local: "local";
|
|
141
|
+
s3: "s3";
|
|
142
|
+
gcs: "gcs";
|
|
143
|
+
legacy: "legacy";
|
|
144
|
+
}>;
|
|
145
|
+
url: z.ZodString;
|
|
146
|
+
createdAt: z.ZodString;
|
|
147
|
+
updatedAt: z.ZodString;
|
|
148
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
149
|
+
pendingCleanup: z.ZodBoolean;
|
|
150
|
+
altText: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
151
|
+
references: z.ZodArray<z.ZodObject<{
|
|
152
|
+
kind: z.ZodEnum<{
|
|
153
|
+
product_gallery: "product_gallery";
|
|
154
|
+
product_attachment: "product_attachment";
|
|
155
|
+
product_virtual_download: "product_virtual_download";
|
|
156
|
+
category_main_image: "category_main_image";
|
|
157
|
+
cms_body_embed: "cms_body_embed";
|
|
158
|
+
megamenu_item_target: "megamenu_item_target";
|
|
159
|
+
blog_category_main_image: "blog_category_main_image";
|
|
160
|
+
blog_post_content: "blog_post_content";
|
|
161
|
+
blog_category_description: "blog_category_description";
|
|
162
|
+
}>;
|
|
163
|
+
entityId: z.ZodString;
|
|
164
|
+
label: z.ZodString;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
export type AssetDetail = z.infer<typeof assetDetailSchema>;
|
|
168
|
+
export declare const listAssetsQuerySchema: z.ZodObject<{
|
|
169
|
+
folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
q: z.ZodOptional<z.ZodString>;
|
|
171
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
172
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
173
|
+
public: "public";
|
|
174
|
+
private: "private";
|
|
175
|
+
}>>;
|
|
176
|
+
includeDeleted: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
|
|
177
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
178
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
export type ListAssetsQuery = z.infer<typeof listAssetsQuerySchema>;
|
|
181
|
+
export declare const listAssetsResponseSchema: z.ZodObject<{
|
|
182
|
+
data: z.ZodArray<z.ZodObject<{
|
|
183
|
+
id: z.ZodString;
|
|
184
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
185
|
+
filename: z.ZodString;
|
|
186
|
+
label: z.ZodNullable<z.ZodString>;
|
|
187
|
+
mimeType: z.ZodString;
|
|
188
|
+
sizeBytes: z.ZodNumber;
|
|
189
|
+
visibility: z.ZodEnum<{
|
|
190
|
+
public: "public";
|
|
191
|
+
private: "private";
|
|
192
|
+
}>;
|
|
193
|
+
storageBackend: z.ZodEnum<{
|
|
194
|
+
local: "local";
|
|
195
|
+
s3: "s3";
|
|
196
|
+
gcs: "gcs";
|
|
197
|
+
legacy: "legacy";
|
|
198
|
+
}>;
|
|
199
|
+
url: z.ZodString;
|
|
200
|
+
createdAt: z.ZodString;
|
|
201
|
+
updatedAt: z.ZodString;
|
|
202
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
203
|
+
pendingCleanup: z.ZodBoolean;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export type ListAssetsResponse = z.infer<typeof listAssetsResponseSchema>;
|
|
208
|
+
export declare const getAssetResponseSchema: z.ZodObject<{
|
|
209
|
+
data: z.ZodObject<{
|
|
210
|
+
id: z.ZodString;
|
|
211
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
212
|
+
filename: z.ZodString;
|
|
213
|
+
label: z.ZodNullable<z.ZodString>;
|
|
214
|
+
mimeType: z.ZodString;
|
|
215
|
+
sizeBytes: z.ZodNumber;
|
|
216
|
+
visibility: z.ZodEnum<{
|
|
217
|
+
public: "public";
|
|
218
|
+
private: "private";
|
|
219
|
+
}>;
|
|
220
|
+
storageBackend: z.ZodEnum<{
|
|
221
|
+
local: "local";
|
|
222
|
+
s3: "s3";
|
|
223
|
+
gcs: "gcs";
|
|
224
|
+
legacy: "legacy";
|
|
225
|
+
}>;
|
|
226
|
+
url: z.ZodString;
|
|
227
|
+
createdAt: z.ZodString;
|
|
228
|
+
updatedAt: z.ZodString;
|
|
229
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
230
|
+
pendingCleanup: z.ZodBoolean;
|
|
231
|
+
altText: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
232
|
+
references: z.ZodArray<z.ZodObject<{
|
|
233
|
+
kind: z.ZodEnum<{
|
|
234
|
+
product_gallery: "product_gallery";
|
|
235
|
+
product_attachment: "product_attachment";
|
|
236
|
+
product_virtual_download: "product_virtual_download";
|
|
237
|
+
category_main_image: "category_main_image";
|
|
238
|
+
cms_body_embed: "cms_body_embed";
|
|
239
|
+
megamenu_item_target: "megamenu_item_target";
|
|
240
|
+
blog_category_main_image: "blog_category_main_image";
|
|
241
|
+
blog_post_content: "blog_post_content";
|
|
242
|
+
blog_category_description: "blog_category_description";
|
|
243
|
+
}>;
|
|
244
|
+
entityId: z.ZodString;
|
|
245
|
+
label: z.ZodString;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
export type GetAssetResponse = z.infer<typeof getAssetResponseSchema>;
|
|
250
|
+
export declare const getAssetUrlResponseSchema: z.ZodObject<{
|
|
251
|
+
data: z.ZodObject<{
|
|
252
|
+
url: z.ZodString;
|
|
253
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
export type GetAssetUrlResponse = z.infer<typeof getAssetUrlResponseSchema>;
|
|
257
|
+
export declare const patchAssetRequestSchema: z.ZodObject<{
|
|
258
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
259
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
260
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
261
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
262
|
+
public: "public";
|
|
263
|
+
private: "private";
|
|
264
|
+
}>>;
|
|
265
|
+
folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
export type PatchAssetRequest = z.infer<typeof patchAssetRequestSchema>;
|
|
268
|
+
export declare const moveAssetRequestSchema: z.ZodObject<{
|
|
269
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
export type MoveAssetRequest = z.infer<typeof moveAssetRequestSchema>;
|
|
272
|
+
export declare const moveManyAssetsRequestSchema: z.ZodObject<{
|
|
273
|
+
assetIds: z.ZodArray<z.ZodString>;
|
|
274
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
export type MoveManyAssetsRequest = z.infer<typeof moveManyAssetsRequestSchema>;
|
|
277
|
+
export declare const moveManyAssetsResponseSchema: z.ZodObject<{
|
|
278
|
+
data: z.ZodObject<{
|
|
279
|
+
movedCount: z.ZodNumber;
|
|
280
|
+
}, z.core.$strip>;
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
export type MoveManyAssetsResponse = z.infer<typeof moveManyAssetsResponseSchema>;
|
|
283
|
+
export declare const storageSelfCheckResponseSchema: z.ZodObject<{
|
|
284
|
+
data: z.ZodObject<{
|
|
285
|
+
adapter: z.ZodEnum<{
|
|
286
|
+
local: "local";
|
|
287
|
+
s3: "s3";
|
|
288
|
+
gcs: "gcs";
|
|
289
|
+
}>;
|
|
290
|
+
ok: z.ZodBoolean;
|
|
291
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
292
|
+
}, z.core.$strip>;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
export type StorageSelfCheckResponse = z.infer<typeof storageSelfCheckResponseSchema>;
|
|
295
|
+
export declare const storageStateResponseSchema: z.ZodObject<{
|
|
296
|
+
data: z.ZodObject<{
|
|
297
|
+
activeAdapter: z.ZodEnum<{
|
|
298
|
+
local: "local";
|
|
299
|
+
s3: "s3";
|
|
300
|
+
gcs: "gcs";
|
|
301
|
+
}>;
|
|
302
|
+
selfCheck: z.ZodObject<{
|
|
303
|
+
ok: z.ZodBoolean;
|
|
304
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
pendingCleanupCount: z.ZodNumber;
|
|
307
|
+
softDeletedCount: z.ZodNumber;
|
|
308
|
+
}, z.core.$strip>;
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
export type StorageStateResponse = z.infer<typeof storageStateResponseSchema>;
|
|
311
|
+
export declare const assetRefNodeSchema: z.ZodObject<{
|
|
312
|
+
type: z.ZodLiteral<"asset_ref">;
|
|
313
|
+
assetId: z.ZodString;
|
|
314
|
+
rendering: z.ZodOptional<z.ZodEnum<{
|
|
315
|
+
link: "link";
|
|
316
|
+
image: "image";
|
|
317
|
+
embed: "embed";
|
|
318
|
+
}>>;
|
|
319
|
+
}, z.core.$loose>;
|
|
320
|
+
export type AssetRefNode = z.infer<typeof assetRefNodeSchema>;
|
|
321
|
+
/** Resolved view of an embedded asset, returned alongside the body in CMS responses. */
|
|
322
|
+
export declare const assetEmbedResolutionSchema: z.ZodObject<{
|
|
323
|
+
url: z.ZodString;
|
|
324
|
+
mimeType: z.ZodString;
|
|
325
|
+
filename: z.ZodString;
|
|
326
|
+
label: z.ZodNullable<z.ZodString>;
|
|
327
|
+
visibility: z.ZodEnum<{
|
|
328
|
+
public: "public";
|
|
329
|
+
private: "private";
|
|
330
|
+
}>;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
export type AssetEmbedResolution = z.infer<typeof assetEmbedResolutionSchema>;
|
|
333
|
+
/**
|
|
334
|
+
* An asset row as it crosses a module boundary — a plain shape, never the ORM
|
|
335
|
+
* entity (FR-011). Distinct from `AssetSummary` / `AssetDetail` above, which
|
|
336
|
+
* are the HTTP projections: those carry ISO strings and a resolved URL, this
|
|
337
|
+
* carries the columns a module reads when it embeds or attaches one.
|
|
338
|
+
*/
|
|
339
|
+
/**
|
|
340
|
+
* What the library stores, as the column records it.
|
|
341
|
+
*
|
|
342
|
+
* Deliberately **not** `catalog`'s `AssetKind`, which the two attach surfaces
|
|
343
|
+
* narrow to: this one carries `other`, and a record typed with the narrower
|
|
344
|
+
* union would make every row the library holds unrepresentable in the shape
|
|
345
|
+
* that reads it.
|
|
346
|
+
*/
|
|
347
|
+
export type AssetStoredKind = 'image' | 'video' | 'pdf' | 'certificate' | 'other';
|
|
348
|
+
export interface AssetRecord {
|
|
349
|
+
id: string;
|
|
350
|
+
kind: AssetStoredKind;
|
|
351
|
+
filename: string;
|
|
352
|
+
mimeType: string;
|
|
353
|
+
/** Byte count as a decimal string — the column is `bigint`. */
|
|
354
|
+
sizeBytes: string;
|
|
355
|
+
storageUrl: string;
|
|
356
|
+
altText: Record<string, string> | null;
|
|
357
|
+
folderId: string | null;
|
|
358
|
+
visibility: AssetVisibility;
|
|
359
|
+
label: string | null;
|
|
360
|
+
storageBackend: 'local' | 's3' | 'gcs' | 'legacy';
|
|
361
|
+
storageLocator: string;
|
|
362
|
+
pendingCleanup: boolean;
|
|
363
|
+
purgeAfterAt: Date | null;
|
|
364
|
+
mimeTypeOverridden: boolean;
|
|
365
|
+
createdAt: Date;
|
|
366
|
+
updatedAt: Date;
|
|
367
|
+
deletedAt: Date | null;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Container name: `assetReadPort`. Owner: `assets_library`.
|
|
371
|
+
*
|
|
372
|
+
* Five inbound sites read the `Asset` entity to validate that an id an admin
|
|
373
|
+
* supplied exists and is the right kind before attaching it — `catalog`'s
|
|
374
|
+
* gallery, attachments and product links, and `orders`' invoice branding.
|
|
375
|
+
*
|
|
376
|
+
* When `assets_library` is off the read fails closed, which is right: an
|
|
377
|
+
* attach that cannot verify the asset would store a dangling id.
|
|
378
|
+
*
|
|
379
|
+
* Whether `assets_library` has an off state at all is its manifest's `activation` to
|
|
380
|
+
* say, not this line's: a module declaring `nonDeactivatable` never enters one.
|
|
381
|
+
*/
|
|
382
|
+
export interface AssetReadPort {
|
|
383
|
+
findById(id: string, options?: {
|
|
384
|
+
liveOnly?: boolean;
|
|
385
|
+
}): Promise<AssetRecord | null>;
|
|
386
|
+
findByIds(ids: readonly string[], options?: {
|
|
387
|
+
liveOnly?: boolean;
|
|
388
|
+
}): Promise<AssetRecord[]>;
|
|
389
|
+
/**
|
|
390
|
+
* The **stable, publicly reachable** URL of each of these assets, keyed by
|
|
391
|
+
* asset id — and nothing for the rest.
|
|
392
|
+
*
|
|
393
|
+
* Absence is the answer, not an exception: an id that names no row, a
|
|
394
|
+
* soft-deleted one, a `private` one and one whose URL could only be produced
|
|
395
|
+
* as an expiring signed link are all simply missing from the map. That is the
|
|
396
|
+
* degrade expressed in the return type rather than at a caller's `catch`,
|
|
397
|
+
* which is the only place it can be decided — a consumer holding an asset id
|
|
398
|
+
* cannot tell a signed URL from a stable one, and a consumer that guesses
|
|
399
|
+
* publishes a link that 403s the day after it is fetched.
|
|
400
|
+
*
|
|
401
|
+
* `product_feeds` is the requirement (FR-043): a marketplace fetches a feed
|
|
402
|
+
* from its own network days after it was written, so an expiring URL is not a
|
|
403
|
+
* slightly worse URL, it is no URL at all. It came here from a composition
|
|
404
|
+
* root's closure in `specs/110-instance-repository/` T118c.
|
|
405
|
+
*
|
|
406
|
+
* **Batched, and that is why it is here rather than
|
|
407
|
+
* {@link AssetsLibraryPort.getAsset}.** `getAsset` answers the same question
|
|
408
|
+
* for one asset and carries a resolved `url` already, which is the right
|
|
409
|
+
* answer for `cms` resolving a handful of embeds on one page. It is the wrong
|
|
410
|
+
* one for a feed: it builds the full detail, and the detail carries the
|
|
411
|
+
* deletion-protection `references` list, which is one query per registered
|
|
412
|
+
* reference descriptor. Measured on this tree — seven descriptors, so roughly
|
|
413
|
+
* ten queries per asset — against a feed hydration batch of 500 products
|
|
414
|
+
* whose gallery is one to four images each. This is one query plus a string
|
|
415
|
+
* build per row, and the run walks the whole sellable catalogue.
|
|
416
|
+
*/
|
|
417
|
+
resolvePublicUrls(assetIds: readonly string[]): Promise<Map<string, string>>;
|
|
418
|
+
/**
|
|
419
|
+
* The **bytes** of one asset, buffered, with the MIME type they were stored
|
|
420
|
+
* under — or nothing.
|
|
421
|
+
*
|
|
422
|
+
* Absence is the answer and not an exception, for the reason
|
|
423
|
+
* {@link resolvePublicUrls} gives: an id that names no row, a soft-deleted
|
|
424
|
+
* one, a row whose bytes this platform never issued (`storageBackend` is
|
|
425
|
+
* `legacy` — a URL this library can resolve and an object it cannot open) and
|
|
426
|
+
* a configured store that would not stream are all simply `null`. That is the
|
|
427
|
+
* degrade expressed in the return type rather than at a caller's `catch`,
|
|
428
|
+
* which is composition checklist item 7's rule and the only place it can be
|
|
429
|
+
* decided: the caller cannot tell "this asset is not there" from "the bucket
|
|
430
|
+
* did not answer", and neither should turn a document into an error page.
|
|
431
|
+
*
|
|
432
|
+
* `invoices` is the requirement. pdfmake resolves an `image:` by **fetching**
|
|
433
|
+
* it, so an `InvoiceLogo` pointing at `/assets/file/<id>` makes the process
|
|
434
|
+
* serving the preview request issue an HTTP request to itself — which
|
|
435
|
+
* deadlocks for a public asset and 403s for a private one. The document
|
|
436
|
+
* embeds an inline `data:` URI instead, and that needs the bytes. It came
|
|
437
|
+
* here from a composition root's closure in
|
|
438
|
+
* `specs/110-instance-repository/` T118c.
|
|
439
|
+
*
|
|
440
|
+
* **Here rather than on {@link AssetsLibraryPort}, and rather than left at
|
|
441
|
+
* the caller over {@link ObjectStoragePort}.** It is a read, and a consumer
|
|
442
|
+
* that wants a logo must not thereby acquire `upload`, `patchAsset` and
|
|
443
|
+
* `softDelete` — the argument `ObjectStoragePort`'s own doc block makes in
|
|
444
|
+
* the other direction. A caller that opened the store itself would carry
|
|
445
|
+
* three facts about this module's storage layout instead: that `legacy` has
|
|
446
|
+
* no `open`, that a locator falls back to `storageUrl` when the column is
|
|
447
|
+
* empty, and that the stream has to be drained. Those are what the root
|
|
448
|
+
* closure knew, and moving them here is what publishing a port is for.
|
|
449
|
+
*
|
|
450
|
+
* `Uint8Array` and not `Buffer`: this package is compiled by
|
|
451
|
+
* `@endora-commerce/admin-kit` with `types: ["vite/client"]`, so the `Buffer`
|
|
452
|
+
* global is not in scope — the reason {@link AssetByteStream} gives in full.
|
|
453
|
+
* Buffered and not a stream, because the one consumer base64-encodes the
|
|
454
|
+
* whole object and the objects this answers for are document decorations. A
|
|
455
|
+
* consumer that wants to *stream* bytes it owns takes
|
|
456
|
+
* {@link ObjectStoragePort}.
|
|
457
|
+
*
|
|
458
|
+
* **It does not filter by kind, and that is the caller's half.** Which MIME
|
|
459
|
+
* types a consumer can use is the consumer's rule — pdfmake embeds PNG and
|
|
460
|
+
* JPEG and nothing else — so ask {@link findById} first when the answer
|
|
461
|
+
* decides whether the bytes are worth moving.
|
|
462
|
+
*/
|
|
463
|
+
openAssetBytes(assetId: string): Promise<AssetBytes | null>;
|
|
464
|
+
}
|
|
465
|
+
/** One asset's stored bytes, with the MIME type they were stored under. */
|
|
466
|
+
export interface AssetBytes {
|
|
467
|
+
bytes: Uint8Array;
|
|
468
|
+
mimeType: string;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* One contributed "who points at this asset" scanner.
|
|
472
|
+
*
|
|
473
|
+
* `ownerModuleId` is required and is the whole mechanism (D-39): without it the
|
|
474
|
+
* registry could not state a policy for an absent owner at all — not "honour",
|
|
475
|
+
* not "skip", only "nobody looked".
|
|
476
|
+
*/
|
|
477
|
+
export interface AssetReferenceDescriptor {
|
|
478
|
+
ownerModuleId: string;
|
|
479
|
+
/**
|
|
480
|
+
* Given a list of asset ids, return every reference that points at any of
|
|
481
|
+
* them. MUST issue a single batched query, one per descriptor regardless of
|
|
482
|
+
* batch size.
|
|
483
|
+
*/
|
|
484
|
+
findReferences(assetIds: string[]): Promise<AssetReference[]>;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Container name: `assetReferenceRegistry`. Owner: `assets_library`.
|
|
488
|
+
*
|
|
489
|
+
* A **contribution seam**: `catalog` (four descriptors), `cms`, `blog` and
|
|
490
|
+
* `megamenu` register from their boot hooks, and the library consults the
|
|
491
|
+
* table before every soft-delete (feature 013 FR-030).
|
|
492
|
+
*
|
|
493
|
+
* **Enumeration policy: honoured while the contributing module is absent**,
|
|
494
|
+
* and that is the deviation from D-39's default, with the reason D-39 requires.
|
|
495
|
+
* This registry is referential integrity, not a surface. If `blog` is switched
|
|
496
|
+
* off its posts still exist and still embed assets; skipping `blog`'s scanner
|
|
497
|
+
* would let an operator delete an asset that comes back as a broken image the
|
|
498
|
+
* moment `blog` is switched on again — data loss caused by an action
|
|
499
|
+
* Constitution XVII promises is non-destructive and reversible.
|
|
500
|
+
*
|
|
501
|
+
* `skip` is right for surface-like contributions, where a switched-off module
|
|
502
|
+
* must contribute nothing a user can see. Nobody sees these; they exist to
|
|
503
|
+
* refuse a delete. Publishing the shape must not change that classification.
|
|
504
|
+
*/
|
|
505
|
+
export interface AssetReferenceRegistryPort {
|
|
506
|
+
register(descriptor: AssetReferenceDescriptor): void;
|
|
507
|
+
/** The contributing module of every registered descriptor, in registration order. */
|
|
508
|
+
owners(): readonly string[];
|
|
509
|
+
/** Every reference pointing at **one** asset, across all descriptors. */
|
|
510
|
+
findReferences(assetId: string): Promise<AssetReference[]>;
|
|
511
|
+
/**
|
|
512
|
+
* The same question for many assets at once, keyed by asset id. Every id
|
|
513
|
+
* asked for is present in the result, with an empty list when nothing points
|
|
514
|
+
* at it — a caller deleting in bulk needs to tell "no references" from "not
|
|
515
|
+
* asked about".
|
|
516
|
+
*/
|
|
517
|
+
findReferencesMany(assetIds: string[]): Promise<Map<string, AssetReference[]>>;
|
|
518
|
+
}
|
|
519
|
+
export interface AssetPatchInput {
|
|
520
|
+
filename?: string;
|
|
521
|
+
label?: string | null;
|
|
522
|
+
mimeType?: string;
|
|
523
|
+
visibility?: AssetVisibility;
|
|
524
|
+
folderId?: string | null;
|
|
525
|
+
/**
|
|
526
|
+
* Per-language alternate text. Feature 068 needs it, because an imported
|
|
527
|
+
* image must keep the alternate text the source supplied, per language
|
|
528
|
+
* (FR-047). Deliberately absent from the HTTP patch schema — this is a
|
|
529
|
+
* module-caller field.
|
|
530
|
+
*/
|
|
531
|
+
altText?: Record<string, string> | null;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* The byte source an upload streams from, described structurally.
|
|
535
|
+
*
|
|
536
|
+
* Deliberately **not** `NodeJS.ReadableStream`: this package is imported by
|
|
537
|
+
* the admin SPA and the storefront as well as the backend, and naming the
|
|
538
|
+
* `NodeJS` namespace here fails the compile of a consumer that type-checks
|
|
539
|
+
* without `@types/node`. It named `@endora-commerce/api-client` until D-202
|
|
540
|
+
* deleted that package; measured again on the tree that replaced it, the
|
|
541
|
+
* consumer that goes red is `@endora-commerce/admin-kit`, which compiles this
|
|
542
|
+
* file with `types: ["vite/client"]`. A Node `Readable` satisfies this shape —
|
|
543
|
+
* `Buffer` extends `Uint8Array` — so the one caller passes its multipart part
|
|
544
|
+
* through unchanged.
|
|
545
|
+
*/
|
|
546
|
+
export interface AssetUploadStream {
|
|
547
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Uint8Array>;
|
|
548
|
+
}
|
|
549
|
+
export interface AssetUploadInput {
|
|
550
|
+
/** Original filename from the multipart part. Used for extension + display. */
|
|
551
|
+
filename: string;
|
|
552
|
+
/** MIME from the multipart Content-Type header (may be wrong; sniffed on ingest). */
|
|
553
|
+
declaredMime: string;
|
|
554
|
+
/** Streaming source — must be consumed exactly once. */
|
|
555
|
+
stream: AssetUploadStream;
|
|
556
|
+
/** Best-effort byte count from headers; `0` when unknown. */
|
|
557
|
+
declaredSize: number;
|
|
558
|
+
/** Folder id chosen by the caller, or null for "Unsorted". */
|
|
559
|
+
folderId: string | null;
|
|
560
|
+
/** Optional storefront-visible label. */
|
|
561
|
+
label: string | null;
|
|
562
|
+
visibility: AssetVisibility;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Container name: `assetsLibraryPort`. Owner: `assets_library`.
|
|
566
|
+
*
|
|
567
|
+
* `pim_ergonode` ingests media during an import run: it uploads the file the
|
|
568
|
+
* source supplied, patches the alternate text onto it, and soft-deletes the
|
|
569
|
+
* asset an item stopped pointing at. Four methods, which is the whole of the
|
|
570
|
+
* demand — the module's own admin surface is much larger and stays unpublished.
|
|
571
|
+
*
|
|
572
|
+
* `cms` is the second consumer and takes `getAsset` alone, to turn an asset id a
|
|
573
|
+
* page or block embeds into the detail the storefront response carries. It reached
|
|
574
|
+
* the same service through a composition-root contribution until
|
|
575
|
+
* `specs/110-instance-repository/` T118c; nothing about this interface changed to
|
|
576
|
+
* admit it, which is the point of publishing one.
|
|
577
|
+
*
|
|
578
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
579
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
580
|
+
* half-executes. Whether `assets_library` has an off state at all is its manifest's
|
|
581
|
+
* `activation` to say, not this line's: a module declaring
|
|
582
|
+
* `nonDeactivatable` never enters one.
|
|
583
|
+
*/
|
|
584
|
+
export interface AssetsLibraryPort {
|
|
585
|
+
upload(input: AssetUploadInput): Promise<AssetDetail>;
|
|
586
|
+
getAsset(assetId: string): Promise<AssetDetail>;
|
|
587
|
+
patchAsset(assetId: string, patch: AssetPatchInput): Promise<AssetDetail>;
|
|
588
|
+
softDelete(assetId: string): Promise<{
|
|
589
|
+
deletedAt: Date;
|
|
590
|
+
purgeAfterAt: Date;
|
|
591
|
+
}>;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* The byte source an object read streams into, described structurally.
|
|
595
|
+
*
|
|
596
|
+
* {@link AssetUploadStream}'s twin, for the reason that one gives in full: this
|
|
597
|
+
* package is compiled by `@endora-commerce/admin-kit` with
|
|
598
|
+
* `types: ["vite/client"]`, so naming the `NodeJS` namespace here fails a
|
|
599
|
+
* consumer's build. A Node `Readable` satisfies it — `NodeJS.ReadableStream`
|
|
600
|
+
* declares `[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>`
|
|
601
|
+
* and `Buffer` extends `Uint8Array` — so an adapter returns its stream
|
|
602
|
+
* unchanged and a consumer that needs `.pipe` wraps it once with
|
|
603
|
+
* `Readable.from`, in a backend layer where `node:stream` is legal.
|
|
604
|
+
*/
|
|
605
|
+
export interface AssetByteStream {
|
|
606
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Uint8Array>;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* A backend that physically stores objects.
|
|
610
|
+
*
|
|
611
|
+
* {@link StorageBackendCode} minus `legacy`, and the exclusion is the whole
|
|
612
|
+
* point: `legacy` is not a store, it is a resolver for pre-013 rows whose URL
|
|
613
|
+
* this platform did not issue. It can answer a URL and it can stream nothing,
|
|
614
|
+
* which is why {@link ObjectStoragePort.getForBackend} is total here and the
|
|
615
|
+
* module-internal registry's equivalent is not.
|
|
616
|
+
*/
|
|
617
|
+
export type ObjectStorageBackendCode = Exclude<StorageBackendCode, 'legacy'>;
|
|
618
|
+
export interface ObjectStoragePutInput {
|
|
619
|
+
locator: string;
|
|
620
|
+
mimeType: string;
|
|
621
|
+
visibility: AssetVisibility;
|
|
622
|
+
/** Consumed exactly once. */
|
|
623
|
+
stream: AssetUploadStream;
|
|
624
|
+
/** Best-effort byte count; `0` when the length is not known up front. */
|
|
625
|
+
sizeBytes: number;
|
|
626
|
+
}
|
|
627
|
+
/** One configured object store — bytes in, bytes out, bytes gone. */
|
|
628
|
+
export interface ObjectStore {
|
|
629
|
+
/** Which backend this is, so a caller can record where an object's bytes went. */
|
|
630
|
+
readonly code: ObjectStorageBackendCode;
|
|
631
|
+
put(input: ObjectStoragePutInput): Promise<void>;
|
|
632
|
+
open(input: {
|
|
633
|
+
locator: string;
|
|
634
|
+
}): Promise<AssetByteStream>;
|
|
635
|
+
delete(input: {
|
|
636
|
+
locator: string;
|
|
637
|
+
}): Promise<void>;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Container name: `objectStoragePort`. Owner: `assets_library`.
|
|
641
|
+
*
|
|
642
|
+
* **Which bucket this deployment writes to, with which credentials** — and
|
|
643
|
+
* nothing about assets. A consumer of this port stores its own bytes under its
|
|
644
|
+
* own locator prefix and creates no `Asset` row: the objects are its data, they
|
|
645
|
+
* do not appear in the asset browser, they are not counted in library quotas
|
|
646
|
+
* and they are not reachable through the assets routes.
|
|
647
|
+
*
|
|
648
|
+
* `product_feeds` is the first consumer (FR-043): a generated feed artefact is
|
|
649
|
+
* written under `product-feeds/…` and served by that module's own tokenised
|
|
650
|
+
* route, which streams `open()` rather than handing out a store URL, so
|
|
651
|
+
* rotating a feed token actually revokes access. `invoices` asks the same
|
|
652
|
+
* question of the same registry today through a composition root, to embed a
|
|
653
|
+
* logo in a PDF.
|
|
654
|
+
*
|
|
655
|
+
* **A sibling of {@link AssetsLibraryPort} rather than four more methods on
|
|
656
|
+
* it.** That port's demand is an *asset* — upload it, read it, patch its
|
|
657
|
+
* alternate text, soft-delete it — and hanging a byte store off it would hand
|
|
658
|
+
* an importer a capability it never asked for. These are two capabilities that
|
|
659
|
+
* happen to share a configuration.
|
|
660
|
+
*
|
|
661
|
+
* **Retiring condition.** This is really an object store and not an asset
|
|
662
|
+
* library, and it lives here because that is where the configuration lives. If
|
|
663
|
+
* a byte-store module is ever extracted, this port moves to it wholesale and no
|
|
664
|
+
* consumer's call site changes. Nothing is owed today: `assets_library`
|
|
665
|
+
* declares `nonDeactivatable`, so the coupling costs an operator no control.
|
|
666
|
+
*
|
|
667
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
668
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
|
|
669
|
+
* half-executes. Whether `assets_library` has an off state at all is its
|
|
670
|
+
* manifest's `activation` to say, not this line's: a module declaring
|
|
671
|
+
* `nonDeactivatable` never enters one.
|
|
672
|
+
*/
|
|
673
|
+
export interface ObjectStoragePort {
|
|
674
|
+
/** The store new objects are written to. */
|
|
675
|
+
getActive(): Promise<ObjectStore>;
|
|
676
|
+
/**
|
|
677
|
+
* The store that owns an existing object's bytes. Reads and deletes MUST go
|
|
678
|
+
* through this and never through {@link getActive}: after a backend switch
|
|
679
|
+
* the active store would resolve an object written under the old one to the
|
|
680
|
+
* wrong place.
|
|
681
|
+
*/
|
|
682
|
+
getForBackend(backend: ObjectStorageBackendCode): Promise<ObjectStore>;
|
|
683
|
+
}
|
|
684
|
+
//# sourceMappingURL=assets-library.d.ts.map
|