@happyvertical/smrt-tags 0.55.7 → 0.55.9
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/AGENTS.md +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -5
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +132 -7
- package/dist/recipes.d.ts +80 -0
- package/dist/recipes.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +122 -11
- package/dist/tag-alias.d.ts.map +1 -1
- package/dist/tag.d.ts.map +1 -1
- package/package.json +8 -8
package/AGENTS.md
CHANGED
|
@@ -20,3 +20,13 @@ Hierarchical tagging with context-scoped slugs and multi-language aliases.
|
|
|
20
20
|
- **Slug stored in protected `_slug`**: has override getter/setter (not standard SmrtObject slug behavior)
|
|
21
21
|
- **Context defaults to 'global'**: if not specified
|
|
22
22
|
- **Optional tenancy** with nullable tenantId
|
|
23
|
+
|
|
24
|
+
## Recipes (#3719)
|
|
25
|
+
|
|
26
|
+
`src/recipes.ts` declares `tags.taxonomy` (`TaxonomyRecipe`: Tag and TagAlias,
|
|
27
|
+
no prerequisites), emitted into the built `manifest.json` and
|
|
28
|
+
`smrt-knowledge.json` `recipes`. It is the first app-wide feature recipe and the
|
|
29
|
+
pipeline proof for the epic. User-facing help lives in `src/taxonomy.recipe.md`
|
|
30
|
+
(#3591); keep it and the `@field({ description })` text on Tag/TagAlias in plain
|
|
31
|
+
language. Surfaces, providers, and demo data come once #3708 lands. See
|
|
32
|
+
[core recipes](../core/agents/recipes.md).
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAQ,CAAC;AAGvC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,YAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,YAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAW,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAQ,CAAC;AAGvC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,YAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,YAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { calculateLevel, generateUniqueSlug, hasCircularReference, sanitizeSlug, validateSlug } from "./utils.js";
|
|
2
|
-
import { ObjectRegistry, SmrtCollection, SmrtHierarchical, SmrtObject, field, smrt } from "@happyvertical/smrt-core";
|
|
2
|
+
import { ObjectRegistry, SmrtCollection, SmrtHierarchical, SmrtObject, SmrtRecipe, field, smrt } from "@happyvertical/smrt-core";
|
|
3
3
|
import { TenantScoped, queryGlobal, queryWithGlobals, tenantId } from "@happyvertical/smrt-tenancy";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
5
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/__smrt-register__.ts
|
|
17
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tags","packageVersion":"0.55.7","objects":{"@happyvertical/smrt-tags:TagAlias":{"name":"tagalias","className":"TagAlias","qualifiedName":"@happyvertical/smrt-tags:TagAlias","collection":"tagaliases","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag-alias.ts","packageName":"@happyvertical/smrt-tags","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tagSlug":{"type":"text","required":false,"default":""},"alias":{"type":"text","required":true,"default":"","_meta":{"required":true}},"language":{"type":"text","required":false,"default":""},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"createdAt":{"type":"datetime","required":false}},"methods":{"getTag":{"name":"getTag","async":true,"parameters":[],"returnType":"Promise<Tag | null>","isStatic":false,"isPublic":true},"searchByAlias":{"name":"searchByAlias","async":true,"parameters":[{"name":"_alias","type":"string","optional":false},{"name":"_language","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":true,"isPublic":true},"getAliasesForTag":{"name":"getAliasesForTag","async":true,"parameters":[{"name":"_tagSlug","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":true,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"TagAlias","collectionExportName":"TagAliasCollection","validationRules":[{"field":"alias","rule":"required","fieldType":"text"}],"schema":{"tableName":"tag_aliases","ddl":"CREATE TABLE IF NOT EXISTS \\"tag_aliases\\" (\\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 \\"tag_slug\\" TEXT DEFAULT '',\\n \\"alias\\" TEXT DEFAULT '',\\n \\"language\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"tag_slug":{"type":"TEXT","notNull":false,"default":""},"alias":{"type":"TEXT","notNull":false,"default":""},"language":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tag_aliases_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tag_aliases_meta_type_idx","columns":["_meta_type"]},{"name":"tag_aliases_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"95a4bc18"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:TagAliasCollection":{"name":"tagaliascollection","className":"TagAliasCollection","qualifiedName":"@happyvertical/smrt-tags:TagAliasCollection","collection":"tagaliases","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag-aliases.ts","packageName":"@happyvertical/smrt-tags","fields":{},"methods":{"addAlias":{"name":"addAlias","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"alias","type":"string","optional":false},{"name":"language","type":"string","optional":true},{"name":"context","type":"string","optional":true}],"returnType":"Promise<TagAlias>","isStatic":false,"isPublic":true},"searchByAlias":{"name":"searchByAlias","async":true,"parameters":[{"name":"alias","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getAliasesForTag":{"name":"getAliasesForTag","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"removeAlias":{"name":"removeAlias","async":true,"parameters":[{"name":"aliasId","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"bulkAddAliases":{"name":"bulkAddAliases","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"aliases","type":"Array<object>","optional":false,"memberTypes":["string"]}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"getAliasesByLanguage":{"name":"getAliasesByLanguage","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false}],"returnType":"Promise<Map<string, string[]>>","isStatic":false,"isPublic":true},"findMatchingAliases":{"name":"findMatchingAliases","async":true,"parameters":[{"name":"query","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"TagAlias","exportName":"TagAliasCollection","collectionExportName":"TagAliasCollectionCollection","schema":{"tableName":"tag_aliases","ddl":"CREATE TABLE IF NOT EXISTS \\"tag_aliases\\" (\\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 \\"tag_slug\\" TEXT DEFAULT '',\\n \\"alias\\" TEXT DEFAULT '',\\n \\"language\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"tag_slug":{"type":"TEXT","notNull":false,"default":""},"alias":{"type":"TEXT","notNull":false,"default":""},"language":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tag_aliases_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tag_aliases_meta_type_idx","columns":["_meta_type"]},{"name":"tag_aliases_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"95a4bc18"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:Tag":{"name":"tag","className":"Tag","qualifiedName":"@happyvertical/smrt-tags:Tag","collection":"tags","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag.ts","packageName":"@happyvertical/smrt-tags","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"parentId":{"type":"foreignKey","required":false,"related":"Tag","_meta":{"nullable":true}},"name":{"type":"text","required":true,"default":"","_meta":{"required":true}},"level":{"type":"integer","required":false,"default":0},"description":{"type":"text","required":false,"default":""},"metadata":{"type":"text","required":false,"default":""},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"createdAt":{"type":"datetime","required":false},"updatedAt":{"type":"datetime","required":false}},"methods":{"getParent":{"name":"getParent","async":true,"parameters":[],"returnType":"Promise<this | null>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getAncestors":{"name":"getAncestors","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[],"returnType":"Promise<HierarchyView<this>>","isStatic":false,"isPublic":true},"moveTo":{"name":"moveTo","async":true,"parameters":[{"name":"newParent","type":"this | string | null","optional":false,"unionBranches":[{"type":"this"},{"type":"string"},{"type":"null"}]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"getMetadata":{"name":"getMetadata","async":false,"parameters":[],"returnType":"TagMetadata","isStatic":false,"isPublic":true},"setMetadata":{"name":"setMetadata","async":false,"parameters":[{"name":"data","type":"TagMetadata","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"updateMetadata":{"name":"updateMetadata","async":false,"parameters":[{"name":"updates","type":"Partial<TagMetadata>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getBySlug":{"name":"getBySlug","async":true,"parameters":[{"name":"_slug","type":"string","optional":false},{"name":"_context","type":"string","optional":true}],"returnType":"Promise<Tag | null>","isStatic":true,"isPublic":true},"getRootTags":{"name":"getRootTags","async":true,"parameters":[{"name":"_context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag[]>","isStatic":true,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create","update"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtHierarchical","exportName":"Tag","collectionExportName":"TagCollection","displayLabelField":"name","validationRules":[{"field":"name","rule":"required","fieldType":"text"}],"schema":{"tableName":"tags","ddl":"CREATE TABLE IF NOT EXISTS \\"tags\\" (\\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 \\"parent_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"level\\" INTEGER DEFAULT 0,\\n \\"description\\" TEXT DEFAULT '',\\n \\"metadata\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"tags","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"default":""},"level":{"type":"INTEGER","notNull":false,"default":0},"description":{"type":"TEXT","notNull":false,"default":""},"metadata":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tags_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tags_meta_type_idx","columns":["_meta_type"]},{"name":"tags_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"tags_parent_id_idx","columns":["parent_id"]}],"version":"4da9de3e"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:TagCollection":{"name":"tagcollection","className":"TagCollection","qualifiedName":"@happyvertical/smrt-tags:TagCollection","collection":"tags","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tags.ts","packageName":"@happyvertical/smrt-tags","fields":{},"methods":{"getOrCreate":{"name":"getOrCreate","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag>","isStatic":false,"isPublic":true},"listByContext":{"name":"listByContext","async":true,"parameters":[{"name":"context","type":"string","optional":false},{"name":"parentSlug","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getRootTags":{"name":"getRootTags","async":true,"parameters":[{"name":"context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[{"name":"parentSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<TagHierarchy>","isStatic":false,"isPublic":true},"moveTag":{"name":"moveTag","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"newParentSlug","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"context","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"mergeTag":{"name":"mergeTag","async":true,"parameters":[{"name":"fromSlug","type":"string","optional":false},{"name":"toSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"cleanupUnused":{"name":"cleanupUnused","async":true,"parameters":[{"name":"context","type":"string","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"calculateLevel":{"name":"calculateLevel","async":true,"parameters":[{"name":"parentSlug","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"context","type":"string","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Tag","exportName":"TagCollection","collectionExportName":"TagCollectionCollection","schema":{"tableName":"tags","ddl":"CREATE TABLE IF NOT EXISTS \\"tags\\" (\\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 \\"parent_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"level\\" INTEGER DEFAULT 0,\\n \\"description\\" TEXT DEFAULT '',\\n \\"metadata\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"tags","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"default":""},"level":{"type":"INTEGER","notNull":false,"default":0},"description":{"type":"TEXT","notNull":false,"default":""},"metadata":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tags_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tags_meta_type_idx","columns":["_meta_type"]},{"name":"tags_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"tags_parent_id_idx","columns":["parent_id"]}],"version":"4da9de3e"},"importPath":"@happyvertical/smrt-tags"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
|
|
17
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tags","packageVersion":"0.55.9","objects":{"@happyvertical/smrt-tags:TagAlias":{"name":"tagalias","className":"TagAlias","qualifiedName":"@happyvertical/smrt-tags:TagAlias","collection":"tagaliases","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag-alias.ts","packageName":"@happyvertical/smrt-tags","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"tagSlug":{"type":"text","required":false,"default":"","description":"The tag this alternative name points to.","_meta":{"description":"The tag this alternative name points to."}},"alias":{"type":"text","required":true,"default":"","description":"Another name or a translation people may use for the tag.","_meta":{"required":true,"description":"Another name or a translation people may use for the tag."}},"language":{"type":"text","required":false,"default":"","description":"The two-letter language code of the alternative name.","_meta":{"description":"The two-letter language code of the alternative name."}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"createdAt":{"type":"datetime","required":false}},"methods":{"getTag":{"name":"getTag","async":true,"parameters":[],"returnType":"Promise<Tag | null>","isStatic":false,"isPublic":true},"searchByAlias":{"name":"searchByAlias","async":true,"parameters":[{"name":"_alias","type":"string","optional":false},{"name":"_language","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":true,"isPublic":true},"getAliasesForTag":{"name":"getAliasesForTag","async":true,"parameters":[{"name":"_tagSlug","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":true,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtObject","exportName":"TagAlias","collectionExportName":"TagAliasCollection","validationRules":[{"field":"alias","rule":"required","fieldType":"text"}],"schema":{"tableName":"tag_aliases","ddl":"CREATE TABLE IF NOT EXISTS \\"tag_aliases\\" (\\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 \\"tag_slug\\" TEXT DEFAULT '',\\n \\"alias\\" TEXT DEFAULT '',\\n \\"language\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"tag_slug":{"type":"TEXT","notNull":false,"default":""},"alias":{"type":"TEXT","notNull":false,"default":""},"language":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tag_aliases_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tag_aliases_meta_type_idx","columns":["_meta_type"]},{"name":"tag_aliases_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"95a4bc18"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:TagAliasCollection":{"name":"tagaliascollection","className":"TagAliasCollection","qualifiedName":"@happyvertical/smrt-tags:TagAliasCollection","collection":"tagaliases","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag-aliases.ts","packageName":"@happyvertical/smrt-tags","fields":{},"methods":{"addAlias":{"name":"addAlias","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"alias","type":"string","optional":false},{"name":"language","type":"string","optional":true},{"name":"context","type":"string","optional":true}],"returnType":"Promise<TagAlias>","isStatic":false,"isPublic":true},"searchByAlias":{"name":"searchByAlias","async":true,"parameters":[{"name":"alias","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getAliasesForTag":{"name":"getAliasesForTag","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"removeAlias":{"name":"removeAlias","async":true,"parameters":[{"name":"aliasId","type":"string","optional":false}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"bulkAddAliases":{"name":"bulkAddAliases","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false},{"name":"aliases","type":"Array<object>","optional":false,"memberTypes":["string"]}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"getAliasesByLanguage":{"name":"getAliasesByLanguage","async":true,"parameters":[{"name":"tagSlug","type":"string","optional":false}],"returnType":"Promise<Map<string, string[]>>","isStatic":false,"isPublic":true},"findMatchingAliases":{"name":"findMatchingAliases","async":true,"parameters":[{"name":"query","type":"string","optional":false},{"name":"language","type":"string","optional":true}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<TagAlias[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"TagAlias","exportName":"TagAliasCollection","collectionExportName":"TagAliasCollectionCollection","schema":{"tableName":"tag_aliases","ddl":"CREATE TABLE IF NOT EXISTS \\"tag_aliases\\" (\\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 \\"tag_slug\\" TEXT DEFAULT '',\\n \\"alias\\" TEXT DEFAULT '',\\n \\"language\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"tag_slug":{"type":"TEXT","notNull":false,"default":""},"alias":{"type":"TEXT","notNull":false,"default":""},"language":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tag_aliases_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tag_aliases_meta_type_idx","columns":["_meta_type"]},{"name":"tag_aliases_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"95a4bc18"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:Tag":{"name":"tag","className":"Tag","qualifiedName":"@happyvertical/smrt-tags:Tag","collection":"tags","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tag.ts","packageName":"@happyvertical/smrt-tags","fields":{"created_at":{"type":"datetime","required":false},"updated_at":{"type":"datetime","required":false},"parentId":{"type":"foreignKey","required":false,"related":"Tag","_meta":{"nullable":true}},"name":{"type":"text","required":true,"default":"","description":"The name people see when they pick or browse tags.","_meta":{"required":true,"description":"The name people see when they pick or browse tags."}},"level":{"type":"integer","required":false,"default":0},"description":{"type":"text","required":false,"default":"","description":"A short note on what belongs under this tag.","_meta":{"description":"A short note on what belongs under this tag."}},"metadata":{"type":"text","required":false,"default":"","description":"Extra details about the tag, saved as named items.","_meta":{"description":"Extra details about the tag, saved as named items."}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true,"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false}}},"createdAt":{"type":"datetime","required":false},"updatedAt":{"type":"datetime","required":false}},"methods":{"getParent":{"name":"getParent","async":true,"parameters":[],"returnType":"Promise<this | null>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getAncestors":{"name":"getAncestors","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getDescendants":{"name":"getDescendants","async":true,"parameters":[],"returnType":"Promise<this[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[],"returnType":"Promise<HierarchyView<this>>","isStatic":false,"isPublic":true},"moveTo":{"name":"moveTo","async":true,"parameters":[{"name":"newParent","type":"this | string | null","optional":false,"unionBranches":[{"type":"this"},{"type":"string"},{"type":"null"}]}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"getMetadata":{"name":"getMetadata","async":false,"parameters":[],"returnType":"TagMetadata","isStatic":false,"isPublic":true},"setMetadata":{"name":"setMetadata","async":false,"parameters":[{"name":"data","type":"TagMetadata","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"updateMetadata":{"name":"updateMetadata","async":false,"parameters":[{"name":"updates","type":"Partial<TagMetadata>","optional":false}],"returnType":"void","isStatic":false,"isPublic":true},"getBySlug":{"name":"getBySlug","async":true,"parameters":[{"name":"_slug","type":"string","optional":false},{"name":"_context","type":"string","optional":true}],"returnType":"Promise<Tag | null>","isStatic":true,"isPublic":true},"getRootTags":{"name":"getRootTags","async":true,"parameters":[{"name":"_context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag[]>","isStatic":true,"isPublic":true}},"decoratorConfig":{"tableStrategy":"sti","api":{"include":["list","get","create","update","delete"]},"mcp":{"include":["list","get","create","update"]},"cli":{"skipApiCheck":true},"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context","_meta_type"]},"extends":"SmrtHierarchical","exportName":"Tag","collectionExportName":"TagCollection","displayLabelField":"name","validationRules":[{"field":"name","rule":"required","fieldType":"text"}],"schema":{"tableName":"tags","ddl":"CREATE TABLE IF NOT EXISTS \\"tags\\" (\\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 \\"parent_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"level\\" INTEGER DEFAULT 0,\\n \\"description\\" TEXT DEFAULT '',\\n \\"metadata\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"tags","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"default":""},"level":{"type":"INTEGER","notNull":false,"default":0},"description":{"type":"TEXT","notNull":false,"default":""},"metadata":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tags_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tags_meta_type_idx","columns":["_meta_type"]},{"name":"tags_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"tags_parent_id_idx","columns":["parent_id"]}],"version":"4da9de3e"},"importPath":"@happyvertical/smrt-tags"},"@happyvertical/smrt-tags:TagCollection":{"name":"tagcollection","className":"TagCollection","qualifiedName":"@happyvertical/smrt-tags:TagCollection","collection":"tags","filePath":"/home/runner/work/smrt/smrt/packages/tags/src/tags.ts","packageName":"@happyvertical/smrt-tags","fields":{},"methods":{"getOrCreate":{"name":"getOrCreate","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag>","isStatic":false,"isPublic":true},"listByContext":{"name":"listByContext","async":true,"parameters":[{"name":"context","type":"string","optional":false},{"name":"parentSlug","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getRootTags":{"name":"getRootTags","async":true,"parameters":[{"name":"context","type":"string","optional":true,"default":"global"}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getChildren":{"name":"getChildren","async":true,"parameters":[{"name":"parentSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"getHierarchy":{"name":"getHierarchy","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<TagHierarchy>","isStatic":false,"isPublic":true},"moveTag":{"name":"moveTag","async":true,"parameters":[{"name":"slug","type":"string","optional":false},{"name":"newParentSlug","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"context","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"mergeTag":{"name":"mergeTag","async":true,"parameters":[{"name":"fromSlug","type":"string","optional":false},{"name":"toSlug","type":"string","optional":false},{"name":"context","type":"string","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true},"cleanupUnused":{"name":"cleanupUnused","async":true,"parameters":[{"name":"context","type":"string","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"calculateLevel":{"name":"calculateLevel","async":true,"parameters":[{"name":"parentSlug","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"context","type":"string","optional":true}],"returnType":"Promise<number>","isStatic":false,"isPublic":true},"findByTenant":{"name":"findByTenant","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"findGlobal":{"name":"findGlobal","async":true,"parameters":[],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true},"findWithGlobals":{"name":"findWithGlobals","async":true,"parameters":[{"name":"tenantId","type":"string","optional":false}],"returnType":"Promise<Tag[]>","isStatic":false,"isPublic":true}},"decoratorConfig":{},"extends":"SmrtCollection","extendsTypeArg":"Tag","exportName":"TagCollection","collectionExportName":"TagCollectionCollection","schema":{"tableName":"tags","ddl":"CREATE TABLE IF NOT EXISTS \\"tags\\" (\\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 \\"parent_id\\" UUID,\\n \\"name\\" TEXT DEFAULT '',\\n \\"level\\" INTEGER DEFAULT 0,\\n \\"description\\" TEXT DEFAULT '',\\n \\"metadata\\" TEXT DEFAULT '',\\n \\"tenant_id\\" UUID\\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"},"parent_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"foreignKey":{"table":"tags","column":"id","onDelete":"NO ACTION","onUpdate":"CASCADE"}},"name":{"type":"TEXT","notNull":false,"default":""},"level":{"type":"INTEGER","notNull":false,"default":0},"description":{"type":"TEXT","notNull":false,"default":""},"metadata":{"type":"TEXT","notNull":false,"default":""},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false}},"indexes":[{"name":"tags_slug_context_meta_type_idx","columns":["tenant_id","slug","context","_meta_type"],"unique":true,"nullsNotDistinct":true},{"name":"tags_meta_type_idx","columns":["_meta_type"]},{"name":"tags_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"tags_parent_id_idx","columns":["parent_id"]}],"version":"4da9de3e"},"importPath":"@happyvertical/smrt-tags"}},"moduleType":"smrt","recipes":[{"id":"tags.taxonomy","className":"TaxonomyRecipe","label":"Taxonomy","summary":"Organise anything with a shared set of nested tags and alternative names.","synonyms":["tags","tagging","categories","labels","topics"],"models":["@happyvertical/smrt-tags:Tag","@happyvertical/smrt-tags:TagAlias"],"nav":[{"label":"Tags","model":"@happyvertical/smrt-tags:Tag","icon":"tag","description":"The shared set of tags, including tags inside other tags."},{"label":"Alternative names","model":"@happyvertical/smrt-tags:TagAlias","icon":"book","description":"Other names and translations that lead people to the same tag."}],"requires":[],"section":{"id":"taxonomy","label":"Taxonomy","icon":"tag","description":"The tags people use to sort and find things."},"options":{"@happyvertical/smrt-tags:Tag":{"fields":{"name":{"order":1},"parentId":{"label":"Parent tag","help":"The broader tag this one sits under. Leave it empty for a top-level tag.","order":2},"description":{"order":3},"level":{"visibility":"hidden","locked":true},"metadata":{"visibility":"advanced"}}},"@happyvertical/smrt-tags:TagAlias":{"fields":{"alias":{"label":"Alternative name","order":1},"tagSlug":{"label":"Tag","order":2},"language":{"order":3}}}},"help":{"markdown":"## Overview\\n\\nTaxonomy is a shared list of tags you can use to organise anything in your app.\\nTags can sit inside other tags, so a broad tag such as \\"Events\\" can hold\\nnarrower ones such as \\"Concerts\\" and \\"Workshops\\". A tag can also have\\nalternative names, including translations, so people find it by whichever word\\nthey know.\\n\\n## Tasks\\n\\n### Add a tag\\n\\n1. Choose the **New** button above the list of tags.\\n2. Give the tag a **{field:name}** people will recognise.\\n3. Add a **{field:description}** that says what belongs under it.\\n4. Save. The tag is now ready to use.\\n\\n### Put a tag inside another tag\\n\\n1. Open the tag from the list and choose Edit.\\n2. Pick the **{field:parentId}**, the broader tag it belongs under.\\n3. Leave it empty to make the tag a top-level tag.\\n4. Save. Moving a tag moves everything under it too.\\n\\n### Add another name for a tag\\n\\n1. Open the list of alternative names and choose **New**.\\n2. Pick the **{field:tagSlug}** the new name belongs to.\\n3. Type the **{field:alias}**, for example a common nickname or a translation.\\n4. Set the **{field:language}** if the name is in a specific language.\\n5. Save. The alternative name is now on file for that tag.\\n\\n### Keep the list tidy\\n\\nKeep one tag for each idea. If two tags mean the same thing, record the second\\nas an alternative name instead of keeping both.\\n","fieldRefs":["alias","description","language","name","parentId","tagSlug"]},"demo":{"mode":"server","reasons":["Needs a server because its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/tag.ts
|
|
20
20
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -120,7 +120,12 @@ var Tag = class extends SmrtHierarchical {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
__publicField$1(Tag, "__smrtPackage__", "@happyvertical/smrt-tags");
|
|
123
|
-
__decorateClass$1([field({
|
|
123
|
+
__decorateClass$1([field({
|
|
124
|
+
required: true,
|
|
125
|
+
description: "The name people see when they pick or browse tags."
|
|
126
|
+
})], Tag.prototype, "name", 2);
|
|
127
|
+
__decorateClass$1([field({ description: "A short note on what belongs under this tag." })], Tag.prototype, "description", 2);
|
|
128
|
+
__decorateClass$1([field({ description: "Extra details about the tag, saved as named items." })], Tag.prototype, "metadata", 2);
|
|
124
129
|
__decorateClass$1([tenantId({ nullable: true })], Tag.prototype, "tenantId", 2);
|
|
125
130
|
Tag = __decorateClass$1([TenantScoped({ mode: "optional" }), smrt({
|
|
126
131
|
tableStrategy: "sti",
|
|
@@ -206,7 +211,12 @@ var TagAlias = class extends SmrtObject {
|
|
|
206
211
|
}
|
|
207
212
|
};
|
|
208
213
|
__publicField(TagAlias, "__smrtPackage__", "@happyvertical/smrt-tags");
|
|
209
|
-
__decorateClass([field({
|
|
214
|
+
__decorateClass([field({ description: "The tag this alternative name points to." })], TagAlias.prototype, "tagSlug", 2);
|
|
215
|
+
__decorateClass([field({
|
|
216
|
+
required: true,
|
|
217
|
+
description: "Another name or a translation people may use for the tag."
|
|
218
|
+
})], TagAlias.prototype, "alias", 2);
|
|
219
|
+
__decorateClass([field({ description: "The two-letter language code of the alternative name." })], TagAlias.prototype, "language", 2);
|
|
210
220
|
__decorateClass([tenantId({ nullable: true })], TagAlias.prototype, "tenantId", 2);
|
|
211
221
|
TagAlias = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
|
|
212
222
|
tableStrategy: "sti",
|
|
@@ -225,6 +235,66 @@ TagAlias = __decorateClass([TenantScoped({ mode: "optional" }), smrt({
|
|
|
225
235
|
cli: { skipApiCheck: true }
|
|
226
236
|
})], TagAlias);
|
|
227
237
|
//#endregion
|
|
238
|
+
//#region src/recipes.ts
|
|
239
|
+
var TaxonomyRecipe = class extends SmrtRecipe {
|
|
240
|
+
static id = "tags.taxonomy";
|
|
241
|
+
static help = "./taxonomy.recipe.md";
|
|
242
|
+
static label = "Taxonomy";
|
|
243
|
+
static summary = "Organise anything with a shared set of nested tags and alternative names.";
|
|
244
|
+
static synonyms = [
|
|
245
|
+
"tags",
|
|
246
|
+
"tagging",
|
|
247
|
+
"categories",
|
|
248
|
+
"labels",
|
|
249
|
+
"topics"
|
|
250
|
+
];
|
|
251
|
+
static section = {
|
|
252
|
+
id: "taxonomy",
|
|
253
|
+
label: "Taxonomy",
|
|
254
|
+
icon: "tag",
|
|
255
|
+
description: "The tags people use to sort and find things."
|
|
256
|
+
};
|
|
257
|
+
static models = [Tag, TagAlias];
|
|
258
|
+
static nav = [{
|
|
259
|
+
label: "Tags",
|
|
260
|
+
model: Tag,
|
|
261
|
+
icon: "tag",
|
|
262
|
+
description: "The shared set of tags, including tags inside other tags."
|
|
263
|
+
}, {
|
|
264
|
+
label: "Alternative names",
|
|
265
|
+
model: TagAlias,
|
|
266
|
+
icon: "book",
|
|
267
|
+
description: "Other names and translations that lead people to the same tag."
|
|
268
|
+
}];
|
|
269
|
+
static options = {
|
|
270
|
+
Tag: { fields: {
|
|
271
|
+
name: { order: 1 },
|
|
272
|
+
parentId: {
|
|
273
|
+
label: "Parent tag",
|
|
274
|
+
help: "The broader tag this one sits under. Leave it empty for a top-level tag.",
|
|
275
|
+
order: 2
|
|
276
|
+
},
|
|
277
|
+
description: { order: 3 },
|
|
278
|
+
level: {
|
|
279
|
+
visibility: "hidden",
|
|
280
|
+
locked: true
|
|
281
|
+
},
|
|
282
|
+
metadata: { visibility: "advanced" }
|
|
283
|
+
} },
|
|
284
|
+
TagAlias: { fields: {
|
|
285
|
+
alias: {
|
|
286
|
+
label: "Alternative name",
|
|
287
|
+
order: 1
|
|
288
|
+
},
|
|
289
|
+
tagSlug: {
|
|
290
|
+
label: "Tag",
|
|
291
|
+
order: 2
|
|
292
|
+
},
|
|
293
|
+
language: { order: 3 }
|
|
294
|
+
} }
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
//#endregion
|
|
228
298
|
//#region src/tag-aliases.ts
|
|
229
299
|
var tag_aliases_exports = /* @__PURE__ */ __exportAll({ TagAliasCollection: () => TagAliasCollection });
|
|
230
300
|
var TagAliasCollection = class extends SmrtCollection {
|
|
@@ -721,6 +791,6 @@ var TagCollection = class extends SmrtCollection {
|
|
|
721
791
|
}
|
|
722
792
|
};
|
|
723
793
|
//#endregion
|
|
724
|
-
export { Tag, TagAlias, TagAliasCollection, TagCollection, calculateLevel, generateUniqueSlug, hasCircularReference, sanitizeSlug, validateSlug };
|
|
794
|
+
export { Tag, TagAlias, TagAliasCollection, TagCollection, TaxonomyRecipe, calculateLevel, generateUniqueSlug, hasCircularReference, sanitizeSlug, validateSlug };
|
|
725
795
|
|
|
726
796
|
//# sourceMappingURL=index.js.map
|