@happyvertical/smrt-images 0.40.65 → 0.40.67

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.
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
+ "sensitiveFieldsExcluded": true,
3
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
4
5
  "packageName": "@happyvertical/smrt-images",
5
- "packageVersion": "0.40.65",
6
+ "packageVersion": "0.40.67",
6
7
  "sourceManifestPath": "dist/manifest.json",
7
8
  "agentDocPath": "AGENTS.md",
8
9
  "sourceHashes": {
9
- "manifest": "fc02e979a0c0840689dd2f127934389f77582be2993ad0f50aa2dfd4354d84ac",
10
- "packageJson": "00b953304665e7011341b9d2ea01bd28e44d3070839c72e76bf982c66982816f",
10
+ "manifest": "e363eecc4e6f5cf39077ddd0c658cfbe552a23d475e9b4f52b34d9ced6969c26",
11
+ "packageJson": "f4a13739e2b61dda40c513a4df39f7a59ed1a9e952c6058b4b7dccf29d8f9f5f",
11
12
  "agents": "b0cf63bd78f00cc1729ea7f1425291f8e23ab5591161cbbf0d08f4b16ace07fd"
12
13
  },
13
14
  "exports": [
@@ -16,7 +17,8 @@
16
17
  "./manifest.json",
17
18
  "./playground",
18
19
  "./svelte",
19
- "./ui"
20
+ "./ui",
21
+ "./workbench"
20
22
  ],
21
23
  "dependencies": {
22
24
  "@happyvertical/ai": "catalog:",
@@ -122,7 +124,8 @@
122
124
  "name": "version",
123
125
  "type": "integer",
124
126
  "required": true,
125
- "columnType": "INTEGER"
127
+ "columnType": "INTEGER",
128
+ "default": 1
126
129
  },
127
130
  {
128
131
  "name": "primaryVersionId",
@@ -198,19 +201,22 @@
198
201
  "name": "width",
199
202
  "type": "integer",
200
203
  "required": false,
201
- "columnType": "INTEGER"
204
+ "columnType": "INTEGER",
205
+ "default": 0
202
206
  },
203
207
  {
204
208
  "name": "height",
205
209
  "type": "integer",
206
210
  "required": false,
207
- "columnType": "INTEGER"
211
+ "columnType": "INTEGER",
212
+ "default": 0
208
213
  },
209
214
  {
210
215
  "name": "alt",
211
216
  "type": "text",
212
217
  "required": false,
213
- "columnType": "TEXT"
218
+ "columnType": "TEXT",
219
+ "default": ""
214
220
  }
215
221
  ],
216
222
  "relationships": [
@@ -304,6 +310,385 @@
304
310
  "toPlainObject",
305
311
  "toPublicJSON"
306
312
  ],
