@svadmin/core 0.71.0 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/result.ts ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * High-rigor Result<T, E> algebraic data type for safe, typed error handling
3
+ * without throwing exceptions.
4
+ */
5
+
6
+ export interface Ok<T> {
7
+ readonly ok: true;
8
+ readonly value: T;
9
+ readonly error?: never;
10
+ }
11
+
12
+ export interface Err<E> {
13
+ readonly ok: false;
14
+ readonly error: E;
15
+ readonly value?: never;
16
+ }
17
+
18
+ export type Result<T, E> = Ok<T> | Err<E>;
19
+
20
+ export function ok<T>(value: T): Ok<T> {
21
+ return { ok: true, value };
22
+ }
23
+
24
+ export function err<E>(error: E): Err<E> {
25
+ return { ok: false, error };
26
+ }
27
+
28
+ export function isOk<T, E>(result: Result<T, E>): result is Ok<T> {
29
+ return result.ok === true;
30
+ }
31
+
32
+ export function isErr<T, E>(result: Result<T, E>): result is Err<E> {
33
+ return result.ok === false;
34
+ }
35
+
36
+ export function unwrapResult<T, E>(result: Result<T, E>): T {
37
+ if (result.ok) {
38
+ return result.value;
39
+ }
40
+ throw result.error;
41
+ }
42
+
43
+ export function unwrapOr<T, E>(result: Result<T, E>, fallback: T): T {
44
+ return result.ok ? result.value : fallback;
45
+ }
46
+
47
+ export function mapResult<T, E, U>(result: Result<T, E>, fn: (value: T) => U): Result<U, E> {
48
+ if (result.ok) {
49
+ return ok(fn(result.value));
50
+ }
51
+ return result;
52
+ }
53
+
54
+ export function mapErr<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F> {
55
+ if (!result.ok) {
56
+ return err(fn(result.error));
57
+ }
58
+ return result;
59
+ }
60
+
61
+ export function flatMapResult<T, E, U>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E> {
62
+ if (result.ok) {
63
+ return fn(result.value);
64
+ }
65
+ return result;
66
+ }
67
+
68
+ export function matchResult<T, E, R>(
69
+ result: Result<T, E>,
70
+ patterns: {
71
+ ok: (value: T) => R;
72
+ err: (error: E) => R;
73
+ },
74
+ ): R {
75
+ return result.ok ? patterns.ok(result.value) : patterns.err(result.error);
76
+ }
77
+
78
+ export function fromThrowable<T, E = unknown>(
79
+ fn: () => T,
80
+ onError: (cause: unknown) => E,
81
+ ): Result<T, E> {
82
+ try {
83
+ return ok(fn());
84
+ } catch (cause) {
85
+ return err(onError(cause));
86
+ }
87
+ }
88
+
89
+ export async function fromPromise<T, E = unknown>(
90
+ promise: Promise<T>,
91
+ onError: (cause: unknown) => E,
92
+ ): Promise<Result<T, E>> {
93
+ try {
94
+ const value = await promise;
95
+ return ok(value);
96
+ } catch (cause) {
97
+ return err(onError(cause));
98
+ }
99
+ }
@@ -3,12 +3,31 @@ import { Value } from 'typebox/value';
3
3
 
4
4
  export type SchemaFormScalar = string | number | boolean | null;
5
5
 
6
- /** 条件路径从表单根开始,只能引用无条件的标量字段。 */
6
+ /**
7
+ * 条件路径从表单根开始,只能引用无条件的标量字段。
8
+ * 组合器(all/any/not)与跨字段比较(equalsField)让联动表达力接近
9
+ * schema 驱动的表单方案,但仍不引入表达式求值。
10
+ */
7
11
  export interface SchemaFormCondition {
8
- path: readonly string[];
12
+ path?: readonly string[];
9
13
  equals?: SchemaFormScalar;
10
14
  notEquals?: SchemaFormScalar;
11
15
  exists?: boolean;
16
+ /** 与另一字段的当前值比较(路径从表单根开始)。 */
17
+ equalsField?: readonly string[];
18
+ all?: readonly SchemaFormCondition[];
19
+ any?: readonly SchemaFormCondition[];
20
+ not?: SchemaFormCondition;
21
+ }
22
+
23
+ /** 封闭集合的派生规则;不编译表达式,避免把 schema 变成代码执行入口。 */
24
+ export type SchemaFormComputedOp='sum'|'count'|'first'|'concat';
25
+
26
+ export interface SchemaFormComputed {
27
+ from: readonly string[];
28
+ op: SchemaFormComputedOp;
29
+ /** 仅 `concat` 使用,最多 8 个字符。 */
30
+ separator?: string;
12
31
  }
