adula 2.1.0 → 2.3.0
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/README.md +149 -18
- package/build/agent/AGENTS.template.md +4 -4
- package/build/agent/capabilities.md +22 -12
- package/build/agent/skills/adula-frontend-design/SKILL.md +6 -4
- package/build/agent/skills/idea-review/SKILL.md +2 -2
- package/build/commands/adula_assistant_prune.d.ts +10 -0
- package/build/commands/adula_assistant_prune.js +12 -0
- package/build/commands/adula_outbox.d.ts +10 -0
- package/build/commands/adula_outbox.js +11 -0
- package/build/commands/adula_restore_reconcile.d.ts +10 -0
- package/build/commands/adula_restore_reconcile.js +34 -0
- package/build/commands/adula_runtime_health.d.ts +10 -0
- package/build/commands/adula_runtime_health.js +27 -0
- package/build/commands/adula_uploads_prune.d.ts +10 -0
- package/build/commands/adula_uploads_prune.js +16 -0
- package/build/commands/app.d.ts +10 -0
- package/build/commands/app.js +64 -0
- package/build/commands/backup_create.d.ts +11 -0
- package/build/commands/backup_create.js +99 -0
- package/build/commands/backup_open.d.ts +16 -0
- package/build/commands/backup_open.js +48 -0
- package/build/commands/backup_restore_files.d.ts +11 -0
- package/build/commands/backup_restore_files.js +44 -0
- package/build/commands/backup_restore_test.d.ts +12 -0
- package/build/commands/backup_restore_test.js +188 -0
- package/build/commands/backup_seal.d.ts +12 -0
- package/build/commands/backup_seal.js +36 -0
- package/build/commands/backup_services.d.ts +33 -0
- package/build/commands/backup_services.js +6 -0
- package/build/commands/backup_verify.d.ts +9 -0
- package/build/commands/backup_verify.js +59 -0
- package/build/commands/backup_verify_snapshot.d.ts +10 -0
- package/build/commands/backup_verify_snapshot.js +37 -0
- package/build/commands/client.d.ts +16 -0
- package/build/commands/client.js +71 -0
- package/build/commands/doctor.js +21 -1
- package/build/commands/install.d.ts +8 -0
- package/build/commands/install.js +69 -45
- package/build/commands/main.d.ts +3 -2
- package/build/commands/main.js +32 -0
- package/build/commands/module_add.js +4 -20
- package/build/commands/resource.d.ts +2 -0
- package/build/commands/resource.js +12 -3
- package/build/commands/resource_migration.d.ts +15 -0
- package/build/commands/resource_migration.js +81 -0
- package/build/commands/resource_snapshot.d.ts +2 -0
- package/build/commands/resource_snapshot.js +21 -4
- package/build/commands/sla_evaluate.d.ts +14 -0
- package/build/commands/sla_evaluate.js +16 -0
- package/build/commands/ui.js +4 -2
- package/build/commands/ui_css.d.ts +9 -0
- package/build/commands/ui_css.js +19 -0
- package/build/commands/upgrade.d.ts +1 -1
- package/build/commands/upgrade.js +1 -1
- package/build/configure.js +1 -1
- package/build/database/migrations/1770000000020_two_factor.d.ts +5 -0
- package/build/database/migrations/1770000000020_two_factor.js +10 -0
- package/build/database/migrations/1770000000041_import_modes.d.ts +5 -0
- package/build/database/migrations/1770000000041_import_modes.js +10 -0
- package/build/database/migrations/1770000000042_sync_jobs.d.ts +5 -0
- package/build/database/migrations/1770000000042_sync_jobs.js +10 -0
- package/build/database/migrations/1770000000043_notification_channels.d.ts +5 -0
- package/build/database/migrations/1770000000043_notification_channels.js +10 -0
- package/build/database/migrations/1770000000044_channel_confirmations.d.ts +5 -0
- package/build/database/migrations/1770000000044_channel_confirmations.js +10 -0
- package/build/database/migrations/1770000000045_import_leases.d.ts +5 -0
- package/build/database/migrations/1770000000045_import_leases.js +10 -0
- package/build/database/migrations/1770000000046_workflow_delegation_sla.d.ts +5 -0
- package/build/database/migrations/1770000000046_workflow_delegation_sla.js +10 -0
- package/build/database/migrations/1770000000049_print_templates.d.ts +5 -0
- package/build/database/migrations/1770000000049_print_templates.js +10 -0
- package/build/database/migrations/1770000000051_comment_notifications.d.ts +5 -0
- package/build/database/migrations/1770000000051_comment_notifications.js +10 -0
- package/build/database/migrations/1770000000054_cloud_backups.d.ts +5 -0
- package/build/database/migrations/1770000000054_cloud_backups.js +10 -0
- package/build/database/migrations/1770000000055_ai_assistant.d.ts +5 -0
- package/build/database/migrations/1770000000055_ai_assistant.js +10 -0
- package/build/database/migrations/1770000000056_appearance.d.ts +5 -0
- package/build/database/migrations/1770000000056_appearance.js +10 -0
- package/build/index.d.ts +87 -11
- package/build/index.js +50 -7
- package/build/providers/adula_provider.d.ts +2 -0
- package/build/providers/adula_provider.js +7 -0
- package/build/src/admin/contracts.js +1 -1
- package/build/src/admin/controller.d.ts +14 -1
- package/build/src/admin/controller.js +91 -13
- package/build/src/admin/errors.d.ts +32 -0
- package/build/src/admin/errors.js +63 -1
- package/build/src/admin/presentation.d.ts +21 -2
- package/build/src/admin/resource/editor.d.ts +60 -0
- package/build/src/admin/resource/editor.js +345 -0
- package/build/src/admin/resource/export.d.ts +54 -0
- package/build/src/admin/resource/export.js +262 -0
- package/build/src/admin/resource/lifecycle.d.ts +23 -0
- package/build/src/admin/resource/lifecycle.js +91 -0
- package/build/src/admin/resource/query.d.ts +111 -0
- package/build/src/admin/resource/query.js +595 -0
- package/build/src/admin/resource/read.d.ts +109 -0
- package/build/src/admin/resource/read.js +388 -0
- package/build/src/admin/resource/shared.d.ts +93 -0
- package/build/src/admin/resource/shared.js +265 -0
- package/build/src/admin/resource/trash.d.ts +10 -0
- package/build/src/admin/resource/trash.js +56 -0
- package/build/src/admin/resource/write.d.ts +57 -0
- package/build/src/admin/resource/write.js +603 -0
- package/build/src/admin/resource_service.d.ts +80 -193
- package/build/src/admin/resource_service.js +81 -1343
- package/build/src/admin/resource_tools.d.ts +111 -0
- package/build/src/admin/resource_tools.js +139 -0
- package/build/src/ai/assistant.d.ts +100 -0
- package/build/src/ai/assistant.js +487 -0
- package/build/src/ai/client.d.ts +49 -0
- package/build/src/ai/client.js +85 -0
- package/build/src/ai/prompt.d.ts +23 -0
- package/build/src/ai/prompt.js +83 -0
- package/build/src/ai/settings.d.ts +56 -0
- package/build/src/ai/settings.js +214 -0
- package/build/src/ai/usage.d.ts +16 -0
- package/build/src/ai/usage.js +33 -0
- package/build/src/appearance/appearance.d.ts +134 -0
- package/build/src/appearance/appearance.js +461 -0
- package/build/src/appearance/colors.d.ts +43 -0
- package/build/src/appearance/colors.js +99 -0
- package/build/src/appearance/logo.d.ts +32 -0
- package/build/src/appearance/logo.js +112 -0
- package/build/src/attachments/attachment_service.d.ts +46 -2
- package/build/src/attachments/attachment_service.js +96 -4
- package/build/src/auth/actor_store.d.ts +5 -1
- package/build/src/auth/actor_store.js +8 -4
- package/build/src/auth/conditions.d.ts +5 -0
- package/build/src/auth/conditions.js +26 -3
- package/build/src/auth/sql.js +17 -5
- package/build/src/auth/two_factor.d.ts +96 -0
- package/build/src/auth/two_factor.js +259 -0
- package/build/src/backups/archive.d.ts +52 -0
- package/build/src/backups/archive.js +362 -0
- package/build/src/backups/cloud_backups.d.ts +133 -0
- package/build/src/backups/cloud_backups.js +650 -0
- package/build/src/backups/doctor.d.ts +7 -0
- package/build/src/backups/doctor.js +55 -0
- package/build/src/backups/providers.d.ts +81 -0
- package/build/src/backups/providers.js +470 -0
- package/build/src/collaboration/assignments.d.ts +59 -2
- package/build/src/collaboration/assignments.js +196 -74
- package/build/src/collaboration/record_collaboration.d.ts +21 -4
- package/build/src/collaboration/record_collaboration.js +126 -51
- package/build/src/collaboration/shared.d.ts +24 -0
- package/build/src/collaboration/shared.js +34 -0
- package/build/src/commands/app_scaffold.d.ts +72 -0
- package/build/src/commands/app_scaffold.js +285 -0
- package/build/src/commands/capabilities.js +35 -9
- package/build/src/commands/doctor.d.ts +24 -2
- package/build/src/commands/doctor.js +81 -6
- package/build/src/commands/gap_report.d.ts +1 -1
- package/build/src/commands/gap_report.js +2 -2
- package/build/src/commands/generator.d.ts +37 -1
- package/build/src/commands/generator.js +61 -18
- package/build/src/commands/snapshot.d.ts +24 -13
- package/build/src/commands/snapshot.js +54 -14
- package/build/src/commands/source_markers.d.ts +10 -0
- package/build/src/commands/source_markers.js +29 -0
- package/build/src/core/activity.d.ts +2 -0
- package/build/src/core/activity.js +7 -1
- package/build/src/core/administrators.d.ts +38 -0
- package/build/src/core/administrators.js +145 -0
- package/build/src/core/avatar_image.d.ts +33 -0
- package/build/src/core/avatar_image.js +278 -0
- package/build/src/core/html_sanitizer.d.ts +20 -0
- package/build/src/core/html_sanitizer.js +261 -0
- package/build/src/core/like.d.ts +5 -0
- package/build/src/core/like.js +5 -0
- package/build/src/core/lookups.d.ts +80 -0
- package/build/src/core/lookups.js +319 -0
- package/build/src/core/mail_settings.d.ts +83 -0
- package/build/src/core/mail_settings.js +274 -0
- package/build/src/core/mail_test.d.ts +16 -0
- package/build/src/core/mail_test.js +81 -6
- package/build/src/core/message_templates.d.ts +15 -2
- package/build/src/core/message_templates.js +81 -11
- package/build/src/core/module_seed.js +2 -1
- package/build/src/core/notification_channels.d.ts +235 -0
- package/build/src/core/notification_channels.js +660 -0
- package/build/src/core/roles.js +26 -9
- package/build/src/core/saved_views.d.ts +8 -1
- package/build/src/core/saved_views.js +91 -26
- package/build/src/core/sequences.d.ts +32 -0
- package/build/src/core/sequences.js +97 -0
- package/build/src/core/settings.d.ts +5 -0
- package/build/src/core/settings.js +31 -3
- package/build/src/core/template_language.d.ts +61 -0
- package/build/src/core/template_language.js +141 -0
- package/build/src/core/ui_preferences.d.ts +10 -0
- package/build/src/core/ui_preferences.js +15 -1
- package/build/src/core/user_avatars.d.ts +79 -0
- package/build/src/core/user_avatars.js +186 -0
- package/build/src/core/user_invitations.d.ts +5 -1
- package/build/src/core/user_invitations.js +7 -1
- package/build/src/core/user_preferences.d.ts +36 -0
- package/build/src/core/user_preferences.js +125 -0
- package/build/src/core/users.d.ts +2 -0
- package/build/src/core/users.js +5 -3
- package/build/src/database/calendar_days.d.ts +19 -0
- package/build/src/database/calendar_days.js +36 -0
- package/build/src/database/schema.d.ts +201 -2
- package/build/src/database/schema.js +713 -59
- package/build/src/database/schema_diff.d.ts +70 -0
- package/build/src/database/schema_diff.js +190 -0
- package/build/src/events/record_mutation.d.ts +2 -1
- package/build/src/events/record_mutation.js +1 -0
- package/build/src/integrations/api_client.d.ts +37 -0
- package/build/src/integrations/api_client.js +567 -0
- package/build/src/integrations/import_adapters.d.ts +37 -0
- package/build/src/integrations/import_adapters.js +35 -0
- package/build/src/integrations/imports.d.ts +130 -16
- package/build/src/integrations/imports.js +434 -73
- package/build/src/integrations/openapi.d.ts +3 -1
- package/build/src/integrations/openapi.js +465 -31
- package/build/src/integrations/outbound.d.ts +94 -0
- package/build/src/integrations/outbound.js +276 -0
- package/build/src/integrations/print.d.ts +22 -1
- package/build/src/integrations/print.js +68 -22
- package/build/src/integrations/print_templates.d.ts +216 -0
- package/build/src/integrations/print_templates.js +1017 -0
- package/build/src/integrations/sync_jobs.d.ts +139 -0
- package/build/src/integrations/sync_jobs.js +416 -0
- package/build/src/integrations/webhooks.d.ts +12 -12
- package/build/src/integrations/webhooks.js +34 -43
- package/build/src/integrations/xlsx.d.ts +41 -0
- package/build/src/integrations/xlsx.js +519 -0
- package/build/src/languages/ar.d.ts +11 -0
- package/build/src/languages/ar.js +358 -0
- package/build/src/languages/ar_ui.d.ts +461 -0
- package/build/src/languages/ar_ui.js +464 -0
- package/build/src/languages/catalog.d.ts +66 -0
- package/build/src/languages/catalog.js +152 -0
- package/build/src/languages/en.d.ts +7 -0
- package/build/src/languages/en.js +352 -0
- package/build/src/languages/en_ui.d.ts +3 -0
- package/build/src/languages/en_ui.js +458 -0
- package/build/src/languages/validation.d.ts +26 -0
- package/build/src/languages/validation.js +60 -0
- package/build/src/lists/bulk_actions.d.ts +89 -0
- package/build/src/lists/bulk_actions.js +268 -0
- package/build/src/lists/dashboards.d.ts +138 -0
- package/build/src/lists/dashboards.js +290 -0
- package/build/src/mcp/tools.js +9 -104
- package/build/src/resource/define_resource.d.ts +18 -1
- package/build/src/resource/define_resource.js +212 -18
- package/build/src/resource/definition.d.ts +44 -0
- package/build/src/resource/definition.js +171 -0
- package/build/src/resource/registry.js +15 -4
- package/build/src/resource/types.d.ts +313 -16
- package/build/src/resource/values.d.ts +56 -1
- package/build/src/resource/values.js +237 -5
- package/build/src/services/settings.d.ts +2 -0
- package/build/src/services/settings.js +5 -1
- package/build/src/upgrade/legacy.js +2 -2
- package/build/src/workflows/calendar.d.ts +9 -0
- package/build/src/workflows/calendar.js +44 -0
- package/build/src/workflows/define_workflow.d.ts +48 -3
- package/build/src/workflows/define_workflow.js +57 -13
- package/build/src/workflows/delegations.d.ts +107 -0
- package/build/src/workflows/delegations.js +326 -0
- package/build/src/workflows/engine.d.ts +80 -4
- package/build/src/workflows/engine.js +466 -86
- package/build/src/workflows/sla.d.ts +15 -0
- package/build/src/workflows/sla.js +8 -0
- package/build/stubs/resource_contract.txt +12 -1
- package/package.json +9 -2
|
@@ -1,97 +1,55 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
2
|
import type { ResourceRegistry } from '../resource/registry.js';
|
|
3
|
-
import type { Action,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
filters?: Record<string, unknown>;
|
|
16
|
-
/** Role-rule style conditions ($eq, $ne, $in, $lt, $gt, $like, "$actor.id"). */
|
|
17
|
-
where?: Conditions;
|
|
18
|
-
search?: string;
|
|
19
|
-
};
|
|
20
|
-
export type AggregateRow = {
|
|
21
|
-
group: Record<string, JsonValue>;
|
|
22
|
-
count?: number;
|
|
23
|
-
sum?: Record<string, string | null>;
|
|
24
|
-
};
|
|
25
|
-
export type ListOptions = {
|
|
26
|
-
limit?: number;
|
|
27
|
-
cursor?: string;
|
|
28
|
-
search?: string;
|
|
29
|
-
sort?: string;
|
|
30
|
-
direction?: 'asc' | 'desc';
|
|
31
|
-
filters?: Record<string, unknown>;
|
|
32
|
-
/** Only records carrying this tag (see RecordCollaboration.setTags). */
|
|
33
|
-
tag?: string;
|
|
34
|
-
estimate?: boolean;
|
|
35
|
-
};
|
|
3
|
+
import type { Action, RecordData, SerializedRecord } from '../resource/types.js';
|
|
4
|
+
import type { Actor } from '../auth/ability.js';
|
|
5
|
+
import type { ResourceDescription, ResourceNavigation } from './presentation.js';
|
|
6
|
+
import type { AttachmentPreviewOptions } from '../attachments/attachment_service.js';
|
|
7
|
+
import { type CsvExport, type ExportOptions, type XlsxExport } from './resource/export.js';
|
|
8
|
+
import type { AggregateOptions, AggregateRow, ListOptions } from './resource/query.js';
|
|
9
|
+
import type { SystemSaveOptions } from './resource/write.js';
|
|
10
|
+
export { canQueryField } from './resource/shared.js';
|
|
11
|
+
export type { AggregateOptions, AggregateRow, ListOptions, ListFilterScalar, ListFilterValue, } from './resource/query.js';
|
|
12
|
+
export { EXPORT_ROW_LIMIT, guardFormula } from './resource/export.js';
|
|
13
|
+
export type { CsvExport, ExportOptions, XlsxExport } from './resource/export.js';
|
|
14
|
+
export type { SystemSaveOptions } from './resource/write.js';
|
|
36
15
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
16
|
+
* Authorized reads and writes of registered resources. The work is done by the modules
|
|
17
|
+
* under ./resource (query, read, editor, write, lifecycle); this class keeps the public
|
|
18
|
+
* surface and hands them its database and registry.
|
|
39
19
|
*/
|
|
40
|
-
export declare function canQueryField(resource: Resource, actor: Actor, ability: AdulaAbility, key: string): boolean;
|
|
41
|
-
/** Options of ResourceService.systemSave. */
|
|
42
|
-
export type SystemSaveOptions = {
|
|
43
|
-
/** The user recorded as the author: created/updated by, activity and events. */
|
|
44
|
-
actorId: number;
|
|
45
|
-
/** Write inside the module's transaction. */
|
|
46
|
-
trx?: Knex.Transaction;
|
|
47
|
-
/** Why module code wrote the record; stored with the activity entry. */
|
|
48
|
-
reason?: string;
|
|
49
|
-
/** Optimistic lock: when given, it must match the stored version. */
|
|
50
|
-
version?: number;
|
|
51
|
-
/**
|
|
52
|
-
* The person who chose the values, when module code writes a choice made by a user,
|
|
53
|
-
* such as a supervisor reassigning a record. A new value of a user field must then be
|
|
54
|
-
* eligible for them as in a user save; without it, any active member qualifies on
|
|
55
|
-
* unscoped resources.
|
|
56
|
-
*/
|
|
57
|
-
chooser?: Actor;
|
|
58
|
-
};
|
|
59
20
|
export declare class ResourceService {
|
|
60
21
|
private db;
|
|
61
22
|
private registry;
|
|
62
|
-
|
|
23
|
+
private context;
|
|
24
|
+
/** `attachments.pdfPreview: false` reports PDFs as download-only in summaries (ADR 047). */
|
|
25
|
+
constructor(db: Knex, registry: ResourceRegistry, options?: {
|
|
26
|
+
attachments?: AttachmentPreviewOptions;
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Runs work in one database transaction; pass the transaction to save(), transition(),
|
|
30
|
+
* restore() or amend() so several reads and writes commit or roll back together.
|
|
31
|
+
*/
|
|
32
|
+
transaction<T>(work: (trx: Knex.Transaction) => Promise<T>): Promise<T>;
|
|
63
33
|
/** The Arabic label of a registered resource, for notifications and titles. */
|
|
64
34
|
label(name: string): string;
|
|
65
35
|
/** Project navigation is derived from registered resources and the current actor. */
|
|
66
36
|
navigation(actor: Actor): ResourceNavigation;
|
|
67
37
|
describe(name: string, actor: Actor): ResourceDescription;
|
|
68
|
-
private permissions;
|
|
69
|
-
private normalizeValues;
|
|
70
|
-
/** Stored attachment ids become summaries for readers; copies keep policy checks on raw rows. */
|
|
71
|
-
private hydrate;
|
|
72
|
-
private hydrateOne;
|
|
73
|
-
private authorizeAction;
|
|
74
|
-
private scopedQuery;
|
|
75
|
-
private columns;
|
|
76
|
-
private find;
|
|
77
|
-
/** A live record regardless of any actor's scope, for system writes. */
|
|
78
|
-
private findAny;
|
|
79
|
-
private requireRecord;
|
|
80
38
|
/**
|
|
81
39
|
* Authorizes one record for collaboration features (comments, tags, assignments...).
|
|
82
40
|
* Scope and conditional rules apply exactly as for show/update.
|
|
83
41
|
*/
|
|
84
42
|
access(name: string, id: number, actor: Actor, action?: Action, db?: Knex): Promise<{
|
|
85
|
-
resource: Resource;
|
|
43
|
+
resource: import("../resource/types.js").Resource;
|
|
86
44
|
record: RecordData;
|
|
87
|
-
ability: AdulaAbility;
|
|
45
|
+
ability: import("../auth/ability.js").AdulaAbility;
|
|
88
46
|
}>;
|
|
89
47
|
/** Whether a (possibly other) actor may perform an action on a record; never throws for denial. */
|
|
90
48
|
permits(name: string, id: number, actor: Actor, action?: Action): Promise<boolean>;
|
|
91
49
|
list(name: string, actor: Actor, options?: ListOptions): Promise<{
|
|
92
50
|
data: SerializedRecord[];
|
|
93
51
|
permissions: {
|
|
94
|
-
[k: string]: Partial<Record<Action, boolean>>;
|
|
52
|
+
[k: string]: Partial<Record<Action | "restore", boolean>>;
|
|
95
53
|
};
|
|
96
54
|
meta: {
|
|
97
55
|
limit: number;
|
|
@@ -100,7 +58,6 @@ export declare class ResourceService {
|
|
|
100
58
|
};
|
|
101
59
|
related: Record<string, SerializedRecord[]>;
|
|
102
60
|
}>;
|
|
103
|
-
private canQueryField;
|
|
104
61
|
/**
|
|
105
62
|
* Counts and totals over the records the actor may view, grouped by queryable fields,
|
|
106
63
|
* for dashboards. Authorization is list()'s: the same rules, organization scope and
|
|
@@ -111,9 +68,11 @@ export declare class ResourceService {
|
|
|
111
68
|
rows: AggregateRow[];
|
|
112
69
|
truncated: boolean;
|
|
113
70
|
}>;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Tag names used on records the actor may view, at most `limit` (1-200), for tag
|
|
73
|
+
* suggestions. Authorization is list()'s: rules, organization scope and soft delete.
|
|
74
|
+
*/
|
|
75
|
+
tagNames(name: string, actor: Actor, limit?: number): Promise<string[]>;
|
|
117
76
|
/**
|
|
118
77
|
* Titles of records the actor may view, read under the actor's field access (#32).
|
|
119
78
|
* Records the actor cannot view are left out; callers fall back to the record id.
|
|
@@ -121,7 +80,7 @@ export declare class ResourceService {
|
|
|
121
80
|
titles(name: string, ids: readonly number[], actor: Actor): Promise<Map<number, string>>;
|
|
122
81
|
show(name: string, id: number, actor: Actor): Promise<{
|
|
123
82
|
data: SerializedRecord;
|
|
124
|
-
permissions: Partial<Record<Action, boolean>>;
|
|
83
|
+
permissions: Partial<Record<Action | "restore", boolean>>;
|
|
125
84
|
related: Record<string, SerializedRecord[]>;
|
|
126
85
|
}>;
|
|
127
86
|
relationOptions(name: string, key: string, actor: Actor, options?: {
|
|
@@ -139,25 +98,27 @@ export declare class ResourceService {
|
|
|
139
98
|
}[];
|
|
140
99
|
nextCursor: string | null;
|
|
141
100
|
}>;
|
|
142
|
-
/**
|
|
143
|
-
* Choices for a user field. A form lists active members of the record's unit or its
|
|
144
|
-
* ancestors (the users the record is visible to through membership); a filter lists
|
|
145
|
-
* active users who share organization scope with the actor. Only names are returned.
|
|
146
|
-
*/
|
|
147
|
-
private userOptions;
|
|
148
|
-
/**
|
|
149
|
-
* Active users eligible for a user field: members of the unit at `path` or of one of
|
|
150
|
-
* its ancestors, or (without a path) users sharing organization scope with the actor.
|
|
151
|
-
* A system write on an unscoped resource passes no actor: any active member qualifies.
|
|
152
|
-
*/
|
|
153
|
-
private eligibleUsers;
|
|
154
101
|
/** Deferred relation reads re-authorize the parent and each child on every request. */
|
|
155
102
|
children(name: string, id: number, actor: Actor): Promise<Record<string, {
|
|
156
103
|
rows: SerializedRecord[];
|
|
157
104
|
hasMore: boolean;
|
|
105
|
+
related?: Record<string, SerializedRecord[]>;
|
|
106
|
+
}>>;
|
|
107
|
+
/**
|
|
108
|
+
* The lines of a printed document (ADR 048), authorized like children(): the hasMany
|
|
109
|
+
* field's rules and level, the child's view permission and each line's scope apply,
|
|
110
|
+
* and a group is read only when the record exposes it (`serialize`, or `list` and
|
|
111
|
+
* `show`) or one of the resource's code print templates declares it. Each group holds up
|
|
112
|
+
* to `limit` rows (`hasMore` beyond) with the display rows of the lines' relations.
|
|
113
|
+
*/
|
|
114
|
+
documentLines(name: string, id: number, actor: Actor, options: {
|
|
115
|
+
fields: readonly string[];
|
|
116
|
+
limit: number;
|
|
117
|
+
}): Promise<Record<string, {
|
|
118
|
+
rows: SerializedRecord[];
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
related?: Record<string, SerializedRecord[]>;
|
|
158
121
|
}>>;
|
|
159
|
-
/** Inline children of an already authorized parent record. */
|
|
160
|
-
private childrenOf;
|
|
161
122
|
/** Active lookup labels for the lookup fields the actor may read on this resource. */
|
|
162
123
|
lookups(name: string, actor: Actor): Promise<Record<string, {
|
|
163
124
|
value: string;
|
|
@@ -170,10 +131,7 @@ export declare class ResourceService {
|
|
|
170
131
|
fields: string[];
|
|
171
132
|
actorId: number;
|
|
172
133
|
actorName: string | null;
|
|
173
|
-
|
|
174
|
-
* @deprecated Always null. Kept so project-owned copies of resource-show from
|
|
175
|
-
* earlier releases still compile; they fall back to the actor id.
|
|
176
|
-
*/
|
|
134
|
+
actorAvatarUrl: string | null;
|
|
177
135
|
actorEmail: string | null;
|
|
178
136
|
createdAt: string;
|
|
179
137
|
}[]>;
|
|
@@ -185,6 +143,7 @@ export declare class ResourceService {
|
|
|
185
143
|
children: Record<string, {
|
|
186
144
|
rows: SerializedRecord[];
|
|
187
145
|
hasMore: boolean;
|
|
146
|
+
related?: Record<string, SerializedRecord[]>;
|
|
188
147
|
}>;
|
|
189
148
|
activity: {
|
|
190
149
|
id: number;
|
|
@@ -192,22 +151,17 @@ export declare class ResourceService {
|
|
|
192
151
|
fields: string[];
|
|
193
152
|
actorId: number;
|
|
194
153
|
actorName: string | null;
|
|
195
|
-
|
|
196
|
-
* @deprecated Always null. Kept so project-owned copies of resource-show from
|
|
197
|
-
* earlier releases still compile; they fall back to the actor id.
|
|
198
|
-
*/
|
|
154
|
+
actorAvatarUrl: string | null;
|
|
199
155
|
actorEmail: string | null;
|
|
200
156
|
createdAt: string;
|
|
201
157
|
}[];
|
|
202
158
|
}>;
|
|
203
159
|
/** show(), children() and activity() of one record from a single record read. */
|
|
204
160
|
record(name: string, id: number, actor: Actor): Promise<{
|
|
205
|
-
data: SerializedRecord;
|
|
206
|
-
permissions: Partial<Record<Action, boolean>>;
|
|
207
|
-
related: Record<string, SerializedRecord[]>;
|
|
208
161
|
children: Record<string, {
|
|
209
162
|
rows: SerializedRecord[];
|
|
210
163
|
hasMore: boolean;
|
|
164
|
+
related?: Record<string, SerializedRecord[]>;
|
|
211
165
|
}>;
|
|
212
166
|
activity: {
|
|
213
167
|
id: number;
|
|
@@ -215,15 +169,14 @@ export declare class ResourceService {
|
|
|
215
169
|
fields: string[];
|
|
216
170
|
actorId: number;
|
|
217
171
|
actorName: string | null;
|
|
218
|
-
|
|
219
|
-
* @deprecated Always null. Kept so project-owned copies of resource-show from
|
|
220
|
-
* earlier releases still compile; they fall back to the actor id.
|
|
221
|
-
*/
|
|
172
|
+
actorAvatarUrl: string | null;
|
|
222
173
|
actorEmail: string | null;
|
|
223
174
|
createdAt: string;
|
|
224
175
|
}[];
|
|
176
|
+
data: SerializedRecord;
|
|
177
|
+
permissions: Partial<Record<Action | "restore", boolean>>;
|
|
178
|
+
related: Record<string, SerializedRecord[]>;
|
|
225
179
|
}>;
|
|
226
|
-
private activityOf;
|
|
227
180
|
/**
|
|
228
181
|
* The form description for create (no id) or update. `defaults` pre-fills a create form
|
|
229
182
|
* (#48), for example `?defaults[violation]=13`: only visible form fields are used, a
|
|
@@ -237,87 +190,7 @@ export declare class ResourceService {
|
|
|
237
190
|
name: string;
|
|
238
191
|
label: string;
|
|
239
192
|
recordLabel: string | null;
|
|
240
|
-
fields: (
|
|
241
|
-
label: import("../resource/types.js").Label;
|
|
242
|
-
column?: string;
|
|
243
|
-
required?: boolean;
|
|
244
|
-
unique?: boolean;
|
|
245
|
-
sortable?: boolean;
|
|
246
|
-
searchable?: boolean;
|
|
247
|
-
filterable?: boolean;
|
|
248
|
-
permissionLevel?: number;
|
|
249
|
-
sequence?: string;
|
|
250
|
-
type: "string" | "text" | "integer" | "money" | "boolean" | "date" | "datetime" | "json";
|
|
251
|
-
key: string;
|
|
252
|
-
} | {
|
|
253
|
-
label: import("../resource/types.js").Label;
|
|
254
|
-
column?: string;
|
|
255
|
-
required?: boolean;
|
|
256
|
-
unique?: boolean;
|
|
257
|
-
sortable?: boolean;
|
|
258
|
-
searchable?: boolean;
|
|
259
|
-
filterable?: boolean;
|
|
260
|
-
permissionLevel?: number;
|
|
261
|
-
sequence?: string;
|
|
262
|
-
type: "attachment";
|
|
263
|
-
accept?: string[] | "any";
|
|
264
|
-
maxSize?: string;
|
|
265
|
-
key: string;
|
|
266
|
-
} | {
|
|
267
|
-
label: import("../resource/types.js").Label;
|
|
268
|
-
column?: string;
|
|
269
|
-
required?: boolean;
|
|
270
|
-
unique?: boolean;
|
|
271
|
-
sortable?: boolean;
|
|
272
|
-
searchable?: boolean;
|
|
273
|
-
filterable?: boolean;
|
|
274
|
-
permissionLevel?: number;
|
|
275
|
-
sequence?: string;
|
|
276
|
-
type: "belongsTo";
|
|
277
|
-
resource: string;
|
|
278
|
-
key: string;
|
|
279
|
-
} | {
|
|
280
|
-
label: import("../resource/types.js").Label;
|
|
281
|
-
column?: string;
|
|
282
|
-
required?: boolean;
|
|
283
|
-
unique?: boolean;
|
|
284
|
-
sortable?: boolean;
|
|
285
|
-
searchable?: boolean;
|
|
286
|
-
filterable?: boolean;
|
|
287
|
-
permissionLevel?: number;
|
|
288
|
-
sequence?: string;
|
|
289
|
-
type: "user";
|
|
290
|
-
key: string;
|
|
291
|
-
} | {
|
|
292
|
-
label: import("../resource/types.js").Label;
|
|
293
|
-
column?: string;
|
|
294
|
-
required?: boolean;
|
|
295
|
-
unique?: boolean;
|
|
296
|
-
sortable?: boolean;
|
|
297
|
-
searchable?: boolean;
|
|
298
|
-
filterable?: boolean;
|
|
299
|
-
permissionLevel?: number;
|
|
300
|
-
sequence?: string;
|
|
301
|
-
type: "hasMany";
|
|
302
|
-
resource: string;
|
|
303
|
-
foreignKey: string;
|
|
304
|
-
inline?: boolean;
|
|
305
|
-
key: string;
|
|
306
|
-
} | {
|
|
307
|
-
label: import("../resource/types.js").Label;
|
|
308
|
-
column?: string;
|
|
309
|
-
required?: boolean;
|
|
310
|
-
unique?: boolean;
|
|
311
|
-
sortable?: boolean;
|
|
312
|
-
searchable?: boolean;
|
|
313
|
-
filterable?: boolean;
|
|
314
|
-
permissionLevel?: number;
|
|
315
|
-
sequence?: string;
|
|
316
|
-
type: "lookup";
|
|
317
|
-
group: string;
|
|
318
|
-
key: string;
|
|
319
|
-
})[];
|
|
320
|
-
/** Initial values of a create form, already checked against the actor's access. */
|
|
193
|
+
fields: import("./presentation.js").ResourceField[];
|
|
321
194
|
defaults: SerializedRecord;
|
|
322
195
|
inline: Record<string, {
|
|
323
196
|
rows: SerializedRecord[];
|
|
@@ -327,13 +200,14 @@ export declare class ResourceService {
|
|
|
327
200
|
update: boolean;
|
|
328
201
|
delete: boolean;
|
|
329
202
|
}>;
|
|
330
|
-
fields: ResourceField[];
|
|
203
|
+
fields: import("./presentation.js").ResourceField[];
|
|
331
204
|
createFields: string[];
|
|
332
205
|
updateFields: Record<string, string[]>;
|
|
333
206
|
}>;
|
|
334
207
|
options: Record<string, {
|
|
335
208
|
value: string;
|
|
336
209
|
label: string;
|
|
210
|
+
avatarUrl?: string | null;
|
|
337
211
|
}[]>;
|
|
338
212
|
relationSearch: Record<string, boolean>;
|
|
339
213
|
orgUnits: {
|
|
@@ -341,7 +215,6 @@ export declare class ResourceService {
|
|
|
341
215
|
label: string;
|
|
342
216
|
}[];
|
|
343
217
|
scoped: boolean;
|
|
344
|
-
/** The belongsTo field whose record decides the unit; the form shows no unit picker. */
|
|
345
218
|
scopeFrom: string | null;
|
|
346
219
|
record: SerializedRecord | null;
|
|
347
220
|
}>;
|
|
@@ -361,16 +234,30 @@ export declare class ResourceService {
|
|
|
361
234
|
* `updated` event, or right after moving the parent. Returns the number of moved records.
|
|
362
235
|
*/
|
|
363
236
|
rehome(parentName: string, parentId: number, options: Omit<SystemSaveOptions, 'version'>): Promise<number>;
|
|
364
|
-
private persist;
|
|
365
|
-
private requireVersion;
|
|
366
|
-
/** Inline children share the parent's draft state, organization and update authority. */
|
|
367
|
-
private requireInlineParents;
|
|
368
237
|
transition(name: string, id: number, actor: Actor, action: 'delete' | 'submit' | 'cancel', version?: unknown, transaction?: Knex.Transaction): Promise<SerializedRecord>;
|
|
238
|
+
/**
|
|
239
|
+
* Restores a soft-deleted record (ADR 046). Authorized by the actor's delete rule: its
|
|
240
|
+
* conditions and organization scope are evaluated on the deleted record (404 outside
|
|
241
|
+
* the scope or when the record is not deleted, 403 when a condition refuses). Records a
|
|
242
|
+
* `restore` activity and a `<module>.<resource>.restored` event.
|
|
243
|
+
*/
|
|
244
|
+
restore(name: string, id: number, actor: Actor, transaction?: Knex.Transaction): Promise<SerializedRecord>;
|
|
245
|
+
/**
|
|
246
|
+
* The currently filtered list as CSV (BOM, CRLF), read through list() with the same
|
|
247
|
+
* authorization, filters, search, tag and sort; columns are the list fields the actor
|
|
248
|
+
* may read, as display values. Above EXPORT_ROW_LIMIT rows it is 422 E_EXPORT_LIMIT.
|
|
249
|
+
* Every export is recorded in the activity log (`core.exports`, `exported`).
|
|
250
|
+
*/
|
|
251
|
+
export(name: string, actor: Actor, options?: ExportOptions): Promise<CsvExport>;
|
|
252
|
+
/**
|
|
253
|
+
* The same export as an Excel workbook: one right-to-left sheet with a bold header, typed
|
|
254
|
+
* numbers, amounts and dates, the same limit and an audit entry with `format: 'xlsx'`.
|
|
255
|
+
*/
|
|
256
|
+
exportXlsx(name: string, actor: Actor, options?: ExportOptions): Promise<XlsxExport>;
|
|
369
257
|
/**
|
|
370
258
|
* Amend-by-copy: a cancelled document is copied into a new draft that points to
|
|
371
259
|
* it through amended_from_id, together with its inline lines. The original stays
|
|
372
260
|
* cancelled and unchanged; sequence fields receive new numbers.
|
|
373
261
|
*/
|
|
374
262
|
amend(name: string, id: number, actor: Actor, transaction?: Knex.Transaction): Promise<SerializedRecord>;
|
|
375
|
-
private audit;
|
|
376
263
|
}
|