313
+ "methodSignatures": [
314
+ {
315
+ "name": "_setLoadedRelationship",
316
+ "params": [
317
+ "fieldName: string",
318
+ "value: any"
319
+ ],
320
+ "returns": "void"
321
+ },
322
+ {
323
+ "name": "associateWith",
324
+ "async": true,
325
+ "params": [
326
+ "metaType: string",
327
+ "metaId: string",
328
+ "role?: any"
329
+ ],
330
+ "returns": "Promise<AssetAssociation>"
331
+ },
332
+ {
333
+ "name": "classifyConstraintError",
334
+ "static": true,
335
+ "params": [
336
+ "message: string"
337
+ ],
338
+ "returns": "'unique' | 'not_null' | null"
339
+ },
340
+ {
341
+ "name": "clearEmbeddings",
342
+ "async": true,
343
+ "returns": "Promise<void>"
344
+ },
345
+ {
346
+ "name": "delete",
347
+ "async": true,
348
+ "returns": "Promise<void>"
349
+ },
350
+ {
351
+ "name": "describe",
352
+ "async": true,
353
+ "params": [
354
+ "options?: AiOperationOptions"
355
+ ],
356
+ "returns": "any"
357
+ },
358
+ {
359
+ "name": "destroy",
360
+ "returns": "void"
361
+ },
362
+ {
363
+ "name": "do",
364
+ "async": true,
365
+ "params": [
366
+ "instructions: string",
367
+ "options?: AiOperationOptions"
368
+ ],
369
+ "returns": "any"
370
+ },
371
+ {
372
+ "name": "executeToolCall",
373
+ "async": true,
374
+ "params": [
375
+ "toolCall: ToolCall"
376
+ ],
377
+ "returns": "Promise<ToolCallResult>"
378
+ },
379
+ {
380
+ "name": "forget",
381
+ "async": true,
382
+ "params": [
383
+ "options: object"
384
+ ],
385
+ "returns": "Promise<void>"
386
+ },
387
+ {
388
+ "name": "forgetScope",
389
+ "async": true,
390
+ "params": [
391
+ "options: object"
392
+ ],
393
+ "returns": "Promise<number>"
394
+ },
395
+ {
396
+ "name": "generateAltText",
397
+ "async": true,
398
+ "returns": "Promise<string>"
399
+ },
400
+ {
401
+ "name": "generateEmbeddings",
402
+ "async": true,
403
+ "params": [
404
+ "options?: GenerateEmbeddingsOptions"
405
+ ],
406
+ "returns": "Promise<void>"
407
+ },
408
+ {
409
+ "name": "getAiUsageSnapshot",
410
+ "returns": "AiUsageSnapshot | undefined"
411
+ },
412
+ {
413
+ "name": "getAssociations",
414
+ "async": true,
415
+ "returns": "Promise<AssetAssociation[]>"
416
+ },
417
+ {
418
+ "name": "getAvailableTools",
419
+ "returns": "AITool[]"
420
+ },
421
+ {
422
+ "name": "getBySlug",
423
+ "async": true,
424
+ "static": true,
425
+ "params": [
426
+ "_slug: string"
427
+ ],
428
+ "returns": "Promise<Asset | null>"
429
+ },
430
+ {
431
+ "name": "getDerivatives",
432
+ "async": true,
433
+ "returns": "Promise<Asset[]>"
434
+ },
435
+ {
436
+ "name": "getEmbedding",
437
+ "async": true,
438
+ "params": [
439
+ "fieldName: string",
440
+ "model?: string"
441
+ ],
442
+ "returns": "Promise<number[] | null>"
443
+ },
444
+ {
445
+ "name": "getExternalRef",
446
+ "params": [
447
+ "provider: string"
448
+ ],
449
+ "returns": "AssetExternalReference | null"
450
+ },
451
+ {
452
+ "name": "getExternalRefs",
453
+ "returns": "Record<string, AssetExternalReference>"
454
+ },
455
+ {
456
+ "name": "getFields",
457
+ "async": true,
458
+ "returns": "Promise<any>"
459
+ },
460
+ {
461
+ "name": "getId",
462
+ "async": true,
463
+ "returns": "any"
464
+ },
465
+ {
466
+ "name": "getMetadata",
467
+ "returns": "Record<string>"
468
+ },
469
+ {
470
+ "name": "getRelated",
471
+ "async": true,
472
+ "params": [
473
+ "fieldName: string",
474
+ "opts?: LoadRelatedOptions"
475
+ ],
476
+ "returns": "Promise<any>"
477
+ },
478
+ {
479
+ "name": "getSavedId",
480
+ "async": true,
481
+ "returns": "any"
482
+ },
483
+ {
484
+ "name": "getSlug",
485
+ "async": true,
486
+ "returns": "any"
487
+ },
488
+ {
489
+ "name": "getSource",
490
+ "async": true,
491
+ "returns": "Promise<Asset | null>"
492
+ },
493
+ {
494
+ "name": "getStatus",
495
+ "async": true,
496
+ "returns": "Promise<AssetStatus | null>"
497
+ },
498
+ {
499
+ "name": "getTags",
500
+ "async": true,
501
+ "returns": "Promise<Tag[]>"
502
+ },
503
+ {
504
+ "name": "getType",
505
+ "async": true,
506
+ "returns": "Promise<AssetType | null>"
507
+ },
508
+ {
509
+ "name": "hasStaleEmbeddings",
510
+ "async": true,
511
+ "returns": "Promise<boolean>"
512
+ },
513
+ {
514
+ "name": "hasTag",
515
+ "async": true,
516
+ "params": [
517
+ "tagSlug: string"
518
+ ],
519
+ "returns": "Promise<boolean>"
520
+ },
521
+ {
522
+ "name": "initialize",
523
+ "async": true,
524
+ "returns": "Promise"
525
+ },
526
+ {
527
+ "name": "is",
528
+ "async": true,
529
+ "params": [
530
+ "criteria: string",
531
+ "options?: AiOperationOptions"
532
+ ],
533
+ "returns": "any"
534
+ },
535
+ {
536
+ "name": "isHighResolution",
537
+ "returns": "boolean"
538
+ },
539
+ {
540
+ "name": "isRelatedLoaded",
541
+ "params": [
542
+ "fieldName: string"
543
+ ],
544
+ "returns": "boolean"
545
+ },
546
+ {
547
+ "name": "isSaved",
548
+ "async": true,
549
+ "returns": "any"
550
+ },
551
+ {
552
+ "name": "isValidImageFormat",
553
+ "returns": "boolean"
554
+ },
555
+ {
556
+ "name": "listAiUsage",
557
+ "async": true,
558
+ "params": [
559
+ "options?: AiUsageListOptions"
560
+ ],
561
+ "returns": "Promise<SmrtAiUsageRecord[]>"
562
+ },
563
+ {
564
+ "name": "loadDataFromDb",
565
+ "async": true,
566
+ "params": [
567
+ "data: Record<string>"
568
+ ],
569
+ "returns": "any"
570
+ },
571
+ {
572
+ "name": "loadFromId",
573
+ "async": true,
574
+ "returns": "any"
575
+ },
576
+ {
577
+ "name": "loadFromSlug",
578
+ "async": true,
579
+ "returns": "any"
580
+ },
581
+ {
582
+ "name": "loadRelated",
583
+ "async": true,
584
+ "params": [
585
+ "fieldName: string",
586
+ "opts?: LoadRelatedOptions"
587
+ ],
588
+ "returns": "Promise<any>"
589
+ },
590
+ {
591
+ "name": "loadRelatedMany",
592
+ "async": true,
593
+ "params": [
594
+ "fieldName: string",
595
+ "opts?: LoadRelatedOptions"
596
+ ],
597
+ "returns": "Promise<any[]>"
598
+ },
599
+ {
600
+ "name": "markAsPersisted",
601
+ "returns": "void"
602
+ },
603
+ {
604
+ "name": "mergeMetadata",
605
+ "params": [
606
+ "metadata: Record<string>"
607
+ ],
608
+ "returns": "void"
609
+ },
610
+ {
611
+ "name": "recall",
612
+ "async": true,
613
+ "params": [
614
+ "options: object"
615
+ ],
616
+ "returns": "Promise"
617
+ },
618
+ {
619
+ "name": "recallAll",
620
+ "async": true,
621
+ "params": [
622
+ "options?: object"
623
+ ],
624
+ "returns": "Promise<Map<string>>"
625
+ },
626
+ {
627
+ "name": "remember",
628
+ "async": true,
629
+ "params": [
630
+ "options: object"
631
+ ],
632
+ "returns": "Promise<void>"
633
+ },
634
+ {
635
+ "name": "requireInsertOnSave",
636
+ "returns": "void"
637
+ },
638
+ {
639
+ "name": "resetAiUsage",
640
+ "returns": "void"
641
+ },
642
+ {
643
+ "name": "save",
644
+ "async": true,
645
+ "returns": "any"
646
+ },
647
+ {
648
+ "name": "setExternalRef",
649
+ "params": [
650
+ "provider: string",
651
+ "reference: any"
652
+ ],
653
+ "returns": "void"
654
+ },
655
+ {
656
+ "name": "setMetadata",
657
+ "params": [
658
+ "metadata: Record<string>"
659
+ ],
660
+ "returns": "void"
661
+ },
662
+ {
663
+ "name": "summarizeAiUsage",
664
+ "async": true,
665
+ "params": [
666
+ "options?: AiUsageSummaryOptions"
667
+ ],
668
+ "returns": "Promise<Record<string, AiUsageStats>>"
669
+ },
670
+ {
671
+ "name": "toJSON",
672
+ "returns": "any"
673
+ },
674
+ {
675
+ "name": "toPlainObject",
676
+ "returns": "Record<string>"
677
+ },
678
+ {
679
+ "name": "toPublicJSON",
680
+ "params": [
681
+ "options?: PublicJsonOptions"
682
+ ],
683
+ "returns": "Record<string>"
684
+ }
685
+ ],
686
+ "tenant": {
687
+ "scoped": true,
688
+ "mode": "optional",
689
+ "field": "tenantId"
690
+ },
691
+ "tableStrategy": "sti",
307
692
  "surfaces": [
308
693
  {
309
694
  "kind": "api",
@@ -436,6 +821,81 @@
436
821
  "getPortrait",
437
822
  "getSquare"
438
823
  ],
824
+ "methodSignatures": [
825
+ {
826
+ "name": "findByTenant",
827
+ "async": true,
828
+ "params": [
829
+ "tenantId: string"
830
+ ],
831
+ "returns": "Promise<Image[]>"
832
+ },
833
+ {
834
+ "name": "findGlobal",
835
+ "async": true,
836
+ "returns": "Promise<Image[]>"
837
+ },
838
+ {
839
+ "name": "findWithGlobals",
840
+ "async": true,
841
+ "params": [
842
+ "tenantId: string"
843
+ ],
844
+ "returns": "Promise<Image[]>"
845
+ },
846
+ {
847
+ "name": "getByAspectRatio",
848
+ "async": true,
849
+ "params": [
850
+ "minRatio: number",
851
+ "maxRatio: number"
852
+ ],
853
+ "returns": "Promise<Image[]>"
854
+ },
855
+ {
856
+ "name": "getByMaxDimensions",
857
+ "async": true,
858
+ "params": [
859
+ "maxWidth: number",
860
+ "maxHeight: number"
861
+ ],
862
+ "returns": "Promise<Image[]>"
863
+ },
864
+ {
865
+ "name": "getByMinDimensions",
866
+ "async": true,
867
+ "params": [
868
+ "minWidth: number",
869
+ "minHeight: number"
870
+ ],
871
+ "returns": "Promise<Image[]>"
872
+ },
873
+ {
874
+ "name": "getHighResolution",
875
+ "async": true,
876
+ "returns": "Promise<Image[]>"
877
+ },
878
+ {
879
+ "name": "getLandscape",
880
+ "async": true,
881
+ "returns": "Promise<Image[]>"
882
+ },
883
+ {
884
+ "name": "getMissingAltText",
885
+ "async": true,
886
+ "returns": "Promise<Image[]>"
887
+ },
888
+ {
889
+ "name": "getPortrait",
890
+ "async": true,
891
+ "returns": "Promise<Image[]>"
892
+ },
893
+ {
894
+ "name": "getSquare",
895
+ "async": true,
896
+ "returns": "Promise<Image[]>"
897
+ }
898
+ ],
439
899
  "surfaces": [],
440
900
  "relationshipFeatures": [
441
901
  "uuidColumns"
@@ -19,7 +19,6 @@ declare const _default: {
19
19
  mock: {
20
20
  label: string;
21
21
  };
22
- live?: undefined;
23
22
  };
24
23
  } | {
25
24
  id: string;
@@ -48,26 +47,7 @@ declare const _default: {
48
47
  mock: {
49
48
  label: string;
50
49
  };
51
- live?: undefined;
52
50
  };
53
- } | {
54
- id: string;
55
- title: string;
56
- description: string;
57
- loadComponent: () => Promise<typeof import("./routes/ImageStudioRoute.svelte")>;
58
- order: number;
59
- tags: string[];
60
- modes: {
61
- live: {
62
- label: string;
63
- description: string;
64
- props: {
65
- apiBaseUrl: string;
66
- };
67
- };
68
- mock?: undefined;
69
- };
70
- props?: undefined;
71
51
  })[];