13
32
 
14
33
  export interface SchemaFormSchema {
@@ -21,6 +40,7 @@ export interface SchemaFormSchema {
21
40
  default?: unknown;
22
41
  required?: string[];
23
42
  visibleWhen?: SchemaFormCondition;
43
+ computed?: SchemaFormComputed;
24
44
  minLength?: number;
25
45
  maxLength?: number;
26
46
  pattern?: string;
@@ -32,14 +52,70 @@ export interface SchemaFormSchema {
32
52
 
33
53
  const keys = new Set([
34
54
  'type', 'title', 'description', 'properties', 'items', 'enum', 'default', 'required',
35
- 'visibleWhen', 'minLength', 'maxLength', 'pattern', 'minimum', 'maximum', 'minItems', 'maxItems',
55
+ 'visibleWhen', 'computed', 'minLength', 'maxLength', 'pattern', 'minimum', 'maximum', 'minItems', 'maxItems',
36
56
  ]);
57
+ const COMPUTED_OPS=new Set<SchemaFormComputedOp>(['sum','count','first','concat']);
37
58
  const scalar = (value: unknown): value is SchemaFormScalar => value === null ||
38
59
  typeof value === 'string' || typeof value === 'boolean' ||
39
60
  (typeof value === 'number' && Number.isFinite(value));
40
- const fail = (): never => { throw new TypeError('Invalid schema form configuration.'); };
61
+ const fail: () => never = () => { throw new TypeError('Invalid schema form configuration.'); };
62
+
63
+ /** 解析条件路径并断言它指向一个无条件标量字段。 */
64
+ function assertFieldPath(schema: SchemaFormSchema, parts: readonly string[]): void {
65
+ if (parts.length === 0 || parts.length > 32 || parts.some(part => part === '')) fail();
66
+ let controller: SchemaFormSchema=schema;
67
+ for (const part of parts) {
68
+ const properties=controller.properties;
69
+ if (!properties || controller.visibleWhen || !Object.hasOwn(properties, part)) fail();
70
+ const next=properties[part];
71
+ if (!next) fail();
72
+ controller=next;
73
+ }
74
+ if (controller.visibleWhen || controller.properties || controller.type === 'object' || controller.type === 'array') fail();
75
+ }
76
+
77
+ /** 条件结构自校验:组合器与路径二选一,并限制递归深度。 */
78
+ function assertCondition(condition: SchemaFormCondition, root: SchemaFormSchema, depth: number): void {
79
+ if (!condition || typeof condition !== 'object' || Array.isArray(condition) || depth > 8) fail();
80
+ const allowed=['path','equals','notEquals','exists','equalsField','all','any','not'];
81
+ if (Object.keys(condition).some(key => !allowed.includes(key))) fail();
82
+ const combinators=['all','any','not'].filter(key => Object.hasOwn(condition, key));
83
+ const comparators=['equals','notEquals','exists','equalsField'].filter(key => Object.hasOwn(condition, key));
84
+ const hasPath=condition.path !== undefined;
85
+ if (combinators.length === 0 && !hasPath) fail();
86
+ if (combinators.length > 0 && (hasPath || comparators.length > 0)) fail();
87
+ if (combinators.length > 1) fail();
88
+ if (condition.path !== undefined &&
89
+ (!Array.isArray(condition.path) || condition.path.length === 0 || condition.path.length > 32 ||
90
+ condition.path.some(part => typeof part !== 'string' || part === ''))) fail();
91
+ if (condition.equalsField !== undefined &&
92
+ (!Array.isArray(condition.equalsField) || condition.equalsField.length === 0 ||
93
+ condition.equalsField.length > 32 || condition.equalsField.some(part => typeof part !== 'string' || part === ''))) fail();
94
+ if ((Object.hasOwn(condition, 'equals') && !scalar(condition.equals)) ||
95
+ (Object.hasOwn(condition, 'notEquals') && !scalar(condition.notEquals)) ||
96
+ (Object.hasOwn(condition, 'exists') && typeof condition.exists !== 'boolean')) fail();
97
+ if (condition.all !== undefined &&
98
+ (!Array.isArray(condition.all) || condition.all.length === 0 || condition.all.length > 16)) fail();
99
+ if (condition.any !== undefined &&
100
+ (!Array.isArray(condition.any) || condition.any.length === 0 || condition.any.length > 16)) fail();
101
+ if (condition.not !== undefined && (typeof condition.not !== 'object' || Array.isArray(condition.not))) fail();
102
+ for (const child of condition.all ?? []) assertCondition(child, root, depth + 1);
103
+ for (const child of condition.any ?? []) assertCondition(child, root, depth + 1);
104
+ if (condition.not !== undefined) assertCondition(condition.not, root, depth + 1);
105
+ }
106
+
107
+ /** 条件路径必须指向无条件的标量字段(与 visibleWhen 的既有约束一致)。 */
108
+ function assertConditionPaths(condition: SchemaFormCondition, root: SchemaFormSchema): void {
109
+ if (condition.path !== undefined) assertFieldPath(root, condition.path);
110
+ if (condition.equalsField !== undefined) assertFieldPath(root, condition.equalsField);
111
+ for (const child of condition.all ?? []) assertConditionPaths(child, root);
112
+ for (const child of condition.any ?? []) assertConditionPaths(child, root);
113
+ if (condition.not !== undefined) assertConditionPaths(condition.not, root);
114
+ }
41
115
 
42
- /** Schema 来自可信宿主,但仍拒绝未知关键字、循环、错误约束和超限结构。 */
116
+ /**
117
+ * Schema 来自可信宿主,但仍拒绝未知关键字、循环、错误约束和超限结构。
118
+ */
43
119
  export function assertSchemaFormSchema(schema: SchemaFormSchema): void {
44
120
  let visited = 0;
45
121
  const active = new Set<object>();
@@ -80,22 +156,21 @@ export function assertSchemaFormSchema(schema: SchemaFormSchema): void {
80
156
  }
81
157
  const condition = node.visibleWhen;
82
158
  if (condition !== undefined) {
83
- if (!condition || typeof condition !== 'object' || Array.isArray(condition) ||
84
- !Array.isArray(condition.path) || condition.path.length === 0 || condition.path.length > 32 ||
85
- condition.path.some(part => typeof part !== 'string') ||
86
- Object.keys(condition).some(key => !['path', 'equals', 'notEquals', 'exists'].includes(key)) ||
87
- !['equals', 'notEquals', 'exists'].some(key => Object.hasOwn(condition, key))) fail();
88
- if ((Object.hasOwn(condition, 'equals') && !scalar(condition.equals)) ||
89
- (Object.hasOwn(condition, 'notEquals') && !scalar(condition.notEquals)) ||
90
- (Object.hasOwn(condition, 'exists') && typeof condition.exists !== 'boolean')) fail();
91
- let controller = schema;
92
- for (const part of condition.path) {
93
- if (controller.visibleWhen || !controller.properties || !Object.hasOwn(controller.properties, part)) fail();
94
- const next = controller.properties?.[part];
95
- if (!next) return fail();
96
- controller = next;
97
- }
98
- if (controller.visibleWhen || controller.properties || controller.type === 'object' || controller.type === 'array') fail();
159
+ assertCondition(condition, schema, 0);
160
+ assertConditionPaths(condition, schema);
161
+ }
162
+ const computed = node.computed;
163
+ if (computed !== undefined) {
164
+ if (!computed || typeof computed !== 'object' || Array.isArray(computed) ||
165
+ Object.keys(computed).some(key => !['from', 'op', 'separator'].includes(key)) ||
166
+ !Array.isArray(computed.from) || computed.from.length === 0 || computed.from.length > 32 ||
167
+ computed.from.some(part => typeof part !== 'string') ||
168
+ !COMPUTED_OPS.has(computed.op)) fail();
169
+ if (computed.separator !== undefined &&
170
+ (computed.op !== 'concat' || typeof computed.separator !== 'string' || computed.separator.length > 8)) fail();
171
+ // 派生字段是只读标量,写回对象/数组会让投影与校验产生二义性。
172
+ if (kind === 'object' || kind === 'array') fail();
173
+ for (const path of computed.from) assertFieldPath(schema, path.split('.'));
99
174
  }
100
175
  active.delete(node);
101
176
  }
@@ -113,10 +188,16 @@ export function readSchemaFormPath(value: unknown, path: readonly string[]): unk
113
188
 
114
189
  export function matchesSchemaFormCondition(condition: SchemaFormCondition | undefined, value: unknown): boolean {
115
190
  if (!condition) return true;
191
+ if (condition.all !== undefined) return condition.all.every((child) => matchesSchemaFormCondition(child, value));
192
+ if (condition.any !== undefined) return condition.any.some((child) => matchesSchemaFormCondition(child, value));
193
+ if (condition.not !== undefined) return !matchesSchemaFormCondition(condition.not, value);
194
+ if (condition.path === undefined) return false;
116
195
  const current = readSchemaFormPath(value, condition.path);
117
196
  if (condition.exists !== undefined && (current !== undefined) !== condition.exists) return false;
118
197
  if (Object.hasOwn(condition, 'equals') && !Object.is(current, condition.equals)) return false;
119
198
  if (Object.hasOwn(condition, 'notEquals') && Object.is(current, condition.notEquals)) return false;
199
+ if (condition.equalsField !== undefined &&
200
+ !Object.is(current, readSchemaFormPath(value, condition.equalsField))) return false;
120
201
  return true;
121
202
  }
122
203
 
@@ -199,6 +280,64 @@ export function prepareSchemaFormValue(schema: SchemaFormSchema, value: unknown)
199
280
  };
200
281
  }
201
282
 
283
+ function readComputedSource(value: unknown, path: string): unknown {
284
+ return readSchemaFormPath(value, path.split('.'));
285
+ }
286
+
287
+ function computeSchemaFormNode(node: SchemaFormComputed, value: unknown): SchemaFormScalar {
288
+ const sources=node.from.map((path) => readComputedSource(value, path));
289
+ switch (node.op) {
290
+ case 'count': return sources.filter((entry) => entry !== undefined && entry !== null && entry !== '').length;
291
+ case 'sum': return sources.reduce<number>((total, entry) => {
292
+ const numeric=typeof entry === 'number' ? entry : typeof entry === 'string' ? Number(entry) : Number.NaN;
293
+ return Number.isFinite(numeric) ? total + numeric : total;
294
+ }, 0);
295
+ case 'first': {
296
+ const first=sources.find((entry) => scalar(entry));
297
+ return scalar(first) ? first : null;
298
+ }
299
+ case 'concat': {
300
+ const parts=sources.filter((entry): entry is string|number|boolean =>
301
+ typeof entry === 'string' || typeof entry === 'number' || typeof entry === 'boolean');
302
+ return parts.join(node.separator ?? '');
303
+ }
304
+ default: return null;
305
+ }
306
+ }
307
+
308
+ /**
309
+ * 计算 `computed` 字段并返回新的表单值;不修改入参,也不参与写回校验。
310
+ * 派生值只用于展示与只读提交,宿主仍可覆盖。
311
+ */
312
+ export function applySchemaFormComputed(schema: SchemaFormSchema, value: unknown): unknown {
313
+ assertSchemaFormSchema(schema);
314
+ let visited=0;
315
+ function visit(node: SchemaFormSchema, current: unknown): unknown {
316
+ if (++visited > 1000) throw new TypeError('Schema form data limit exceeded.');
317
+ if (node.properties && current !== null && typeof current === 'object' && !Array.isArray(current)) {
318
+ const source=current as Record<string, unknown>;
319
+ const result: Record<string, unknown>={ ...source };
320
+ for (const [key, child] of Object.entries(node.properties)) {
321
+ if (child.computed !== undefined) {
322
+ Object.defineProperty(result, key, {
323
+ value: computeSchemaFormNode(child.computed, value),
324
+ enumerable: true,
325
+ writable: true,
326
+ configurable: true,
327
+ });
328
+ }
329
+ if (Object.hasOwn(source, key)) {
330
+ Object.defineProperty(result, key, { value: visit(child, source[key]), enumerable: true, writable: true, configurable: true });
331
+ }
332
+ }
333
+ return result;
334
+ }
335
+ if (Array.isArray(current) && node.items) return current.map((item) => visit(node.items as SchemaFormSchema, item));
336
+ return current;
337
+ }
338
+ return visit(schema, value);
339
+ }
340
+
202
341
  export function validateSchemaFormValue(schema: SchemaFormSchema, value: unknown): SchemaFormValidationError[] {
203
342
  return prepareSchemaFormValue(schema, value).errors;
204
343
  }
@@ -1,4 +1,11 @@
1
1
  import { definedOptions } from './defined-options';
2
+ import {
3
+ deriveColorPreset,
4
+ exportThemeTokens,
5
+ parseThemeTokens,
6
+ type DerivedColorPreset,
7
+ type ThemeTokenDocument,
8
+ } from './color-scale';
2
9
  // Theme — dark/light/system mode + color theme management (Svelte 5 runes)
3
10
  //
4
11
  // Supports two class strategies:
@@ -6,7 +13,9 @@ import { definedOptions } from './defined-options';
6
13
  // - 'dark-first': adds 'light' class for light mode (dark-first)
7
14
 
8
15
  export type ThemeMode='light'|'dark'|'system';
9
- export type ColorTheme='default'|'blue'|'green'|'rose'|'orange'|'violet'|'neutral'|'indigo'|'stripe';
16
+ /** Built-in preset names keep editor autocomplete; registered presets are any string. */
17
+ export type BuiltinColorTheme='default'|'blue'|'green'|'rose'|'orange'|'violet'|'neutral'|'indigo'|'stripe';
18
+ export type ColorTheme=BuiltinColorTheme|(string&{});
10
19
 
11
20
  /** Controls how the theme class is applied to <html> */
12
21
  export type ThemeStrategy='standard'|'dark-first';
@@ -347,9 +356,10 @@ function readStoredTheme(): ThemeMode|undefined {
347
356
  }
348
357
 
349
358
  function readStoredColorTheme(): ColorTheme {
350
- const stored=getStorage()?.getItem(COLOR_STORAGE_KEY);
351
- // The built-in preset is the product default; an existing persisted preset remains authoritative.
352
- return stored&&builtinPresets[stored]? stored as ColorTheme:'default';
359
+ const stored=getStorage()?.getItem(COLOR_STORAGE_KEY)?.trim();
360
+ // A registered preset may be re-created after this module loads, so any
361
+ // non-empty stored id stays authoritative; unknown ids fall back at apply time.
362
+ return stored? stored:'default';
353
363
  }
354
364
 
355
365
  function persistSelection(key: string,value: string): void {
@@ -582,6 +592,44 @@ export function unregisterThemeOwner(token: ThemeOwnerToken|undefined): void {
582
592
  if(removed&&(isExplicitOwner(removed.options)||removed.options.fallbackThemeConfig)) applyEffectiveTheme();
583
593
  }
584
594
 
595
+ /**
596
+ * Derive a full tonal palette from one brand color and register it.
597
+ * Mirrors the Arco `@arco-design/color` capability without a Less variable layer.
598
+ */
599
+ export function registerColorTheme(input: { name: string; label?: string; color: string }): ColorPreset {
600
+ const derived=deriveColorPreset(input);
601
+ const preset: ColorPreset={
602
+ name: derived.name,
603
+ label: derived.label,
604
+ color: derived.color,
605
+ light: { ...derived.light },
606
+ dark: { ...derived.dark },
607
+ };
608
+ registerColorPreset(preset);
609
+ return preset;
610
+ }
611
+
612
+ /** Serialize every registered preset (built-in + custom) as a portable document. */
613
+ export function exportColorThemes(): ThemeTokenDocument {
614
+ return exportThemeTokens(getColorPresets() as readonly DerivedColorPreset[]);
615
+ }
616
+
617
+ /**
618
+ * Validate and register a token document. Invalid payloads throw before any
619
+ * preset is written, so importing never leaves the registry half-updated.
620
+ */
621
+ export function importColorThemes(payload: unknown): ColorPreset[] {
622
+ const presets=parseThemeTokens(payload);
623
+ for(const preset of presets) registerColorPreset(preset);
624
+ return presets.map((preset) => ({
625
+ name: preset.name,
626
+ label: preset.label,
627
+ color: preset.color,
628
+ light: { ...preset.light },
629
+ dark: { ...preset.dark },
630
+ }));
631
+ }
632
+
585
633
  export function resetTheme(): void {
586
634
  selectedMode=readStoredTheme();
587
635
  selectedColorTheme=readStoredColorTheme();
@@ -17,6 +17,8 @@ import { auditWithProvider } from './audit';
17
17
  import { HttpError } from './types';
18
18
  import { useTranslation } from './i18n.svelte';
19
19
  import { toast } from './toast.svelte';
20
+ import { ok, err, type Result as SafeResult } from './result';
21
+ import { toDomainError, type DomainError } from './domain-errors';
20
22
 
21
23
  export type { ContractUpdateParams } from './update-contract';
22
24
  export interface ContractUpdateOptions<S extends ContractSchemas> {
@@ -328,13 +330,21 @@ export function useContractUpdate<S extends ContractSchemas>(options: ContractUp
328
330
  mutate(params: ContractUpdateParams<S>, callbacks?: Callbacks<S>): void {
329
331
  void mutateAsync(params, callbacks).catch(() => {});
330
332
  },
333
+ async safeMutate(params: ContractUpdateParams<S>, callbacks?: Callbacks<S>): Promise<SafeResult<ContractRecord<S>, DomainError>> {
334
+ try {
335
+ const res = await mutateAsync(params, callbacks);
336
+ return ok(res.data);
337
+ } catch (cause) {
338
+ return err(toDomainError(cause));
339
+ }
340
+ },
331
341
  reset() { active = undefined; latest = undefined; latestToken = undefined; mutation.reset(); },
332
342
  });
333
343
  const idle: typeof result = {
334
344
  context: undefined, data: undefined, error: null, failureCount: 0, failureReason: null,
335
345
  isError: false, isIdle: true, isPending: false, isPaused: false, isSuccess: false,
336
346
  status: 'idle', submittedAt: 0, variables: undefined,
337
- mutate: result.mutate, mutateAsync: result.mutateAsync, reset: result.reset,
347
+ mutate: result.mutate, mutateAsync: result.mutateAsync, safeMutate: result.safeMutate, reset: result.reset,
338
348
  };
339
349
  const view = createQueryResultView(() => {
340
350
  const invocation = mutation.variables;
@@ -15,6 +15,8 @@ import { getAdminOptions } from './options.svelte';
15
15
  import { captureAuthLiveScope, clearAuthQueries, handleAuthError } from './auth-hooks.svelte';
16
16
  import { auditWithProvider } from './audit';
17
17
  import { HttpError } from './types';
18
+ import { ok, err, type Result as SafeResult } from './result';
19
+ import { toDomainError, type DomainError } from './domain-errors';
18
20
  import { useTranslation } from './i18n.svelte';
19
21
  import { toast } from './toast.svelte';
20
22
 
@@ -357,13 +359,21 @@ export function useContractUpdateMany<S extends ContractSchemas>(options: Contra
357
359
  mutate(params: ContractUpdateManyParams<S>, callbacks?: Callbacks<S>): void {
358
360
  void mutateAsync(params, callbacks).catch(() => {});
359
361
  },
362
+ async safeMutate(params: ContractUpdateManyParams<S>, callbacks?: Callbacks<S>): Promise<SafeResult<ContractRecord<S>[], DomainError>> {
363
+ try {
364
+ const res = await mutateAsync(params, callbacks);
365
+ return ok(res.data);
366
+ } catch (cause) {
367
+ return err(toDomainError(cause));
368
+ }
369
+ },
360
370
  reset() { active = undefined; latest = undefined; latestToken = undefined; mutation.reset(); },
361
371
  });
362
372
  const idle: typeof result = {
363
373
  context: undefined, data: undefined, error: null, failureCount: 0, failureReason: null,
364
374
  isError: false, isIdle: true, isPending: false, isPaused: false, isSuccess: false,
365
375
  status: 'idle', submittedAt: 0, variables: undefined,
366
- mutate: result.mutate, mutateAsync: result.mutateAsync, reset: result.reset,
376
+ mutate: result.mutate, mutateAsync: result.mutateAsync, safeMutate: result.safeMutate, reset: result.reset,
367
377
  };
368
378
  const view = createQueryResultView(() => {
369
379
  const invocation = mutation.variables;