@happyvertical/smrt-tags 0.51.32 → 0.51.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/index.d.ts +15 -464
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +4 -4
- package/dist/tag-alias.d.ts +42 -0
- package/dist/tag-alias.d.ts.map +1 -0
- package/dist/tag-aliases.d.ts +101 -0
- package/dist/tag-aliases.d.ts.map +1 -0
- package/dist/tag.d.ts +58 -0
- package/dist/tag.d.ts.map +1 -0
- package/dist/tags.d.ts +176 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/types.d.ts +57 -110
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +66 -326
- package/dist/utils.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,464 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare function calculateLevel(parentSlug: string | null, tagCollection: TagCollection): Promise<number>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Generate a unique slug from a name
|
|
20
|
-
*
|
|
21
|
-
* Creates a slug and ensures uniqueness by appending a number if needed.
|
|
22
|
-
*
|
|
23
|
-
* @param name - The name to convert to slug
|
|
24
|
-
* @param context - The context for uniqueness checking
|
|
25
|
-
* @param tagCollection - TagCollection instance for queries
|
|
26
|
-
* @returns Unique slug
|
|
27
|
-
*/
|
|
28
|
-
export declare function generateUniqueSlug(name: string, context: string, tagCollection: TagCollection): Promise<string>;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Validate hierarchy for circular references
|
|
32
|
-
*
|
|
33
|
-
* Checks if setting a parent would create a circular reference
|
|
34
|
-
* (e.g., making a tag its own ancestor). The actual move call in
|
|
35
|
-
* `TagCollection.moveTag` also runs `SmrtHierarchical.moveTo`'s
|
|
36
|
-
* descendant-cycle check; this helper remains exported for callers that
|
|
37
|
-
* want to pre-validate a candidate parent without attempting the move.
|
|
38
|
-
*
|
|
39
|
-
* Tags are identified by `(slug, context)`. If `context` is omitted,
|
|
40
|
-
* slug-only lookups are used — fine when slugs are unique across all
|
|
41
|
-
* contexts, but the walk can traverse the wrong chain when the same
|
|
42
|
-
* slug exists in multiple contexts. Pass the candidate parent's
|
|
43
|
-
* `context` for accurate cross-context-safe validation.
|
|
44
|
-
*
|
|
45
|
-
* @param slug - The tag being moved
|
|
46
|
-
* @param parentSlug - The proposed new parent
|
|
47
|
-
* @param tagCollection - TagCollection instance for queries
|
|
48
|
-
* @param context - Optional context to scope every slug lookup to
|
|
49
|
-
* @returns True if circular reference detected
|
|
50
|
-
*/
|
|
51
|
-
export declare function hasCircularReference(slug: string, parentSlug: string, tagCollection: TagCollection, context?: string): Promise<boolean>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Sanitize slug input
|
|
55
|
-
*
|
|
56
|
-
* Converts to lowercase, replaces spaces with hyphens,
|
|
57
|
-
* removes invalid characters, and ensures proper format.
|
|
58
|
-
*
|
|
59
|
-
* @param input - The input string to sanitize
|
|
60
|
-
* @returns Sanitized slug
|
|
61
|
-
*/
|
|
62
|
-
export declare function sanitizeSlug(input: string): string;
|
|
63
|
-
|
|
64
|
-
export declare class Tag extends SmrtHierarchical {
|
|
65
|
-
protected _slug: string;
|
|
66
|
-
protected _context: string;
|
|
67
|
-
get slug(): string;
|
|
68
|
-
set slug(value: string);
|
|
69
|
-
get context(): string;
|
|
70
|
-
set context(value: string);
|
|
71
|
-
name: string;
|
|
72
|
-
level: number;
|
|
73
|
-
description: string;
|
|
74
|
-
metadata: string;
|
|
75
|
-
tenantId: string | null;
|
|
76
|
-
createdAt: Date;
|
|
77
|
-
updatedAt: Date;
|
|
78
|
-
constructor(options?: TagOptions);
|
|
79
|
-
/**
|
|
80
|
-
* Get metadata as parsed object
|
|
81
|
-
*
|
|
82
|
-
* @returns Parsed metadata object or empty object if no metadata
|
|
83
|
-
*/
|
|
84
|
-
getMetadata(): TagMetadata;
|
|
85
|
-
/**
|
|
86
|
-
* Set metadata from object
|
|
87
|
-
*
|
|
88
|
-
* @param data - Metadata object to store
|
|
89
|
-
*/
|
|
90
|
-
setMetadata(data: TagMetadata): void;
|
|
91
|
-
/**
|
|
92
|
-
* Update metadata by merging with existing values
|
|
93
|
-
*
|
|
94
|
-
* @param updates - Partial metadata to merge
|
|
95
|
-
*/
|
|
96
|
-
updateMetadata(updates: Partial<TagMetadata>): void;
|
|
97
|
-
/**
|
|
98
|
-
* Convenience method for slug-based lookup
|
|
99
|
-
*
|
|
100
|
-
* @param slug - The slug to search for
|
|
101
|
-
* @param context - Optional context filter
|
|
102
|
-
* @returns Tag instance or null if not found
|
|
103
|
-
*/
|
|
104
|
-
static getBySlug(_slug: string, _context?: string): Promise<Tag | null>;
|
|
105
|
-
/**
|
|
106
|
-
* Get root tags (no parent) for a context
|
|
107
|
-
*
|
|
108
|
-
* @param context - The context to filter by
|
|
109
|
-
* @returns Array of root tags
|
|
110
|
-
*/
|
|
111
|
-
static getRootTags(_context?: string): Promise<Tag[]>;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export declare class TagAlias extends SmrtObject {
|
|
115
|
-
tagSlug: string;
|
|
116
|
-
alias: string;
|
|
117
|
-
language: string;
|
|
118
|
-
protected _context: string;
|
|
119
|
-
get context(): string;
|
|
120
|
-
set context(value: string);
|
|
121
|
-
tenantId: string | null;
|
|
122
|
-
createdAt: Date;
|
|
123
|
-
constructor(options?: TagAliasOptions);
|
|
124
|
-
/**
|
|
125
|
-
* Get the tag this alias belongs to
|
|
126
|
-
*
|
|
127
|
-
* @returns Tag instance or null if not found
|
|
128
|
-
*/
|
|
129
|
-
getTag(): Promise<Tag | null>;
|
|
130
|
-
/**
|
|
131
|
-
* Search tags by alias
|
|
132
|
-
*
|
|
133
|
-
* @param alias - The alias to search for
|
|
134
|
-
* @param language - Optional language filter
|
|
135
|
-
* @returns Array of matching tags
|
|
136
|
-
*/
|
|
137
|
-
static searchByAlias(_alias: string, _language?: string): Promise<Tag[]>;
|
|
138
|
-
/**
|
|
139
|
-
* Get all aliases for a tag
|
|
140
|
-
*
|
|
141
|
-
* @param tagSlug - The tag slug to get aliases for
|
|
142
|
-
* @returns Array of TagAlias instances
|
|
143
|
-
*/
|
|
144
|
-
static getAliasesForTag(_tagSlug: string): Promise<TagAlias[]>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export declare class TagAliasCollection extends SmrtCollection<TagAlias> {
|
|
148
|
-
static readonly _itemClass: typeof TagAlias;
|
|
149
|
-
/**
|
|
150
|
-
* Add an alias to a tag (get or create)
|
|
151
|
-
*
|
|
152
|
-
* @param tagSlug - The tag slug
|
|
153
|
-
* @param alias - The alias text
|
|
154
|
-
* @param language - Optional language code
|
|
155
|
-
* @param context - Optional context
|
|
156
|
-
* @returns TagAlias instance
|
|
157
|
-
*/
|
|
158
|
-
addAlias(tagSlug: string, alias: string, language?: string, context?: string): Promise<TagAlias>;
|
|
159
|
-
/**
|
|
160
|
-
* Search tags by alias
|
|
161
|
-
*
|
|
162
|
-
* @param alias - The alias to search for
|
|
163
|
-
* @param language - Optional language filter
|
|
164
|
-
* @returns Array of matching tags
|
|
165
|
-
*/
|
|
166
|
-
searchByAlias(alias: string, language?: string): Promise<Tag[]>;
|
|
167
|
-
/**
|
|
168
|
-
* Get all aliases for a tag
|
|
169
|
-
*
|
|
170
|
-
* @param tagSlug - The tag slug
|
|
171
|
-
* @param language - Optional language filter
|
|
172
|
-
* @returns Array of TagAlias instances
|
|
173
|
-
*/
|
|
174
|
-
getAliasesForTag(tagSlug: string, language?: string): Promise<TagAlias[]>;
|
|
175
|
-
/**
|
|
176
|
-
* Remove an alias by ID
|
|
177
|
-
*
|
|
178
|
-
* @param aliasId - The alias UUID
|
|
179
|
-
*/
|
|
180
|
-
removeAlias(aliasId: string): Promise<void>;
|
|
181
|
-
/**
|
|
182
|
-
* Bulk add aliases to a tag
|
|
183
|
-
*
|
|
184
|
-
* @param tagSlug - The tag slug
|
|
185
|
-
* @param aliases - Array of alias configurations
|
|
186
|
-
* @returns Array of created TagAlias instances
|
|
187
|
-
*/
|
|
188
|
-
bulkAddAliases(tagSlug: string, aliases: Array<{
|
|
189
|
-
alias: string;
|
|
190
|
-
language?: string;
|
|
191
|
-
context?: string;
|
|
192
|
-
}>): Promise<TagAlias[]>;
|
|
193
|
-
/**
|
|
194
|
-
* Get aliases grouped by language
|
|
195
|
-
*
|
|
196
|
-
* @param tagSlug - The tag slug
|
|
197
|
-
* @returns Map of language code to array of aliases
|
|
198
|
-
*/
|
|
199
|
-
getAliasesByLanguage(tagSlug: string): Promise<Map<string, string[]>>;
|
|
200
|
-
/**
|
|
201
|
-
* Find matching aliases (case-insensitive partial match)
|
|
202
|
-
*
|
|
203
|
-
* Note: This is a simple implementation. For production use,
|
|
204
|
-
* consider using full-text search or fuzzy matching.
|
|
205
|
-
*
|
|
206
|
-
* @param query - The search query
|
|
207
|
-
* @param language - Optional language filter
|
|
208
|
-
* @returns Array of matching TagAlias instances
|
|
209
|
-
*/
|
|
210
|
-
findMatchingAliases(query: string, language?: string): Promise<TagAlias[]>;
|
|
211
|
-
/**
|
|
212
|
-
* Find all tag aliases belonging to a specific tenant
|
|
213
|
-
*
|
|
214
|
-
* @param tenantId - The tenant ID to filter by
|
|
215
|
-
* @returns Array of tag aliases for the specified tenant
|
|
216
|
-
*/
|
|
217
|
-
findByTenant(tenantId: string): Promise<TagAlias[]>;
|
|
218
|
-
/**
|
|
219
|
-
* Find all global (tenant-less) tag aliases.
|
|
220
|
-
*
|
|
221
|
-
* Routes through the shared tenant-global helper so it does not throw under
|
|
222
|
-
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
223
|
-
* flagged as an isolation violation). (#1600)
|
|
224
|
-
*
|
|
225
|
-
* @returns Array of global tag aliases with null tenantId
|
|
226
|
-
*/
|
|
227
|
-
findGlobal(): Promise<TagAlias[]>;
|
|
228
|
-
/**
|
|
229
|
-
* Find tag aliases for a tenant including global aliases.
|
|
230
|
-
*
|
|
231
|
-
* Fails closed if an active tenant context requests a different tenant's
|
|
232
|
-
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
233
|
-
*
|
|
234
|
-
* @param tenantId - The tenant ID to filter by
|
|
235
|
-
* @returns Array of tag aliases for the tenant plus all global aliases
|
|
236
|
-
*/
|
|
237
|
-
findWithGlobals(tenantId: string): Promise<TagAlias[]>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Options for creating a TagAlias instance
|
|
242
|
-
*/
|
|
243
|
-
export declare interface TagAliasOptions extends SmrtObjectOptions {
|
|
244
|
-
tagSlug?: string;
|
|
245
|
-
alias?: string;
|
|
246
|
-
language?: string;
|
|
247
|
-
context?: string;
|
|
248
|
-
tenantId?: string | null;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export declare class TagCollection extends SmrtCollection<Tag> {
|
|
252
|
-
static readonly _itemClass: typeof Tag;
|
|
253
|
-
/**
|
|
254
|
-
* Get or create a tag with context
|
|
255
|
-
*
|
|
256
|
-
* @param slug - Tag slug
|
|
257
|
-
* @param context - Tag context (default: 'global')
|
|
258
|
-
* @returns Tag instance
|
|
259
|
-
*/
|
|
260
|
-
getOrCreate(slug: string, context?: string): Promise<Tag>;
|
|
261
|
-
/**
|
|
262
|
-
* Resolve a tag by slug, optionally scoped to a context.
|
|
263
|
-
*
|
|
264
|
-
* Tags are identified by `(slug, context)`. When `context` is omitted
|
|
265
|
-
* and the slug exists in more than one context, this throws a clear
|
|
266
|
-
* ambiguity error rather than silently picking the first matching row.
|
|
267
|
-
* Callers that know their context should pass it; callers that work in
|
|
268
|
-
* a single-context world can leave it off.
|
|
269
|
-
*
|
|
270
|
-
* @returns The matching Tag, or `null` if nothing matches.
|
|
271
|
-
* @throws Error if `context` is omitted and the slug is ambiguous.
|
|
272
|
-
*/
|
|
273
|
-
private resolveBySlug;
|
|
274
|
-
/**
|
|
275
|
-
* List tags by context with optional parent filtering by slug.
|
|
276
|
-
*
|
|
277
|
-
* @param context - The context to filter by
|
|
278
|
-
* @param parentSlug - Optional parent slug to filter children. Pass an
|
|
279
|
-
* empty string or `null` to find root tags; pass a slug to find that
|
|
280
|
-
* tag's immediate children. Typed as `string | null` so TypeScript
|
|
281
|
-
* callers can pass `null` without a cast — the `null` and `''` paths
|
|
282
|
-
* are both treated as "roots only".
|
|
283
|
-
* @returns Array of matching tags
|
|
284
|
-
*/
|
|
285
|
-
listByContext(context: string, parentSlug?: string | null): Promise<Tag[]>;
|
|
286
|
-
/**
|
|
287
|
-
* Get root tags (no parent) for a context
|
|
288
|
-
*
|
|
289
|
-
* @param context - The context to filter by (default: 'global')
|
|
290
|
-
* @returns Array of root tags
|
|
291
|
-
*/
|
|
292
|
-
getRootTags(context?: string): Promise<Tag[]>;
|
|
293
|
-
/**
|
|
294
|
-
* Get immediate children of a parent tag, looked up by slug.
|
|
295
|
-
*
|
|
296
|
-
* @param parentSlug - The parent tag slug
|
|
297
|
-
* @param context - Optional context for the parent lookup. When omitted,
|
|
298
|
-
* the parent slug must be unambiguous across contexts (throws if not).
|
|
299
|
-
* @returns Array of child tags, or `[]` if the parent slug doesn't
|
|
300
|
-
* resolve. Children are filtered to the resolved parent's context so
|
|
301
|
-
* cross-context children don't leak in.
|
|
302
|
-
*/
|
|
303
|
-
getChildren(parentSlug: string, context?: string): Promise<Tag[]>;
|
|
304
|
-
/**
|
|
305
|
-
* Get tag hierarchy (all ancestors and descendants)
|
|
306
|
-
*
|
|
307
|
-
* @param slug - The tag slug
|
|
308
|
-
* @param context - Optional context for the slug lookup. When omitted,
|
|
309
|
-
* the slug must be unambiguous across contexts.
|
|
310
|
-
* @returns Object with ancestors, current tag, and descendants
|
|
311
|
-
*/
|
|
312
|
-
getHierarchy(slug: string, context?: string): Promise<TagHierarchy>;
|
|
313
|
-
/**
|
|
314
|
-
* Move a tag to a new parent. Slug-based API; UUIDs resolved internally.
|
|
315
|
-
*
|
|
316
|
-
* Cycle detection is inlined here (mirroring `SmrtHierarchical.moveTo`'s
|
|
317
|
-
* self-loop + descendant checks) so that both `parentId` and the
|
|
318
|
-
* denormalised `level` field can be persisted in a single `save()`.
|
|
319
|
-
* Delegating to `moveTo` would write `parentId` first and `level` in a
|
|
320
|
-
* second save — if the second save failed, the tag would be left with
|
|
321
|
-
* the new parent but a stale level, breaking the depth cache.
|
|
322
|
-
*
|
|
323
|
-
* After the moved tag persists, descendant levels are recalculated
|
|
324
|
-
* recursively via `updateDescendantLevels`.
|
|
325
|
-
*
|
|
326
|
-
* @param slug - The tag to move
|
|
327
|
-
* @param newParentSlug - The new parent slug (null for root)
|
|
328
|
-
* @param context - Optional context. When provided, both source and new
|
|
329
|
-
* parent are resolved within it. When omitted, both slugs must be
|
|
330
|
-
* unambiguous across contexts; the resolver throws otherwise.
|
|
331
|
-
* @throws Error if either slug fails to resolve, if either slug is
|
|
332
|
-
* ambiguous across contexts (no context provided), if source and new
|
|
333
|
-
* parent live in different contexts, or if the move would create a
|
|
334
|
-
* cycle.
|
|
335
|
-
*/
|
|
336
|
-
moveTag(slug: string, newParentSlug: string | null, context?: string): Promise<void>;
|
|
337
|
-
/**
|
|
338
|
-
* Merge one tag into another (updates all references)
|
|
339
|
-
*
|
|
340
|
-
* Reparents `fromTag`'s direct children onto `toTag` and recalculates
|
|
341
|
-
* their `level` field plus the level of every descendant — without
|
|
342
|
-
* this, children moved from a different depth would carry stale
|
|
343
|
-
* levels relative to their new parent. `TagAlias.tagSlug` references
|
|
344
|
-
* are also rewritten, then `fromTag` is deleted.
|
|
345
|
-
*
|
|
346
|
-
* Note: Consuming packages are responsible for updating their own
|
|
347
|
-
* join tables (e.g. `asset_tags`).
|
|
348
|
-
*
|
|
349
|
-
* @param fromSlug - The tag to merge from
|
|
350
|
-
* @param toSlug - The tag to merge into
|
|
351
|
-
* @param context - Optional context. When provided, both tags are
|
|
352
|
-
* resolved within it. When omitted, both slugs must be unambiguous
|
|
353
|
-
* across contexts.
|
|
354
|
-
* @throws Error if either slug fails to resolve, if either slug is
|
|
355
|
-
* ambiguous, or if the two tags live in different contexts.
|
|
356
|
-
*/
|
|
357
|
-
mergeTag(fromSlug: string, toSlug: string, context?: string): Promise<void>;
|
|
358
|
-
/**
|
|
359
|
-
* Remove tags with no references (cleanup unused tags)
|
|
360
|
-
*
|
|
361
|
-
* Note: This requires consuming packages to provide usage information.
|
|
362
|
-
* By default, only removes tags with no children and no aliases.
|
|
363
|
-
*
|
|
364
|
-
* @param context - Optional context to filter cleanup
|
|
365
|
-
*/
|
|
366
|
-
cleanupUnused(context?: string): Promise<number>;
|
|
367
|
-
/**
|
|
368
|
-
* Calculate hierarchy level for a tag, looking the parent up by slug.
|
|
369
|
-
*
|
|
370
|
-
* @param parentSlug - The parent tag slug (null/empty for root)
|
|
371
|
-
* @param context - Optional context for the parent lookup. When
|
|
372
|
-
* omitted, the parent slug must be unambiguous across contexts.
|
|
373
|
-
* @returns The calculated level (root parent → 1, missing parent → 0)
|
|
374
|
-
*/
|
|
375
|
-
calculateLevel(parentSlug: string | null, context?: string): Promise<number>;
|
|
376
|
-
/**
|
|
377
|
-
* Update levels for all descendants after moving a tag
|
|
378
|
-
*
|
|
379
|
-
* @param tag - The tag that was moved
|
|
380
|
-
*/
|
|
381
|
-
private updateDescendantLevels;
|
|
382
|
-
/**
|
|
383
|
-
* Find all tags belonging to a specific tenant
|
|
384
|
-
*
|
|
385
|
-
* @param tenantId - The tenant ID to filter by
|
|
386
|
-
* @returns Array of tags for the specified tenant
|
|
387
|
-
*/
|
|
388
|
-
findByTenant(tenantId: string): Promise<Tag[]>;
|
|
389
|
-
/**
|
|
390
|
-
* Find all global (tenant-less) tags.
|
|
391
|
-
*
|
|
392
|
-
* Routes through the shared tenant-global helper so it does not throw under
|
|
393
|
-
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
394
|
-
* flagged as an isolation violation). (#1600)
|
|
395
|
-
*
|
|
396
|
-
* @returns Array of global tags with null tenantId
|
|
397
|
-
*/
|
|
398
|
-
findGlobal(): Promise<Tag[]>;
|
|
399
|
-
/**
|
|
400
|
-
* Find tags for a tenant including global tags.
|
|
401
|
-
*
|
|
402
|
-
* Fails closed if an active tenant context requests a different tenant's
|
|
403
|
-
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
404
|
-
*
|
|
405
|
-
* @param tenantId - The tenant ID to filter by
|
|
406
|
-
* @returns Array of tags for the tenant plus all global tags
|
|
407
|
-
*/
|
|
408
|
-
findWithGlobals(tenantId: string): Promise<Tag[]>;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Tag hierarchy result structure
|
|
413
|
-
*/
|
|
414
|
-
export declare interface TagHierarchy {
|
|
415
|
-
ancestors: Tag[];
|
|
416
|
-
current: Tag;
|
|
417
|
-
descendants: Tag[];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Tag metadata structure (flexible, application-specific)
|
|
422
|
-
*/
|
|
423
|
-
export declare interface TagMetadata {
|
|
424
|
-
color?: string;
|
|
425
|
-
backgroundColor?: string;
|
|
426
|
-
icon?: string;
|
|
427
|
-
emoji?: string;
|
|
428
|
-
usageCount?: number;
|
|
429
|
-
lastUsed?: string;
|
|
430
|
-
trending?: boolean;
|
|
431
|
-
featured?: boolean;
|
|
432
|
-
sortOrder?: number;
|
|
433
|
-
showInNav?: boolean;
|
|
434
|
-
displayFormat?: string;
|
|
435
|
-
aiGenerated?: boolean;
|
|
436
|
-
confidence?: number;
|
|
437
|
-
source?: string;
|
|
438
|
-
reviewStatus?: string;
|
|
439
|
-
[key: string]: unknown;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Options for creating a Tag instance
|
|
444
|
-
*/
|
|
445
|
-
export declare interface TagOptions extends SmrtObjectOptions {
|
|
446
|
-
slug?: string;
|
|
447
|
-
name?: string;
|
|
448
|
-
context?: string;
|
|
449
|
-
parentId?: string | null;
|
|
450
|
-
level?: number;
|
|
451
|
-
description?: string;
|
|
452
|
-
metadata?: string | Record<string, unknown>;
|
|
453
|
-
tenantId?: string | null;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Validate slug format (lowercase, alphanumeric + hyphens)
|
|
458
|
-
*
|
|
459
|
-
* @param slug - The slug to validate
|
|
460
|
-
* @returns True if slug is valid
|
|
461
|
-
*/
|
|
462
|
-
export declare function validateSlug(slug: string): boolean;
|
|
463
|
-
|
|
464
|
-
export { }
|
|
1
|
+
/**
|
|
2
|
+
* @have/tags
|
|
3
|
+
*
|
|
4
|
+
* Reusable tagging system with hierarchies, contexts, and multi-language support
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import './__smrt-register__.js';
|
|
9
|
+
export { Tag } from './tag';
|
|
10
|
+
export { TagAlias } from './tag-alias';
|
|
11
|
+
export { TagAliasCollection } from './tag-aliases';
|
|
12
|
+
export { TagCollection } from './tags';
|
|
13
|
+
export type { TagAliasOptions, TagHierarchy, TagMetadata, TagOptions, } from './types';
|
|
14
|
+
export { calculateLevel, generateUniqueSlug, hasCircularReference, sanitizeSlug, validateSlug, } from './utils';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -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.51.32\",\"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\",\"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\"]}"));
|
|
17
|
+
ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-tags\",\"packageVersion\":\"0.51.33\",\"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\",\"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\"]}"));
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/tag.ts
|
|
20
20
|
var __defProp$1 = Object.defineProperty;
|