@igstack/app-catalog-backend-core 0.17.0 → 0.17.1-alpha-20260821043201

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.
Files changed (36) hide show
  1. package/dist/db/syncAppCatalog.mjs +11 -0
  2. package/dist/db/syncAppCatalog.mjs.map +1 -1
  3. package/dist/generated/prisma/internal/class.mjs +4 -4
  4. package/dist/generated/prisma/internal/class.mjs.map +1 -1
  5. package/dist/generated/prisma/internal/prismaNamespace.d.mts +1 -0
  6. package/dist/generated/prisma/internal/prismaNamespace.d.mts.map +1 -1
  7. package/dist/generated/prisma/models/DbResource.d.mts +43 -1
  8. package/dist/generated/prisma/models/DbResource.d.mts.map +1 -1
  9. package/dist/index.d.mts +2 -1
  10. package/dist/index.mjs +2 -1
  11. package/dist/modules/appCatalog/service.d.mts +7 -0
  12. package/dist/modules/appCatalog/service.d.mts.map +1 -0
  13. package/dist/modules/appCatalog/service.mjs +15 -1
  14. package/dist/modules/appCatalog/service.mjs.map +1 -1
  15. package/dist/modules/assets/upsertAsset.mjs +12 -1
  16. package/dist/modules/assets/upsertAsset.mjs.map +1 -1
  17. package/dist/server/controller.d.mts +8 -0
  18. package/dist/server/controller.d.mts.map +1 -1
  19. package/dist/server/controller.mjs +7 -1
  20. package/dist/server/controller.mjs.map +1 -1
  21. package/dist/types/common/appCatalogTypes.d.mts +2 -0
  22. package/dist/types/common/appCatalogTypes.d.mts.map +1 -1
  23. package/package.json +7 -7
  24. package/prisma/migrations/20260813000000_add_ai_memory/migration.sql +2 -0
  25. package/prisma/schema.prisma +1 -0
  26. package/src/__tests__/assetMime.test.ts +104 -14
  27. package/src/db/syncAppCatalog.ts +22 -0
  28. package/src/generated/prisma/internal/class.ts +4 -4
  29. package/src/generated/prisma/internal/prismaNamespace.ts +1 -0
  30. package/src/generated/prisma/internal/prismaNamespaceBrowser.ts +1 -0
  31. package/src/generated/prisma/models/DbResource.ts +44 -1
  32. package/src/index.ts +1 -0
  33. package/src/modules/appCatalog/service.ts +26 -0
  34. package/src/modules/assets/upsertAsset.ts +20 -4
  35. package/src/server/controller.ts +11 -0
  36. package/src/types/common/appCatalogTypes.ts +2 -0
