@beechcms/core 0.9.5 → 0.9.7
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/LICENSE +21 -0
- package/dist/auth/login-request.d.ts +16 -0
- package/dist/auth/login-request.d.ts.map +1 -0
- package/dist/auth/login-request.js +22 -0
- package/dist/automations-grammar-words.d.ts +2 -0
- package/dist/automations-grammar-words.d.ts.map +1 -0
- package/dist/automations-grammar-words.js +8 -0
- package/dist/automations.repository.interface.d.ts +19 -0
- package/dist/automations.repository.interface.d.ts.map +1 -0
- package/dist/automations.repository.interface.js +3 -0
- package/dist/automations.runner.interface.d.ts +10 -0
- package/dist/automations.runner.interface.d.ts.map +1 -0
- package/dist/automations.runner.interface.js +3 -0
- package/dist/automations.runner.stub.d.ts +5 -0
- package/dist/automations.runner.stub.d.ts.map +1 -0
- package/dist/automations.runner.stub.js +7 -0
- package/dist/automations.types.d.ts +75 -0
- package/dist/automations.types.d.ts.map +1 -0
- package/dist/automations.types.js +3 -0
- package/dist/clock.d.ts +25 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +11 -0
- package/dist/content/content.repository.d.ts +22 -22
- package/dist/content/content.repository.d.ts.map +1 -1
- package/dist/content/retention.d.ts +13 -0
- package/dist/content/retention.d.ts.map +1 -0
- package/dist/content/retention.js +20 -0
- package/dist/content/slug-utils.d.ts +7 -0
- package/dist/content/slug-utils.d.ts.map +1 -1
- package/dist/content/slug-utils.js +12 -0
- package/dist/content-scan.repository.d.ts +9 -0
- package/dist/content-scan.repository.d.ts.map +1 -0
- package/dist/content-scan.repository.js +3 -0
- package/dist/content.repository.d.ts +247 -0
- package/dist/content.repository.d.ts.map +1 -0
- package/dist/content.repository.js +59 -0
- package/dist/dashboard-layout/dashboard-layout.d.ts +2 -2
- package/dist/dashboard-layout/dashboard-layout.d.ts.map +1 -1
- package/dist/dashboard-layout/dashboard-layout.js +3 -3
- package/dist/dashboard-layout/relation-avatar.d.ts +12 -0
- package/dist/dashboard-layout/relation-avatar.d.ts.map +1 -0
- package/dist/dashboard-layout/relation-avatar.js +18 -0
- package/dist/dashboard-layout/seed-layout.d.ts.map +1 -1
- package/dist/dashboard-layout/seed-layout.js +17 -1
- package/dist/dashboard-layout.d.ts +154 -0
- package/dist/dashboard-layout.d.ts.map +1 -0
- package/dist/dashboard-layout.js +186 -0
- package/dist/dashboard-layout.repository.d.ts +18 -0
- package/dist/dashboard-layout.repository.d.ts.map +1 -0
- package/dist/dashboard-layout.repository.js +3 -0
- package/dist/dashboard-permissions.d.ts +3 -0
- package/dist/dashboard-permissions.d.ts.map +1 -0
- package/dist/dashboard-permissions.js +11 -0
- package/dist/dashboard-scopes.d.ts +12 -0
- package/dist/dashboard-scopes.d.ts.map +1 -0
- package/dist/dashboard-scopes.js +30 -0
- package/dist/define-seed.d.ts +3 -0
- package/dist/define-seed.d.ts.map +1 -0
- package/dist/define-seed.js +5 -0
- package/dist/demo-data.repository.d.ts +5 -0
- package/dist/demo-data.repository.d.ts.map +1 -0
- package/dist/demo-data.repository.js +3 -0
- package/dist/email.provider.d.ts +32 -0
- package/dist/email.provider.d.ts.map +1 -0
- package/dist/email.provider.js +4 -0
- package/dist/engine/ddl/ddl.d.ts +4 -6
- package/dist/engine/ddl/ddl.d.ts.map +1 -1
- package/dist/engine/ddl/ddl.js +13 -27
- package/dist/engine/ddl/seed-ddl.d.ts.map +1 -1
- package/dist/engine/ddl/seed-ddl.js +10 -2
- package/dist/engine/ddl.d.ts +0 -23
- package/dist/engine/ddl.d.ts.map +1 -1
- package/dist/engine/ddl.js +3 -59
- package/dist/engine/localization.d.ts +127 -0
- package/dist/engine/localization.d.ts.map +1 -0
- package/dist/engine/localization.js +212 -0
- package/dist/engine/privacy.service.d.ts.map +1 -1
- package/dist/engine/query/active-clause.d.ts +2 -3
- package/dist/engine/query/active-clause.d.ts.map +1 -1
- package/dist/engine/query/active-clause.js +3 -4
- package/dist/engine/query/query.js +8 -8
- package/dist/engine/query/search-support.d.ts +32 -0
- package/dist/engine/query/search-support.d.ts.map +1 -0
- package/dist/engine/query/search-support.js +34 -0
- package/dist/engine/query.d.ts.map +1 -1
- package/dist/engine/query.js +0 -12
- package/dist/engine/schema-fingerprint.d.ts +2 -0
- package/dist/engine/schema-fingerprint.d.ts.map +1 -1
- package/dist/engine/schema-fingerprint.js +2 -0
- package/dist/engine/seed-ddl.d.ts +1 -4
- package/dist/engine/seed-ddl.d.ts.map +1 -1
- package/dist/engine/seed-ddl.js +2 -17
- package/dist/engine/seed-registry.d.ts.map +1 -1
- package/dist/engine/seed-types-generator.d.ts +2 -17
- package/dist/engine/seed-types-generator.d.ts.map +1 -1
- package/dist/engine/seed-types-generator.js +3 -31
- package/dist/engine/seed-validation.d.ts.map +1 -1
- package/dist/engine/seed-validation.js +0 -10
- package/dist/engine/seeds/seed-definition-diff.d.ts +1 -1
- package/dist/engine/seeds/seed-definition-diff.d.ts.map +1 -1
- package/dist/engine/seeds/seed-definition-diff.js +2 -2
- package/dist/engine/seeds/seed-validation.d.ts.map +1 -1
- package/dist/engine/seeds/seed-validation.js +3 -12
- package/dist/engine/types.d.ts +7 -7
- package/dist/engine/types.d.ts.map +1 -1
- package/dist/engine.d.ts +144 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +741 -0
- package/dist/file-types.d.ts +13 -0
- package/dist/file-types.d.ts.map +1 -0
- package/dist/file-types.js +85 -0
- package/dist/hooks.d.ts +29 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +3 -0
- package/dist/id-generator.d.ts +26 -0
- package/dist/id-generator.d.ts.map +1 -0
- package/dist/id-generator.js +12 -0
- package/dist/idempotency.repository.d.ts +13 -0
- package/dist/idempotency.repository.d.ts.map +1 -0
- package/dist/idempotency.repository.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/kanban-position.repository.d.ts +19 -0
- package/dist/kanban-position.repository.d.ts.map +1 -0
- package/dist/kanban-position.repository.js +3 -0
- package/dist/kanban.d.ts +75 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.js +82 -0
- package/dist/layout-permissions.d.ts +3 -0
- package/dist/layout-permissions.d.ts.map +1 -0
- package/dist/layout-permissions.js +11 -0
- package/dist/media.repository.d.ts +61 -0
- package/dist/media.repository.d.ts.map +1 -0
- package/dist/media.repository.js +3 -0
- package/dist/notifications/notification.repository.d.ts +6 -3
- package/dist/notifications/notification.repository.d.ts.map +1 -1
- package/dist/policies.d.ts +10 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +33 -0
- package/dist/queue.interface.d.ts +39 -0
- package/dist/queue.interface.d.ts.map +1 -0
- package/dist/queue.interface.js +3 -0
- package/dist/queue.stub.d.ts +6 -0
- package/dist/queue.stub.d.ts.map +1 -0
- package/dist/queue.stub.js +8 -0
- package/dist/relations.d.ts +28 -0
- package/dist/relations.d.ts.map +1 -0
- package/dist/relations.js +25 -0
- package/dist/richtext-render.d.ts +11 -0
- package/dist/richtext-render.d.ts.map +1 -0
- package/dist/richtext-render.js +87 -0
- package/dist/richtext.d.ts +11 -0
- package/dist/richtext.d.ts.map +1 -0
- package/dist/richtext.js +13 -0
- package/dist/scheduler.interface.d.ts +4 -0
- package/dist/scheduler.interface.d.ts.map +1 -0
- package/dist/scheduler.interface.js +3 -0
- package/dist/scheduler.stub.d.ts +5 -0
- package/dist/scheduler.stub.d.ts.map +1 -0
- package/dist/scheduler.stub.js +7 -0
- package/dist/schema-mutator.d.ts +26 -0
- package/dist/schema-mutator.d.ts.map +1 -0
- package/dist/schema-mutator.js +3 -0
- package/dist/security/time-trap.d.ts +3 -2
- package/dist/security/time-trap.d.ts.map +1 -1
- package/dist/security/time-trap.js +5 -4
- package/dist/seed-ddl-destructive.d.ts +40 -0
- package/dist/seed-ddl-destructive.d.ts.map +1 -0
- package/dist/seed-ddl-destructive.js +149 -0
- package/dist/seed-ddl.d.ts +40 -0
- package/dist/seed-ddl.d.ts.map +1 -0
- package/dist/seed-ddl.js +100 -0
- package/dist/seed-layout.d.ts +145 -0
- package/dist/seed-layout.d.ts.map +1 -0
- package/dist/seed-layout.js +192 -0
- package/dist/seed-layout.repository.d.ts +22 -0
- package/dist/seed-layout.repository.d.ts.map +1 -0
- package/dist/seed-layout.repository.js +3 -0
- package/dist/seed-registry.d.ts +71 -0
- package/dist/seed-registry.d.ts.map +1 -0
- package/dist/seed-registry.js +143 -0
- package/dist/seed-types-generator.d.ts +1 -1
- package/dist/seed-types-generator.d.ts.map +1 -1
- package/dist/seed-validation.d.ts +23 -0
- package/dist/seed-validation.d.ts.map +1 -0
- package/dist/seed-validation.js +224 -0
- package/dist/seed.repository.d.ts +37 -0
- package/dist/seed.repository.d.ts.map +1 -0
- package/dist/seed.repository.js +3 -0
- package/dist/seeds.d.ts +20 -0
- package/dist/seeds.d.ts.map +1 -0
- package/dist/seeds.js +21 -0
- package/dist/settings/site-settings.repository.d.ts +2 -0
- package/dist/settings/site-settings.repository.d.ts.map +1 -1
- package/dist/site-settings.repository.d.ts +16 -0
- package/dist/site-settings.repository.d.ts.map +1 -0
- package/dist/site-settings.repository.js +3 -0
- package/dist/slug-utils.d.ts +18 -0
- package/dist/slug-utils.d.ts.map +1 -0
- package/dist/slug-utils.js +32 -0
- package/dist/storage.d.ts +46 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +3 -0
- package/dist/types.d.ts +243 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/validation.d.ts +50 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +660 -0
- package/dist/webhook-validation.d.ts +3 -0
- package/dist/webhook-validation.d.ts.map +1 -0
- package/dist/webhook-validation.js +6 -0
- package/package.json +1 -1
- package/dist/content/content-lock.repository.d.ts +0 -63
- package/dist/content/content-lock.repository.d.ts.map +0 -1
- package/dist/content/content-lock.repository.js +0 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Flavio De Musso
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Same bounds the setup and reset-password flows enforce, so a password that can be created can log in. */
|
|
3
|
+
export declare const LOGIN_PASSWORD_MIN_LENGTH = 8;
|
|
4
|
+
export declare const LOGIN_PASSWORD_MAX_LENGTH = 128;
|
|
5
|
+
/** bcrypt silently truncates at 72 bytes; refusing longer input stops two passwords sharing a hash. */
|
|
6
|
+
export declare const LOGIN_PASSWORD_MAX_BYTES = 72;
|
|
7
|
+
/**
|
|
8
|
+
* Body of `POST /auth/login`. The single source of both the runtime check and the type the typed
|
|
9
|
+
* client sends: the output email is already trimmed and lowercased, the form it is stored in.
|
|
10
|
+
*/
|
|
11
|
+
export declare const loginRequestSchema: z.ZodObject<{
|
|
12
|
+
email: z.ZodString;
|
|
13
|
+
password: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type LoginRequest = z.input<typeof loginRequestSchema>;
|
|
16
|
+
//# sourceMappingURL=login-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-request.d.ts","sourceRoot":"","sources":["../../src/auth/login-request.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,4GAA4G;AAC5G,eAAO,MAAM,yBAAyB,IAAI,CAAA;AAC1C,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,uGAAuG;AACvG,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;iBAO7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
|
|
3
|
+
// See LICENSE in the repository root for license terms.
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { isValidAccountEmail } from './account-email.js';
|
|
6
|
+
/** Same bounds the setup and reset-password flows enforce, so a password that can be created can log in. */
|
|
7
|
+
export const LOGIN_PASSWORD_MIN_LENGTH = 8;
|
|
8
|
+
export const LOGIN_PASSWORD_MAX_LENGTH = 128;
|
|
9
|
+
/** bcrypt silently truncates at 72 bytes; refusing longer input stops two passwords sharing a hash. */
|
|
10
|
+
export const LOGIN_PASSWORD_MAX_BYTES = 72;
|
|
11
|
+
/**
|
|
12
|
+
* Body of `POST /auth/login`. The single source of both the runtime check and the type the typed
|
|
13
|
+
* client sends: the output email is already trimmed and lowercased, the form it is stored in.
|
|
14
|
+
*/
|
|
15
|
+
export const loginRequestSchema = z.object({
|
|
16
|
+
email: z.string().trim().toLowerCase().refine(isValidAccountEmail),
|
|
17
|
+
password: z
|
|
18
|
+
.string()
|
|
19
|
+
.min(LOGIN_PASSWORD_MIN_LENGTH)
|
|
20
|
+
.max(LOGIN_PASSWORD_MAX_LENGTH)
|
|
21
|
+
.refine((password) => new TextEncoder().encode(password).length <= LOGIN_PASSWORD_MAX_BYTES),
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations-grammar-words.d.ts","sourceRoot":"","sources":["../src/automations-grammar-words.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,aAKpC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export const AUTOMATION_RESERVED_WORDS = new Set([
|
|
4
|
+
'this', 'batch', 'all', 'firstone', 'lastone', 'byid', 'where',
|
|
5
|
+
'array',
|
|
6
|
+
'count', 'sum', 'avg', 'min', 'max', 'pluck',
|
|
7
|
+
'true', 'false', 'null',
|
|
8
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Automation, AutomationAction, AutomationTrigger, AutomationTriggerEvent, WhenNode } from './automations.types.js';
|
|
2
|
+
export interface CreateAutomationInput {
|
|
3
|
+
seed_slug: string;
|
|
4
|
+
name: string;
|
|
5
|
+
triggers: AutomationTrigger[];
|
|
6
|
+
trigger_conditions: WhenNode | null;
|
|
7
|
+
actions: AutomationAction[];
|
|
8
|
+
}
|
|
9
|
+
export type UpdateAutomationInput = Partial<CreateAutomationInput>;
|
|
10
|
+
export interface IAutomationRepository {
|
|
11
|
+
list(seedSlug: string): Promise<Automation[]>;
|
|
12
|
+
findById(id: string): Promise<Automation | null>;
|
|
13
|
+
create(input: CreateAutomationInput): Promise<string>;
|
|
14
|
+
update(id: string, input: UpdateAutomationInput): Promise<void>;
|
|
15
|
+
toggle(id: string, enabled: boolean): Promise<void>;
|
|
16
|
+
delete(id: string): Promise<void>;
|
|
17
|
+
findActive(seedSlug: string, event: AutomationTriggerEvent): Promise<Automation[]>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=automations.repository.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations.repository.interface.d.ts","sourceRoot":"","sources":["../src/automations.repository.interface.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAE/H,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,iBAAiB,EAAE,CAAA;IAC7B,kBAAkB,EAAE,QAAQ,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAElE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;IAChD,MAAM,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;CACnF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AutomationTriggerEvent } from './automations.types.js';
|
|
2
|
+
export interface AutomationEventPayload {
|
|
3
|
+
seedSlug: string;
|
|
4
|
+
event: AutomationTriggerEvent;
|
|
5
|
+
entry: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface IAutomationRunner {
|
|
8
|
+
run(payload: AutomationEventPayload): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=automations.runner.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations.runner.interface.d.ts","sourceRoot":"","sources":["../src/automations.runner.interface.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAEpE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IAutomationRunner, AutomationEventPayload } from './automations.runner.interface.js';
|
|
2
|
+
export declare class NoOpAutomationRunner implements IAutomationRunner {
|
|
3
|
+
run(_payload: AutomationEventPayload): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=automations.runner.stub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations.runner.stub.d.ts","sourceRoot":"","sources":["../src/automations.runner.stub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAElG,qBAAa,oBAAqB,YAAW,iBAAiB;IACtD,GAAG,CAAC,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type AutomationTriggerEvent = 'create' | 'update' | 'delete' | 'cron';
|
|
2
|
+
export interface AutomationTrigger {
|
|
3
|
+
event: AutomationTriggerEvent;
|
|
4
|
+
cron?: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface TriggerCondition {
|
|
7
|
+
field: string;
|
|
8
|
+
op: 'eq' | 'neq' | 'contains' | 'gt' | 'lt' | 'isempty' | 'isnotempty';
|
|
9
|
+
value: unknown;
|
|
10
|
+
}
|
|
11
|
+
export type WhenOperand = {
|
|
12
|
+
kind: 'literal';
|
|
13
|
+
value: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'ref';
|
|
16
|
+
key: string;
|
|
17
|
+
};
|
|
18
|
+
export type WhenOp = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'startswith' | 'endswith' | 'in' | 'notin' | 'isempty' | 'isnotempty' | 'matches';
|
|
19
|
+
export interface WhenPredicate {
|
|
20
|
+
kind: 'predicate';
|
|
21
|
+
left: WhenOperand;
|
|
22
|
+
op: WhenOp;
|
|
23
|
+
right?: WhenOperand;
|
|
24
|
+
}
|
|
25
|
+
export interface WhenGroup {
|
|
26
|
+
kind: 'group';
|
|
27
|
+
op: 'AND' | 'OR';
|
|
28
|
+
children: WhenNode[];
|
|
29
|
+
negate?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type WhenNode = WhenPredicate | WhenGroup;
|
|
32
|
+
export interface SetVariableAction {
|
|
33
|
+
type: 'set_variable';
|
|
34
|
+
name: string;
|
|
35
|
+
seed_slug?: string;
|
|
36
|
+
fixed_id?: string;
|
|
37
|
+
column?: string;
|
|
38
|
+
filters?: TriggerCondition[];
|
|
39
|
+
order_by?: string;
|
|
40
|
+
order?: 'asc' | 'desc';
|
|
41
|
+
/** @deprecated Read but ignored at runtime. Removed on next save. */
|
|
42
|
+
load_type?: 'fruit' | 'branch';
|
|
43
|
+
}
|
|
44
|
+
export type AutomationAction = {
|
|
45
|
+
type: 'webhook';
|
|
46
|
+
url: string;
|
|
47
|
+
method?: 'POST' | 'GET' | 'PUT';
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
body_template?: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'send_mail';
|
|
52
|
+
to: string;
|
|
53
|
+
subject_template: string;
|
|
54
|
+
body_template: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'edit_field';
|
|
57
|
+
field: string;
|
|
58
|
+
value: unknown;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'create_entry';
|
|
61
|
+
seed_slug: string;
|
|
62
|
+
field_map: Record<string, string>;
|
|
63
|
+
} | SetVariableAction;
|
|
64
|
+
export interface Automation {
|
|
65
|
+
id: string;
|
|
66
|
+
seed_slug: string;
|
|
67
|
+
name: string;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
triggers: AutomationTrigger[];
|
|
70
|
+
trigger_conditions: WhenNode | null;
|
|
71
|
+
actions: AutomationAction[];
|
|
72
|
+
created_at: number;
|
|
73
|
+
updated_at: number;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=automations.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations.types.d.ts","sourceRoot":"","sources":["../src/automations.types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,sBA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/**
|
|
2
|
+
* Time abstraction. Hides direct calls to {@link Date.now} so callers can
|
|
3
|
+
* swap in deterministic clocks during tests without resorting to global
|
|
4
|
+
* timer mocks (e.g. vi.useFakeTimers, sinon, monkey-patching Date).
|
|
5
|
+
*/
|
|
6
|
+
export interface IClock {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the current Unix timestamp in milliseconds.
|
|
9
|
+
* Equivalent to Date.now() in production.
|
|
10
|
+
* Overridable in tests for deterministic time-sensitive assertions.
|
|
11
|
+
*/
|
|
12
|
+
now(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the current Unix timestamp in whole seconds.
|
|
15
|
+
* Equivalent to Math.floor(Date.now() / 1000) in production.
|
|
16
|
+
* Used by JWT issuance, session expiry, and analytics day-bucket computations.
|
|
17
|
+
*/
|
|
18
|
+
nowSeconds(): number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Production singleton. Delegates to the host runtime clock. Stateless and
|
|
22
|
+
* therefore safe to share across requests.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SystemClock: IClock;
|
|
25
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,GAAG,IAAI,MAAM,CAAA;IAEb;;;;OAIG;IACH,UAAU,IAAI,MAAM,CAAA;CACrB;AAID;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAGzB,CAAA"}
|
package/dist/clock.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
4
|
+
/**
|
|
5
|
+
* Production singleton. Delegates to the host runtime clock. Stateless and
|
|
6
|
+
* therefore safe to share across requests.
|
|
7
|
+
*/
|
|
8
|
+
export const SystemClock = {
|
|
9
|
+
now: () => Date.now(),
|
|
10
|
+
nowSeconds: () => Math.floor(Date.now() / MILLISECONDS_PER_SECOND),
|
|
11
|
+
};
|
|
@@ -145,6 +145,15 @@ export interface RepositoryOptions {
|
|
|
145
145
|
*/
|
|
146
146
|
ifMatch?: number;
|
|
147
147
|
}
|
|
148
|
+
/** Options for `purge`. */
|
|
149
|
+
export interface PurgeOptions extends RepositoryOptions {
|
|
150
|
+
/**
|
|
151
|
+
* Which rows the purge may erase. Default `'trashed'`: an ordinary purge only ever erases an entry
|
|
152
|
+
* already in the Trash. `'any'` is reserved for ledger reconciliation, which must re-erase a row a
|
|
153
|
+
* database restore resurrected as live.
|
|
154
|
+
*/
|
|
155
|
+
trashed?: Exclude<TrashedMode, 'active'>;
|
|
156
|
+
}
|
|
148
157
|
/**
|
|
149
158
|
* Declarative multi-write operation translated into a single `db.batch` call.
|
|
150
159
|
* Used for coordinated writes across one or more seeds when D1's lack of
|
|
@@ -184,7 +193,7 @@ export type BatchWrite = {
|
|
|
184
193
|
export interface PurgeResult {
|
|
185
194
|
/** The row as it existed immediately before erasure — the source of the R2 media keys. */
|
|
186
195
|
row: Record<string, any>;
|
|
187
|
-
/** True when a ledger event was appended. False only
|
|
196
|
+
/** True when a ledger event was appended. False only when the repository has no ledger configured. */
|
|
188
197
|
ledgerWritten: boolean;
|
|
189
198
|
}
|
|
190
199
|
/** Per-id outcome of a bulk trash operation, mirroring `bulkUpdate`'s shape. */
|
|
@@ -249,14 +258,6 @@ export interface ContentRepository {
|
|
|
249
258
|
* Throws EntryConflictError if `options.ifMatch` is set and no longer matches the live row's `updated_at`.
|
|
250
259
|
*/
|
|
251
260
|
update(seed: Seed, id: string, data: Record<string, any>, status?: string, options?: RepositoryOptions): Promise<void>;
|
|
252
|
-
/**
|
|
253
|
-
* Deletes an entry from the live table.
|
|
254
|
-
* Returns the deleted row data (useful for media cleanup).
|
|
255
|
-
* Throws EntryNotFoundError if the ID does not exist.
|
|
256
|
-
*/
|
|
257
|
-
delete(seed: Seed, id: string, options?: RepositoryOptions): Promise<{
|
|
258
|
-
row: Record<string, any>;
|
|
259
|
-
}>;
|
|
260
261
|
/**
|
|
261
262
|
* Atomically increments/decrements a numeric field with optional min/max guards.
|
|
262
263
|
* Bypasses document-level lifecycle hooks — it's a single UPDATE statement,
|
|
@@ -350,19 +351,19 @@ export interface ContentRepository {
|
|
|
350
351
|
}>;
|
|
351
352
|
/**
|
|
352
353
|
* Reversible delete: stamps `deleted_at` and returns the row as it was.
|
|
353
|
-
*
|
|
354
|
+
* Stamps `deleted_at` from the repository's `IClock` and renames the slug with `toTrashedSlug`.
|
|
355
|
+
* Runs `beforeDelete`/`afterDelete`.
|
|
354
356
|
* Leaves junction rows, `_drafts` rows and R2 media untouched — a trashed entry must be
|
|
355
357
|
* restorable whole.
|
|
356
|
-
* @throws RepositoryError if `seed.softDelete` is not true.
|
|
357
358
|
* @throws EntryNotFoundError if no live row with `id` exists.
|
|
358
359
|
*/
|
|
359
360
|
softDelete(seed: Seed, id: string, options?: RepositoryOptions): Promise<{
|
|
360
361
|
row: Record<string, any>;
|
|
361
362
|
}>;
|
|
362
363
|
/**
|
|
363
|
-
* Clears `deleted_at`. When
|
|
364
|
-
* UNIQUE constraint rejects the update; the implementation catches it
|
|
365
|
-
*
|
|
364
|
+
* Clears `deleted_at` and restores `fromTrashedSlug(slug)`. When that slug was taken by a live
|
|
365
|
+
* entry in the meantime the UNIQUE constraint rejects the update; the implementation catches it
|
|
366
|
+
* and falls back to `<original>-restored-<id8>` rather than failing the operation (feature brief §4).
|
|
366
367
|
* @returns The restored row, carrying the slug it actually ended up with.
|
|
367
368
|
* @throws EntryNotFoundError if no TRASHED row with `id` exists.
|
|
368
369
|
*/
|
|
@@ -372,12 +373,12 @@ export interface ContentRepository {
|
|
|
372
373
|
/**
|
|
373
374
|
* Irreversible erasure: runs `beforeDelete`, reads the row, deletes it (junction and
|
|
374
375
|
* `_drafts` rows follow via ON DELETE CASCADE), appends the ledger event, runs `afterDelete`.
|
|
375
|
-
*
|
|
376
|
+
* Only erases a trashed row unless `PurgeOptions.trashed` is `'any'`.
|
|
376
377
|
* R2 media deletion is NOT performed here — the caller owns it (VSA: no external I/O in the
|
|
377
378
|
* repository beyond the ledger port).
|
|
378
|
-
* @throws EntryNotFoundError if no row with `id` exists.
|
|
379
|
+
* @throws EntryNotFoundError if no row matching the `PurgeOptions.trashed` mode with `id` exists.
|
|
379
380
|
*/
|
|
380
|
-
purge(seed: Seed, id: string, options?:
|
|
381
|
+
purge(seed: Seed, id: string, options?: PurgeOptions): Promise<PurgeResult>;
|
|
381
382
|
/** `restore` applied per id. Never partially fails the batch: each id reports its own outcome. */
|
|
382
383
|
bulkRestore(seed: Seed, ids: string[], options?: RepositoryOptions): Promise<BulkDeleteResult>;
|
|
383
384
|
/**
|
|
@@ -388,11 +389,10 @@ export interface ContentRepository {
|
|
|
388
389
|
}>;
|
|
389
390
|
/**
|
|
390
391
|
* Pure query, no side effects: ids of trashed entries whose retention window has elapsed
|
|
391
|
-
* (`deleted_at +
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* (feature brief §2). `now` is supplied by the caller's `IClock`; never read the clock here.
|
|
392
|
+
* (`deleted_at + retentionDays * 86400 <= now`), oldest deletion first, at most `limit`.
|
|
393
|
+
* `retentionDays` is the EFFECTIVE value (`resolveRetentionDays`); `0` = never purge → [] without querying.
|
|
394
|
+
* `now` is unix seconds supplied by the caller's `IClock`; never read the clock here.
|
|
395
395
|
*/
|
|
396
|
-
findExpiredByRetention(seed: Seed, now: number, limit: number): Promise<string[]>;
|
|
396
|
+
findExpiredByRetention(seed: Seed, retentionDays: number, now: number, limit: number): Promise<string[]>;
|
|
397
397
|
}
|
|
398
398
|
//# sourceMappingURL=content.repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.repository.d.ts","sourceRoot":"","sources":["../../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MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAC,CAAA;IAEnG;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAE3E,kGAAkG;IAClG,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE9F;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CACxE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,CACnD,CAAA;IAED;;;;;OAKG;IACH,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CACzG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Seed } from '../engine/types.js';
|
|
2
|
+
/** Global Trash retention when the setting was never configured (feature brief §2). */
|
|
3
|
+
export declare const DEFAULT_TRASH_RETENTION_DAYS = 14;
|
|
4
|
+
/** Upper bound for any retention value: ~100 years. Keeps `days * 86400` far inside safe-integer range. */
|
|
5
|
+
export declare const MAX_RETENTION_DAYS = 36500;
|
|
6
|
+
/** True for an integer in [0, MAX_RETENTION_DAYS]. `0` means "never purge". Rejects NaN, floats, strings, null. */
|
|
7
|
+
export declare function isValidRetentionDays(value: unknown): value is number;
|
|
8
|
+
/**
|
|
9
|
+
* Effective retention for one seed: the seed's own `retentionDays` when it is a number (including 0),
|
|
10
|
+
* otherwise `globalRetentionDays`. `0` = never purge. Pure; never throws.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveRetentionDays(seed: Pick<Seed, 'retentionDays'>, globalRetentionDays: number): number;
|
|
13
|
+
//# sourceMappingURL=retention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/content/retention.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE9C,uFAAuF;AACvF,eAAO,MAAM,4BAA4B,KAAK,CAAA;AAE9C,2GAA2G;AAC3G,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC,mHAAmH;AACnH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAKpE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE3G"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
/** Global Trash retention when the setting was never configured (feature brief §2). */
|
|
4
|
+
export const DEFAULT_TRASH_RETENTION_DAYS = 14;
|
|
5
|
+
/** Upper bound for any retention value: ~100 years. Keeps `days * 86400` far inside safe-integer range. */
|
|
6
|
+
export const MAX_RETENTION_DAYS = 36500;
|
|
7
|
+
/** True for an integer in [0, MAX_RETENTION_DAYS]. `0` means "never purge". Rejects NaN, floats, strings, null. */
|
|
8
|
+
export function isValidRetentionDays(value) {
|
|
9
|
+
return typeof value === 'number'
|
|
10
|
+
&& Number.isInteger(value)
|
|
11
|
+
&& value >= 0
|
|
12
|
+
&& value <= MAX_RETENTION_DAYS;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Effective retention for one seed: the seed's own `retentionDays` when it is a number (including 0),
|
|
16
|
+
* otherwise `globalRetentionDays`. `0` = never purge. Pure; never throws.
|
|
17
|
+
*/
|
|
18
|
+
export function resolveRetentionDays(seed, globalRetentionDays) {
|
|
19
|
+
return typeof seed.retentionDays === 'number' ? seed.retentionDays : globalRetentionDays;
|
|
20
|
+
}
|
|
@@ -5,8 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Converte una stringa in uno slug URL-safe.
|
|
7
7
|
* Limita la lunghezza a 15 caratteri come richiesto.
|
|
8
|
+
* Never emits `_`, so a live slug can never carry `TRASHED_SLUG_INFIX`.
|
|
8
9
|
*/
|
|
9
10
|
export declare function slugify(value: string): string;
|
|
11
|
+
/** Separator between an entry's slug and its deletion timestamp while it sits in the Trash. */
|
|
12
|
+
export declare const TRASHED_SLUG_INFIX = "_old_";
|
|
13
|
+
/** `<slug>_old_<deletedAtMs>`, lower-cased. Frees the slug for reuse under any UNIQUE constraint. */
|
|
14
|
+
export declare function toTrashedSlug(slug: string, deletedAtMs: number): string;
|
|
15
|
+
/** Inverse of toTrashedSlug: strips a trailing `_old_<digits>`; returns the input unchanged when absent. */
|
|
16
|
+
export declare function fromTrashedSlug(slug: string): string;
|
|
10
17
|
/**
|
|
11
18
|
* Genera uno slug da un input (es. titolo o nome) o un fallback UUID.
|
|
12
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug-utils.d.ts","sourceRoot":"","sources":["../../src/content/slug-utils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"slug-utils.d.ts","sourceRoot":"","sources":["../../src/content/slug-utils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAU7C;AAED,+FAA+F;AAC/F,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAIzC,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CASnG"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Converte una stringa in uno slug URL-safe.
|
|
9
9
|
* Limita la lunghezza a 15 caratteri come richiesto.
|
|
10
|
+
* Never emits `_`, so a live slug can never carry `TRASHED_SLUG_INFIX`.
|
|
10
11
|
*/
|
|
11
12
|
export function slugify(value) {
|
|
12
13
|
return value
|
|
@@ -19,6 +20,17 @@ export function slugify(value) {
|
|
|
19
20
|
.slice(0, 15) // Limita a 15 caratteri
|
|
20
21
|
.replace(/-+$/g, ''); // Rimuove trattini rimasti alla fine dopo il taglio
|
|
21
22
|
}
|
|
23
|
+
/** Separator between an entry's slug and its deletion timestamp while it sits in the Trash. */
|
|
24
|
+
export const TRASHED_SLUG_INFIX = '_old_';
|
|
25
|
+
const TRASHED_SLUG_SUFFIX = new RegExp(`${TRASHED_SLUG_INFIX}\\d+$`);
|
|
26
|
+
/** `<slug>_old_<deletedAtMs>`, lower-cased. Frees the slug for reuse under any UNIQUE constraint. */
|
|
27
|
+
export function toTrashedSlug(slug, deletedAtMs) {
|
|
28
|
+
return `${slug.toLowerCase()}${TRASHED_SLUG_INFIX}${deletedAtMs}`;
|
|
29
|
+
}
|
|
30
|
+
/** Inverse of toTrashedSlug: strips a trailing `_old_<digits>`; returns the input unchanged when absent. */
|
|
31
|
+
export function fromTrashedSlug(slug) {
|
|
32
|
+
return slug.replace(TRASHED_SLUG_SUFFIX, '');
|
|
33
|
+
}
|
|
22
34
|
/**
|
|
23
35
|
* Genera uno slug da un input (es. titolo o nome) o un fallback UUID.
|
|
24
36
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Seed } from './types.js';
|
|
2
|
+
export interface IContentScanRepository {
|
|
3
|
+
/**
|
|
4
|
+
* Scans across all registered seeds to identify media keys that are currently referenced
|
|
5
|
+
* by any content entry. Used for orphaned media detection and storage analytics.
|
|
6
|
+
*/
|
|
7
|
+
getReferencedMediaKeys(seeds: Seed[]): Promise<Set<string>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=content-scan.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-scan.repository.d.ts","sourceRoot":"","sources":["../src/content-scan.repository.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,sBAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;CAC5D"}
|