convex-cms 0.0.16 → 0.0.17
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/admin/dist/types/admin/src/components/ui/field.d.ts +1 -1
- package/admin/dist/types/admin/src/lib/cmsExports.d.ts +6 -6
- package/admin/dist/types/admin/src/lib/cmsExports.d.ts.map +1 -1
- package/admin/src/lib/cmsExports.ts +8 -8
- package/admin-dist/assets/index-DagpgVMo.js +104 -0
- package/admin-dist/embed/favicon.ico +0 -0
- package/admin-dist/embed/index.js +30961 -0
- package/admin-dist/embed/index.js.map +1 -0
- package/admin-dist/index.html +1 -1
- package/package.json +12 -5
- package/admin/dist/types/src/client/admin/bulk.d.ts +0 -79
- package/admin/dist/types/src/client/admin/bulk.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/contentLock.d.ts +0 -118
- package/admin/dist/types/src/client/admin/contentLock.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/contentTypes.d.ts +0 -1627
- package/admin/dist/types/src/client/admin/contentTypes.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/dashboard.d.ts +0 -16
- package/admin/dist/types/src/client/admin/dashboard.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/entries.d.ts +0 -357
- package/admin/dist/types/src/client/admin/entries.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/index.d.ts +0 -7502
- package/admin/dist/types/src/client/admin/index.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/media.d.ts +0 -1038
- package/admin/dist/types/src/client/admin/media.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/settings.d.ts +0 -50
- package/admin/dist/types/src/client/admin/settings.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/taxonomies.d.ts +0 -339
- package/admin/dist/types/src/client/admin/taxonomies.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/trash.d.ts +0 -90
- package/admin/dist/types/src/client/admin/trash.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/types.d.ts +0 -594
- package/admin/dist/types/src/client/admin/types.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/users.d.ts +0 -58
- package/admin/dist/types/src/client/admin/users.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/validators.d.ts +0 -7732
- package/admin/dist/types/src/client/admin/validators.d.ts.map +0 -1
- package/admin/dist/types/src/client/admin/versions.d.ts +0 -106
- package/admin/dist/types/src/client/admin/versions.d.ts.map +0 -1
- package/admin/dist/types/src/client/adminConfig.d.ts +0 -125
- package/admin/dist/types/src/client/adminConfig.d.ts.map +0 -1
- package/admin/dist/types/src/client/config.d.ts +0 -155
- package/admin/dist/types/src/client/config.d.ts.map +0 -1
- package/admin/dist/types/src/client/field-types.d.ts +0 -55
- package/admin/dist/types/src/client/field-types.d.ts.map +0 -1
- package/admin/dist/types/src/client/fields.d.ts +0 -70
- package/admin/dist/types/src/client/fields.d.ts.map +0 -1
- package/admin/dist/types/src/client/registry.d.ts +0 -77
- package/admin/dist/types/src/client/registry.d.ts.map +0 -1
- package/admin/dist/types/src/client/schema/defineContentType.d.ts +0 -233
- package/admin/dist/types/src/client/schema/defineContentType.d.ts.map +0 -1
- package/admin/dist/types/src/client/schema/types.d.ts +0 -540
- package/admin/dist/types/src/client/schema/types.d.ts.map +0 -1
- package/admin/dist/types/src/client/types.d.ts +0 -449
- package/admin/dist/types/src/client/types.d.ts.map +0 -1
- package/admin/dist/types/src/client/utils/toSlug.d.ts +0 -60
- package/admin/dist/types/src/client/utils/toSlug.d.ts.map +0 -1
- package/admin/dist/types/src/client/workflows.d.ts +0 -51
- package/admin/dist/types/src/client/workflows.d.ts.map +0 -1
- package/admin/dist/types/src/component/_generated/component.d.ts +0 -4813
- package/admin/dist/types/src/component/_generated/component.d.ts.map +0 -1
- package/admin/dist/types/src/component/_generated/dataModel.d.ts +0 -46
- package/admin/dist/types/src/component/_generated/dataModel.d.ts.map +0 -1
- package/admin/dist/types/src/component/_generated/server.d.ts +0 -121
- package/admin/dist/types/src/component/_generated/server.d.ts.map +0 -1
- package/admin/dist/types/src/component/contentEntryMutations.d.ts +0 -551
- package/admin/dist/types/src/component/contentEntryMutations.d.ts.map +0 -1
- package/admin/dist/types/src/component/contentLock.d.ts +0 -328
- package/admin/dist/types/src/component/contentLock.d.ts.map +0 -1
- package/admin/dist/types/src/component/contentTypeMutations.d.ts +0 -1253
- package/admin/dist/types/src/component/contentTypeMutations.d.ts.map +0 -1
- package/admin/dist/types/src/component/documentTypes.d.ts +0 -186
- package/admin/dist/types/src/component/documentTypes.d.ts.map +0 -1
- package/admin/dist/types/src/component/eventEmitter.d.ts +0 -309
- package/admin/dist/types/src/component/eventEmitter.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/errors.d.ts +0 -306
- package/admin/dist/types/src/component/lib/errors.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/metadataExtractor.d.ts +0 -245
- package/admin/dist/types/src/component/lib/metadataExtractor.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/mutationAuth.d.ts +0 -95
- package/admin/dist/types/src/component/lib/mutationAuth.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/slugGenerator.d.ts +0 -71
- package/admin/dist/types/src/component/lib/slugGenerator.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/slugUniqueness.d.ts +0 -131
- package/admin/dist/types/src/component/lib/slugUniqueness.d.ts.map +0 -1
- package/admin/dist/types/src/component/lib/softDelete.d.ts +0 -18
- package/admin/dist/types/src/component/lib/softDelete.d.ts.map +0 -1
- package/admin/dist/types/src/component/localeFields.d.ts +0 -508
- package/admin/dist/types/src/component/localeFields.d.ts.map +0 -1
- package/admin/dist/types/src/component/mediaAssetMutations.d.ts +0 -282
- package/admin/dist/types/src/component/mediaAssetMutations.d.ts.map +0 -1
- package/admin/dist/types/src/component/schema.d.ts +0 -5248
- package/admin/dist/types/src/component/schema.d.ts.map +0 -1
- package/admin/dist/types/src/component/validation.d.ts +0 -407
- package/admin/dist/types/src/component/validation.d.ts.map +0 -1
- package/admin/dist/types/src/component/validators.d.ts +0 -5722
- package/admin/dist/types/src/component/validators.d.ts.map +0 -1
- package/admin/dist/types/src/react/index.d.ts +0 -493
- package/admin/dist/types/src/react/index.d.ts.map +0 -1
- package/admin-dist/assets/index-DTgANhXL.js +0 -104
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slug Generator Utility
|
|
3
|
-
*
|
|
4
|
-
* Generates URL-friendly slugs from content titles.
|
|
5
|
-
* Handles special characters, unicode, and ensures slug format consistency.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Options for slug generation
|
|
9
|
-
*/
|
|
10
|
-
export interface SlugOptions {
|
|
11
|
-
/** Maximum length of the generated slug (default: 100) */
|
|
12
|
-
maxLength?: number;
|
|
13
|
-
/** Separator character to use (default: '-') */
|
|
14
|
-
separator?: string;
|
|
15
|
-
/** Whether to lowercase the slug (default: true) */
|
|
16
|
-
lowercase?: boolean;
|
|
17
|
-
/** Custom replacements for specific characters */
|
|
18
|
-
customReplacements?: Record<string, string>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Generates a URL-friendly slug from a given title string.
|
|
22
|
-
*
|
|
23
|
-
* @param title - The input string to convert to a slug
|
|
24
|
-
* @param options - Optional configuration for slug generation
|
|
25
|
-
* @returns A URL-friendly slug string
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* generateSlug("Hello World!") // "hello-world"
|
|
30
|
-
* generateSlug("Café & Restaurant") // "cafe-and-restaurant"
|
|
31
|
-
* generateSlug("日本語タイトル") // "ri-ben-yu-taitoru"
|
|
32
|
-
* generateSlug(" Multiple Spaces ") // "multiple-spaces"
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function generateSlug(title: string, options?: SlugOptions): string;
|
|
36
|
-
/**
|
|
37
|
-
* Validates if a string is a valid slug format
|
|
38
|
-
*
|
|
39
|
-
* @param slug - The string to validate
|
|
40
|
-
* @param separator - The separator character (default: '-')
|
|
41
|
-
* @returns True if the string is a valid slug
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* isValidSlug("hello-world") // true
|
|
46
|
-
* isValidSlug("Hello World") // false
|
|
47
|
-
* isValidSlug("hello--world") // false
|
|
48
|
-
* isValidSlug("-hello-world") // false
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare function isValidSlug(slug: string, separator?: string): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Generates a unique slug by appending a numeric suffix if needed.
|
|
54
|
-
* This is a helper that can be used with a uniqueness check function.
|
|
55
|
-
*
|
|
56
|
-
* @param baseSlug - The base slug to make unique
|
|
57
|
-
* @param isUnique - Async function that checks if a slug is unique
|
|
58
|
-
* @param maxAttempts - Maximum number of suffix attempts (default: 100)
|
|
59
|
-
* @returns A unique slug
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* const checkUnique = async (slug: string) => {
|
|
64
|
-
* return !(await db.query("entries").withSlug(slug).first());
|
|
65
|
-
* };
|
|
66
|
-
* const uniqueSlug = await generateUniqueSlug("hello-world", checkUnique);
|
|
67
|
-
* // Returns "hello-world" if unique, or "hello-world-1", "hello-world-2", etc.
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare function generateUniqueSlug(baseSlug: string, isUnique: (slug: string) => Promise<boolean>, maxAttempts?: number): Promise<string>;
|
|
71
|
-
//# sourceMappingURL=slugGenerator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugGenerator.d.ts","sourceRoot":"","sources":["../../../../../../src/component/lib/slugGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AA2ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAoD7E;AAiCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,OAAO,CAW1E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAC5C,WAAW,GAAE,MAAY,GACxB,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slug Uniqueness Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides functions for checking slug uniqueness within content type scope
|
|
5
|
-
* and generating unique slugs with incremental suffixes when conflicts exist.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Options for slug uniqueness checking
|
|
9
|
-
*/
|
|
10
|
-
export interface SlugUniquenessOptions {
|
|
11
|
-
/** Maximum number of suffix attempts before falling back to timestamp (default: 100) */
|
|
12
|
-
maxAttempts?: number;
|
|
13
|
-
/** Separator character used in slugs (default: '-') */
|
|
14
|
-
separator?: string;
|
|
15
|
-
/** ID of the current entry to exclude from uniqueness check (for updates) */
|
|
16
|
-
excludeEntryId?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Result of a slug uniqueness check
|
|
20
|
-
*/
|
|
21
|
-
export interface SlugCheckResult {
|
|
22
|
-
/** Whether the slug is unique */
|
|
23
|
-
isUnique: boolean;
|
|
24
|
-
/** The existing entry ID that has this slug (if not unique) */
|
|
25
|
-
existingEntryId?: string;
|
|
26
|
-
/** Suggested alternative slug if not unique */
|
|
27
|
-
suggestedSlug?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Entry data structure for uniqueness checking
|
|
31
|
-
*/
|
|
32
|
-
export interface SlugEntry {
|
|
33
|
-
/** The entry's unique identifier */
|
|
34
|
-
_id: string;
|
|
35
|
-
/** The entry's slug */
|
|
36
|
-
slug: string;
|
|
37
|
-
/** Soft delete timestamp (null/undefined if not deleted) */
|
|
38
|
-
deletedAt?: number | null;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Function type for querying existing entries by slug within a content type
|
|
42
|
-
*/
|
|
43
|
-
export type SlugQueryFn = (slug: string) => Promise<SlugEntry | null>;
|
|
44
|
-
/**
|
|
45
|
-
* Function type for querying all entries with a slug prefix within a content type
|
|
46
|
-
* Used for finding the next available suffix number
|
|
47
|
-
*/
|
|
48
|
-
export type SlugPrefixQueryFn = (slugPrefix: string) => Promise<SlugEntry[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Checks if a slug is unique within a content type scope.
|
|
51
|
-
*
|
|
52
|
-
* @param slug - The slug to check
|
|
53
|
-
* @param queryFn - Function that queries the database for entries with the given slug
|
|
54
|
-
* @param options - Configuration options
|
|
55
|
-
* @returns Result indicating uniqueness and suggestions
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* // In a Convex mutation
|
|
60
|
-
* const queryFn = async (slug: string) => {
|
|
61
|
-
* return await ctx.db
|
|
62
|
-
* .query("contentEntries")
|
|
63
|
-
* .withIndex("by_content_type_and_slug", (q) =>
|
|
64
|
-
* q.eq("contentTypeId", contentTypeId).eq("slug", slug)
|
|
65
|
-
* )
|
|
66
|
-
* .filter((q) => q.eq(q.field("deletedAt"), undefined))
|
|
67
|
-
* .first();
|
|
68
|
-
* };
|
|
69
|
-
*
|
|
70
|
-
* const result = await checkSlugUniqueness("my-post", queryFn);
|
|
71
|
-
* if (!result.isUnique) {
|
|
72
|
-
* console.log(`Slug conflict with entry ${result.existingEntryId}`);
|
|
73
|
-
* console.log(`Suggested alternative: ${result.suggestedSlug}`);
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function checkSlugUniqueness(slug: string, queryFn: SlugQueryFn, options?: SlugUniquenessOptions): Promise<SlugCheckResult>;
|
|
78
|
-
/**
|
|
79
|
-
* Ensures a slug is unique by generating incremental suffixes if needed.
|
|
80
|
-
* This is the main function to use when creating or updating content entries.
|
|
81
|
-
*
|
|
82
|
-
* @param baseSlug - The desired slug (or title to generate slug from)
|
|
83
|
-
* @param queryFn - Function that queries the database for entries with a given slug
|
|
84
|
-
* @param options - Configuration options
|
|
85
|
-
* @returns A unique slug (either the original or with a numeric suffix)
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* // In a Convex mutation for creating a new entry
|
|
90
|
-
* const queryFn = async (slug: string) => {
|
|
91
|
-
* return await ctx.db
|
|
92
|
-
* .query("contentEntries")
|
|
93
|
-
* .withIndex("by_content_type_and_slug", (q) =>
|
|
94
|
-
* q.eq("contentTypeId", contentTypeId).eq("slug", slug)
|
|
95
|
-
* )
|
|
96
|
-
* .filter((q) => q.eq(q.field("deletedAt"), undefined))
|
|
97
|
-
* .first();
|
|
98
|
-
* };
|
|
99
|
-
*
|
|
100
|
-
* const uniqueSlug = await ensureUniqueSlug("my-post", queryFn);
|
|
101
|
-
* // Returns "my-post" if unique, or "my-post-1", "my-post-2", etc.
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
export declare function ensureUniqueSlug(baseSlug: string, queryFn: SlugQueryFn, options?: SlugUniquenessOptions): Promise<string>;
|
|
105
|
-
/**
|
|
106
|
-
* Finds the next available slug suffix by analyzing existing slugs.
|
|
107
|
-
* This is useful when you want to pre-compute the next suffix without
|
|
108
|
-
* iterating through each number.
|
|
109
|
-
*
|
|
110
|
-
* @param baseSlug - The base slug to find the next suffix for
|
|
111
|
-
* @param prefixQueryFn - Function that returns all entries with slugs starting with the base
|
|
112
|
-
* @param options - Configuration options
|
|
113
|
-
* @returns The next available slug with the appropriate suffix
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* // If entries exist with slugs: "post", "post-1", "post-2", "post-5"
|
|
118
|
-
* const nextSlug = await findNextAvailableSlug("post", queryPrefixFn);
|
|
119
|
-
* // Returns "post-3" (fills the gap)
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export declare function findNextAvailableSlug(baseSlug: string, prefixQueryFn: SlugPrefixQueryFn, options?: SlugUniquenessOptions): Promise<string>;
|
|
123
|
-
/**
|
|
124
|
-
* Validates a slug and returns validation errors if any.
|
|
125
|
-
*
|
|
126
|
-
* @param slug - The slug to validate
|
|
127
|
-
* @param separator - The separator character (default: '-')
|
|
128
|
-
* @returns Array of validation error messages (empty if valid)
|
|
129
|
-
*/
|
|
130
|
-
export declare function validateSlugFormat(slug: string, separator?: string): string[];
|
|
131
|
-
//# sourceMappingURL=slugUniqueness.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugUniqueness.d.ts","sourceRoot":"","sources":["../../../../../../src/component/lib/slugUniqueness.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,iCAAiC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,eAAe,CAAC,CA2C1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,iBAAiB,EAChC,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,MAAM,CAAC,CA0DjB;AASD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAY,GACrB,MAAM,EAAE,CA0CV"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Soft-delete utilities for CMS documents.
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe helpers for working with documents that use
|
|
5
|
-
* the soft-delete pattern (deletedAt timestamp).
|
|
6
|
-
*/
|
|
7
|
-
export interface SoftDeletable {
|
|
8
|
-
deletedAt?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function isDeleted<T extends SoftDeletable>(doc: T): boolean;
|
|
11
|
-
export declare function isActive<T extends SoftDeletable>(doc: T): boolean;
|
|
12
|
-
export declare function filterActive<T extends SoftDeletable>(docs: T[]): T[];
|
|
13
|
-
export declare function filterDeleted<T extends SoftDeletable>(docs: T[]): T[];
|
|
14
|
-
export declare function requireNotDeleted<T extends SoftDeletable>(doc: T, errorFactory: () => Error): asserts doc is T & {
|
|
15
|
-
deletedAt: undefined;
|
|
16
|
-
};
|
|
17
|
-
export declare function requireDeleted<T extends SoftDeletable>(doc: T, errorFactory: () => Error): void;
|
|
18
|
-
//# sourceMappingURL=softDelete.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"softDelete.d.ts","sourceRoot":"","sources":["../../../../../../src/component/lib/softDelete.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAElE;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,aAAa,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAEjE;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEpE;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAErE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,EACvD,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,MAAM,KAAK,GACxB,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,CAI7C;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,MAAM,KAAK,GACxB,IAAI,CAIN"}
|