72
52
  };
73
53
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,wBA6DE"}
1
+ {"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,wBA2CE"}
@@ -1,20 +1,3 @@
1
- import { IMAGES_ROUTE_META } from './routes/shared.js';
2
- const DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL = '/api/v1';
3
- function resolveImagesPlaygroundApiBaseUrl() {
4
- const configuredViaGlobal = globalThis
5
- .__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__;
6
- if (configuredViaGlobal) {
7
- return configuredViaGlobal;
8
- }
9
- const browserLocation = globalThis.location;
10
- if (browserLocation) {
11
- const configuredViaQuery = new URLSearchParams(browserLocation.search).get('smrtImagesApiBaseUrl');
12
- if (configuredViaQuery) {
13
- return configuredViaQuery;
14
- }
15
- }
16
- return DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL;
17
- }
18
1
  function createPreviewImageUri(label, accent) {
19
2
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
20
3
  <defs>
@@ -43,12 +26,11 @@ const sampleImage = {
43
26
  alt: 'Cargo cranes and harbor lights reflected at dusk.',
44
27
  };
45
28
  const loadImageEditor = () => import('./components/ImageEditor.svelte');
46
- const loadImageStudioRoute = () => import('./routes/ImageStudioRoute.svelte');
47
29
  const loadImageUploader = () => import('./components/ImageUploader.svelte');
48
30
  export default {
49
31
  packageName: '@happyvertical/smrt-images',
50
32
  displayName: 'Images',
51
- description: IMAGES_ROUTE_META.studio.description,
33
+ description: 'Component previews for image acquisition, editing, and package UI states.',
52
34
  entries: [
53
35
  {
54
36
  id: 'image-uploader',
@@ -84,22 +66,5 @@ export default {
84
66
  },
85
67
  },
86
68
  },
87
- {
88
- id: 'image-studio-route',
89
- title: 'Image Studio Route',
90
- description: 'Package-owned acquisition and editing flow backed by the generated images API.',
91
- loadComponent: loadImageStudioRoute,
92
- order: 3,
93
- tags: ['route', 'images', 'admin'],
94
- modes: {
95
- live: {
96
- label: 'Live',
97
- description: 'Requires the images package dev server and generated routes. Override the base URL with ?smrtImagesApiBaseUrl=... or window.__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__ when needed.',
98
- props: {
99
- apiBaseUrl: resolveImagesPlaygroundApiBaseUrl(),
100
- },
101
- },
102
- },
103
- },
104
69
  ],
105
70
  };
