@dinoxx/dinox-cli 3.3.0 → 3.4.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.
@@ -24,7 +24,7 @@ import {
24
24
  toAuthorizationHeaderValue,
25
25
  withAsyncRelease,
26
26
  writeDaemonLogLine
27
- } from "./chunk-2S4U3MRS.js";
27
+ } from "./chunk-T7FAMGXX.js";
28
28
  import {
29
29
  DEFAULT_TODO_FILTER,
30
30
  TASK_STATUS_MARKDOWN_MARKER,
@@ -6545,6 +6545,203 @@ function buildJsonArrayHasValuesSql(noteAlias, field, itemAlias) {
6545
6545
  `;
6546
6546
  }
6547
6547
 
6548
+ // ../../packages/shared/src/protocol/channels.ts
6549
+ var RPC_CHANNELS = {
6550
+ codexSubscription: {
6551
+ STATE: "codex-subscription:state",
6552
+ COMMAND: "codex-subscription:command",
6553
+ CHANGED: "codex-subscription:changed"
6554
+ },
6555
+ auth: {
6556
+ SIGN_IN: "auth:sign-in",
6557
+ SIGN_UP: "auth:sign-up",
6558
+ SEND_SIGN_UP_CODE: "auth:send-sign-up-code",
6559
+ RESET_PASSWORD: "auth:reset-password",
6560
+ SEND_PASSWORD_RESET_CODE: "auth:send-password-reset-code",
6561
+ SIGN_OUT: "auth:sign-out",
6562
+ GET_SESSION: "auth:get-session",
6563
+ GET_TOKEN: "auth:get-token",
6564
+ SESSION_CHANGED: "auth:session-changed",
6565
+ UPDATE_MEMBERSHIP: "auth:update-membership",
6566
+ REPORT_UNAUTHORIZED: "auth:report-unauthorized"
6567
+ },
6568
+ ai: {
6569
+ /** Streaming chat run (request/response start; chunks pushed via CHAT_CHUNK). */
6570
+ CHAT: "ai:chat",
6571
+ /** Server → client event: streamed chat chunk. */
6572
+ CHAT_CHUNK: "ai:chat-chunk",
6573
+ /** Domain-owned editor continuation pipeline (config, retrieval, prompt, model). */
6574
+ CONTINUE_WRITING: "ai:continue-writing",
6575
+ /** Cancel retrieval and model streams for one continuation batch. */
6576
+ CANCEL_CONTINUE_WRITING: "ai:continue-writing-cancel",
6577
+ /** Server → client editor continuation candidate events. */
6578
+ CONTINUE_WRITING_EVENT: "ai:continue-writing-event",
6579
+ COMPLETE: "ai:complete",
6580
+ CANCEL: "ai:cancel",
6581
+ PROVIDER_TEST: "ai:provider-test",
6582
+ PROVIDER_MODELS: "ai:provider-models",
6583
+ /** Generate note title/tags/zettel-box proposals against backend catalogs. */
6584
+ /** Fill note property values against backend property definitions. */
6585
+ GENERATE_NOTE_PROPERTIES: "ai:generate-note-properties",
6586
+ /** Choose a property template with Jev. Abstaining returns null. */
6587
+ MATCH_NOTE_PROPERTY_TEMPLATE: "ai:match-note-property-template",
6588
+ /** Generate project-scoped, editor-anchored note review annotations. */
6589
+ GENERATE_NOTE_REVIEW: "ai:generate-note-review",
6590
+ /** Generate a replacement proposal for a live editor selection. */
6591
+ REWRITE_EDITOR_SELECTION: "ai:rewrite-editor-selection",
6592
+ /** Generate timestamp-grounded media highlights. */
6593
+ GENERATE_MEDIA_HIGHLIGHTS: "ai:generate-media-highlights",
6594
+ /** Generate typed flashcard proposals. */
6595
+ GENERATE_FLASHCARDS: "ai:generate-flashcards",
6596
+ /** Generate a title for a supported product context. */
6597
+ GENERATE_TITLE: "ai:generate-title",
6598
+ /** Generate and normalize an editable saved-view plan from natural language. */
6599
+ GENERATE_SAVED_VIEW_PLAN: "ai:generate-saved-view-plan",
6600
+ /** Generate one saved-view chart or stat from natural language (editable, not persisted). */
6601
+ GENERATE_SAVED_VIEW_ANALYTICS: "ai:generate-saved-view-analytics",
6602
+ /** Synthesize a user self-portrait suggestion from long-term memory (not persisted). */
6603
+ GENERATE_SELF_PORTRAIT: "ai:generate-self-portrait",
6604
+ /** Read-only, restricted headless diagnostics for Direct/Deferred tool selection. */
6605
+ TOOL_SELECTION_DIAGNOSTICS: "ai:tool-selection-diagnostics",
6606
+ /** Restricted snapshot-backed retrieval and production Agent evaluations. */
6607
+ AGENT_EVAL: "ai:agent-eval"
6608
+ },
6609
+ backendApi: {
6610
+ REQUEST: "backend-api:request"
6611
+ },
6612
+ bizApi: {
6613
+ REQUEST: "biz-api:request"
6614
+ },
6615
+ localLibrary: {
6616
+ /** Create a new local library (pglite-backed, main-process only). */
6617
+ CREATE: "local-library:create",
6618
+ /** List all local libraries. */
6619
+ LIST: "local-library:list",
6620
+ /** Update a local library (name/config/active). */
6621
+ UPDATE: "local-library:update",
6622
+ /** Delete a local library by id. */
6623
+ DELETE: "local-library:delete",
6624
+ /** Run an import sync for a local library. */
6625
+ SYNC: "local-library:sync",
6626
+ /** Cheap check whether the source changed since last sync. */
6627
+ DETECT_STALE: "local-library:detect-stale",
6628
+ /** List imported items for a library. */
6629
+ LIST_ITEMS: "local-library:list-items",
6630
+ /** Hybrid (full-text + vector) search across libraries. */
6631
+ SEARCH: "local-library:search",
6632
+ /** Open an imported item in its owning desktop application. */
6633
+ OPEN_ITEM: "local-library:open-item"
6634
+ },
6635
+ localOcr: {
6636
+ /** Run in-process PaddleOCR for a renderer-provided image input. */
6637
+ RECOGNIZE_IMAGE: "localOcr:recognizeImage",
6638
+ /** Reindex one uploaded image resource through local OCR + semantic fallback. */
6639
+ REINDEX_RESOURCE: "localOcr:reindexResource",
6640
+ /** Reindex uploaded image resources in a bounded background batch. */
6641
+ REINDEX_RESOURCES: "localOcr:reindexResources"
6642
+ },
6643
+ /** Delegated tasks: the user's own decisions (approve / decline) sent to the scheduler. */
6644
+ agentTask: {
6645
+ DECIDE: "agent-task:decide"
6646
+ },
6647
+ remoteDevice: {
6648
+ GET_HOST_STATUS: "remote-device:get-host-status",
6649
+ UPDATE_HOST_CONFIG: "remote-device:update-host-config"
6650
+ },
6651
+ /**
6652
+ * The desktop as a remote-device CLIENT: computer agents (`dino gateway` robots) an agent can
6653
+ * be bound to. Run control for bound agents reuses the thread-run channels.
6654
+ */
6655
+ remoteAgent: {
6656
+ /** Gateway robots (c_robot, `gw-` devices) merged with live presence. */
6657
+ LIST_DEVICES: "remote-agent:list-devices",
6658
+ /** Ask online devices to announce themselves now, then return the merged list. */
6659
+ DISCOVER: "remote-agent:discover",
6660
+ /** Push: the robot list or a device's presence changed. Payload: RemoteAgentDevicesChangedEvent. */
6661
+ DEVICES_CHANGED: "remote-agent:devices-changed",
6662
+ /** A bound agent's computer-agent choices + option catalog (cached; `refresh` asks the agent). */
6663
+ GET_RUN_CONFIG: "remote-agent:get-run-config",
6664
+ /** Saves one choice in `c_project.meta_data.runSettings` (synced to every device). */
6665
+ SET_RUN_SETTING: "remote-agent:set-run-setting",
6666
+ /** How the computer runs the agent: approval, pause, note access, folder. */
6667
+ GET_HOST_SETTINGS: "remote-agent:get-host-settings",
6668
+ UPDATE_HOST_SETTINGS: "remote-agent:update-host-settings",
6669
+ /** Folders on the computer for the working-folder picker. */
6670
+ LIST_FOLDERS: "remote-agent:list-folders",
6671
+ /** Checks / prepares a folder on the computer, then saves it as the agent's working folder. */
6672
+ SET_WORKING_FOLDER: "remote-agent:set-working-folder"
6673
+ }
6674
+ };
6675
+
6676
+ // ../../packages/shared/src/auth.ts
6677
+ import { z } from "zod";
6678
+ var AUTH_CODE_OK2 = "000000";
6679
+ var AUTH_RPC_CHANNELS = RPC_CHANNELS.auth;
6680
+ var AUTH_UNAUTHORIZED_SOURCE_SCHEMA = z.enum([
6681
+ "backend",
6682
+ "gateway",
6683
+ "powersync",
6684
+ "embedding",
6685
+ "collab",
6686
+ "renderer-api",
6687
+ "asr"
6688
+ ]);
6689
+ var AUTH_UNAUTHORIZED_REPORT_DETAILS_SCHEMA = z.object({
6690
+ status: z.number().int().min(100).max(599).optional(),
6691
+ code: z.string().trim().min(1).max(512).nullable().optional(),
6692
+ requestId: z.string().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/).nullable().optional(),
6693
+ expectedToken: z.string().min(1).max(16384).nullable().optional()
6694
+ }).strict();
6695
+ var AUTH_UNAUTHORIZED_REPORT_OBJECT_SCHEMA = AUTH_UNAUTHORIZED_REPORT_DETAILS_SCHEMA.extend({
6696
+ source: AUTH_UNAUTHORIZED_SOURCE_SCHEMA
6697
+ });
6698
+ var AUTH_UNAUTHORIZED_REPORT_SCHEMA = z.union([
6699
+ AUTH_UNAUTHORIZED_SOURCE_SCHEMA.transform((source) => ({ source })),
6700
+ AUTH_UNAUTHORIZED_REPORT_OBJECT_SCHEMA
6701
+ ]);
6702
+ var SIGN_IN_PARAM_SCHEMA = z.object({
6703
+ email: z.string().trim().min(1).max(320),
6704
+ password: z.string().min(1).max(1024)
6705
+ }).strict();
6706
+ var SIGN_UP_PARAM_SCHEMA = z.object({
6707
+ email: z.string().trim().min(1).max(320),
6708
+ password: z.string().min(6).max(1024),
6709
+ verifyCode: z.string().trim().min(1).max(64),
6710
+ username: z.string().trim().min(1).max(128)
6711
+ }).strict();
6712
+ var SEND_SIGN_UP_CODE_PARAM_SCHEMA = z.object({
6713
+ email: z.string().trim().min(1).max(320)
6714
+ }).strict();
6715
+ var RESET_PASSWORD_PARAM_SCHEMA = z.object({
6716
+ email: z.string().trim().min(1).max(320),
6717
+ password: z.string().min(6).max(1024),
6718
+ checkCode: z.string().trim().min(1).max(64)
6719
+ }).strict();
6720
+ var AUTH_MEMBERSHIP_UPDATE_SCHEMA = z.object({
6721
+ level: z.union([z.string(), z.number()]).nullable().optional(),
6722
+ expireAt: z.string().nullable().optional(),
6723
+ username: z.string().nullable().optional(),
6724
+ email: z.string().nullable().optional()
6725
+ }).strict();
6726
+
6727
+ // ../../packages/shared/src/constants/service-endpoints.ts
6728
+ var BACKEND_API_BASE_URL = "https://dinoai.chatgo.pro";
6729
+ var NOTE_SHARE_WEB_BASE_URL = "https://share.dinox.info";
6730
+ var POWERSYNC_DEFAULT_TOKEN_ENDPOINT = `${BACKEND_API_BASE_URL}/auth/v2/token`;
6731
+ var AI_SERVICE_HOST = "https://aisdk.chatgo.pro";
6732
+ var AI_SDK_API_BASE_URL = `${AI_SERVICE_HOST}/api`;
6733
+ var AI_SDK_GATEWAY_V1_BASE_URL = `${AI_SERVICE_HOST}/api/gateway/v1`;
6734
+ var AI_SDK_GATEWAY_V2_BASE_URL = `${AI_SERVICE_HOST}/api/gateway/v2`;
6735
+ var AI_SDK_MODELS_DEV_CATALOG_URL = `${AI_SERVICE_HOST}/api/model/models-dev`;
6736
+ var AI_SDK_VERSION_LIST_URL = `${AI_SERVICE_HOST}/api/version/list`;
6737
+ var AI_SDK_VERSION_LATEST_URL = `${AI_SERVICE_HOST}/api/version/latest`;
6738
+ var NATS_DEVICE_CREDENTIALS_URL = `${AI_SERVICE_HOST}/api/nats/credentials`;
6739
+ var AI_SDK_WEB_SEARCH_URL = `${AI_SERVICE_HOST}/api/openapi/web/search`;
6740
+ var AI_SDK_ASR_REALTIME_WS_URL = `${AI_SERVICE_HOST.replace(
6741
+ /^http/,
6742
+ "ws"
6743
+ )}/api/openapi/asr/realtime`;
6744
+
6548
6745
  // ../../packages/agent-contracts/src/chat-order.ts
6549
6746
  function normalizeChatOrderIndex(value) {
6550
6747
  if (typeof value === "number") {
@@ -18796,9 +18993,54 @@ function guardSave(stored, incoming, schema) {
18796
18993
  // src/commands/domain/run.ts
18797
18994
  import { ZodError } from "zod";
18798
18995
 
18799
- // ../../packages/core/src/powersync/typed-rpc/domain/note-templates.ts
18800
- import { uuidv7 } from "uuidv7";
18801
- import { z } from "zod";
18996
+ // ../../packages/powersync/child-notes.ts
18997
+ var topLevelNoteCondition = (alias) => `${alias ? `${alias}.` : ""}parent_id IS NULL`;
18998
+ function parseExtraData(raw) {
18999
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
19000
+ return { ...raw };
19001
+ }
19002
+ if (typeof raw !== "string" || !raw.trim()) return {};
19003
+ try {
19004
+ const parsed = JSON.parse(raw);
19005
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
19006
+ } catch {
19007
+ return {};
19008
+ }
19009
+ }
19010
+ function markCascadeDeleted(extraData, parentId) {
19011
+ return JSON.stringify({ ...parseExtraData(extraData), cascadeDeletedBy: parentId });
19012
+ }
19013
+
19014
+ // ../../packages/powersync/mutation-timestamps.ts
19015
+ var tableColumns = new Map(
19016
+ AppSchema.tables.map((table) => [table.name, /* @__PURE__ */ new Set(["id", ...table.columns.map((column4) => column4.name)])])
19017
+ );
19018
+ function resolveTimestamp(options2) {
19019
+ return options2?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
19020
+ }
19021
+ function parseSyncTimestampMs(value) {
19022
+ if (typeof value !== "string") {
19023
+ return null;
19024
+ }
19025
+ const trimmed = value.trim();
19026
+ if (!trimmed) {
19027
+ return null;
19028
+ }
19029
+ const parsed = Date.parse(trimmed.replace(" ", "T"));
19030
+ return Number.isNaN(parsed) ? null : parsed;
19031
+ }
19032
+ function nextMonotonicUpdatedAt(previous, options2) {
19033
+ const timestamp = resolveTimestamp(options2);
19034
+ const candidate = parseSyncTimestampMs(timestamp);
19035
+ const floor = parseSyncTimestampMs(previous);
19036
+ if (candidate == null || floor == null || candidate > floor) {
19037
+ return timestamp;
19038
+ }
19039
+ return new Date(floor + 1).toISOString();
19040
+ }
19041
+
19042
+ // ../../packages/core/src/powersync/typed-rpc/domain/note-lifecycle.ts
19043
+ import { z as z2 } from "zod";
18802
19044
 
18803
19045
  // ../../packages/core/src/powersync/typed-rpc/PowerSyncRpcDefinitions.ts
18804
19046
  function defineReadModel(definition) {
@@ -18808,6 +19050,129 @@ function defineCommand(definition) {
18808
19050
  return definition;
18809
19051
  }
18810
19052
 
19053
+ // ../../packages/core/src/powersync/typed-rpc/domain/note-lifecycle.ts
19054
+ var NOTE_TYPE_UPDATE_INPUT = z2.object({
19055
+ noteId: z2.string().trim().min(1),
19056
+ type: z2.enum(["note", "crawl"]),
19057
+ updatedAt: z2.string().trim().min(1).max(64)
19058
+ });
19059
+ var NOTE_SOFT_DELETE_INPUT = z2.object({
19060
+ noteId: z2.string().trim().min(1),
19061
+ updatedAt: z2.string().trim().min(1).max(64)
19062
+ });
19063
+ function createNoteLifecycleCommands() {
19064
+ return [
19065
+ defineCommand({
19066
+ name: "notes.updateType",
19067
+ inputSchema: NOTE_TYPE_UPDATE_INPUT,
19068
+ run: async (db, input) => {
19069
+ await updateNoteType(db, input);
19070
+ return { result: true, affectedTables: ["c_note"] };
19071
+ }
19072
+ }),
19073
+ defineCommand({
19074
+ name: "notes.softDelete",
19075
+ inputSchema: NOTE_SOFT_DELETE_INPUT,
19076
+ run: async (db, input) => {
19077
+ await softDeleteNote2(db, input);
19078
+ return { result: true, affectedTables: ["c_note"] };
19079
+ }
19080
+ })
19081
+ ];
19082
+ }
19083
+ function createNoteLifecycleReadModels() {
19084
+ return [
19085
+ defineReadModel({
19086
+ name: "notes.maxActiveTop",
19087
+ inputSchema: z2.unknown().optional(),
19088
+ tables: () => ["c_note"],
19089
+ fetch: async (db) => fetchNoteMaxActiveTop(db)
19090
+ })
19091
+ ];
19092
+ }
19093
+ async function fetchNoteMaxActiveTop(db) {
19094
+ return await db.getAll(
19095
+ `
19096
+ SELECT MAX(CAST(COALESCE(is_top, 0) AS INTEGER)) AS max_top
19097
+ FROM c_note
19098
+ WHERE is_del IS NULL OR is_del = 0
19099
+ `
19100
+ );
19101
+ }
19102
+ async function updateNoteType(db, input) {
19103
+ const noteId = input.noteId.trim();
19104
+ const updatedAt = input.updatedAt.trim();
19105
+ if (!noteId || !updatedAt) {
19106
+ throw new Error("Invalid note type update input");
19107
+ }
19108
+ await db.writeTransaction(async (tx) => {
19109
+ const row = await tx.getOptional(
19110
+ "SELECT updated_at FROM c_note WHERE id = ? AND (is_del IS NULL OR is_del = 0) LIMIT 1",
19111
+ [noteId]
19112
+ );
19113
+ if (!row) {
19114
+ throw new Error("NOTE_NOT_FOUND");
19115
+ }
19116
+ await tx.execute(
19117
+ `
19118
+ UPDATE c_note
19119
+ SET type = ?,
19120
+ updated_at = ?
19121
+ WHERE id = ?
19122
+ AND (is_del IS NULL OR is_del = 0)
19123
+ `,
19124
+ [input.type, nextMonotonicUpdatedAt(row.updated_at, { timestamp: updatedAt }), noteId]
19125
+ );
19126
+ });
19127
+ }
19128
+ async function softDeleteNote2(db, input) {
19129
+ const noteId = input.noteId.trim();
19130
+ const updatedAt = input.updatedAt.trim();
19131
+ if (!noteId || !updatedAt) {
19132
+ throw new Error("Invalid note soft delete input");
19133
+ }
19134
+ await db.writeTransaction(async (tx) => {
19135
+ const row = await tx.getOptional(
19136
+ "SELECT updated_at FROM c_note WHERE id = ? AND (is_del IS NULL OR is_del = 0) LIMIT 1",
19137
+ [noteId]
19138
+ );
19139
+ if (!row) {
19140
+ throw new Error("NOTE_NOT_FOUND");
19141
+ }
19142
+ await tx.execute(
19143
+ `
19144
+ UPDATE c_note
19145
+ SET is_del = 1,
19146
+ updated_at = ?
19147
+ WHERE id = ?
19148
+ AND (is_del IS NULL OR is_del = 0)
19149
+ `,
19150
+ [nextMonotonicUpdatedAt(row.updated_at, { timestamp: updatedAt }), noteId]
19151
+ );
19152
+ await softDeleteChildNotesOfParent(tx, noteId, updatedAt);
19153
+ });
19154
+ }
19155
+ async function softDeleteChildNotesOfParent(tx, parentId, updatedAt) {
19156
+ const children = await tx.getAll(
19157
+ "SELECT id, extra_data, updated_at FROM c_note WHERE parent_id = ? AND (is_del IS NULL OR is_del = 0)",
19158
+ [parentId]
19159
+ );
19160
+ for (const child of children) {
19161
+ await tx.execute(
19162
+ "UPDATE c_note SET is_del = 1, extra_data = ?, updated_at = ? WHERE id = ?",
19163
+ [
19164
+ markCascadeDeleted(child.extra_data, parentId),
19165
+ nextMonotonicUpdatedAt(child.updated_at, { timestamp: updatedAt }),
19166
+ child.id
19167
+ ]
19168
+ );
19169
+ }
19170
+ }
19171
+
19172
+ // ../../packages/core/src/powersync/typed-rpc/domain/note-templates.ts
19173
+ import { uuidv7 } from "uuidv7";
19174
+ import { z as z3 } from "zod";
19175
+
18811
19176
  // ../../packages/core/src/powersync/typed-rpc/sql-utils.ts
18812
19177
  function normalizeLimit(value, fallback, max) {
18813
19178
  const numeric = Number(value ?? fallback);
@@ -18827,38 +19192,38 @@ var NOTE_TEMPLATE_COLUMNS = `
18827
19192
  id, user_id, name, content, priority, is_show, extra_data, property_def,
18828
19193
  insert_at, update_at, is_del
18829
19194
  `;
18830
- var PROPERTY_KEYS_INPUT = z.array(z.string().min(1).max(64).refine(isPropertyKeyValid)).max(50);
18831
- var NOTE_TEMPLATE_CATALOG_INPUT = z.object({
18832
- userId: z.string().trim().min(1),
18833
- limit: z.number().int().positive().max(2e3).optional()
19195
+ var PROPERTY_KEYS_INPUT = z3.array(z3.string().min(1).max(64).refine(isPropertyKeyValid)).max(50);
19196
+ var NOTE_TEMPLATE_CATALOG_INPUT = z3.object({
19197
+ userId: z3.string().trim().min(1),
19198
+ limit: z3.number().int().positive().max(2e3).optional()
18834
19199
  });
18835
- var TEMPLATE_CONTENT_INPUT = z.string().max(2e5);
18836
- var NOTE_TEMPLATE_CREATE_INPUT = z.object({
18837
- userId: z.string().trim().min(1),
18838
- name: z.string().trim().min(1).max(120),
19200
+ var TEMPLATE_CONTENT_INPUT = z3.string().max(2e5);
19201
+ var NOTE_TEMPLATE_CREATE_INPUT = z3.object({
19202
+ userId: z3.string().trim().min(1),
19203
+ name: z3.string().trim().min(1).max(120),
18839
19204
  propertyKeys: PROPERTY_KEYS_INPUT,
18840
19205
  content: TEMPLATE_CONTENT_INPUT.nullable().optional(),
18841
19206
  /** Initial extra_data JSON object (e.g. the workshop's catalogOrigin); defaults to `{}`. */
18842
- extraData: z.record(z.string(), z.unknown()).nullable().optional(),
18843
- updatedAt: z.string().trim().min(1).max(64)
19207
+ extraData: z3.record(z3.string(), z3.unknown()).nullable().optional(),
19208
+ updatedAt: z3.string().trim().min(1).max(64)
18844
19209
  });
18845
- var NOTE_TEMPLATE_UPDATE_INPUT = z.object({
18846
- id: z.string().trim().min(1),
18847
- userId: z.string().trim().min(1),
18848
- name: z.string().trim().min(1).max(120).optional(),
19210
+ var NOTE_TEMPLATE_UPDATE_INPUT = z3.object({
19211
+ id: z3.string().trim().min(1),
19212
+ userId: z3.string().trim().min(1),
19213
+ name: z3.string().trim().min(1).max(120).optional(),
18849
19214
  propertyKeys: PROPERTY_KEYS_INPUT.optional(),
18850
19215
  content: TEMPLATE_CONTENT_INPUT.nullable().optional(),
18851
- updatedAt: z.string().trim().min(1).max(64)
19216
+ updatedAt: z3.string().trim().min(1).max(64)
18852
19217
  }).refine(
18853
19218
  (input) => input.name !== void 0 || input.propertyKeys !== void 0 || input.content !== void 0,
18854
19219
  {
18855
19220
  message: "At least one note-template field must be updated"
18856
19221
  }
18857
19222
  );
18858
- var NOTE_TEMPLATE_SOFT_DELETE_INPUT = z.object({
18859
- id: z.string().trim().min(1),
18860
- userId: z.string().trim().min(1),
18861
- updatedAt: z.string().trim().min(1).max(64)
19223
+ var NOTE_TEMPLATE_SOFT_DELETE_INPUT = z3.object({
19224
+ id: z3.string().trim().min(1),
19225
+ userId: z3.string().trim().min(1),
19226
+ updatedAt: z3.string().trim().min(1).max(64)
18862
19227
  });
18863
19228
  function createNoteTemplateReadModels() {
18864
19229
  return [
@@ -19048,7 +19413,7 @@ async function softDeleteNoteTemplate(db, input) {
19048
19413
  }
19049
19414
 
19050
19415
  // ../../packages/saved-views/src/saved-views.ts
19051
- import { z as z2 } from "zod";
19416
+ import { z as z4 } from "zod";
19052
19417
  var SAVED_VIEW_DISPLAY_ONLY_SYSTEM_FIELDS = [
19053
19418
  "cover",
19054
19419
  "audio",
@@ -19092,7 +19457,7 @@ function isSavedViewFieldRef(value) {
19092
19457
  function isSavedViewSelfSourceFieldRef(value) {
19093
19458
  return value === SAVED_VIEW_SELF_ID_FIELD || isSavedViewFieldRef(value);
19094
19459
  }
19095
- var savedViewFieldRefSchema = z2.custom(
19460
+ var savedViewFieldRefSchema = z4.custom(
19096
19461
  isSavedViewFieldRef,
19097
19462
  "Invalid saved view field reference"
19098
19463
  );
@@ -19192,11 +19557,11 @@ function canSortSavedViewField(field, type) {
19192
19557
  var MAX_SAVED_VIEW_FILTER_DEPTH = 8;
19193
19558
  var MAX_SAVED_VIEW_FILTER_NODES = 100;
19194
19559
  var MAX_SAVED_VIEW_FILTER_VALUE_LENGTH = 2e3;
19195
- var savedViewFilterValueSchema = z2.union([
19196
- z2.string().max(MAX_SAVED_VIEW_FILTER_VALUE_LENGTH),
19197
- z2.number(),
19198
- z2.boolean(),
19199
- z2.null()
19560
+ var savedViewFilterValueSchema = z4.union([
19561
+ z4.string().max(MAX_SAVED_VIEW_FILTER_VALUE_LENGTH),
19562
+ z4.number(),
19563
+ z4.boolean(),
19564
+ z4.null()
19200
19565
  ]);
19201
19566
  var SAVED_VIEW_VALUE_REQUIRED_OPERATORS = /* @__PURE__ */ new Set([
19202
19567
  "contains",
@@ -19239,17 +19604,17 @@ function canSavedViewSelfSourceField(field) {
19239
19604
  if (!isSavedViewFieldRef(field) || isSavedViewDisplayOnlyField(field)) return false;
19240
19605
  return field !== "sys.primary_resource_type" && field !== "sys.images";
19241
19606
  }
19242
- var savedViewSelfValueRefSchema = z2.object({
19243
- kind: z2.literal("self"),
19244
- field: z2.custom(
19607
+ var savedViewSelfValueRefSchema = z4.object({
19608
+ kind: z4.literal("self"),
19609
+ field: z4.custom(
19245
19610
  isSavedViewSelfSourceFieldRef,
19246
19611
  "Invalid saved view self source field reference"
19247
19612
  )
19248
19613
  });
19249
- var savedViewFilterConditionSchema = z2.object({
19250
- kind: z2.literal("condition"),
19614
+ var savedViewFilterConditionSchema = z4.object({
19615
+ kind: z4.literal("condition"),
19251
19616
  field: savedViewFieldRefSchema,
19252
- operator: z2.enum(SAVED_VIEW_FILTER_OPERATORS),
19617
+ operator: z4.enum(SAVED_VIEW_FILTER_OPERATORS),
19253
19618
  value: savedViewFilterValueSchema.optional(),
19254
19619
  valueRef: savedViewSelfValueRefSchema.optional()
19255
19620
  }).superRefine((condition, context) => {
@@ -19258,7 +19623,7 @@ var savedViewFilterConditionSchema = z2.object({
19258
19623
  const allowedPresence = condition.operator === "isEmpty" || condition.operator === "isNotEmpty";
19259
19624
  if (!comparesValue && !allowedPresence || comparesValue && !SAVED_VIEW_PRIMARY_RESOURCE_TYPES.some((option) => option === condition.value)) {
19260
19625
  context.addIssue({
19261
- code: z2.ZodIssueCode.custom,
19626
+ code: z4.ZodIssueCode.custom,
19262
19627
  path: ["value"],
19263
19628
  message: "Invalid primary resource type filter"
19264
19629
  });
@@ -19268,7 +19633,7 @@ var savedViewFilterConditionSchema = z2.object({
19268
19633
  const hasLiteralValue = condition.value !== void 0 && condition.value !== null;
19269
19634
  if (hasSelfValue && hasLiteralValue) {
19270
19635
  context.addIssue({
19271
- code: z2.ZodIssueCode.custom,
19636
+ code: z4.ZodIssueCode.custom,
19272
19637
  path: ["valueRef"],
19273
19638
  message: "Saved view condition cannot combine a literal value with a self value ref"
19274
19639
  });
@@ -19276,14 +19641,14 @@ var savedViewFilterConditionSchema = z2.object({
19276
19641
  if (hasSelfValue) {
19277
19642
  if (!canSavedViewFilterConditionUseSelfValue(condition.field, condition.operator)) {
19278
19643
  context.addIssue({
19279
- code: z2.ZodIssueCode.custom,
19644
+ code: z4.ZodIssueCode.custom,
19280
19645
  path: ["valueRef"],
19281
19646
  message: `Saved view operator ${condition.operator} does not accept a self value`
19282
19647
  });
19283
19648
  }
19284
19649
  if (condition.valueRef && !canSavedViewSelfSourceField(condition.valueRef.field)) {
19285
19650
  context.addIssue({
19286
- code: z2.ZodIssueCode.custom,
19651
+ code: z4.ZodIssueCode.custom,
19287
19652
  path: ["valueRef", "field"],
19288
19653
  message: `${condition.valueRef.field} cannot be used as a self filter value`
19289
19654
  });
@@ -19291,28 +19656,28 @@ var savedViewFilterConditionSchema = z2.object({
19291
19656
  }
19292
19657
  if (SAVED_VIEW_VALUE_REQUIRED_OPERATORS.has(condition.operator) && !hasSelfValue && !hasLiteralValue) {
19293
19658
  context.addIssue({
19294
- code: z2.ZodIssueCode.custom,
19659
+ code: z4.ZodIssueCode.custom,
19295
19660
  path: ["value"],
19296
19661
  message: `Saved view operator ${condition.operator} requires a value`
19297
19662
  });
19298
19663
  }
19299
19664
  if (SAVED_VIEW_VALUE_REQUIRED_OPERATORS.has(condition.operator) && !hasSelfValue && typeof condition.value === "string" && condition.value.trim().length === 0) {
19300
19665
  context.addIssue({
19301
- code: z2.ZodIssueCode.custom,
19666
+ code: z4.ZodIssueCode.custom,
19302
19667
  path: ["value"],
19303
19668
  message: `Saved view operator ${condition.operator} requires a non-empty value`
19304
19669
  });
19305
19670
  }
19306
19671
  if (SAVED_VIEW_VALUELESS_OPERATORS.has(condition.operator) && (hasLiteralValue || hasSelfValue)) {
19307
19672
  context.addIssue({
19308
- code: z2.ZodIssueCode.custom,
19673
+ code: z4.ZodIssueCode.custom,
19309
19674
  path: hasSelfValue ? ["valueRef"] : ["value"],
19310
19675
  message: `Saved view operator ${condition.operator} does not accept a value`
19311
19676
  });
19312
19677
  }
19313
19678
  if (condition.operator === "withinLastDays" && (typeof condition.value !== "number" || !Number.isInteger(condition.value) || condition.value < 1 || condition.value > MAX_SAVED_VIEW_RELATIVE_DAYS)) {
19314
19679
  context.addIssue({
19315
- code: z2.ZodIssueCode.custom,
19680
+ code: z4.ZodIssueCode.custom,
19316
19681
  path: ["value"],
19317
19682
  message: `Saved view operator withinLastDays requires an integer from 1 to ${MAX_SAVED_VIEW_RELATIVE_DAYS}`
19318
19683
  });
@@ -19346,27 +19711,27 @@ function isRawFilterNodeWithinLimits(value) {
19346
19711
  return true;
19347
19712
  }
19348
19713
  var invalidSavedViewFilterNode = { kind: "__invalid_saved_view_filter__" };
19349
- var savedViewFilterNodeSchema = z2.preprocess(
19714
+ var savedViewFilterNodeSchema = z4.preprocess(
19350
19715
  (value) => isRawFilterNodeWithinLimits(value) ? value : invalidSavedViewFilterNode,
19351
- z2.lazy(
19352
- () => z2.union([
19716
+ z4.lazy(
19717
+ () => z4.union([
19353
19718
  savedViewFilterConditionSchema,
19354
- z2.object({
19355
- kind: z2.literal("group"),
19356
- operator: z2.enum(["and", "or"]),
19357
- children: z2.array(savedViewFilterNodeSchema).max(MAX_SAVED_VIEW_FILTER_NODES)
19719
+ z4.object({
19720
+ kind: z4.literal("group"),
19721
+ operator: z4.enum(["and", "or"]),
19722
+ children: z4.array(savedViewFilterNodeSchema).max(MAX_SAVED_VIEW_FILTER_NODES)
19358
19723
  }),
19359
- z2.object({
19360
- kind: z2.literal("not"),
19724
+ z4.object({
19725
+ kind: z4.literal("not"),
19361
19726
  child: savedViewFilterNodeSchema
19362
19727
  })
19363
19728
  ])
19364
19729
  )
19365
19730
  );
19366
- var savedViewFilterGroupSchema = z2.object({
19367
- kind: z2.literal("group"),
19368
- operator: z2.enum(["and", "or"]),
19369
- children: z2.array(savedViewFilterNodeSchema).max(100)
19731
+ var savedViewFilterGroupSchema = z4.object({
19732
+ kind: z4.literal("group"),
19733
+ operator: z4.enum(["and", "or"]),
19734
+ children: z4.array(savedViewFilterNodeSchema).max(100)
19370
19735
  });
19371
19736
  function inspectSavedViewFilterNode(node, depth, state) {
19372
19737
  state.count += 1;
@@ -19492,22 +19857,22 @@ function bindDetailSavedView(view, host) {
19492
19857
  if (context.resolve(rule.field) !== rule.value) return null;
19493
19858
  return bindSavedViewFilter(view.filter, context);
19494
19859
  }
19495
- var savedViewFilterSchema = z2.object({
19496
- version: z2.union([z2.literal(1), z2.literal(2), z2.literal(3)]),
19860
+ var savedViewFilterSchema = z4.object({
19861
+ version: z4.union([z4.literal(1), z4.literal(2), z4.literal(3)]),
19497
19862
  root: savedViewFilterNodeSchema.nullable()
19498
19863
  }).superRefine((filter, context) => {
19499
19864
  const usesSelf = savedViewFilterNodeUsesSelf(filter.root);
19500
19865
  const usesDynamicDate = savedViewFilterNodeUsesDynamicDate(filter.root);
19501
19866
  if (filter.version === 1 && (usesDynamicDate || usesSelf)) {
19502
19867
  context.addIssue({
19503
- code: z2.ZodIssueCode.custom,
19868
+ code: z4.ZodIssueCode.custom,
19504
19869
  path: ["version"],
19505
19870
  message: usesSelf ? "Self filter values require saved view filter version 3" : "Dynamic date filters require saved view filter version 2"
19506
19871
  });
19507
19872
  }
19508
19873
  if (filter.version === 2 && usesSelf) {
19509
19874
  context.addIssue({
19510
- code: z2.ZodIssueCode.custom,
19875
+ code: z4.ZodIssueCode.custom,
19511
19876
  path: ["version"],
19512
19877
  message: "Self filter values require saved view filter version 3"
19513
19878
  });
@@ -19517,14 +19882,14 @@ var savedViewFilterSchema = z2.object({
19517
19882
  inspectSavedViewFilterNode(filter.root, 1, state);
19518
19883
  if (state.count > MAX_SAVED_VIEW_FILTER_NODES) {
19519
19884
  context.addIssue({
19520
- code: z2.ZodIssueCode.custom,
19885
+ code: z4.ZodIssueCode.custom,
19521
19886
  path: ["root"],
19522
19887
  message: `Saved view filters support at most ${MAX_SAVED_VIEW_FILTER_NODES} nodes`
19523
19888
  });
19524
19889
  }
19525
19890
  if (state.maxDepth > MAX_SAVED_VIEW_FILTER_DEPTH) {
19526
19891
  context.addIssue({
19527
- code: z2.ZodIssueCode.custom,
19892
+ code: z4.ZodIssueCode.custom,
19528
19893
  path: ["root"],
19529
19894
  message: `Saved view filters support at most ${MAX_SAVED_VIEW_FILTER_DEPTH} levels`
19530
19895
  });
@@ -19555,12 +19920,12 @@ var MAX_SAVED_VIEW_CHART_LIMIT = 500;
19555
19920
  var MAX_SAVED_VIEW_COMPUTED_COLUMNS = 10;
19556
19921
  var MAX_SAVED_VIEW_SUMMARY_ITEMS = 20;
19557
19922
  var MAX_SAVED_VIEW_COMPUTED_COLUMN_TITLE_LENGTH = 80;
19558
- var savedViewColumnSchema = z2.object({
19923
+ var savedViewColumnSchema = z4.object({
19559
19924
  field: savedViewFieldRefSchema
19560
19925
  });
19561
- var savedViewSortSchema = z2.object({
19926
+ var savedViewSortSchema = z4.object({
19562
19927
  field: savedViewFieldRefSchema,
19563
- direction: z2.enum(["asc", "desc"])
19928
+ direction: z4.enum(["asc", "desc"])
19564
19929
  });
19565
19930
  var SYS_DATE_FIELD_REFS = /* @__PURE__ */ new Set([
19566
19931
  "sys.created_at",
@@ -19589,13 +19954,13 @@ function canGroupSavedViewChartByField(field, type) {
19589
19954
  function canUseSavedViewChartMeasureField(field, type) {
19590
19955
  return field.startsWith("prop.") && type === "number";
19591
19956
  }
19592
- var savedViewChartDimensionSchema = z2.object({
19957
+ var savedViewChartDimensionSchema = z4.object({
19593
19958
  field: savedViewFieldRefSchema,
19594
- timeBucket: z2.enum(SAVED_VIEW_CHART_TIME_BUCKETS).optional()
19959
+ timeBucket: z4.enum(SAVED_VIEW_CHART_TIME_BUCKETS).optional()
19595
19960
  }).superRefine((dimension, context) => {
19596
19961
  if (dimension.field === "sys.primary_resource_type" || dimension.field === "sys.title" || dimension.field === "sys.images" || isSavedViewDisplayOnlyField(dimension.field)) {
19597
19962
  context.addIssue({
19598
- code: z2.ZodIssueCode.custom,
19963
+ code: z4.ZodIssueCode.custom,
19599
19964
  path: ["field"],
19600
19965
  message: `${dimension.field} cannot be used as a chart dimension`
19601
19966
  });
@@ -19604,56 +19969,56 @@ var savedViewChartDimensionSchema = z2.object({
19604
19969
  const isDate = SYS_DATE_FIELD_REFS.has(dimension.field);
19605
19970
  if (isDate && !dimension.timeBucket) {
19606
19971
  context.addIssue({
19607
- code: z2.ZodIssueCode.custom,
19972
+ code: z4.ZodIssueCode.custom,
19608
19973
  path: ["timeBucket"],
19609
19974
  message: "Date chart dimensions require a timeBucket"
19610
19975
  });
19611
19976
  }
19612
19977
  if (!isDate && dimension.timeBucket) {
19613
19978
  context.addIssue({
19614
- code: z2.ZodIssueCode.custom,
19979
+ code: z4.ZodIssueCode.custom,
19615
19980
  path: ["timeBucket"],
19616
19981
  message: "timeBucket is only allowed on date chart dimensions"
19617
19982
  });
19618
19983
  }
19619
19984
  }
19620
19985
  });
19621
- var savedViewChartBinaryExprSchema = z2.object({
19622
- op: z2.enum(SAVED_VIEW_CHART_EXPR_OPS),
19986
+ var savedViewChartBinaryExprSchema = z4.object({
19987
+ op: z4.enum(SAVED_VIEW_CHART_EXPR_OPS),
19623
19988
  left: savedViewFieldRefSchema,
19624
19989
  right: savedViewFieldRefSchema
19625
19990
  }).superRefine((expr, context) => {
19626
19991
  if (!expr.left.startsWith("prop.")) {
19627
19992
  context.addIssue({
19628
- code: z2.ZodIssueCode.custom,
19993
+ code: z4.ZodIssueCode.custom,
19629
19994
  path: ["left"],
19630
19995
  message: "Chart expressions only support number property fields on the left"
19631
19996
  });
19632
19997
  }
19633
19998
  if (!expr.right.startsWith("prop.")) {
19634
19999
  context.addIssue({
19635
- code: z2.ZodIssueCode.custom,
20000
+ code: z4.ZodIssueCode.custom,
19636
20001
  path: ["right"],
19637
20002
  message: "Chart expressions only support number property fields on the right"
19638
20003
  });
19639
20004
  }
19640
20005
  });
19641
- var savedViewChartMeasureSchema = z2.object({
20006
+ var savedViewChartMeasureSchema = z4.object({
19642
20007
  field: savedViewFieldRefSchema.nullable(),
19643
- aggregation: z2.enum(SAVED_VIEW_CHART_AGGREGATIONS),
20008
+ aggregation: z4.enum(SAVED_VIEW_CHART_AGGREGATIONS),
19644
20009
  expr: savedViewChartBinaryExprSchema.optional()
19645
20010
  }).superRefine((measure, context) => {
19646
20011
  if (measure.aggregation === "count") {
19647
20012
  if (measure.field !== null) {
19648
20013
  context.addIssue({
19649
- code: z2.ZodIssueCode.custom,
20014
+ code: z4.ZodIssueCode.custom,
19650
20015
  path: ["field"],
19651
20016
  message: "count does not accept a measure field"
19652
20017
  });
19653
20018
  }
19654
20019
  if (measure.expr) {
19655
20020
  context.addIssue({
19656
- code: z2.ZodIssueCode.custom,
20021
+ code: z4.ZodIssueCode.custom,
19657
20022
  path: ["expr"],
19658
20023
  message: "count does not accept a measure expression"
19659
20024
  });
@@ -19664,43 +20029,43 @@ var savedViewChartMeasureSchema = z2.object({
19664
20029
  const hasExpr = measure.expr !== void 0;
19665
20030
  if (hasField === hasExpr) {
19666
20031
  context.addIssue({
19667
- code: z2.ZodIssueCode.custom,
20032
+ code: z4.ZodIssueCode.custom,
19668
20033
  path: hasExpr ? ["field"] : ["expr"],
19669
20034
  message: `${measure.aggregation} requires either a measure field or an expression, not both`
19670
20035
  });
19671
20036
  }
19672
20037
  if (hasField && measure.field && !measure.field.startsWith("prop.")) {
19673
20038
  context.addIssue({
19674
- code: z2.ZodIssueCode.custom,
20039
+ code: z4.ZodIssueCode.custom,
19675
20040
  path: ["field"],
19676
20041
  message: `${measure.aggregation} only supports number property fields`
19677
20042
  });
19678
20043
  }
19679
20044
  });
19680
- var savedViewChartSchema = z2.object({
19681
- id: z2.string().trim().min(1).max(64),
19682
- title: z2.string().max(MAX_SAVED_VIEW_CHART_TITLE_LENGTH).optional(),
19683
- type: z2.enum(SAVED_VIEW_CHART_TYPES),
19684
- dimensions: z2.tuple([savedViewChartDimensionSchema]),
19685
- measures: z2.tuple([savedViewChartMeasureSchema]),
19686
- orderBy: z2.object({
19687
- by: z2.enum(["bucket", "value"]),
19688
- direction: z2.enum(["asc", "desc"])
20045
+ var savedViewChartSchema = z4.object({
20046
+ id: z4.string().trim().min(1).max(64),
20047
+ title: z4.string().max(MAX_SAVED_VIEW_CHART_TITLE_LENGTH).optional(),
20048
+ type: z4.enum(SAVED_VIEW_CHART_TYPES),
20049
+ dimensions: z4.tuple([savedViewChartDimensionSchema]),
20050
+ measures: z4.tuple([savedViewChartMeasureSchema]),
20051
+ orderBy: z4.object({
20052
+ by: z4.enum(["bucket", "value"]),
20053
+ direction: z4.enum(["asc", "desc"])
19689
20054
  }).optional(),
19690
- limit: z2.number().int().min(1).max(MAX_SAVED_VIEW_CHART_LIMIT).optional()
20055
+ limit: z4.number().int().min(1).max(MAX_SAVED_VIEW_CHART_LIMIT).optional()
19691
20056
  }).superRefine((chart, context) => {
19692
20057
  if (chart.type === "contribute" && chart.dimensions[0]?.timeBucket !== "day") {
19693
20058
  context.addIssue({
19694
- code: z2.ZodIssueCode.custom,
20059
+ code: z4.ZodIssueCode.custom,
19695
20060
  path: ["dimensions", 0, "timeBucket"],
19696
20061
  message: "contribute charts require a day timeBucket dimension"
19697
20062
  });
19698
20063
  }
19699
20064
  });
19700
- var savedViewStatSchema = z2.object({
19701
- id: z2.string().trim().min(1).max(64),
19702
- title: z2.string().max(MAX_SAVED_VIEW_STAT_TITLE_LENGTH).optional(),
19703
- unit: z2.string().trim().max(MAX_SAVED_VIEW_STAT_UNIT_LENGTH).optional(),
20065
+ var savedViewStatSchema = z4.object({
20066
+ id: z4.string().trim().min(1).max(64),
20067
+ title: z4.string().max(MAX_SAVED_VIEW_STAT_TITLE_LENGTH).optional(),
20068
+ unit: z4.string().trim().max(MAX_SAVED_VIEW_STAT_UNIT_LENGTH).optional(),
19704
20069
  measure: savedViewChartMeasureSchema
19705
20070
  });
19706
20071
  var CALC_COLUMN_KEY_PATTERN = /^calc\.[0-9A-Za-z_-]{1,64}$/;
@@ -19708,36 +20073,36 @@ function isSavedViewTableColumnKey(value) {
19708
20073
  if (isSavedViewFieldRef(value)) return true;
19709
20074
  return typeof value === "string" && CALC_COLUMN_KEY_PATTERN.test(value);
19710
20075
  }
19711
- var savedViewTableColumnKeySchema = z2.custom(
20076
+ var savedViewTableColumnKeySchema = z4.custom(
19712
20077
  isSavedViewTableColumnKey,
19713
20078
  "Invalid saved view table column key"
19714
20079
  );
19715
- var savedViewComputedColumnSchema = z2.object({
19716
- id: z2.string().trim().min(1).max(64),
19717
- title: z2.string().max(MAX_SAVED_VIEW_COMPUTED_COLUMN_TITLE_LENGTH).optional(),
20080
+ var savedViewComputedColumnSchema = z4.object({
20081
+ id: z4.string().trim().min(1).max(64),
20082
+ title: z4.string().max(MAX_SAVED_VIEW_COMPUTED_COLUMN_TITLE_LENGTH).optional(),
19718
20083
  expr: savedViewChartBinaryExprSchema
19719
20084
  });
19720
- var savedViewSummaryItemSchema = z2.object({
20085
+ var savedViewSummaryItemSchema = z4.object({
19721
20086
  column: savedViewTableColumnKeySchema,
19722
- aggregation: z2.enum(SAVED_VIEW_CHART_AGGREGATIONS)
20087
+ aggregation: z4.enum(SAVED_VIEW_CHART_AGGREGATIONS)
19723
20088
  });
19724
- var savedViewConfigSchema = z2.object({
19725
- version: z2.literal(1),
19726
- noteDetail: z2.object({
20089
+ var savedViewConfigSchema = z4.object({
20090
+ version: z4.literal(1),
20091
+ noteDetail: z4.object({
19727
20092
  field: savedViewFieldRefSchema,
19728
- value: z2.union([z2.string().min(1), z2.number().finite(), z2.boolean()])
20093
+ value: z4.union([z4.string().min(1), z4.number().finite(), z4.boolean()])
19729
20094
  }).optional(),
19730
- layout: z2.enum(SAVED_VIEW_LAYOUTS),
19731
- columns: z2.array(savedViewColumnSchema).min(1).max(100),
19732
- sort: z2.array(savedViewSortSchema).max(20).optional(),
19733
- stats: z2.array(savedViewStatSchema).max(MAX_SAVED_VIEW_STATS).optional(),
19734
- charts: z2.array(savedViewChartSchema).max(MAX_SAVED_VIEW_CHARTS).optional(),
19735
- computedColumns: z2.array(savedViewComputedColumnSchema).max(MAX_SAVED_VIEW_COMPUTED_COLUMNS).optional(),
19736
- summary: z2.array(savedViewSummaryItemSchema).max(MAX_SAVED_VIEW_SUMMARY_ITEMS).optional()
20095
+ layout: z4.enum(SAVED_VIEW_LAYOUTS),
20096
+ columns: z4.array(savedViewColumnSchema).min(1).max(100),
20097
+ sort: z4.array(savedViewSortSchema).max(20).optional(),
20098
+ stats: z4.array(savedViewStatSchema).max(MAX_SAVED_VIEW_STATS).optional(),
20099
+ charts: z4.array(savedViewChartSchema).max(MAX_SAVED_VIEW_CHARTS).optional(),
20100
+ computedColumns: z4.array(savedViewComputedColumnSchema).max(MAX_SAVED_VIEW_COMPUTED_COLUMNS).optional(),
20101
+ summary: z4.array(savedViewSummaryItemSchema).max(MAX_SAVED_VIEW_SUMMARY_ITEMS).optional()
19737
20102
  }).superRefine((config, context) => {
19738
20103
  if (config.columns[0]?.field !== "sys.title") {
19739
20104
  context.addIssue({
19740
- code: z2.ZodIssueCode.custom,
20105
+ code: z4.ZodIssueCode.custom,
19741
20106
  path: ["columns", 0, "field"],
19742
20107
  message: "The title field must be the first saved view column"
19743
20108
  });
@@ -19746,7 +20111,7 @@ var savedViewConfigSchema = z2.object({
19746
20111
  config.columns.forEach((column4, index) => {
19747
20112
  if (columnFields.has(column4.field)) {
19748
20113
  context.addIssue({
19749
- code: z2.ZodIssueCode.custom,
20114
+ code: z4.ZodIssueCode.custom,
19750
20115
  path: ["columns", index, "field"],
19751
20116
  message: "Saved view columns must be unique"
19752
20117
  });
@@ -19757,7 +20122,7 @@ var savedViewConfigSchema = z2.object({
19757
20122
  config.sort?.forEach((sort, index) => {
19758
20123
  if (sortFields.has(sort.field)) {
19759
20124
  context.addIssue({
19760
- code: z2.ZodIssueCode.custom,
20125
+ code: z4.ZodIssueCode.custom,
19761
20126
  path: ["sort", index, "field"],
19762
20127
  message: "Saved view sort fields must be unique"
19763
20128
  });
@@ -19768,7 +20133,7 @@ var savedViewConfigSchema = z2.object({
19768
20133
  config.stats?.forEach((stat, index) => {
19769
20134
  if (statIds.has(stat.id)) {
19770
20135
  context.addIssue({
19771
- code: z2.ZodIssueCode.custom,
20136
+ code: z4.ZodIssueCode.custom,
19772
20137
  path: ["stats", index, "id"],
19773
20138
  message: "Saved view stat ids must be unique"
19774
20139
  });
@@ -19779,7 +20144,7 @@ var savedViewConfigSchema = z2.object({
19779
20144
  config.charts?.forEach((chart, index) => {
19780
20145
  if (chartIds.has(chart.id)) {
19781
20146
  context.addIssue({
19782
- code: z2.ZodIssueCode.custom,
20147
+ code: z4.ZodIssueCode.custom,
19783
20148
  path: ["charts", index, "id"],
19784
20149
  message: "Saved view chart ids must be unique"
19785
20150
  });
@@ -19790,7 +20155,7 @@ var savedViewConfigSchema = z2.object({
19790
20155
  config.computedColumns?.forEach((column4, index) => {
19791
20156
  if (computedColumnIds.has(column4.id)) {
19792
20157
  context.addIssue({
19793
- code: z2.ZodIssueCode.custom,
20158
+ code: z4.ZodIssueCode.custom,
19794
20159
  path: ["computedColumns", index, "id"],
19795
20160
  message: "Saved view computed column ids must be unique"
19796
20161
  });
@@ -19801,7 +20166,7 @@ var savedViewConfigSchema = z2.object({
19801
20166
  config.summary?.forEach((item, index) => {
19802
20167
  if (summaryColumns.has(item.column)) {
19803
20168
  context.addIssue({
19804
- code: z2.ZodIssueCode.custom,
20169
+ code: z4.ZodIssueCode.custom,
19805
20170
  path: ["summary", index, "column"],
19806
20171
  message: "Saved view summary columns must be unique"
19807
20172
  });
@@ -19821,33 +20186,33 @@ function createDefaultSavedViewConfig() {
19821
20186
  };
19822
20187
  }
19823
20188
  var MAX_SAVED_VIEW_NAME_LENGTH = 120;
19824
- var generatedSavedViewPlanSchema = z2.object({
19825
- name: z2.string().trim().min(1).max(MAX_SAVED_VIEW_NAME_LENGTH),
20189
+ var generatedSavedViewPlanSchema = z4.object({
20190
+ name: z4.string().trim().min(1).max(MAX_SAVED_VIEW_NAME_LENGTH),
19826
20191
  filter: savedViewFilterSchema,
19827
20192
  config: savedViewConfigSchema
19828
20193
  });
19829
- var aiGenerateSavedViewPlanRequestSchema = z2.object({
19830
- prompt: z2.string().trim().min(1).max(4e3),
19831
- modelSelector: z2.string().trim().min(1).max(512).optional(),
19832
- locale: z2.string().trim().min(1).max(35).optional(),
19833
- timeZone: z2.string().trim().min(1).max(100).optional(),
20194
+ var aiGenerateSavedViewPlanRequestSchema = z4.object({
20195
+ prompt: z4.string().trim().min(1).max(4e3),
20196
+ modelSelector: z4.string().trim().min(1).max(512).optional(),
20197
+ locale: z4.string().trim().min(1).max(35).optional(),
20198
+ timeZone: z4.string().trim().min(1).max(100).optional(),
19834
20199
  current: generatedSavedViewPlanSchema.optional(),
19835
- embedded: z2.boolean().optional()
20200
+ embedded: z4.boolean().optional()
19836
20201
  }).strict();
19837
- var savedViewEmbedInputSchema = z2.object({
19838
- userId: z2.string().trim().min(1),
19839
- timeZone: z2.string().trim().min(1).max(100).optional(),
19840
- noteId: z2.string().trim().min(1).max(200).optional(),
19841
- viewId: z2.string().trim().min(1).max(200).optional(),
20202
+ var savedViewEmbedInputSchema = z4.object({
20203
+ userId: z4.string().trim().min(1),
20204
+ timeZone: z4.string().trim().min(1).max(100).optional(),
20205
+ noteId: z4.string().trim().min(1).max(200).optional(),
20206
+ viewId: z4.string().trim().min(1).max(200).optional(),
19842
20207
  definition: generatedSavedViewPlanSchema.optional(),
19843
- limit: z2.number().int().positive().max(100).optional()
20208
+ limit: z4.number().int().positive().max(100).optional()
19844
20209
  }).refine((input) => input.viewId === void 0 !== (input.definition === void 0), {
19845
20210
  message: "Pass exactly one of viewId and definition"
19846
20211
  });
19847
- var savedViewZettelBoxDetailsSchema = z2.array(
19848
- z2.object({
19849
- fullPath: z2.string().trim().min(1).max(1e3),
19850
- color: z2.string().trim().max(200).nullable()
20212
+ var savedViewZettelBoxDetailsSchema = z4.array(
20213
+ z4.object({
20214
+ fullPath: z4.string().trim().min(1).max(1e3),
20215
+ color: z4.string().trim().max(200).nullable()
19851
20216
  })
19852
20217
  ).max(100);
19853
20218
  function parseSavedViewZettelBoxDetails(value) {
@@ -19859,171 +20224,171 @@ function parseSavedViewZettelBoxDetails(value) {
19859
20224
  return [];
19860
20225
  }
19861
20226
  }
19862
- var nullableShortStringSchema = z2.string().trim().max(120).nullable();
19863
- var nullableIdSchema = z2.string().trim().min(1).max(200).nullable();
19864
- var nullableTimestampSchema = z2.string().trim().min(1).max(64).nullable();
19865
- var savedViewCatalogInputSchema = z2.object({
19866
- userId: z2.string().trim().min(1),
19867
- limit: z2.number().int().positive().max(5e3).optional()
20227
+ var nullableShortStringSchema = z4.string().trim().max(120).nullable();
20228
+ var nullableIdSchema = z4.string().trim().min(1).max(200).nullable();
20229
+ var nullableTimestampSchema = z4.string().trim().min(1).max(64).nullable();
20230
+ var savedViewCatalogInputSchema = z4.object({
20231
+ userId: z4.string().trim().min(1),
20232
+ limit: z4.number().int().positive().max(5e3).optional()
19868
20233
  });
19869
- var savedViewCreateInputSchema = z2.object({
19870
- userId: z2.string().trim().min(1),
19871
- name: z2.string().trim().min(1).max(120),
20234
+ var savedViewCreateInputSchema = z4.object({
20235
+ userId: z4.string().trim().min(1),
20236
+ name: z4.string().trim().min(1).max(120),
19872
20237
  emoji: nullableShortStringSchema.optional(),
19873
20238
  filter: savedViewFilterSchema,
19874
20239
  config: savedViewConfigSchema,
19875
20240
  templateId: nullableIdSchema.optional(),
19876
20241
  groupId: nullableIdSchema.optional(),
19877
- sortRank: z2.number().int().nullable().optional(),
20242
+ sortRank: z4.number().int().nullable().optional(),
19878
20243
  pinnedAt: nullableTimestampSchema.optional(),
19879
- updatedAt: z2.string().trim().min(1).max(64)
20244
+ updatedAt: z4.string().trim().min(1).max(64)
19880
20245
  });
19881
- var savedViewUpdateInputSchema = z2.object({
19882
- id: z2.string().trim().min(1),
19883
- userId: z2.string().trim().min(1),
19884
- name: z2.string().trim().min(1).max(120).optional(),
20246
+ var savedViewUpdateInputSchema = z4.object({
20247
+ id: z4.string().trim().min(1),
20248
+ userId: z4.string().trim().min(1),
20249
+ name: z4.string().trim().min(1).max(120).optional(),
19885
20250
  emoji: nullableShortStringSchema.optional(),
19886
20251
  filter: savedViewFilterSchema.optional(),
19887
20252
  config: savedViewConfigSchema.optional(),
19888
20253
  templateId: nullableIdSchema.optional(),
19889
20254
  groupId: nullableIdSchema.optional(),
19890
- sortRank: z2.number().int().nullable().optional(),
20255
+ sortRank: z4.number().int().nullable().optional(),
19891
20256
  pinnedAt: nullableTimestampSchema.optional(),
19892
- updatedAt: z2.string().trim().min(1).max(64)
20257
+ updatedAt: z4.string().trim().min(1).max(64)
19893
20258
  }).refine(
19894
20259
  (input) => input.name !== void 0 || input.emoji !== void 0 || input.filter !== void 0 || input.config !== void 0 || input.templateId !== void 0 || input.groupId !== void 0 || input.sortRank !== void 0 || input.pinnedAt !== void 0,
19895
20260
  { message: "At least one saved-view field must be updated" }
19896
20261
  );
19897
- var savedViewSoftDeleteInputSchema = z2.object({
19898
- id: z2.string().trim().min(1),
19899
- userId: z2.string().trim().min(1),
19900
- updatedAt: z2.string().trim().min(1).max(64)
20262
+ var savedViewSoftDeleteInputSchema = z4.object({
20263
+ id: z4.string().trim().min(1),
20264
+ userId: z4.string().trim().min(1),
20265
+ updatedAt: z4.string().trim().min(1).max(64)
19901
20266
  });
19902
- var savedViewPageInputSchema = z2.object({
19903
- viewId: z2.string().trim().min(1),
19904
- userId: z2.string().trim().min(1),
19905
- timeZone: z2.string().trim().min(1).max(100).optional(),
19906
- limit: z2.number().int().positive().max(500).optional(),
19907
- offset: z2.number().int().nonnegative().optional()
20267
+ var savedViewPageInputSchema = z4.object({
20268
+ viewId: z4.string().trim().min(1),
20269
+ userId: z4.string().trim().min(1),
20270
+ timeZone: z4.string().trim().min(1).max(100).optional(),
20271
+ limit: z4.number().int().positive().max(500).optional(),
20272
+ offset: z4.number().int().nonnegative().optional()
19908
20273
  });
19909
- var savedViewCountInputSchema = z2.object({
19910
- viewId: z2.string().trim().min(1),
19911
- userId: z2.string().trim().min(1),
19912
- timeZone: z2.string().trim().min(1).max(100).optional()
20274
+ var savedViewCountInputSchema = z4.object({
20275
+ viewId: z4.string().trim().min(1),
20276
+ userId: z4.string().trim().min(1),
20277
+ timeZone: z4.string().trim().min(1).max(100).optional()
19913
20278
  });
19914
- var savedViewAnalyticsInputSchema = z2.object({
19915
- viewId: z2.string().trim().min(1),
19916
- userId: z2.string().trim().min(1),
19917
- timeZone: z2.string().trim().min(1).max(100).optional(),
19918
- draft: z2.object({
19919
- stats: z2.array(savedViewStatSchema).max(MAX_SAVED_VIEW_STATS).optional(),
19920
- charts: z2.array(savedViewChartSchema).max(MAX_SAVED_VIEW_CHARTS).optional(),
19921
- computedColumns: z2.array(savedViewComputedColumnSchema).max(MAX_SAVED_VIEW_COMPUTED_COLUMNS).optional(),
19922
- summary: z2.array(savedViewSummaryItemSchema).max(MAX_SAVED_VIEW_SUMMARY_ITEMS).optional()
20279
+ var savedViewAnalyticsInputSchema = z4.object({
20280
+ viewId: z4.string().trim().min(1),
20281
+ userId: z4.string().trim().min(1),
20282
+ timeZone: z4.string().trim().min(1).max(100).optional(),
20283
+ draft: z4.object({
20284
+ stats: z4.array(savedViewStatSchema).max(MAX_SAVED_VIEW_STATS).optional(),
20285
+ charts: z4.array(savedViewChartSchema).max(MAX_SAVED_VIEW_CHARTS).optional(),
20286
+ computedColumns: z4.array(savedViewComputedColumnSchema).max(MAX_SAVED_VIEW_COMPUTED_COLUMNS).optional(),
20287
+ summary: z4.array(savedViewSummaryItemSchema).max(MAX_SAVED_VIEW_SUMMARY_ITEMS).optional()
19923
20288
  }).optional()
19924
20289
  });
19925
- var savedViewNoteDetailInputSchema = z2.object({
19926
- userId: z2.string().trim().min(1),
19927
- noteId: z2.string().trim().min(1),
19928
- timeZone: z2.string().trim().min(1).max(100).optional(),
19929
- limit: z2.number().int().positive().max(100).optional()
20290
+ var savedViewNoteDetailInputSchema = z4.object({
20291
+ userId: z4.string().trim().min(1),
20292
+ noteId: z4.string().trim().min(1),
20293
+ timeZone: z4.string().trim().min(1).max(100).optional(),
20294
+ limit: z4.number().int().positive().max(100).optional()
19930
20295
  });
19931
20296
 
19932
20297
  // ../../packages/core/src/powersync/typed-rpc/domain/properties.ts
19933
20298
  import { uuidv7 as uuidv72 } from "uuidv7";
19934
- import { z as z3 } from "zod";
20299
+ import { z as z5 } from "zod";
19935
20300
  var PROPERTY_DEF_TABLE = "c_property_def";
19936
20301
  var CONFIG_PROPERTY_TABLE = "c_config_property";
19937
20302
  var NOTE_TABLE = "c_note";
19938
20303
  var SAVED_VIEW_TABLE = "c_saved_view";
19939
20304
  var PROPERTY_DEF_CONFIG_KEY_SQL_PREFIX = PROPERTY_DEF_CONFIG_KEY_PREFIX.replaceAll("'", "''");
19940
- var NOTE_PROPERTY_KEY = z3.string().min(1).max(NOTE_PROPERTY_LIMITS.keyLength).refine(isPropertyKeyValid);
19941
- var NOTE_PROPERTY_TEXT = z3.string().max(NOTE_PROPERTY_LIMITS.textLength).refine((value) => value.trim().length > 0, "Property value cannot be blank");
19942
- var NOTE_PROPERTY_VALUE = z3.union([
20305
+ var NOTE_PROPERTY_KEY = z5.string().min(1).max(NOTE_PROPERTY_LIMITS.keyLength).refine(isPropertyKeyValid);
20306
+ var NOTE_PROPERTY_TEXT = z5.string().max(NOTE_PROPERTY_LIMITS.textLength).refine((value) => value.trim().length > 0, "Property value cannot be blank");
20307
+ var NOTE_PROPERTY_VALUE = z5.union([
19943
20308
  NOTE_PROPERTY_TEXT,
19944
- z3.number().finite(),
19945
- z3.boolean(),
19946
- z3.array(NOTE_PROPERTY_TEXT).min(1).max(NOTE_PROPERTY_LIMITS.arrayLength),
19947
- z3.custom(
20309
+ z5.number().finite(),
20310
+ z5.boolean(),
20311
+ z5.array(NOTE_PROPERTY_TEXT).min(1).max(NOTE_PROPERTY_LIMITS.arrayLength),
20312
+ z5.custom(
19948
20313
  (value) => {
19949
20314
  const files = normalizeFilePropertyValue(value);
19950
20315
  return files !== null && files.length > 0;
19951
20316
  },
19952
20317
  "Invalid file property value"
19953
20318
  ),
19954
- z3.custom(
20319
+ z5.custom(
19955
20320
  (value) => normalizePlacePropertyValue(value) !== null,
19956
20321
  "Invalid place property value"
19957
20322
  )
19958
20323
  ]);
19959
- var NOTE_PROPERTIES_PATCH = z3.preprocess((patch, context) => {
20324
+ var NOTE_PROPERTIES_PATCH = z5.preprocess((patch, context) => {
19960
20325
  if (patch && typeof patch === "object" && !Array.isArray(patch)) {
19961
20326
  const invalidKey = Object.keys(patch).find((key) => !isPropertyKeyValid(key));
19962
20327
  if (invalidKey !== void 0) {
19963
20328
  context.addIssue({ code: "custom", message: "Invalid property key" });
19964
- return z3.NEVER;
20329
+ return z5.NEVER;
19965
20330
  }
19966
20331
  }
19967
20332
  return patch;
19968
- }, z3.record(NOTE_PROPERTY_KEY, NOTE_PROPERTY_VALUE.nullable())).refine((patch) => Object.keys(patch).length > 0, "Property patch cannot be empty").refine(
20333
+ }, z5.record(NOTE_PROPERTY_KEY, NOTE_PROPERTY_VALUE.nullable())).refine((patch) => Object.keys(patch).length > 0, "Property patch cannot be empty").refine(
19969
20334
  (patch) => Object.keys(patch).length <= NOTE_PROPERTY_LIMITS.mutationKeys,
19970
20335
  "Property patch is too large"
19971
20336
  );
19972
- var NOTE_PROPERTY_VALUES = z3.preprocess((values, context) => {
20337
+ var NOTE_PROPERTY_VALUES = z5.preprocess((values, context) => {
19973
20338
  if (values && typeof values === "object" && !Array.isArray(values)) {
19974
20339
  const invalidKey = Object.keys(values).find((key) => !isPropertyKeyValid(key));
19975
20340
  if (invalidKey !== void 0) {
19976
20341
  context.addIssue({ code: "custom", message: "Invalid property key" });
19977
- return z3.NEVER;
20342
+ return z5.NEVER;
19978
20343
  }
19979
20344
  }
19980
20345
  return values;
19981
- }, z3.record(NOTE_PROPERTY_KEY, NOTE_PROPERTY_VALUE)).refine((values) => Object.keys(values).length > 0, "Property values cannot be empty").refine(
20346
+ }, z5.record(NOTE_PROPERTY_KEY, NOTE_PROPERTY_VALUE)).refine((values) => Object.keys(values).length > 0, "Property values cannot be empty").refine(
19982
20347
  (values) => Object.keys(values).length <= NOTE_PROPERTY_LIMITS.mutationKeys,
19983
20348
  "Property values are too large"
19984
20349
  );
19985
- var PROPERTY_OPTION_INPUT_SCHEMA = z3.object({
19986
- id: z3.string().trim().min(1).max(200).optional(),
19987
- label: z3.string().min(1).max(PROPERTY_OPTION_LABEL_MAX_LENGTH),
19988
- color: z3.enum(PROPERTY_OPTION_COLORS).optional(),
19989
- sortRank: z3.number().int().safe().optional(),
19990
- archived: z3.boolean().optional(),
19991
- group: z3.enum(STATUS_PROPERTY_GROUPS).optional()
20350
+ var PROPERTY_OPTION_INPUT_SCHEMA = z5.object({
20351
+ id: z5.string().trim().min(1).max(200).optional(),
20352
+ label: z5.string().min(1).max(PROPERTY_OPTION_LABEL_MAX_LENGTH),
20353
+ color: z5.enum(PROPERTY_OPTION_COLORS).optional(),
20354
+ sortRank: z5.number().int().safe().optional(),
20355
+ archived: z5.boolean().optional(),
20356
+ group: z5.enum(STATUS_PROPERTY_GROUPS).optional()
19992
20357
  });
19993
- var PROPERTY_DEF_CONFIG_INPUT_SCHEMA = z3.custom(
20358
+ var PROPERTY_DEF_CONFIG_INPUT_SCHEMA = z5.custom(
19994
20359
  (value) => normalizePropertyDefConfig(value) !== void 0
19995
20360
  );
19996
- var PROPERTY_DEF_CATALOG_INPUT = z3.object({
19997
- userId: z3.string().trim().min(1),
19998
- limit: z3.number().int().positive().max(5e3).optional()
20361
+ var PROPERTY_DEF_CATALOG_INPUT = z5.object({
20362
+ userId: z5.string().trim().min(1),
20363
+ limit: z5.number().int().positive().max(5e3).optional()
19999
20364
  });
20000
- var PROPERTY_DEF_ENSURE_INPUT = z3.object({
20001
- key: z3.string().trim().min(1).max(64).refine(isPropertyKeyValid),
20002
- name: z3.string().trim().max(120).nullable().optional(),
20003
- type: z3.enum(ACTIVE_PROPERTY_TYPES).nullable().optional(),
20004
- optionItems: z3.array(PROPERTY_OPTION_INPUT_SCHEMA).max(PROPERTY_OPTION_LIMITS.items).optional(),
20005
- uniqueIdPrefix: z3.string().max(64).nullable().optional(),
20006
- numberPreset: z3.enum(NUMBER_PROPERTY_PRESETS).nullable().optional(),
20365
+ var PROPERTY_DEF_ENSURE_INPUT = z5.object({
20366
+ key: z5.string().trim().min(1).max(64).refine(isPropertyKeyValid),
20367
+ name: z5.string().trim().max(120).nullable().optional(),
20368
+ type: z5.enum(ACTIVE_PROPERTY_TYPES).nullable().optional(),
20369
+ optionItems: z5.array(PROPERTY_OPTION_INPUT_SCHEMA).max(PROPERTY_OPTION_LIMITS.items).optional(),
20370
+ uniqueIdPrefix: z5.string().max(64).nullable().optional(),
20371
+ numberPreset: z5.enum(NUMBER_PROPERTY_PRESETS).nullable().optional(),
20007
20372
  config: PROPERTY_DEF_CONFIG_INPUT_SCHEMA.optional(),
20008
- description: z3.string().max(2e3).nullable().optional(),
20009
- icon: z3.string().max(120).nullable().optional(),
20010
- source: z3.enum(["manual", "ai"]).nullable().optional(),
20011
- userId: z3.string().trim().min(1),
20012
- updatedAt: z3.string().trim().min(1).max(64)
20373
+ description: z5.string().max(2e3).nullable().optional(),
20374
+ icon: z5.string().max(120).nullable().optional(),
20375
+ source: z5.enum(["manual", "ai"]).nullable().optional(),
20376
+ userId: z5.string().trim().min(1),
20377
+ updatedAt: z5.string().trim().min(1).max(64)
20013
20378
  });
20014
- var PROPERTY_DEF_CONFIGURE_INPUT = z3.object({
20015
- id: z3.string().trim().min(1),
20016
- userId: z3.string().trim().min(1),
20017
- name: z3.string().trim().max(120).nullable().optional(),
20018
- description: z3.string().max(2e3).nullable().optional(),
20019
- icon: z3.string().max(120).nullable().optional(),
20020
- showOnCard: z3.boolean().nullable().optional(),
20021
- sortRank: z3.number().int().nullable().optional(),
20022
- options: z3.array(PROPERTY_OPTION_INPUT_SCHEMA).max(PROPERTY_OPTION_LIMITS.items).optional(),
20023
- uniqueIdPrefix: z3.string().max(64).nullable().optional(),
20024
- repairInvalidOptions: z3.boolean().optional(),
20379
+ var PROPERTY_DEF_CONFIGURE_INPUT = z5.object({
20380
+ id: z5.string().trim().min(1),
20381
+ userId: z5.string().trim().min(1),
20382
+ name: z5.string().trim().max(120).nullable().optional(),
20383
+ description: z5.string().max(2e3).nullable().optional(),
20384
+ icon: z5.string().max(120).nullable().optional(),
20385
+ showOnCard: z5.boolean().nullable().optional(),
20386
+ sortRank: z5.number().int().nullable().optional(),
20387
+ options: z5.array(PROPERTY_OPTION_INPUT_SCHEMA).max(PROPERTY_OPTION_LIMITS.items).optional(),
20388
+ uniqueIdPrefix: z5.string().max(64).nullable().optional(),
20389
+ repairInvalidOptions: z5.boolean().optional(),
20025
20390
  config: PROPERTY_DEF_CONFIG_INPUT_SCHEMA.nullable().optional(),
20026
- updatedAt: z3.string().trim().min(1).max(64)
20391
+ updatedAt: z5.string().trim().min(1).max(64)
20027
20392
  }).refine(
20028
20393
  (input) => input.name !== void 0 || input.description !== void 0 || input.icon !== void 0 || input.showOnCard !== void 0 || input.sortRank !== void 0 || input.options !== void 0 || input.uniqueIdPrefix !== void 0 || input.config !== void 0,
20029
20394
  {
@@ -20032,52 +20397,52 @@ var PROPERTY_DEF_CONFIGURE_INPUT = z3.object({
20032
20397
  ).refine((input) => !input.repairInvalidOptions || input.options !== void 0, {
20033
20398
  message: "repairInvalidOptions requires replacement options"
20034
20399
  });
20035
- var PROPERTY_DEF_MIGRATE_LEGACY_OPTIONS_INPUT = z3.object({
20036
- userId: z3.string().trim().min(1),
20037
- updatedAt: z3.string().trim().min(1).max(64)
20400
+ var PROPERTY_DEF_MIGRATE_LEGACY_OPTIONS_INPUT = z5.object({
20401
+ userId: z5.string().trim().min(1),
20402
+ updatedAt: z5.string().trim().min(1).max(64)
20038
20403
  });
20039
- var PROPERTY_DEF_UPDATE_INPUT = z3.object({
20040
- id: z3.string().trim().min(1),
20041
- userId: z3.string().trim().min(1),
20042
- name: z3.string().trim().max(120).nullable().optional(),
20043
- description: z3.string().max(2e3).nullable().optional(),
20044
- icon: z3.string().max(120).nullable().optional(),
20045
- showOnCard: z3.boolean().nullable().optional(),
20046
- sortRank: z3.number().int().nullable().optional(),
20047
- updatedAt: z3.string().trim().min(1).max(64)
20404
+ var PROPERTY_DEF_UPDATE_INPUT = z5.object({
20405
+ id: z5.string().trim().min(1),
20406
+ userId: z5.string().trim().min(1),
20407
+ name: z5.string().trim().max(120).nullable().optional(),
20408
+ description: z5.string().max(2e3).nullable().optional(),
20409
+ icon: z5.string().max(120).nullable().optional(),
20410
+ showOnCard: z5.boolean().nullable().optional(),
20411
+ sortRank: z5.number().int().nullable().optional(),
20412
+ updatedAt: z5.string().trim().min(1).max(64)
20048
20413
  });
20049
- var PROPERTY_DEF_SOFT_DELETE_INPUT = z3.object({
20050
- id: z3.string().trim().min(1),
20051
- userId: z3.string().trim().min(1),
20052
- updatedAt: z3.string().trim().min(1).max(64)
20414
+ var PROPERTY_DEF_SOFT_DELETE_INPUT = z5.object({
20415
+ id: z5.string().trim().min(1),
20416
+ userId: z5.string().trim().min(1),
20417
+ updatedAt: z5.string().trim().min(1).max(64)
20053
20418
  });
20054
- var NOTE_PROPERTIES_UPDATE_INPUT = z3.object({
20055
- noteId: z3.string().trim().min(1),
20056
- userId: z3.string().trim().min(1),
20419
+ var NOTE_PROPERTIES_UPDATE_INPUT = z5.object({
20420
+ noteId: z5.string().trim().min(1),
20421
+ userId: z5.string().trim().min(1),
20057
20422
  patch: NOTE_PROPERTIES_PATCH,
20058
- updatedAt: z3.string().trim().min(1).max(64)
20423
+ updatedAt: z5.string().trim().min(1).max(64)
20059
20424
  });
20060
- var NOTE_PROPERTY_SLOTS_UPDATE_INPUT = z3.object({
20061
- noteId: z3.string().trim().min(1),
20062
- userId: z3.string().trim().min(1),
20063
- operation: z3.enum(["declare", "clear", "remove"]),
20064
- keys: z3.array(NOTE_PROPERTY_KEY).min(1).max(NOTE_PROPERTY_LIMITS.mutationKeys),
20065
- updatedAt: z3.string().trim().min(1).max(64)
20425
+ var NOTE_PROPERTY_SLOTS_UPDATE_INPUT = z5.object({
20426
+ noteId: z5.string().trim().min(1),
20427
+ userId: z5.string().trim().min(1),
20428
+ operation: z5.enum(["declare", "clear", "remove"]),
20429
+ keys: z5.array(NOTE_PROPERTY_KEY).min(1).max(NOTE_PROPERTY_LIMITS.mutationKeys),
20430
+ updatedAt: z5.string().trim().min(1).max(64)
20066
20431
  });
20067
- var NOTE_PROPERTY_SLOTS_REORDER_INPUT = z3.object({
20068
- noteId: z3.string().trim().min(1),
20069
- userId: z3.string().trim().min(1),
20070
- orderedKeys: z3.array(NOTE_PROPERTY_KEY).min(2).max(NOTE_PROPERTY_LIMITS.mutationKeys).refine(
20432
+ var NOTE_PROPERTY_SLOTS_REORDER_INPUT = z5.object({
20433
+ noteId: z5.string().trim().min(1),
20434
+ userId: z5.string().trim().min(1),
20435
+ orderedKeys: z5.array(NOTE_PROPERTY_KEY).min(2).max(NOTE_PROPERTY_LIMITS.mutationKeys).refine(
20071
20436
  (keys) => new Set(keys).size === keys.length,
20072
20437
  "Property slot order contains duplicates"
20073
20438
  ),
20074
- updatedAt: z3.string().trim().min(1).max(64)
20439
+ updatedAt: z5.string().trim().min(1).max(64)
20075
20440
  });
20076
- var NOTE_PROPERTIES_FILL_EMPTY_INPUT = z3.object({
20077
- noteId: z3.string().trim().min(1),
20078
- userId: z3.string().trim().min(1),
20441
+ var NOTE_PROPERTIES_FILL_EMPTY_INPUT = z5.object({
20442
+ noteId: z5.string().trim().min(1),
20443
+ userId: z5.string().trim().min(1),
20079
20444
  values: NOTE_PROPERTY_VALUES,
20080
- updatedAt: z3.string().trim().min(1).max(64)
20445
+ updatedAt: z5.string().trim().min(1).max(64)
20081
20446
  });
20082
20447
  function createPropertyReadModels() {
20083
20448
  return [
@@ -21491,14 +21856,11 @@ var AGENT_WRITABLE_PROPERTY_TYPES = new Set(
21491
21856
  )
21492
21857
  );
21493
21858
 
21494
- // ../../packages/powersync/child-notes.ts
21495
- var topLevelNoteCondition = (alias) => `${alias ? `${alias}.` : ""}parent_id IS NULL`;
21496
-
21497
21859
  // ../../packages/core/src/powersync/typed-rpc/domain/saved-views.ts
21498
21860
  import { uuidv7 as uuidv73 } from "uuidv7";
21499
21861
 
21500
21862
  // ../../packages/core/src/powersync/PowerSyncTransportUtils.ts
21501
- import { z as z4 } from "zod";
21863
+ import { z as z6 } from "zod";
21502
21864
  function rowsFromResult(result) {
21503
21865
  if (!result) {
21504
21866
  return [];
@@ -23225,10 +23587,10 @@ async function softDeleteSavedView(db, input) {
23225
23587
 
23226
23588
  // src/commands/domain/run.ts
23227
23589
  var COMMANDS = new Map(
23228
- [...createPropertyCommands(), ...createSavedViewCommands(), ...createNoteTemplateCommands()].map((definition) => [definition.name, definition])
23590
+ [...createPropertyCommands(), ...createSavedViewCommands(), ...createNoteTemplateCommands(), ...createNoteLifecycleCommands()].map((definition) => [definition.name, definition])
23229
23591
  );
23230
23592
  var READ_MODELS = new Map(
23231
- [...createPropertyReadModels(), ...createSavedViewReadModels(), ...createNoteTemplateReadModels()].map((definition) => [definition.name, definition])
23593
+ [...createPropertyReadModels(), ...createSavedViewReadModels(), ...createNoteTemplateReadModels(), ...createNoteLifecycleReadModels()].map((definition) => [definition.name, definition])
23232
23594
  );
23233
23595
  var DOMAIN_CODE_PATTERN = /^[A-Z][A-Z0-9_]+$/;
23234
23596
  function zodIssues(error) {
@@ -23619,6 +23981,12 @@ function parseMetaPatch(input) {
23619
23981
  if (raw.tags !== void 0) patch.tags = stringList(raw.tags, "tags");
23620
23982
  if (raw.boxes !== void 0) patch.boxes = stringList(raw.boxes, "boxes");
23621
23983
  if (raw.starred !== void 0) patch.starred = Boolean(raw.starred);
23984
+ if (raw.pinned !== void 0) patch.pinned = Boolean(raw.pinned);
23985
+ if (raw.isPublic !== void 0) patch.isPublic = Boolean(raw.isPublic);
23986
+ if (raw.type !== void 0) {
23987
+ if (raw.type !== "note" && raw.type !== "crawl") throw usage('type must be "note" or "crawl"');
23988
+ patch.type = raw.type;
23989
+ }
23622
23990
  if (raw.declare !== void 0) patch.declare = stringList(raw.declare, "declare");
23623
23991
  if (raw.remove !== void 0) patch.remove = stringList(raw.remove, "remove");
23624
23992
  if (raw.properties !== void 0) {
@@ -23630,7 +23998,7 @@ function parseMetaPatch(input) {
23630
23998
  function createMetaStore(db, userId) {
23631
23999
  const row = async (noteId) => {
23632
24000
  const found = await db.getOptional(
23633
- "SELECT id, title, tags, zettel_boxes, starred_at, created_at, updated_at, version, is_del FROM c_note WHERE id = ?",
24001
+ "SELECT id, title, tags, zettel_boxes, starred_at, is_top, is_pub, type, created_at, updated_at, version, is_del FROM c_note WHERE id = ?",
23634
24002
  [noteId]
23635
24003
  );
23636
24004
  if (!found || Number(found.is_del ?? 0) !== 0) {
@@ -23655,6 +24023,9 @@ function createMetaStore(db, userId) {
23655
24023
  return { id, name: box?.name || "\u672A\u77E5\u6587\u4EF6\u5939", path: box?.path || "", color: box?.color || "" };
23656
24024
  }),
23657
24025
  starred: Boolean(note.starred_at),
24026
+ pinned: Number(note.is_top ?? 0) > 0,
24027
+ isPublic: isPublicFlag(note.is_pub),
24028
+ type: note.type === "crawl" ? "crawl" : "note",
23658
24029
  createdAt: note.created_at ?? null,
23659
24030
  updatedAt: note.updated_at ?? null,
23660
24031
  version: version(note.version),
@@ -23713,6 +24084,14 @@ function createMetaStore(db, userId) {
23713
24084
  const result = await updateNote(db, fields);
23714
24085
  changed.push(...result.changed);
23715
24086
  }
24087
+ if (patch.pinned !== void 0 || patch.isPublic !== void 0) changed.push(...await setFlags(noteId, patch));
24088
+ if (patch.type !== void 0) {
24089
+ const current = await row(noteId);
24090
+ if ((current.type === "crawl" ? "crawl" : "note") !== patch.type) {
24091
+ await runDomainCommand(db, "notes.updateType", { noteId, type: patch.type, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
24092
+ changed.push("type");
24093
+ }
24094
+ }
23716
24095
  if (patch.declare?.length) {
23717
24096
  const result = await updateNotePropertySlots2(db, { userId, noteId, operation: "declare", keys: patch.declare });
23718
24097
  if (result.changed) changed.push("properties");
@@ -23736,7 +24115,43 @@ function createMetaStore(db, userId) {
23736
24115
  }
23737
24116
  return { changed: [...new Set(changed)], meta: await meta(noteId) };
23738
24117
  }
23739
- return { meta, catalog, update };
24118
+ async function setFlags(noteId, patch) {
24119
+ const current = await row(noteId);
24120
+ const sets = [];
24121
+ const params = [];
24122
+ const changed = [];
24123
+ const now = (/* @__PURE__ */ new Date()).toISOString();
24124
+ if (patch.pinned !== void 0 && patch.pinned !== Number(current.is_top ?? 0) > 0) {
24125
+ let top = 0;
24126
+ if (patch.pinned) {
24127
+ const [max] = await fetchDomainReadModel(db, "notes.maxActiveTop", void 0);
24128
+ top = (Number(max?.max_top ?? 0) || 0) + 1;
24129
+ }
24130
+ sets.push("is_top = ?", "pinned_at = ?");
24131
+ params.push(top, patch.pinned ? now : null);
24132
+ changed.push("pinned");
24133
+ }
24134
+ if (patch.isPublic !== void 0 && patch.isPublic !== isPublicFlag(current.is_pub)) {
24135
+ sets.push("is_pub = ?");
24136
+ params.push(patch.isPublic ? 1 : 0);
24137
+ changed.push("isPublic");
24138
+ }
24139
+ if (!sets.length) return [];
24140
+ sets.push("updated_at = ?", "version = COALESCE(version, 0) + 1");
24141
+ params.push(nextMonotonicUpdatedAt(current.updated_at, { timestamp: now }), noteId);
24142
+ await db.execute(`UPDATE c_note SET ${sets.join(", ")} WHERE id = ?`, params);
24143
+ return changed;
24144
+ }
24145
+ async function trash(noteId) {
24146
+ await row(noteId);
24147
+ await runDomainCommand(db, "notes.softDelete", { noteId, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
24148
+ }
24149
+ return { meta, catalog, update, trash };
24150
+ }
24151
+ function isPublicFlag(value) {
24152
+ if (value === true) return true;
24153
+ if (typeof value === "string") return ["1", "true"].includes(value.trim().toLowerCase());
24154
+ return Number(value) === 1;
23740
24155
  }
23741
24156
 
23742
24157
  // src/commands/savedViews/fields.ts
@@ -24564,6 +24979,7 @@ function createEditorStore(db, options2) {
24564
24979
  meta: meta.meta,
24565
24980
  catalog: meta.catalog,
24566
24981
  updateMeta: meta.update,
24982
+ trash: meta.trash,
24567
24983
  views: () => listEditorViews(db, options2.userId),
24568
24984
  viewEmbed: (request) => fetchEditorViewEmbed(db, options2.userId, request),
24569
24985
  async load(noteId) {
@@ -24610,6 +25026,59 @@ function createEditorStore(db, options2) {
24610
25026
  };
24611
25027
  }
24612
25028
 
25029
+ // src/editor/share.ts
25030
+ var SHARE_MISSING_CODE = "000404";
25031
+ var REQUEST_TIMEOUT_MS = 2e4;
25032
+ function createShareClient(deps) {
25033
+ async function request(method, pathname, body, missingOk = false) {
25034
+ let response;
25035
+ try {
25036
+ response = await (deps.fetchImpl ?? fetch)(`${deps.baseUrl ?? AI_SERVICE_URL}${pathname}`, {
25037
+ method,
25038
+ headers: {
25039
+ Authorization: toAuthorizationHeaderValue(deps.authorization),
25040
+ Accept: "application/json",
25041
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
25042
+ },
25043
+ ...body === void 0 ? {} : { body: JSON.stringify(body) },
25044
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
25045
+ });
25046
+ } catch (error) {
25047
+ throw new DinoxError(`Share request failed: ${error instanceof Error ? error.message : String(error)}`, { code: "COMMAND_FAILED", recoverable: true });
25048
+ }
25049
+ const json2 = await response.json().catch(() => null);
25050
+ if (missingOk && json2?.code === SHARE_MISSING_CODE) return null;
25051
+ if (response.status === 401 || response.status === 403) {
25052
+ throw new DinoxError("Sign in to Dinox again to share notes.", { code: "AUTH_REQUIRED", recoverable: true });
25053
+ }
25054
+ if (!response.ok || json2?.code !== AUTH_CODE_OK2 || json2.data == null) {
25055
+ throw new DinoxError(json2?.msg || `Share request failed (HTTP ${response.status})`, { code: "COMMAND_FAILED", recoverable: true });
25056
+ }
25057
+ return json2.data;
25058
+ }
25059
+ return async (action, noteId) => {
25060
+ const path14 = `/api/share/notes/${encodeURIComponent(noteId)}`;
25061
+ if (action === "revoke") {
25062
+ await request("POST", `${path14}/revoke`);
25063
+ return null;
25064
+ }
25065
+ const share = action === "create" ? await request("POST", path14, { expiresAt: null }) : await request("GET", path14, void 0, true);
25066
+ return share ? toEditorShare(share) : null;
25067
+ };
25068
+ }
25069
+ function toEditorShare(share) {
25070
+ if (!/^[a-z0-9]{12}$/.test(share.token)) {
25071
+ throw new DinoxError("The share link returned by Dinox is invalid.", { code: "COMMAND_FAILED", recoverable: true });
25072
+ }
25073
+ return {
25074
+ url: `${NOTE_SHARE_WEB_BASE_URL}/s/${share.token}`,
25075
+ hasPassword: Boolean(share.hasPassword),
25076
+ viewCount: Number(share.viewCount) || 0,
25077
+ expiresAt: share.expiresAt ?? null,
25078
+ status: share.status === "expired" ? "expired" : "active"
25079
+ };
25080
+ }
25081
+
24613
25082
  // src/editor/persistence.ts
24614
25083
  import { randomUUID } from "node:crypto";
24615
25084
  import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
@@ -25764,6 +26233,63 @@ var EditorService = class {
25764
26233
  }
25765
26234
  return { changed, meta, metaSeq: session.metaSeq };
25766
26235
  }
26236
+ /**
26237
+ * Moves the open note (and its child cards) to the trash, like the desktop's delete, and
26238
+ * leaves the session without a note. The panel saves pending edits first.
26239
+ */
26240
+ async trash(key, input) {
26241
+ const session = this.requireOpen(key);
26242
+ if (Number(input.openSeq) !== session.openSeq) {
26243
+ throw new DinoxError("The session has opened another note; this change was discarded.", { code: "EDITOR_STALE_SEQUENCE", recoverable: true });
26244
+ }
26245
+ if (session.dirty || session.saving !== null) {
26246
+ throw new DinoxError("The open note has unsaved changes; wait for them to save before deleting it.", { code: "EDITOR_UNSAVED_CHANGES", recoverable: true });
26247
+ }
26248
+ if (!this.options.store.trash) throw new DinoxError("This editor cannot delete notes.", { code: "COMMAND_FAILED", recoverable: false });
26249
+ const title = session.title;
26250
+ await this.options.store.trash(session.noteId);
26251
+ const blank = this.blank(session.key);
26252
+ Object.assign(session, {
26253
+ noteId: null,
26254
+ title: "",
26255
+ knownHash: null,
26256
+ knownVersion: null,
26257
+ doc: null,
26258
+ plainText: "",
26259
+ blocks: [],
26260
+ blocksDoc: null,
26261
+ mirrorRev: null,
26262
+ selection: blank.selection,
26263
+ dirty: false,
26264
+ suggestions: [],
26265
+ upload: null,
26266
+ remote: null,
26267
+ openSeq: session.openSeq + 1,
26268
+ route: "note"
26269
+ });
26270
+ session.meta = null;
26271
+ session.metaSeq++;
26272
+ this.record(session, "user", "save", { key: "\u628A\u300C{title}\u300D\u79FB\u5230\u4E86\u56DE\u6536\u7AD9", params: { title: title || "\u672A\u547D\u540D\u7B46\u8A18" } });
26273
+ void this.options.store.waitForUpload(UPLOAD_TIMEOUT_MS).catch(() => false);
26274
+ this.changed(session);
26275
+ this.updateWatch();
26276
+ return { ok: true, openSeq: session.openSeq };
26277
+ }
26278
+ /** Reads, creates or revokes the open note's share link. */
26279
+ async share(key, input) {
26280
+ const session = this.requireOpen(key);
26281
+ const action = input.action;
26282
+ if (action !== "get" && action !== "create" && action !== "revoke") throw usage2("action must be get, create or revoke");
26283
+ if (!this.options.share) {
26284
+ throw new DinoxError("Sharing needs a signed-in Dinox daemon.", { code: "AUTH_REQUIRED", recoverable: true });
26285
+ }
26286
+ const share = await this.options.share(action, session.noteId);
26287
+ if (action !== "get") {
26288
+ this.record(session, "user", "save", { key: action === "create" ? "\u5EFA\u7ACB\u4E86\u5206\u4EAB\u9023\u7D50" : "\u505C\u6B62\u5206\u4EAB" });
26289
+ this.changed(session);
26290
+ }
26291
+ return { share };
26292
+ }
25767
26293
  note(key, input) {
25768
26294
  const session = this.session(key);
25769
26295
  const text = str2(input.text, "text", { max: 2e3 });
@@ -26222,6 +26748,9 @@ function describeMetaChange(changed, before, after) {
26222
26748
  }
26223
26749
  if (changed.includes("boxes")) parts.push(after.boxes.length ? { key: "\u79FB\u5230\u6587\u4EF6\u5939\u300C{boxes}\u300D", params: { boxes: after.boxes.map((box) => box.name) } } : { key: "\u79FB\u51FA\u4E86\u6587\u4EF6\u5939" });
26224
26750
  if (changed.includes("is_starred")) parts.push({ key: after.starred ? "\u52A0\u4E0A\u661F\u6A19" : "\u53D6\u6D88\u661F\u6A19" });
26751
+ if (changed.includes("pinned")) parts.push({ key: after.pinned ? "\u7F6E\u9802\u4E86\u7B46\u8A18" : "\u53D6\u6D88\u7F6E\u9802" });
26752
+ if (changed.includes("isPublic")) parts.push({ key: after.isPublic ? "\u8A2D\u70BA\u516C\u958B" : "\u8A2D\u70BA\u79C1\u5BC6" });
26753
+ if (changed.includes("type")) parts.push({ key: after.type === "crawl" ? "\u8F49\u70BA\u7D20\u6750" : "\u8F49\u70BA\u7B46\u8A18" });
26225
26754
  if (changed.includes("properties")) parts.push({ key: "\u66F4\u65B0\u4E86\u5C6C\u6027" });
26226
26755
  return { key: "{clauses}", params: { clauses: parts } };
26227
26756
  }
@@ -26255,6 +26784,7 @@ async function createDaemonEditorService(db, options2) {
26255
26784
  restore: (entries) => uploaded(restoreTodoTasks(db, entries))
26256
26785
  },
26257
26786
  ...options2.authorization ? {
26787
+ share: createShareClient({ authorization: options2.authorization }),
26258
26788
  upload: async ({ name, mediaType, data, maxBytes }) => {
26259
26789
  const sent = await uploadToOfficialStorage(
26260
26790
  { db, userId: options2.userId, authorization: options2.authorization },
@@ -26295,6 +26825,8 @@ var EDITOR_METHODS = /* @__PURE__ */ new Set([
26295
26825
  "editor.log",
26296
26826
  "editor.catalog",
26297
26827
  "editor.updateMeta",
26828
+ "editor.trash",
26829
+ "editor.share",
26298
26830
  "editor.watchOpens",
26299
26831
  "editor.showTodos",
26300
26832
  "editor.todos",
@@ -26339,6 +26871,10 @@ async function handleEditorRequest(service, method, params, signal) {
26339
26871
  return service.catalog();
26340
26872
  case "editor.updateMeta":
26341
26873
  return service.updateMeta(session, input);
26874
+ case "editor.trash":
26875
+ return service.trash(session, input);
26876
+ case "editor.share":
26877
+ return service.share(session, input);
26342
26878
  case "editor.watchOpens":
26343
26879
  return service.watchOpens(input, signal);
26344
26880
  case "editor.showTodos":
@@ -26532,7 +27068,7 @@ var DaemonServer = class {
26532
27068
  }
26533
27069
  };
26534
27070
  const execute = async () => {
26535
- const { runCli } = await import("./runCli-TIPCBGV7.js");
27071
+ const { runCli } = await import("./runCli-G4OGL7FZ.js");
26536
27072
  const exitCode = await requestContext.run(context, () => runCli(input.argv));
26537
27073
  return { stdout: context.stdout.join(""), stderr: context.stderr.join(""), exitCode };
26538
27074
  };