@@ -37,6 +37,7 @@ export type DbResourceMinAggregateOutputType = {
37
37
  appUrl: string | null
38
38
  iconName: string | null
39
39
  aiPrompt: string | null
40
+ aiMemory: string | null
40
41
  parentSlug: string | null
41
42
  tier: string | null
42
43
  familySlug: string | null
@@ -60,6 +61,7 @@ export type DbResourceMaxAggregateOutputType = {
60
61
  appUrl: string | null
61
62
  iconName: string | null
62
63
  aiPrompt: string | null
64
+ aiMemory: string | null
63
65
  parentSlug: string | null
64
66
  tier: string | null
65
67
  familySlug: string | null
@@ -91,6 +93,7 @@ export type DbResourceCountAggregateOutputType = {
91
93
  screenshotIds: number
92
94
  deprecated:PrismaJson.AppDeprecation
93
95
  aiPrompt: number
96
+ aiMemory: number
94
97
  urlIssues: number
95
98
  tiers:PrismaJson.TierVariant[]
96
99
  parentSlug: number
@@ -121,6 +124,7 @@ export type DbResourceMinAggregateInputType = {
121
124
  appUrl?: true
122
125
  iconName?: true
123
126
  aiPrompt?: true
127
+ aiMemory?: true
124
128
  parentSlug?: true
125
129
  tier?: true
126
130
  familySlug?: true
@@ -144,6 +148,7 @@ export type DbResourceMaxAggregateInputType = {
144
148
  appUrl?: true
145
149
  iconName?: true
146
150
  aiPrompt?: true
151
+ aiMemory?: true
147
152
  parentSlug?: true
148
153
  tier?: true
149
154
  familySlug?: true
@@ -175,6 +180,7 @@ export type DbResourceCountAggregateInputType = {
175
180
  screenshotIds?: true
176
181
  deprecated?: true
177
182
  aiPrompt?: true
183
+ aiMemory?: true
178
184
  urlIssues?: true
179
185
  tiers?: true
180
186
  parentSlug?: true
@@ -284,6 +290,7 @@ export type DbResourceGroupByOutputType = {
284
290
  screenshotIds: string[]
285
291
  deprecated:PrismaJson.AppDeprecation | null
286
292
  aiPrompt: string | null
293
+ aiMemory: string | null
287
294
  urlIssues: string[]
288
295
  tiers:PrismaJson.TierVariant[] | null
289
296
  parentSlug: string | null
@@ -341,6 +348,7 @@ export type DbResourceWhereInput = {
341
348
  screenshotIds?: Prisma.StringNullableListFilter<"DbResource">
342
349
  deprecated?: Prisma.JsonNullableFilter<"DbResource">
343
350
  aiPrompt?: Prisma.StringNullableFilter<"DbResource"> | string | null
351
+ aiMemory?: Prisma.StringNullableFilter<"DbResource"> | string | null
344
352
  urlIssues?: Prisma.StringNullableListFilter<"DbResource">
345
353
  tiers?: Prisma.JsonNullableFilter<"DbResource">
346
354
  parentSlug?: Prisma.StringNullableFilter<"DbResource"> | string | null
@@ -380,6 +388,7 @@ export type DbResourceOrderByWithRelationInput = {
380
388
  screenshotIds?: Prisma.SortOrder
381
389
  deprecated?: Prisma.SortOrderInput | Prisma.SortOrder
382
390
  aiPrompt?: Prisma.SortOrderInput | Prisma.SortOrder
391
+ aiMemory?: Prisma.SortOrderInput | Prisma.SortOrder
383
392
  urlIssues?: Prisma.SortOrder
384
393
  tiers?: Prisma.SortOrderInput | Prisma.SortOrder
385
394
  parentSlug?: Prisma.SortOrderInput | Prisma.SortOrder
@@ -422,6 +431,7 @@ export type DbResourceWhereUniqueInput = Prisma.AtLeast<{
422
431
  screenshotIds?: Prisma.StringNullableListFilter<"DbResource">
423
432
  deprecated?: Prisma.JsonNullableFilter<"DbResource">
424
433
  aiPrompt?: Prisma.StringNullableFilter<"DbResource"> | string | null
434
+ aiMemory?: Prisma.StringNullableFilter<"DbResource"> | string | null
425
435
  urlIssues?: Prisma.StringNullableListFilter<"DbResource">
426
436
  tiers?: Prisma.JsonNullableFilter<"DbResource">
427
437
  parentSlug?: Prisma.StringNullableFilter<"DbResource"> | string | null
@@ -461,6 +471,7 @@ export type DbResourceOrderByWithAggregationInput = {
461
471
  screenshotIds?: Prisma.SortOrder
462
472
  deprecated?: Prisma.SortOrderInput | Prisma.SortOrder
463
473
  aiPrompt?: Prisma.SortOrderInput | Prisma.SortOrder
474
+ aiMemory?: Prisma.SortOrderInput | Prisma.SortOrder
464
475
  urlIssues?: Prisma.SortOrder
465
476
  tiers?: Prisma.SortOrderInput | Prisma.SortOrder
466
477
  parentSlug?: Prisma.SortOrderInput | Prisma.SortOrder
@@ -503,6 +514,7 @@ export type DbResourceScalarWhereWithAggregatesInput = {
503
514
  screenshotIds?: Prisma.StringNullableListFilter<"DbResource">
504
515
  deprecated?: Prisma.JsonNullableWithAggregatesFilter<"DbResource">
505
516
  aiPrompt?: Prisma.StringNullableWithAggregatesFilter<"DbResource"> | string | null
517
+ aiMemory?: Prisma.StringNullableWithAggregatesFilter<"DbResource"> | string | null
506
518
  urlIssues?: Prisma.StringNullableListFilter<"DbResource">
507
519
  tiers?: Prisma.JsonNullableWithAggregatesFilter<"DbResource">
508
520
  parentSlug?: Prisma.StringNullableWithAggregatesFilter<"DbResource"> | string | null
@@ -539,6 +551,7 @@ export type DbResourceCreateInput = {
539
551
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
540
552
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
541
553
  aiPrompt?: string | null
554
+ aiMemory?: string | null
542
555
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
543
556
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
544
557
  tier?: string | null
@@ -577,6 +590,7 @@ export type DbResourceUncheckedCreateInput = {
577
590
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
578
591
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
579
592
  aiPrompt?: string | null
593
+ aiMemory?: string | null
580
594
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
581
595
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
582
596
  parentSlug?: string | null
@@ -615,6 +629,7 @@ export type DbResourceUpdateInput = {
615
629
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
616
630
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
617
631
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
632
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
618
633
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
619
634
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
620
635
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -653,6 +668,7 @@ export type DbResourceUncheckedUpdateInput = {
653
668
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
654
669
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
655
670
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
671
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
656
672
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
657
673
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
658
674
  parentSlug?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -691,6 +707,7 @@ export type DbResourceCreateManyInput = {
691
707
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
692
708
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
693
709
  aiPrompt?: string | null
710
+ aiMemory?: string | null
694
711
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
695
712
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
696
713
  parentSlug?: string | null
@@ -727,6 +744,7 @@ export type DbResourceUpdateManyMutationInput = {
727
744
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
728
745
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
729
746
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
747
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
730
748
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
731
749
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
732
750
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -762,6 +780,7 @@ export type DbResourceUncheckedUpdateManyInput = {
762
780
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
763
781
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
764
782
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
783
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
765
784
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
766
785
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
767
786
  parentSlug?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -813,6 +832,7 @@ export type DbResourceCountOrderByAggregateInput = {
813
832
  screenshotIds?: Prisma.SortOrder
814
833
  deprecated?: Prisma.SortOrder
815
834
  aiPrompt?: Prisma.SortOrder
835
+ aiMemory?: Prisma.SortOrder
816
836
  urlIssues?: Prisma.SortOrder
817
837
  tiers?: Prisma.SortOrder
818
838
  parentSlug?: Prisma.SortOrder
@@ -841,6 +861,7 @@ export type DbResourceMaxOrderByAggregateInput = {
841
861
  appUrl?: Prisma.SortOrder
842
862
  iconName?: Prisma.SortOrder
843
863
  aiPrompt?: Prisma.SortOrder
864
+ aiMemory?: Prisma.SortOrder
844
865
  parentSlug?: Prisma.SortOrder
845
866
  tier?: Prisma.SortOrder
846
867
  familySlug?: Prisma.SortOrder
@@ -864,6 +885,7 @@ export type DbResourceMinOrderByAggregateInput = {
864
885
  appUrl?: Prisma.SortOrder
865
886
  iconName?: Prisma.SortOrder
866
887
  aiPrompt?: Prisma.SortOrder
888
+ aiMemory?: Prisma.SortOrder
867
889
  parentSlug?: Prisma.SortOrder
868
890
  tier?: Prisma.SortOrder
869
891
  familySlug?: Prisma.SortOrder
@@ -1035,6 +1057,7 @@ export type DbResourceCreateWithoutChildrenInput = {
1035
1057
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1036
1058
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1037
1059
  aiPrompt?: string | null
1060
+ aiMemory?: string | null
1038
1061
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1039
1062
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1040
1063
  tier?: string | null
@@ -1072,6 +1095,7 @@ export type DbResourceUncheckedCreateWithoutChildrenInput = {
1072
1095
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1073
1096
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1074
1097
  aiPrompt?: string | null
1098
+ aiMemory?: string | null
1075
1099
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1076
1100
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1077
1101
  parentSlug?: string | null
@@ -1114,6 +1138,7 @@ export type DbResourceCreateWithoutParentInput = {
1114
1138
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1115
1139
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1116
1140
  aiPrompt?: string | null
1141
+ aiMemory?: string | null
1117
1142
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1118
1143
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1119
1144
  tier?: string | null
@@ -1151,6 +1176,7 @@ export type DbResourceUncheckedCreateWithoutParentInput = {
1151
1176
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1152
1177
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1153
1178
  aiPrompt?: string | null
1179
+ aiMemory?: string | null
1154
1180
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1155
1181
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1156
1182
  tier?: string | null
@@ -1209,6 +1235,7 @@ export type DbResourceUpdateWithoutChildrenInput = {
1209
1235
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1210
1236
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1211
1237
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1238
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1212
1239
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1213
1240
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1214
1241
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1246,6 +1273,7 @@ export type DbResourceUncheckedUpdateWithoutChildrenInput = {
1246
1273
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1247
1274
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1248
1275
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1276
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1249
1277
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1250
1278
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1251
1279
  parentSlug?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1302,6 +1330,7 @@ export type DbResourceScalarWhereInput = {
1302
1330
  screenshotIds?: Prisma.StringNullableListFilter<"DbResource">
1303
1331
  deprecated?: Prisma.JsonNullableFilter<"DbResource">
1304
1332
  aiPrompt?: Prisma.StringNullableFilter<"DbResource"> | string | null
1333
+ aiMemory?: Prisma.StringNullableFilter<"DbResource"> | string | null
1305
1334
  urlIssues?: Prisma.StringNullableListFilter<"DbResource">
1306
1335
  tiers?: Prisma.JsonNullableFilter<"DbResource">
1307
1336
  parentSlug?: Prisma.StringNullableFilter<"DbResource"> | string | null
@@ -1338,6 +1367,7 @@ export type DbResourceCreateWithoutSourceRefsInput = {
1338
1367
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1339
1368
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1340
1369
  aiPrompt?: string | null
1370
+ aiMemory?: string | null
1341
1371
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1342
1372
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1343
1373
  tier?: string | null
@@ -1375,6 +1405,7 @@ export type DbResourceUncheckedCreateWithoutSourceRefsInput = {
1375
1405
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1376
1406
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1377
1407
  aiPrompt?: string | null
1408
+ aiMemory?: string | null
1378
1409
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1379
1410
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1380
1411
  parentSlug?: string | null
@@ -1428,6 +1459,7 @@ export type DbResourceUpdateWithoutSourceRefsInput = {
1428
1459
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1429
1460
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1430
1461
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1462
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1431
1463
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1432
1464
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1433
1465
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1465,6 +1497,7 @@ export type DbResourceUncheckedUpdateWithoutSourceRefsInput = {
1465
1497
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1466
1498
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1467
1499
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1500
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1468
1501
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1469
1502
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1470
1503
  parentSlug?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1502,6 +1535,7 @@ export type DbResourceCreateManyParentInput = {
1502
1535
  screenshotIds?: Prisma.DbResourceCreatescreenshotIdsInput | string[]
1503
1536
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1504
1537
  aiPrompt?: string | null
1538
+ aiMemory?: string | null
1505
1539
  urlIssues?: Prisma.DbResourceCreateurlIssuesInput | string[]
1506
1540
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1507
1541
  tier?: string | null
@@ -1537,6 +1571,7 @@ export type DbResourceUpdateWithoutParentInput = {
1537
1571
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1538
1572
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1539
1573
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1574
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1540
1575
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1541
1576
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1542
1577
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1574,6 +1609,7 @@ export type DbResourceUncheckedUpdateWithoutParentInput = {
1574
1609
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1575
1610
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1576
1611
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1612
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1577
1613
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1578
1614
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1579
1615
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1611,6 +1647,7 @@ export type DbResourceUncheckedUpdateManyWithoutParentInput = {
1611
1647
  screenshotIds?: Prisma.DbResourceUpdatescreenshotIdsInput | string[]
1612
1648
  deprecated?:PrismaJson.AppDeprecation | Prisma.NullableJsonNullValueInput
1613
1649
  aiPrompt?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1650
+ aiMemory?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1614
1651
  urlIssues?: Prisma.DbResourceUpdateurlIssuesInput | string[]
1615
1652
  tiers?:PrismaJson.TierVariant[] | Prisma.NullableJsonNullValueInput
1616
1653
  tier?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
@@ -1686,6 +1723,7 @@ export type DbResourceSelect<ExtArgs extends runtime.Types.Extensions.InternalAr
1686
1723
  screenshotIds?: boolean
1687
1724
  deprecated?: boolean
1688
1725
  aiPrompt?: boolean
1726
+ aiMemory?: boolean
1689
1727
  urlIssues?: boolean
1690
1728
  tiers?: boolean
1691
1729
  parentSlug?: boolean
@@ -1726,6 +1764,7 @@ export type DbResourceSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ex
1726
1764
  screenshotIds?: boolean
1727
1765
  deprecated?: boolean
1728
1766
  aiPrompt?: boolean
1767
+ aiMemory?: boolean
1729
1768
  urlIssues?: boolean
1730
1769
  tiers?: boolean
1731
1770
  parentSlug?: boolean
@@ -1763,6 +1802,7 @@ export type DbResourceSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ex
1763
1802
  screenshotIds?: boolean
1764
1803
  deprecated?: boolean
1765
1804
  aiPrompt?: boolean
1805
+ aiMemory?: boolean
1766
1806
  urlIssues?: boolean
1767
1807
  tiers?: boolean
1768
1808
  parentSlug?: boolean
@@ -1800,6 +1840,7 @@ export type DbResourceSelectScalar = {
1800
1840
  screenshotIds?: boolean
1801
1841
  deprecated?: boolean
1802
1842
  aiPrompt?: boolean
1843
+ aiMemory?: boolean
1803
1844
  urlIssues?: boolean
1804
1845
  tiers?: boolean
1805
1846
  parentSlug?: boolean
@@ -1817,7 +1858,7 @@ export type DbResourceSelectScalar = {
1817
1858
  updatedAt?: boolean
1818
1859
  }
1819
1860
 
1820
- export type DbResourceOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "slug" | "type" | "displayName" | "abbreviation" | "nicknames" | "description" | "access" | "teams" | "accessRequest" | "notes" | "tags" | "appUrl" | "links" | "iconName" | "screenshotIds" | "deprecated" | "aiPrompt" | "urlIssues" | "tiers" | "parentSlug" | "tier" | "familySlug" | "aliases" | "ownerPersonSlug" | "accessMaintainerGroupSlugs" | "accessComments" | "extra" | "lastCheckedAt" | "nextCheckAfter" | "lastContentChangeAt" | "createdAt" | "updatedAt", ExtArgs["result"]["dbResource"]>
1861
+ export type DbResourceOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "slug" | "type" | "displayName" | "abbreviation" | "nicknames" | "description" | "access" | "teams" | "accessRequest" | "notes" | "tags" | "appUrl" | "links" | "iconName" | "screenshotIds" | "deprecated" | "aiPrompt" | "aiMemory" | "urlIssues" | "tiers" | "parentSlug" | "tier" | "familySlug" | "aliases" | "ownerPersonSlug" | "accessMaintainerGroupSlugs" | "accessComments" | "extra" | "lastCheckedAt" | "nextCheckAfter" | "lastContentChangeAt" | "createdAt" | "updatedAt", ExtArgs["result"]["dbResource"]>
1821
1862
  export type DbResourceInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
1822
1863
  sourceRefs?: boolean | Prisma.DbResource$sourceRefsArgs<ExtArgs>
1823
1864
  parent?: boolean | Prisma.DbResource$parentArgs<ExtArgs>
@@ -1869,6 +1910,7 @@ export type $DbResourcePayload<ExtArgs extends runtime.Types.Extensions.Internal
1869
1910
  */
1870
1911
  deprecated:PrismaJson.AppDeprecation | null
1871
1912
  aiPrompt: string | null
1913
+ aiMemory: string | null
1872
1914
  urlIssues: string[]
1873
1915
  /**
1874
1916
  * [TierVariant[]]
@@ -2334,6 +2376,7 @@ export interface DbResourceFieldRefs {
2334
2376
  readonly screenshotIds: Prisma.FieldRef<"DbResource", 'String[]'>
2335
2377
  readonly deprecated: Prisma.FieldRef<"DbResource", 'Json'>
2336
2378
  readonly aiPrompt: Prisma.FieldRef<"DbResource", 'String'>
2379
+ readonly aiMemory: Prisma.FieldRef<"DbResource", 'String'>
2337
2380
  readonly urlIssues: Prisma.FieldRef<"DbResource", 'String[]'>
2338
2381
  readonly tiers: Prisma.FieldRef<"DbResource", 'Json'>
2339
2382
  readonly parentSlug: Prisma.FieldRef<"DbResource", 'String'>
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export type { AcStaticControllerContract } from './server/acStaticControllerCont
16
16
  // backend-only
17
17
 
18
18
  export type { Resource } from './types/common/appCatalogTypes'
19
+ export { getResourcesFromPrisma } from './modules/appCatalog/service.js'
19
20
  export * from './types/index'
20
21
 
21
22
  // Auth
@@ -153,6 +153,7 @@ function rowToResource(row: ResourceRowWithSourceRefs): Resource {
153
153
  ? undefined
154
154
  : (row.deprecated as unknown as Resource['deprecated'])
155
155
  const aiPrompt = row.aiPrompt == null ? undefined : row.aiPrompt
156
+ const aiMemory = row.aiMemory == null ? undefined : row.aiMemory
156
157
  const urlIssues = (row.urlIssues as unknown as string[] | null)?.length
157
158
  ? (row.urlIssues as unknown as string[])
158
159
  : undefined
@@ -186,6 +187,7 @@ function rowToResource(row: ResourceRowWithSourceRefs): Resource {
186
187
  sources,
187
188
  deprecated,
188
189
  aiPrompt,
190
+ aiMemory,
189
191
  urlIssues,
190
192
  tiers,
191
193
  // Fields from former SubResource
@@ -300,6 +302,30 @@ export async function updateApp(input: UpdateAppInput): Promise<Resource> {
300
302
  return rowToResource(updated)
301
303
  }
302
304
 
305
+ export interface UpdateAiMemoryInput {
306
+ /** Resource id (DB id, not slug) */
307
+ id: string
308
+ /** New value for aiMemory. Pass null to clear. */
309
+ aiMemory: string | null
310
+ }
311
+
312
+ /**
313
+ * Updates the AI-owned scratchpad for a resource.
314
+ * This mutation is intentionally separate from updateApp so AI agents can
315
+ * write knowledge without a full MR cycle. It does NOT touch aiPrompt.
316
+ */
317
+ export async function updateAiMemory(
318
+ input: UpdateAiMemoryInput,
319
+ ): Promise<Resource> {
320
+ const prisma = getDbClient()
321
+ const updated = await prisma.dbResource.update({
322
+ where: { id: input.id },
323
+ data: { aiMemory: input.aiMemory },
324
+ include: { sourceRefs: true },
325
+ })
326
+ return rowToResource(updated)
327
+ }
328
+
303
329
  export function deriveCategories(resources: Resource[]): AppCategory[] {
304
330
  const tagSet = new Set<string>()
305
331
  for (const resource of resources) {
@@ -21,15 +21,31 @@ export async function upsertAsset({
21
21
  originalFilename,
22
22
  })
23
23
 
24
- // If an asset with the same checksum already exists, reuse it instead of storing duplicate binary.
25
24
  const existing = await prisma.dbAsset.findUnique({
26
25
  where: { name },
27
26
  })
28
27
 
29
28
  if (existing) {
30
- // Reusing the stored binary must not keep a mimeType we no longer derive:
31
- // rows written by an older, wrong derivation would never be corrected.
32
- if (existing.mimeType !== mimeType) {
29
+ // The checksum is the source of truth for whether the underlying bytes
30
+ // changed. Reusing the stored binary on a checksum match must not keep a
31
+ // mimeType we no longer derive: rows written by an older, wrong
32
+ // derivation would never be corrected otherwise. A checksum mismatch
33
+ // means the file on disk was replaced with different content (e.g. an
34
+ // SVG swapped for a PNG) — the whole row must be rewritten, not just
35
+ // mimeType, or the new bytes are silently discarded forever.
36
+ if (existing.checksum !== checksum) {
37
+ await prisma.dbAsset.update({
38
+ where: { id: existing.id },
39
+ data: {
40
+ content: new Uint8Array(buffer),
41
+ checksum,
42
+ fileSize,
43
+ width,
44
+ height,
45
+ mimeType,
46
+ },
47
+ })
48
+ } else if (existing.mimeType !== mimeType) {
33
49
  await prisma.dbAsset.update({
34
50
  where: { id: existing.id },
35
51
  data: { mimeType },
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  getAppCatalogData,
3
+ updateAiMemory as updateAiMemoryService,
3
4
  updateApp as updateAppService,
4
5
  } from '../modules/appCatalog/service'
5
6
  import type { AppCatalogData } from '../types'
@@ -53,6 +54,16 @@ export function createTrpcRouter(
53
54
  .mutation(async ({ input }): Promise<Resource> => {
54
55
  return updateAppService(input)
55
56
  }),
57
+ updateAiMemory: publicProcedure
58
+ .input(
59
+ z.object({
60
+ id: z.string(),
61
+ aiMemory: z.string().nullable(),
62
+ }),
63
+ )
64
+ .mutation(async ({ input }): Promise<Resource> => {
65
+ return updateAiMemoryService(input)
66
+ }),
56
67
  }),
57
68
 
58
69
  // Auth routes (requires auth instance)
@@ -89,6 +89,8 @@ export interface Resource {
89
89
  }
90
90
  /** Agent-facing prompt guiding how to maintain this app's data */
91
91
  aiPrompt?: string
92
+ /** AI-owned scratchpad: strategies, gotchas, scripts, retros accumulated per app */
93
+ aiMemory?: string
92
94
  /** URL health issues detected by automated scanning */
93
95
  urlIssues?: string[]
94
96
  /** Optional tier variants (e.g., prod/dev) with per-tier URLs and access */