@@ -1,18 +1,48 @@
1
1
  <script lang="ts">
2
2
  import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
3
  import { M } from '../i18n.js';
4
- import type { ImageLike } from '../image-clients.js';
4
+ import type {
5
+ ImageEditorClient,
6
+ ImageLike,
7
+ ImagesGalleryClient,
8
+ } from '../image-clients.js';
5
9
  import { AssetsGallery, ImageEditor, ImageUploader } from '../index.js';
6
10
 
7
11
  const { t } = useI18n();
8
12
 
9
- let { apiBaseUrl = '/api/v1' }: { apiBaseUrl?: string } = $props();
13
+ let {
14
+ apiBaseUrl = '/api/v1',
15
+ galleryClient = undefined,
16
+ editorClient = undefined,
17
+ initialImage = null,
18
+ }: {
19
+ apiBaseUrl?: string;
20
+ galleryClient?: ImagesGalleryClient;
21
+ editorClient?: ImageEditorClient;
22
+ initialImage?: ImageLike | null;
23
+ } = $props();
10
24
 
11
25
  type StudioImage = ImageLike;
12
26
 
13
27
  let selectedImage = $state<StudioImage | null>(null);
28
+ let lastInitialImageId = $state<string | null>(null);
14
29
  let uploaderStatus = $state('No image selected from the uploader yet.');
