@hiai-gg/docsmint 2.1.9 → 2.2.2

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.
@@ -22,6 +22,7 @@ __export(exports_schema, {
22
22
  apiKeys: () => apiKeys,
23
23
  attachmentRelations: () => attachmentRelations,
24
24
  attachmentStorageCleanupOutbox: () => attachmentStorageCleanupOutbox,
25
+ attachmentUploadOperations: () => attachmentUploadOperations,
25
26
  attachments: () => attachments,
26
27
  auditLog: () => auditLog,
27
28
  categories: () => categories,
@@ -515,6 +516,21 @@ var pendingAttachmentUploads = pgTable("pending_attachment_uploads", {
515
516
  index("pending_attachment_uploads_cleanup_lease_idx").on(table.expiresAt, table.leaseExpiresAt, table.id),
516
517
  check("pending_attachment_uploads_quota_state_check", sql`${table.quotaState} IN ('not_required', 'reserve_pending', 'reserved', 'finalize_pending', 'committed')`)
517
518
  ]);
519
+ var attachmentUploadOperations = pgTable("attachment_upload_operations", {
520
+ id: uuid("id").primaryKey().defaultRandom(),
521
+ workspaceId: text("workspace_id").notNull(),
522
+ actorUserId: uuid("actor_user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
523
+ documentId: uuid("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
524
+ idempotencyKey: text("idempotency_key").notNull(),
525
+ requestFingerprint: text("request_fingerprint").notNull(),
526
+ sourceSha256: text("source_sha256").notNull(),
527
+ storageKey: text("storage_key").notNull(),
528
+ expiresAt: timestamp("expires_at").notNull(),
529
+ createdAt: timestamp("created_at").defaultNow().notNull()
530
+ }, (table) => [
531
+ uniqueIndex("attachment_upload_operations_actor_document_key_unique").on(table.workspaceId, table.actorUserId, table.documentId, table.idempotencyKey),
532
+ uniqueIndex("attachment_upload_operations_storage_key_unique").on(table.storageKey)
533
+ ]);
518
534
  var attachmentStorageCleanupOutbox = pgTable("attachment_storage_cleanup_outbox", {
519
535
  id: uuid("id").primaryKey().defaultRandom(),
520
536
  sourceKind: text("source_kind").notNull(),
@@ -22,6 +22,7 @@ __export(exports_schema, {
22
22
  apiKeys: () => apiKeys,
23
23
  attachmentRelations: () => attachmentRelations,
24
24
  attachmentStorageCleanupOutbox: () => attachmentStorageCleanupOutbox,
25
+ attachmentUploadOperations: () => attachmentUploadOperations,
25
26
  attachments: () => attachments,
26
27
  auditLog: () => auditLog,
27
28
  categories: () => categories,
@@ -515,6 +516,21 @@ var pendingAttachmentUploads = pgTable("pending_attachment_uploads", {
515
516
  index("pending_attachment_uploads_cleanup_lease_idx").on(table.expiresAt, table.leaseExpiresAt, table.id),
516
517
  check("pending_attachment_uploads_quota_state_check", sql`${table.quotaState} IN ('not_required', 'reserve_pending', 'reserved', 'finalize_pending', 'committed')`)
517
518
  ]);
519
+ var attachmentUploadOperations = pgTable("attachment_upload_operations", {
520
+ id: uuid("id").primaryKey().defaultRandom(),
521
+ workspaceId: text("workspace_id").notNull(),
522
+ actorUserId: uuid("actor_user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
523
+ documentId: uuid("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
524
+ idempotencyKey: text("idempotency_key").notNull(),
525
+ requestFingerprint: text("request_fingerprint").notNull(),
526
+ sourceSha256: text("source_sha256").notNull(),
527
+ storageKey: text("storage_key").notNull(),
528
+ expiresAt: timestamp("expires_at").notNull(),
529
+ createdAt: timestamp("created_at").defaultNow().notNull()
530
+ }, (table) => [
531
+ uniqueIndex("attachment_upload_operations_actor_document_key_unique").on(table.workspaceId, table.actorUserId, table.documentId, table.idempotencyKey),
532
+ uniqueIndex("attachment_upload_operations_storage_key_unique").on(table.storageKey)
533
+ ]);
518
534
  var attachmentStorageCleanupOutbox = pgTable("attachment_storage_cleanup_outbox", {
519
535
  id: uuid("id").primaryKey().defaultRandom(),
520
536
  sourceKind: text("source_kind").notNull(),
@@ -22,6 +22,7 @@ __export(exports_schema, {
22
22
  apiKeys: () => apiKeys,
23
23
  attachmentRelations: () => attachmentRelations,
24
24
  attachmentStorageCleanupOutbox: () => attachmentStorageCleanupOutbox,
25
+ attachmentUploadOperations: () => attachmentUploadOperations,
25
26
  attachments: () => attachments,
26
27
  auditLog: () => auditLog,
27
28
  categories: () => categories,
@@ -515,6 +516,21 @@ var pendingAttachmentUploads = pgTable("pending_attachment_uploads", {
515
516
  index("pending_attachment_uploads_cleanup_lease_idx").on(table.expiresAt, table.leaseExpiresAt, table.id),
516
517
  check("pending_attachment_uploads_quota_state_check", sql`${table.quotaState} IN ('not_required', 'reserve_pending', 'reserved', 'finalize_pending', 'committed')`)
517
518
  ]);
519
+ var attachmentUploadOperations = pgTable("attachment_upload_operations", {
520
+ id: uuid("id").primaryKey().defaultRandom(),
521
+ workspaceId: text("workspace_id").notNull(),
522
+ actorUserId: uuid("actor_user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
523
+ documentId: uuid("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
524
+ idempotencyKey: text("idempotency_key").notNull(),
525
+ requestFingerprint: text("request_fingerprint").notNull(),
526
+ sourceSha256: text("source_sha256").notNull(),
527
+ storageKey: text("storage_key").notNull(),
528
+ expiresAt: timestamp("expires_at").notNull(),
529
+ createdAt: timestamp("created_at").defaultNow().notNull()
530
+ }, (table) => [
531
+ uniqueIndex("attachment_upload_operations_actor_document_key_unique").on(table.workspaceId, table.actorUserId, table.documentId, table.idempotencyKey),
532
+ uniqueIndex("attachment_upload_operations_storage_key_unique").on(table.storageKey)
533
+ ]);
518
534
  var attachmentStorageCleanupOutbox = pgTable("attachment_storage_cleanup_outbox", {
519
535
  id: uuid("id").primaryKey().defaultRandom(),
520
536
  sourceKind: text("source_kind").notNull(),
package/dist/client.js CHANGED
@@ -492,8 +492,12 @@ export class DocsClient {
492
492
  headers.set("Cookie", requestContext.cookie);
493
493
  if (requestContext?.requestId)
494
494
  headers.set("X-Request-Id", requestContext.requestId);
495
- if (requestContext?.idempotencyKey)
495
+ if (requestContext?.idempotencyKey === null) {
496
+ headers.delete("Idempotency-Key");
497
+ }
498
+ else if (requestContext?.idempotencyKey) {
496
499
  headers.set("Idempotency-Key", requestContext.idempotencyKey);
500
+ }
497
501
  // Document creation supports replay on the server. Generate once before
498
502
  // the retry loop so a lost response cannot create a second document.
499
503
  if (method === "POST" &&
@@ -0,0 +1,290 @@
1
+ import { a as e, i as t, r as n, t as r } from "./dropdown-menu-B3nk2aM-.js";
2
+ import { n as i, t as a } from "./folder-BpmB_sAy.js";
3
+ import { t as o } from "./action_go_to-DO1bicF-.js";
4
+ import { a as s, i as c, n as l, o as u, r as d, t as ee } from "./folders_rename-Cxbg5GIw.js";
5
+ import { t as f } from "./ellipsis-vertical-Oymsv1R4.js";
6
+ import { r as p, t as m } from "./dndzone-B9jA0yIS.js";
7
+ import { s as h } from "./folders-DgKSovXa.js";
8
+ import { a as g, n as _, t as v } from "./route-context-6OHiGtfb.js";
9
+ import { l as te, p as ne } from "./subfolders-refresh-store.svelte-CeyqvNpu.js";
10
+ import { t as y } from "./utils-CnAmIMwr.js";
11
+ import "svelte/internal/disclose-version";
12
+ import * as b from "svelte/internal/client";
13
+ import { untrack as x } from "svelte";
14
+ import { page as S } from "$app/state";
15
+ import { flip as C } from "svelte/animate";
16
+ // src/lib/components/sidebar/FolderNode.svelte
17
+ var w = b.from_html("<button><!></button>"), T = b.from_html("<!> <!> <!> <!> <!> <!>", 1), E = b.from_html("<!> <!>", 1), D = b.from_html("<div><!></div>"), O = b.from_html("<p class=\"px-2 py-1 text-xs text-muted-foreground\">Loading subfolders…</p>"), k = b.from_html("<p class=\"px-2 py-1 text-xs text-destructive\"> </p>"), A = b.from_html("<div class=\"group/doc flex w-full min-w-0 items-center gap-1\"><!> <!> <!></div>"), j = b.from_html("<div class=\"ml-0.5 space-y-0.5 border-l border-border pl-0.5\"><div><!> <!> <!></div> <div></div></div>"), re = b.from_html("<div role=\"group\"><div class=\"group/folder flex w-full min-w-0 items-center gap-1\"><button type=\"button\" data-sidebar-drop-kind=\"folder\"><!> <!> <span class=\"min-w-0 truncate\"> </span></button> <!></div> <!></div>");
18
+ function M(ie, N) {
19
+ b.push(N, !0);
20
+ let P = v(), F = g(), I = b.prop(N, "depth", 3, 0), L = b.prop(N, "isDraggingFolder", 3, !1), R = b.prop(N, "isDraggingDoc", 3, !1), z = b.prop(N, "activeDropFolderId", 3, null), B = b.state(b.proxy([])), V = b.state(!1), H = b.state(!1), U = b.state(null), W = b.state(b.proxy([])), G = b.derived(() => N.expandedFolderIds.has(N.folder.id)), K = b.derived(() => N.folderDocsMap[N.folder.id] ?? []);
21
+ async function q() {
22
+ b.set(H, !0), b.set(U, null);
23
+ try {
24
+ let e = await h(N.folder.id, !1, F.fetch);
25
+ b.set(B, e.map((e) => (ne(e.id, e.parentId ?? null, e.categoryId ?? null, e.order ?? 0), {
26
+ id: e.id,
27
+ name: e.name,
28
+ categoryId: e.categoryId ?? null,
29
+ parentId: e.parentId,
30
+ order: e.order ?? 0
31
+ })), !0), b.set(W, b.get(B), !0), b.set(V, !0);
32
+ } catch (e) {
33
+ console.error("FolderNode: failed to load subfolders", e), b.set(U, e instanceof Error ? e.message : "Failed to load subfolders", !0);
34
+ } finally {
35
+ b.set(H, !1);
36
+ }
37
+ }
38
+ b.user_effect(() => {
39
+ b.get(G) && x(() => {
40
+ !b.get(V) && !b.get(H) && q();
41
+ });
42
+ }), b.user_effect(() => {
43
+ te(N.folder.id) !== 0 && (b.get(V) || b.get(G)) && q();
44
+ });
45
+ function J(e) {
46
+ e.stopPropagation(), b.set(W, Array.isArray(e.detail.items) ? e.detail.items : [], !0), N.onConsiderSubfolders(N.folder.id)(e);
47
+ }
48
+ function ae(e) {
49
+ e.stopPropagation(), b.set(W, Array.isArray(e.detail.items) ? e.detail.items : [], !0), N.onFinalizeSubfolders(N.folder.id)(e);
50
+ }
51
+ var Y = re(), X = b.child(Y), Z = b.child(X), Q = b.child(Z);
52
+ {
53
+ let e = b.derived(() => y("size-3.5 shrink-0 transition-transform", b.get(G) && "rotate-90"));
54
+ i(Q, { get class() {
55
+ return b.get(e);
56
+ } });
57
+ }
58
+ var $ = b.sibling(Q, 2);
59
+ a($, { class: "size-4 shrink-0 text-muted-foreground" });
60
+ var oe = b.sibling($, 2), se = b.only_child(oe, !0);
61
+ b.reset(Z);
62
+ var ce = b.sibling(Z, 2);
63
+ e(ce, {
64
+ children: (e, i) => {
65
+ var a = E(), p = b.first_child(a);
66
+ r(p, {
67
+ child: (e, t) => {
68
+ let n = () => (t?.()).props;
69
+ var r = w();
70
+ b.attribute_effect(r, (e, t) => ({
71
+ ...n(),
72
+ type: "button",
73
+ class: "inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-accent-foreground group-hover/folder:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
74
+ "aria-label": e,
75
+ title: t
76
+ }), [() => c(), () => c()]);
77
+ var i = b.child(r);
78
+ f(i, { class: "size-3.5" }), b.reset(r), b.append(e, r);
79
+ },
80
+ $$slots: { child: !0 }
81
+ });
82
+ var m = b.sibling(p, 2);
83
+ t(m, {
84
+ align: "end",
85
+ children: (e, t) => {
86
+ var r = T(), i = b.first_child(r);
87
+ n(i, {
88
+ onSelect: () => _(P, "/folders/" + N.folder.id),
89
+ children: (e, t) => {
90
+ b.next();
91
+ var n = b.text();
92
+ b.template_effect((e) => b.set_text(n, e), [() => o()]), b.append(e, n);
93
+ },
94
+ $$slots: { default: !0 }
95
+ });
96
+ var a = b.sibling(i, 2);
97
+ n(a, {
98
+ onSelect: () => _(P, `/docs/new?folder=${N.folder.id}`),
99
+ children: (e, t) => {
100
+ b.next();
101
+ var n = b.text();
102
+ b.template_effect((e) => b.set_text(n, e), [() => u()]), b.append(e, n);
103
+ },
104
+ $$slots: { default: !0 }
105
+ });
106
+ var c = b.sibling(a, 2);
107
+ n(c, {
108
+ onSelect: () => N.onCreateSubfolder(N.folder.id),
109
+ children: (e, t) => {
110
+ b.next();
111
+ var n = b.text();
112
+ b.template_effect((e) => b.set_text(n, e), [() => l()]), b.append(e, n);
113
+ },
114
+ $$slots: { default: !0 }
115
+ });
116
+ var f = b.sibling(c, 2);
117
+ n(f, {
118
+ onSelect: () => N.onShare(N.folder.id, N.folder.name),
119
+ children: (e, t) => {
120
+ b.next();
121
+ var n = b.text();
122
+ b.template_effect((e) => b.set_text(n, e), [() => s()]), b.append(e, n);
123
+ },
124
+ $$slots: { default: !0 }
125
+ });
126
+ var p = b.sibling(f, 2);
127
+ n(p, {
128
+ onSelect: () => N.onRename(N.folder.id, N.folder.name),
129
+ children: (e, t) => {
130
+ b.next();
131
+ var n = b.text();
132
+ b.template_effect((e) => b.set_text(n, e), [() => ee()]), b.append(e, n);
133
+ },
134
+ $$slots: { default: !0 }
135
+ });
136
+ var m = b.sibling(p, 2);
137
+ n(m, {
138
+ class: "text-destructive focus:text-destructive",
139
+ onSelect: () => N.onDelete(N.folder.id, N.folder.name),
140
+ children: (e, t) => {
141
+ b.next();
142
+ var n = b.text();
143
+ b.template_effect((e) => b.set_text(n, e), [() => d()]), b.append(e, n);
144
+ },
145
+ $$slots: { default: !0 }
146
+ }), b.append(e, r);
147
+ },
148
+ $$slots: { default: !0 }
149
+ }), b.append(e, a);
150
+ },
151
+ $$slots: { default: !0 }
152
+ }), b.reset(X);
153
+ var le = b.sibling(X, 2), ue = (e) => {
154
+ var t = j(), n = b.child(t), r = b.child(n);
155
+ b.each(r, 25, () => b.get(W), (e) => e.id, (e, t) => {
156
+ let n = b.derived(() => M);
157
+ var r = D(), i = b.child(r);
158
+ {
159
+ let e = b.derived(() => I() + 1);
160
+ b.component(i, () => b.get(n), (n, r) => {
161
+ r(n, {
162
+ get folder() {
163
+ return b.get(t);
164
+ },
165
+ get depth() {
166
+ return b.get(e);
167
+ },
168
+ get folderDocsMap() {
169
+ return N.folderDocsMap;
170
+ },
171
+ get expandedFolderIds() {
172
+ return N.expandedFolderIds;
173
+ },
174
+ get isDraggingFolder() {
175
+ return L();
176
+ },
177
+ get isDraggingDoc() {
178
+ return R();
179
+ },
180
+ get dragDisabled() {
181
+ return N.dragDisabled;
182
+ },
183
+ get folderFlipDurationMs() {
184
+ return N.folderFlipDurationMs;
185
+ },
186
+ get documentFlipDurationMs() {
187
+ return N.documentFlipDurationMs;
188
+ },
189
+ get activeDropFolderId() {
190
+ return z();
191
+ },
192
+ get onToggleFolder() {
193
+ return N.onToggleFolder;
194
+ },
195
+ get onRename() {
196
+ return N.onRename;
197
+ },
198
+ get onShare() {
199
+ return N.onShare;
200
+ },
201
+ get onDelete() {
202
+ return N.onDelete;
203
+ },
204
+ get onCreateSubfolder() {
205
+ return N.onCreateSubfolder;
206
+ },
207
+ get onConsiderDocs() {
208
+ return N.onConsiderDocs;
209
+ },
210
+ get onFinalizeDocs() {
211
+ return N.onFinalizeDocs;
212
+ },
213
+ get onConsiderSubfolders() {
214
+ return N.onConsiderSubfolders;
215
+ },
216
+ get onFinalizeSubfolders() {
217
+ return N.onFinalizeSubfolders;
218
+ },
219
+ get docRowInner() {
220
+ return N.docRowInner;
221
+ },
222
+ get copyButton() {
223
+ return N.copyButton;
224
+ },
225
+ get docMenu() {
226
+ return N.docMenu;
227
+ }
228
+ });
229
+ });
230
+ }
231
+ b.reset(r), b.template_effect(() => b.set_attribute(r, "data-is-dnd-shadow-item-hint", b.get(t)[p])), b.animation(r, () => C, () => ({ duration: N.folderFlipDurationMs })), b.append(e, r);
232
+ });
233
+ var i = b.sibling(r, 2), a = (e) => {
234
+ var t = O();
235
+ b.append(e, t);
236
+ };
237
+ b.if(i, (e) => {
238
+ b.get(H) && e(a);
239
+ });
240
+ var o = b.sibling(i, 2), s = (e) => {
241
+ var t = k(), n = b.only_child(t, !0);
242
+ b.template_effect(() => b.set_text(n, b.get(U))), b.append(e, t);
243
+ };
244
+ b.if(o, (e) => {
245
+ b.get(U) && e(s);
246
+ }), b.reset(n), b.action(n, (e, t) => m?.(e, t), () => ({
247
+ items: b.get(W),
248
+ flipDurationMs: N.folderFlipDurationMs,
249
+ type: "folder",
250
+ dropTargetStyle: {},
251
+ dragDisabled: N.dragDisabled
252
+ }));
253
+ var c = b.sibling(n, 2), l = b.derived(() => N.onConsiderDocs({
254
+ kind: "folder",
255
+ id: N.folder.id
256
+ })), u = b.derived(() => N.onFinalizeDocs({
257
+ kind: "folder",
258
+ id: N.folder.id
259
+ }));
260
+ b.each(c, 29, () => b.get(K), (e) => e.id, (e, t) => {
261
+ var n = A(), r = b.child(n);
262
+ b.snippet(r, () => N.docRowInner, () => b.get(t));
263
+ var i = b.sibling(r, 2);
264
+ b.snippet(i, () => N.copyButton, () => b.get(t));
265
+ var a = b.sibling(i, 2);
266
+ b.snippet(a, () => N.docMenu, () => b.get(t)), b.reset(n), b.animation(n, () => C, () => ({ duration: N.documentFlipDurationMs })), b.append(e, n);
267
+ }), b.reset(c), b.action(c, (e, t) => m?.(e, t), () => ({
268
+ items: b.get(K),
269
+ flipDurationMs: N.documentFlipDurationMs,
270
+ type: "doc",
271
+ dropTargetStyle: {},
272
+ dragDisabled: N.dragDisabled,
273
+ useCursorForDetection: !0,
274
+ centreDraggedOnCursor: !0
275
+ })), b.reset(t), b.template_effect((e, t) => {
276
+ b.set_class(n, 1, e), b.set_class(c, 1, t);
277
+ }, [() => b.clsx(y("min-h-[8px] space-y-0.5 transition-all duration-150", L() && b.get(W).length === 0 && "min-h-[36px] bg-accent/20 rounded border border-dashed border-muted-foreground/20")), () => b.clsx(y("min-h-[8px] space-y-0.5 transition-all duration-150", R() && b.get(K).length === 0 && "min-h-[36px] bg-accent/20 rounded border border-dashed border-muted-foreground/20"))]), b.event("consider", n, J), b.event("finalize", n, ae), b.event("consider", c, function(...e) {
278
+ b.get(l)?.apply(this, e);
279
+ }), b.event("finalize", c, function(...e) {
280
+ b.get(u)?.apply(this, e);
281
+ }), b.append(e, t);
282
+ };
283
+ b.if(le, (e) => {
284
+ b.get(G) && e(ue);
285
+ }), b.reset(Y), b.template_effect((e) => {
286
+ b.set_attribute(Y, "aria-label", N.folder.name), b.set_attribute(Z, "data-sidebar-drop-id", N.folder.id), b.set_attribute(Z, "aria-expanded", b.get(G)), b.set_class(Z, 1, e), b.set_text(se, N.folder.name);
287
+ }, [() => b.clsx(y("flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent hover:text-accent-foreground", S.params.id === N.folder.id && "bg-accent text-accent-foreground font-medium", z() === N.folder.id && "bg-accent ring-1 ring-primary/50"))]), b.delegated("click", Z, () => N.onToggleFolder(N.folder.id)), b.append(ie, Y), b.pop();
288
+ }
289
+ b.delegate(["click"]);
290
+ export { M as t };