@svadmin/core 0.25.0 → 0.25.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/core",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "author": "zuohuadong",
5
5
  "repository": {
6
6
  "type": "git",
@@ -280,6 +280,7 @@ const baseLocales: Record<string, Record<string, string>> = {
280
280
  'task.messageLabel': '消息',
281
281
  'task.errorLabel': '错误',
282
282
  'task.payloadLabel': '负载',
283
+ 'task.resultLabel': '结果',
283
284
  'task.searchPlaceholder': '按名称、ID、状态或消息筛选任务...',
284
285
  'task.statusFilterLabel': '状态筛选',
285
286
  'task.statusAll': '全部状态',
@@ -309,6 +310,12 @@ const baseLocales: Record<string, Record<string, string>> = {
309
310
  'task.status.done': '已完成',
310
311
  'task.status.failed': '失败',
311
312
  'task.status.error': '错误',
313
+ 'task.status.cancelled': '已取消',
314
+ 'task.status.canceled': '已取消',
315
+ 'task.status.succeeded': '已完成',
316
+ 'task.status.dead_lettered': '死信',
317
+ 'task.status.retry_scheduled': '等待重试',
318
+ 'task.status.leased': '已领取',
312
319
  },
313
320
  'en': {
314
321
  'common.list': 'List',
@@ -587,6 +594,7 @@ const baseLocales: Record<string, Record<string, string>> = {
587
594
  'task.messageLabel': 'Message',
588
595
  'task.errorLabel': 'Error',
589
596
  'task.payloadLabel': 'Payload',
597
+ 'task.resultLabel': 'Result',
590
598
  'task.searchPlaceholder': 'Filter tasks by name, ID, status, or message...',
591
599
  'task.statusFilterLabel': 'Status filter',
592
600
  'task.statusAll': 'All statuses',
@@ -616,6 +624,12 @@ const baseLocales: Record<string, Record<string, string>> = {
616
624
  'task.status.done': 'Done',
617
625
  'task.status.failed': 'Failed',
618
626
  'task.status.error': 'Error',
627
+ 'task.status.cancelled': 'Cancelled',
628
+ 'task.status.canceled': 'Canceled',
629
+ 'task.status.succeeded': 'Succeeded',
630
+ 'task.status.dead_lettered': 'Dead lettered',
631
+ 'task.status.retry_scheduled': 'Retry scheduled',
632
+ 'task.status.leased': 'Leased',
619
633
  },
620
634
  };
621
635
 
package/src/index.ts CHANGED
@@ -119,6 +119,8 @@ export type { UseSelectOptions } from './hooks.svelte';
119
119
  export type { UseFormReturn } from './form-hooks.svelte';
120
120
  export type {
121
121
  TaskProvider,
122
+ TaskDateValue,
123
+ TaskMessageValue,
122
124
  TaskRecord,
123
125
  SubmitTaskOptions,
124
126
  TaskHandle,
package/src/types.ts CHANGED
@@ -194,12 +194,52 @@ export interface DataProvider {
194
194
 
195
195
  // ─── TaskProvider ─────────────────────────────────────────────
196
196
 
197
+ export type TaskDateValue = string | Date | null;
198
+ export type TaskMessageValue = string | null;
199
+
197
200
  export interface TaskRecord extends BaseRecord {
198
201
  id: string;
202
+ name?: string;
203
+ title?: string;
199
204
  status?: string;
200
- createdAt?: string | Date;
201
- updatedAt?: string | Date;
205
+ progress?: number;
206
+ priority?: number;
207
+ queueName?: string;
208
+ queue_name?: string;
209
+ message?: TaskMessageValue;
210
+ payload?: unknown;
211
+ /**
212
+ * Task output payload. `result` is the canonical camelCase field used by
213
+ * svadmin UI helpers; `result_data` is accepted for Supabase/Postgres-style
214
+ * task mirrors. Consumers should prefer `result`, then fall back to
215
+ * `result_data`, matching `resolveTaskResult`.
216
+ */
217
+ result?: unknown;
218
+ result_data?: unknown;
219
+ /**
220
+ * Task lifecycle timestamps. Supabase/Postgres mirrors often expose nullable
221
+ * columns for lifecycle phases that have not happened yet, and svadmin UI
222
+ * helpers intentionally skip nullish values with `??` fallback ordering.
223
+ */
224
+ createdAt?: TaskDateValue;
225
+ created_at?: TaskDateValue;
226
+ updatedAt?: TaskDateValue;
227
+ updated_at?: TaskDateValue;
228
+ startedAt?: TaskDateValue;
229
+ started_at?: TaskDateValue;
230
+ finishedAt?: TaskDateValue;
231
+ finished_at?: TaskDateValue;
232
+ cancelledAt?: TaskDateValue;
233
+ cancelled_at?: TaskDateValue;
234
+ /**
235
+ * Task failure payload/message. `error` carries structured error details
236
+ * when available; `errorMessage` and `error_message` are string fallbacks for
237
+ * camelCase and snake_case providers. Consumers should prefer `error`, then
238
+ * `errorMessage`, then `error_message`, matching `resolveTaskError`.
239
+ */
202
240
  error?: unknown;
241
+ errorMessage?: TaskMessageValue;
242
+ error_message?: TaskMessageValue;
203
243
  }
204
244
 
205
245
  export interface SubmitTaskOptions {