15
30
 
31
+ $effect(() => {
32
+ const nextInitialImageId = initialImage?.id || null;
33
+
34
+ if (nextInitialImageId === lastInitialImageId) {
35
+ return;
36
+ }
37
+
38
+ lastInitialImageId = nextInitialImageId;
39
+ selectedImage = initialImage;
40
+
41
+ if (initialImage) {
42
+ uploaderStatus = `Loaded “${initialImage.name}” from the workbench fixture.`;
43
+ }
44
+ });
45
+
16
46
  function isPersistedImage(value: unknown): value is StudioImage {
17
47
  return (
18
48
  typeof value === 'object' &&
@@ -69,7 +99,12 @@ function handleEditorSave(image: StudioImage) {
69
99
  </div>
70
100
 
71
101
  <div class="images-route__card">
72
- <ImageUploader {apiBaseUrl} onSelect={handleUploaderSelect} />
102
+ <ImageUploader
103
+ {apiBaseUrl}
104
+ {galleryClient}
105
+ {editorClient}
106
+ onSelect={handleUploaderSelect}
107
+ />
73
108
  </div>
74
109
  </section>
75
110
 
@@ -83,12 +118,17 @@ function handleEditorSave(image: StudioImage) {
83
118
 
84
119
  <div class="images-route__workspace-grid">
85
120
  <div class="images-route__card images-route__gallery">
86
- <AssetsGallery {apiBaseUrl} onSelect={handleGallerySelect} />
121
+ <AssetsGallery
122
+ {apiBaseUrl}
123
+ client={galleryClient}
124
+ onSelect={handleGallerySelect}
125
+ />
87
126
  </div>
88
127
 
89
128
  <div class="images-route__card images-route__editor">
90
129
  <ImageEditor
91
130
  {apiBaseUrl}
131
+ client={editorClient}
92
132
  image={selectedImage}
93
133
  onSave={handleEditorSave}
94
134
  />