@happyvertical/smrt-images 0.55.15 → 0.55.21
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/svelte/components/AssetsGallery.svelte +27 -24
- package/dist/svelte/components/ImageEditor.svelte +30 -27
- package/dist/svelte/components/ImageUploader.svelte +69 -66
- package/dist/svelte/components/PhotoCutoutSetup.svelte +14 -11
- package/dist/svelte/routes/ImageStudioRoute.svelte +8 -5
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { TenantIsolationError, TenantScoped, getCurrentTenant, isSuperAdminBypas
|
|
|
10
10
|
import { validatePhotoCutoutRig } from "@happyvertical/animation";
|
|
11
11
|
import sharp from "sharp";
|
|
12
12
|
//#region src/__smrt-register__.ts
|
|
13
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-images","packageVersion":"0.55.15","objects":{"@happyvertical/smrt-images:Image":{"name":"image","className":"Image","qualifiedName":"@happyvertical/smrt-images:Image","collection":"assets","filePath":"/home/runner/work/smrt/smrt/packages/images/src/image.ts","packageName":"@happyvertical/smrt-images","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tenantId":{"type":"text","required":false,"_meta":{"generated":true,"source":"tenantScoped_decorator","sqlType":"UUID","__tenancy":{"isTenantIdField":true,"mode":"optional","field":"tenantId","autoFilter":true,"autoPopulate":true,"allowSuperAdminBypass":false}}},"name":{"type":"text","required":false,"description":"A recognizable name for this file or media item.","_meta":{"description":"A recognizable name for this file or media item."}},"sourceUri":{"type":"text","required":false,"description":"Where the original file is stored or can be retrieved.","_meta":{"description":"Where the original file is stored or can be retrieved."}},"mimeType":{"type":"text","required":false,"description":"The file format, such as image/jpeg or application/pdf.","_meta":{"description":"The file format, such as image/jpeg or application/pdf."}},"description":{"type":"text","required":false,"description":"Explain what the file contains and when it should be used.","_meta":{"description":"Explain what the file contains and when it should be used."}},"metadata":{"type":"text","required":false,"description":"Additional details recorded while processing this file.","_meta":{"description":"Additional details recorded while processing this file."}},"version":{"type":"integer","required":true,"default":1,"description":"The revision number of this file in its version history.","_meta":{"description":"The revision number of this file in its version history."}},"primaryVersionId":{"type":"foreignKey","required":false,"related":"Asset","description":"The first version of this file, linking its revision history.","_meta":{"description":"The first version of this file, linking its revision history."}},"typeSlug":{"type":"text","required":false,"description":"The category of asset, such as an image, video, or document.","_meta":{"description":"The category of asset, such as an image, video, or document."}},"statusSlug":{"type":"text","required":false,"description":"The stage of this asset, such as draft, published, or archived.","_meta":{"description":"The stage of this asset, such as draft, published, or archived."}},"ownerProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","description":"The person or organization responsible for this asset.","_meta":{"description":"The person or organization responsible for this asset."}},"sourceAssetId":{"type":"foreignKey","required":false,"related":"Asset","description":"The original asset used to produce this file or variation.","_meta":{"description":"The original asset used to produce this file or variation."}},"folderId":{"type":"foreignKey","required":false,"related":"Folder","description":"The folder that organizes this file in the asset library.","_meta":{"description":"The folder that organizes this file in the asset library."}},"sourceType":{"type":"text","required":false,"description":"The service or source from which this file was obtained.","_meta":{"description":"The service or source from which this file was obtained."}},"externalId":{"type":"text","required":false,"description":"The reference used to identify this file at its original source.","_meta":{"description":"The reference used to identify this file at its original source."}},"externalRefs":{"type":"text","required":false,"description":"References that connect this file to copies held by other services.","_meta":{"description":"References that connect this file to copies held by other services."}},"createdAt":{"type":"text","required":false},"updatedAt":{"type":"text","required":false},"width":{"type":"integer","required":false,"default":0},"height":{"type":"integer","required":false,"default":0},"alt":{"type":"text","required":false,"default":""}},"methods":{"getSlug":{"name":"getSlug","async":true,"parameters":[],"returnType":"Promise<string | null | undefined>","isStatic":false,"isPublic":true},"getMetadata":{"name":"getMetadata","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setMetadata":{"name":"setMetadata","async":false,"parameters":[{"name":"metadata","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"mergeMetadata":{"name":"mergeMetadata","async":false,"parameters":[{"name":"metadata","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getExternalRefs":{"name":"getExternalRefs","async":false,"parameters":[],"returnType":"Record<string, AssetExternalReference>","isStatic":false,"isPublic":true},"getExternalRef":{"name":"getExternalRef","async":false,"parameters":[{"name":"provider","type":"string","optional":false}],"returnType":"AssetExternalReference | null","isStatic":false,"isPublic":true},"setExternalRef":{"name":"setExternalRef","async":false,"parameters":[{"name":"provider","type":"string","optional":false},{"name":"reference","type":"any","optional":false,"typeUnresolved":true}],"returnType":"void","isStatic":false,"isPublic":true},"getTags":{"name":"getTags","async":true,"parameters":[],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"hasTag":{"name":"hasTag","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true},"getSource":{"name":"getSource","async":true,"parameters":[],"returnType":"Promise<Asset | null>","isStatic":false,"isPublic":true},"getDerivatives":{"name":"getDerivatives","async":true,"parameters":[],"returnType":"Promise<Asset[]>","isStatic":false,"isPublic":true},"getType":{"name":"getType","async":true,"parameters":[],"returnType":"Promise<AssetType | null>","isStatic":false,"isPublic":true},"getStatus":{"name":"getStatus","async":true,"parameters":[],"returnType":"Promise<AssetStatus | null>","isStatic":false,"isPublic":true},"getAssociations":{"name":"getAssociations","async":true,"parameters":[],"returnType":"Promise<AssetAssociation[]>","isStatic":false,"isPublic":true},"associateWith":{"name":"associateWith","async":true,"parameters":[{"name":"metaType","type":"string","optional":false},{"name":"metaId","type":"string","optional":false},{"name":"role","type":"any","optional":true,"default":"default"}],"returnType":"Promise<AssetAssociation>","isStatic":false,"isPublic":true},"getBySlug":{"name":"getBySlug","async":true,"parameters":[{"name":"_slug","type":"string","optional":false}],"returnType":"Promise<Asset | null>","isStatic":true,"isPublic":true},"isValidImageFormat":{"name":"isValidImageFormat","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isHighResolution":{"name":"isHighResolution","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"generateAltText":{"name":"generateAltText","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create","update","generateAltText"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"tableName":"assets","tableStrategy":"sti"},"extends":"Asset","exportName":"Image","collectionExportName":"ImageCollection","displayLabelField":"name","validationRules":[{"field":"version","rule":"required","fieldType":"integer"}],"schema":{"tableName":"assets","ddl":"CREATE TABLE IF NOT EXISTS \\"assets\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"name\\" TEXT,\\n \\"source_uri\\" TEXT,\\n \\"mime_type\\" TEXT,\\n \\"description\\" TEXT,\\n \\"metadata\\" TEXT,\\n \\"version\\" INTEGER DEFAULT 1,\\n \\"primary_version_id\\" UUID,\\n \\"type_slug\\" TEXT,\\n \\"status_slug\\" TEXT,\\n \\"owner_profile_id\\" UUID,\\n \\"source_asset_id\\" UUID,\\n \\"folder_id\\" UUID,\\n \\"source_type\\" TEXT,\\n \\"external_id\\" TEXT,\\n \\"external_refs\\" TEXT,\\n \\"width\\" INTEGER DEFAULT 0,\\n \\"height\\" INTEGER DEFAULT 0,\\n \\"alt\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"name":{"type":"TEXT","notNull":false},"source_uri":{"type":"TEXT","notNull":false},"mime_type":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"metadata":{"type":"TEXT","notNull":false},"version":{"type":"INTEGER","notNull":false,"default":1},"primary_version_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"type_slug":{"type":"TEXT","notNull":false},"status_slug":{"type":"TEXT","notNull":false},"owner_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"source_asset_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"folder_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false},"source_type":{"type":"TEXT","notNull":false},"external_id":{"type":"TEXT","notNull":false},"external_refs":{"type":"TEXT","notNull":false},"width":{"type":"INTEGER","notNull":false,"default":0},"height":{"type":"INTEGER","notNull":false,"default":0},"alt":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"assets_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"assets_meta_type_idx","columns":["_meta_type"]},{"name":"assets_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"assets_primary_version_id_idx","columns":["primary_version_id"]},{"name":"assets_owner_profile_id_idx","columns":["owner_profile_id"]},{"name":"assets_source_asset_id_idx","columns":["source_asset_id"]},{"name":"assets_folder_id_idx","columns":["folder_id"]}],"version":"dd79a8b6"},"importPath":"@happyvertical/smrt-images"},"@happyvertical/smrt-images:ImageCollection":{"name":"imagecollection","className":"ImageCollection","qualifiedName":"@happyvertical/smrt-images:ImageCollection","collection":"assets","filePath":"/home/runner/work/smrt/smrt/packages/images/src/images.ts","packageName":"@happyvertical/smrt-images","fields":{},"methods":{"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByMinDimensions":{"name":"getByMinDimensions","async":true,"parameters":[{"name":"minWidth","type":"number","optional":false},{"name":"minHeight","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByMaxDimensions":{"name":"getByMaxDimensions","async":true,"parameters":[{"name":"maxWidth","type":"number","optional":false},{"name":"maxHeight","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getLandscape":{"name":"getLandscape","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getPortrait":{"name":"getPortrait","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getSquare":{"name":"getSquare","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getMissingAltText":{"name":"getMissingAltText","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getHighResolution":{"name":"getHighResolution","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByAspectRatio":{"name":"getByAspectRatio","async":true,"parameters":[{"name":"minRatio","type":"number","optional":false},{"name":"maxRatio","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"assets"},"extends":"SmrtCollection","extendsTypeArg":"Image","exportName":"ImageCollection","collectionExportName":"ImageCollectionCollection","schema":{"tableName":"assets","ddl":"CREATE TABLE IF NOT EXISTS \\"assets\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"name\\" TEXT,\\n \\"source_uri\\" TEXT,\\n \\"mime_type\\" TEXT,\\n \\"description\\" TEXT,\\n \\"metadata\\" TEXT,\\n \\"version\\" INTEGER DEFAULT 1,\\n \\"primary_version_id\\" UUID,\\n \\"type_slug\\" TEXT,\\n \\"status_slug\\" TEXT,\\n \\"owner_profile_id\\" UUID,\\n \\"source_asset_id\\" UUID,\\n \\"folder_id\\" UUID,\\n \\"source_type\\" TEXT,\\n \\"external_id\\" TEXT,\\n \\"external_refs\\" TEXT,\\n \\"width\\" INTEGER DEFAULT 0,\\n \\"height\\" INTEGER DEFAULT 0,\\n \\"alt\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"name":{"type":"TEXT","notNull":false},"source_uri":{"type":"TEXT","notNull":false},"mime_type":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"metadata":{"type":"TEXT","notNull":false},"version":{"type":"INTEGER","notNull":false,"default":1},"primary_version_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"type_slug":{"type":"TEXT","notNull":false},"status_slug":{"type":"TEXT","notNull":false},"owner_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"source_asset_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"folder_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false},"source_type":{"type":"TEXT","notNull":false},"external_id":{"type":"TEXT","notNull":false},"external_refs":{"type":"TEXT","notNull":false},"width":{"type":"INTEGER","notNull":false,"default":0},"height":{"type":"INTEGER","notNull":false,"default":0},"alt":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"assets_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"assets_meta_type_idx","columns":["_meta_type"]},{"name":"assets_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"assets_primary_version_id_idx","columns":["primary_version_id"]},{"name":"assets_owner_profile_id_idx","columns":["owner_profile_id"]},{"name":"assets_source_asset_id_idx","columns":["source_asset_id"]},{"name":"assets_folder_id_idx","columns":["folder_id"]}],"version":"dd79a8b6"},"importPath":"@happyvertical/smrt-images"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-assets","@happyvertical/smrt-core","@happyvertical/smrt-profiles","@happyvertical/smrt-prompts","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624","#3628"],"reason":"sharp, node:fs/promises, node:crypto, resvg native addon","via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
13
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-images","packageVersion":"0.55.21","objects":{"@happyvertical/smrt-images:Image":{"name":"image","className":"Image","qualifiedName":"@happyvertical/smrt-images:Image","collection":"assets","filePath":"/home/runner/work/smrt/smrt/packages/images/src/image.ts","packageName":"@happyvertical/smrt-images","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tenantId":{"type":"text","required":false,"_meta":{"generated":true,"source":"tenantScoped_decorator","sqlType":"UUID","__tenancy":{"isTenantIdField":true,"mode":"optional","field":"tenantId","autoFilter":true,"autoPopulate":true,"allowSuperAdminBypass":false}}},"name":{"type":"text","required":false,"description":"A recognizable name for this file or media item.","_meta":{"description":"A recognizable name for this file or media item."}},"sourceUri":{"type":"text","required":false,"description":"Where the original file is stored or can be retrieved.","_meta":{"description":"Where the original file is stored or can be retrieved."}},"mimeType":{"type":"text","required":false,"description":"The file format, such as image/jpeg or application/pdf.","_meta":{"description":"The file format, such as image/jpeg or application/pdf."}},"description":{"type":"text","required":false,"description":"Explain what the file contains and when it should be used.","_meta":{"description":"Explain what the file contains and when it should be used."}},"metadata":{"type":"text","required":false,"description":"Additional details recorded while processing this file.","_meta":{"description":"Additional details recorded while processing this file."}},"version":{"type":"integer","required":true,"default":1,"description":"The revision number of this file in its version history.","_meta":{"description":"The revision number of this file in its version history."}},"primaryVersionId":{"type":"foreignKey","required":false,"related":"Asset","description":"The first version of this file, linking its revision history.","_meta":{"description":"The first version of this file, linking its revision history."}},"typeSlug":{"type":"text","required":false,"description":"The category of asset, such as an image, video, or document.","_meta":{"description":"The category of asset, such as an image, video, or document."}},"statusSlug":{"type":"text","required":false,"description":"The stage of this asset, such as draft, published, or archived.","_meta":{"description":"The stage of this asset, such as draft, published, or archived."}},"ownerProfileId":{"type":"crossPackageRef","required":false,"related":"@happyvertical/smrt-profiles:Profile","description":"The person or organization responsible for this asset.","_meta":{"description":"The person or organization responsible for this asset."}},"sourceAssetId":{"type":"foreignKey","required":false,"related":"Asset","description":"The original asset used to produce this file or variation.","_meta":{"description":"The original asset used to produce this file or variation."}},"folderId":{"type":"foreignKey","required":false,"related":"Folder","description":"The folder that organizes this file in the asset library.","_meta":{"description":"The folder that organizes this file in the asset library."}},"sourceType":{"type":"text","required":false,"description":"The service or source from which this file was obtained.","_meta":{"description":"The service or source from which this file was obtained."}},"externalId":{"type":"text","required":false,"description":"The reference used to identify this file at its original source.","_meta":{"description":"The reference used to identify this file at its original source."}},"externalRefs":{"type":"text","required":false,"description":"References that connect this file to copies held by other services.","_meta":{"description":"References that connect this file to copies held by other services."}},"createdAt":{"type":"text","required":false},"updatedAt":{"type":"text","required":false},"width":{"type":"integer","required":false,"default":0},"height":{"type":"integer","required":false,"default":0},"alt":{"type":"text","required":false,"default":""}},"methods":{"getSlug":{"name":"getSlug","async":true,"parameters":[],"returnType":"Promise<string | null | undefined>","isStatic":false,"isPublic":true},"getMetadata":{"name":"getMetadata","async":false,"parameters":[],"returnType":"Record<string, unknown>","isStatic":false,"isPublic":true},"setMetadata":{"name":"setMetadata","async":false,"parameters":[{"name":"metadata","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"mergeMetadata":{"name":"mergeMetadata","async":false,"parameters":[{"name":"metadata","type":"Record<string, unknown>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getExternalRefs":{"name":"getExternalRefs","async":false,"parameters":[],"returnType":"Record<string, AssetExternalReference>","isStatic":false,"isPublic":true},"getExternalRef":{"name":"getExternalRef","async":false,"parameters":[{"name":"provider","type":"string","optional":false}],"returnType":"AssetExternalReference | null","isStatic":false,"isPublic":true},"setExternalRef":{"name":"setExternalRef","async":false,"parameters":[{"name":"provider","type":"string","optional":false},{"name":"reference","type":"any","optional":false,"typeUnresolved":true}],"returnType":"void","isStatic":false,"isPublic":true},"getTags":{"name":"getTags","async":true,"parameters":[],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"hasTag":{"name":"hasTag","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true},"getSource":{"name":"getSource","async":true,"parameters":[],"returnType":"Promise<Asset | null>","isStatic":false,"isPublic":true},"getDerivatives":{"name":"getDerivatives","async":true,"parameters":[],"returnType":"Promise<Asset[]>","isStatic":false,"isPublic":true},"getType":{"name":"getType","async":true,"parameters":[],"returnType":"Promise<AssetType | null>","isStatic":false,"isPublic":true},"getStatus":{"name":"getStatus","async":true,"parameters":[],"returnType":"Promise<AssetStatus | null>","isStatic":false,"isPublic":true},"getAssociations":{"name":"getAssociations","async":true,"parameters":[],"returnType":"Promise<AssetAssociation[]>","isStatic":false,"isPublic":true},"associateWith":{"name":"associateWith","async":true,"parameters":[{"name":"metaType","type":"string","optional":false},{"name":"metaId","type":"string","optional":false},{"name":"role","type":"any","optional":true,"default":"default"}],"returnType":"Promise<AssetAssociation>","isStatic":false,"isPublic":true},"getBySlug":{"name":"getBySlug","async":true,"parameters":[{"name":"_slug","type":"string","optional":false}],"returnType":"Promise<Asset | null>","isStatic":true,"isPublic":true},"isValidImageFormat":{"name":"isValidImageFormat","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"isHighResolution":{"name":"isHighResolution","async":false,"parameters":[],"returnType":"boolean","isStatic":false,"isPublic":true},"generateAltText":{"name":"generateAltText","async":true,"parameters":[],"returnType":"Promise<string>","isStatic":false,"isPublic":true}},"decoratorConfig":{"api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create","update","generateAltText"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"tableName":"assets","tableStrategy":"sti"},"extends":"Asset","exportName":"Image","collectionExportName":"ImageCollection","displayLabelField":"name","validationRules":[{"field":"version","rule":"required","fieldType":"integer"}],"schema":{"tableName":"assets","ddl":"CREATE TABLE IF NOT EXISTS \\"assets\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"name\\" TEXT,\\n \\"source_uri\\" TEXT,\\n \\"mime_type\\" TEXT,\\n \\"description\\" TEXT,\\n \\"metadata\\" TEXT,\\n \\"version\\" INTEGER DEFAULT 1,\\n \\"primary_version_id\\" UUID,\\n \\"type_slug\\" TEXT,\\n \\"status_slug\\" TEXT,\\n \\"owner_profile_id\\" UUID,\\n \\"source_asset_id\\" UUID,\\n \\"folder_id\\" UUID,\\n \\"source_type\\" TEXT,\\n \\"external_id\\" TEXT,\\n \\"external_refs\\" TEXT,\\n \\"width\\" INTEGER DEFAULT 0,\\n \\"height\\" INTEGER DEFAULT 0,\\n \\"alt\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"name":{"type":"TEXT","notNull":false},"source_uri":{"type":"TEXT","notNull":false},"mime_type":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"metadata":{"type":"TEXT","notNull":false},"version":{"type":"INTEGER","notNull":false,"default":1},"primary_version_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"type_slug":{"type":"TEXT","notNull":false},"status_slug":{"type":"TEXT","notNull":false},"owner_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"source_asset_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"folder_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false},"source_type":{"type":"TEXT","notNull":false},"external_id":{"type":"TEXT","notNull":false},"external_refs":{"type":"TEXT","notNull":false},"width":{"type":"INTEGER","notNull":false,"default":0},"height":{"type":"INTEGER","notNull":false,"default":0},"alt":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"assets_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"assets_meta_type_idx","columns":["_meta_type"]},{"name":"assets_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"assets_primary_version_id_idx","columns":["primary_version_id"]},{"name":"assets_owner_profile_id_idx","columns":["owner_profile_id"]},{"name":"assets_source_asset_id_idx","columns":["source_asset_id"]},{"name":"assets_folder_id_idx","columns":["folder_id"]}],"version":"dd79a8b6"},"importPath":"@happyvertical/smrt-images"},"@happyvertical/smrt-images:ImageCollection":{"name":"imagecollection","className":"ImageCollection","qualifiedName":"@happyvertical/smrt-images:ImageCollection","collection":"assets","filePath":"/home/runner/work/smrt/smrt/packages/images/src/images.ts","packageName":"@happyvertical/smrt-images","fields":{},"methods":{"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByMinDimensions":{"name":"getByMinDimensions","async":true,"parameters":[{"name":"minWidth","type":"number","optional":false},{"name":"minHeight","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByMaxDimensions":{"name":"getByMaxDimensions","async":true,"parameters":[{"name":"maxWidth","type":"number","optional":false},{"name":"maxHeight","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getLandscape":{"name":"getLandscape","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getPortrait":{"name":"getPortrait","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getSquare":{"name":"getSquare","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getMissingAltText":{"name":"getMissingAltText","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getHighResolution":{"name":"getHighResolution","async":true,"parameters":[],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true},"getByAspectRatio":{"name":"getByAspectRatio","async":true,"parameters":[{"name":"minRatio","type":"number","optional":false},{"name":"maxRatio","type":"number","optional":false}],"returnType":"Promise<Image[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"assets"},"extends":"SmrtCollection","extendsTypeArg":"Image","exportName":"ImageCollection","collectionExportName":"ImageCollectionCollection","schema":{"tableName":"assets","ddl":"CREATE TABLE IF NOT EXISTS \\"assets\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"_meta_type\\" TEXT NOT NULL,\\n \\"_meta_data\\" JSON,\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"name\\" TEXT,\\n \\"source_uri\\" TEXT,\\n \\"mime_type\\" TEXT,\\n \\"description\\" TEXT,\\n \\"metadata\\" TEXT,\\n \\"version\\" INTEGER DEFAULT 1,\\n \\"primary_version_id\\" UUID,\\n \\"type_slug\\" TEXT,\\n \\"status_slug\\" TEXT,\\n \\"owner_profile_id\\" UUID,\\n \\"source_asset_id\\" UUID,\\n \\"folder_id\\" UUID,\\n \\"source_type\\" TEXT,\\n \\"external_id\\" TEXT,\\n \\"external_refs\\" TEXT,\\n \\"width\\" INTEGER DEFAULT 0,\\n \\"height\\" INTEGER DEFAULT 0,\\n \\"alt\\" TEXT DEFAULT ''\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"_meta_type":{"type":"TEXT","notNull":true},"_meta_data":{"type":"JSON","notNull":false},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false},"name":{"type":"TEXT","notNull":false},"source_uri":{"type":"TEXT","notNull":false},"mime_type":{"type":"TEXT","notNull":false},"description":{"type":"TEXT","notNull":false},"metadata":{"type":"TEXT","notNull":false},"version":{"type":"INTEGER","notNull":false,"default":1},"primary_version_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"type_slug":{"type":"TEXT","notNull":false},"status_slug":{"type":"TEXT","notNull":false},"owner_profile_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":false},"source_asset_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"assets","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"folder_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false},"source_type":{"type":"TEXT","notNull":false},"external_id":{"type":"TEXT","notNull":false},"external_refs":{"type":"TEXT","notNull":false},"width":{"type":"INTEGER","notNull":false,"default":0},"height":{"type":"INTEGER","notNull":false,"default":0},"alt":{"type":"TEXT","notNull":false,"default":""}},"indexes":[{"name":"assets_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"assets_meta_type_idx","columns":["_meta_type"]},{"name":"assets_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"assets_primary_version_id_idx","columns":["primary_version_id"]},{"name":"assets_owner_profile_id_idx","columns":["owner_profile_id"]},{"name":"assets_source_asset_id_idx","columns":["source_asset_id"]},{"name":"assets_folder_id_idx","columns":["folder_id"]}],"version":"dd79a8b6"},"importPath":"@happyvertical/smrt-images"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-assets","@happyvertical/smrt-core","@happyvertical/smrt-profiles","@happyvertical/smrt-prompts","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624","#3628"],"reason":"sharp, node:fs/promises, node:crypto, resvg native addon","via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/prompts.ts
|
|
16
16
|
var smrtImagesGenerateAltTextPrompt = definePrompt({
|