@wix/wix-data-items-common 1.0.87 → 1.0.89

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.
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataPatch.ts"],"sourcesContent":["import { WixDataOptions, WixDataItem, WixDataBulkResult } from './types'\n\nexport interface FieldUpdate {\n fieldPath: string\n action:\n | 'SET_FIELD'\n | 'REMOVE_FIELD'\n | 'INCREMENT_FIELD'\n | 'APPEND_TO_ARRAY'\n | 'REMOVE_FROM_ARRAY'\n actionOptions?: any\n}\n\nexport interface WixDataBulkPatch {\n incrementField(fieldName: string, by: number): WixDataBulkPatch\n setField(fieldName: string, value: any): WixDataBulkPatch\n appendToArray(fieldName: string, value: any): WixDataBulkPatch\n removeFromArray(fieldName: string, value: any): WixDataBulkPatch\n removeField(fieldName: string): WixDataBulkPatch\n\n run(options?: WixDataOptions): Promise<WixDataBulkResult>\n}\n\nexport interface WixDataPatch {\n incrementField(fieldName: string, by: number): WixDataPatch\n setField(fieldName: string, value: any): WixDataPatch\n appendToArray(fieldName: string, value: any): WixDataPatch\n removeFromArray(fieldName: string, value: any): WixDataPatch\n removeField(fieldName: string): WixDataPatch\n\n run(options?: WixDataOptions): Promise<WixDataItem | null>\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataPatch.ts"],"sourcesContent":["import { WixDataOptions, WixDataItem, WixDataBulkResult } from './types'\n\nexport interface FieldUpdate {\n fieldPath: string\n action:\n | 'SET_FIELD'\n | 'REMOVE_FIELD'\n | 'INCREMENT_FIELD'\n | 'APPEND_TO_ARRAY'\n | 'REMOVE_FROM_ARRAY'\n actionOptions?: any\n}\n\n/**\n * @builder\n */\nexport interface WixDataBulkPatch {\n /**\n * Increments field\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param by - Value to increment by.\n * @requiredField by\n * @returns Updated patch.\n */\n incrementField(fieldName: string, by: number): WixDataBulkPatch\n\n /**\n * Sets field value\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to set.\n * @requiredField value\n * @returns Updated patch.\n */\n setField(fieldName: string, value: any): WixDataBulkPatch\n\n /**\n * Appends to array\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to append.\n * @requiredField value\n * @returns Updated patch.\n */\n appendToArray(fieldName: string, value: any): WixDataBulkPatch\n\n /**\n * Removes value from array\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to append.\n * @requiredField value\n * @returns Updated patch.\n */\n removeFromArray(fieldName: string, value: any): WixDataBulkPatch\n\n /**\n * Removes field\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @returns Updated patch.\n */\n removeField(fieldName: string): WixDataBulkPatch\n\n /**\n * Executes patch\n * @public\n * @documentationMaturity preview\n * @returns Bulk action results.\n */\n run(options?: WixDataOptions): Promise<WixDataBulkResult>\n}\n\n/**\n * @builder\n */\nexport interface WixDataPatch {\n /**\n * Increments field\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param by - Value to increment by.\n * @requiredField by\n * @returns Updated patch.\n */\n incrementField(fieldName: string, by: number): WixDataPatch\n\n /**\n * Sets field value\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to set.\n * @requiredField value\n * @returns Updated patch.\n */\n setField(fieldName: string, value: any): WixDataPatch\n\n /**\n * Appends to array\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to append.\n * @requiredField value\n * @returns Updated patch.\n */\n appendToArray(fieldName: string, value: any): WixDataPatch\n\n /**\n * Removes value from array\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @param value - Value to append.\n * @requiredField value\n * @returns Updated patch.\n */\n removeFromArray(fieldName: string, value: any): WixDataPatch\n\n /**\n * Removes field\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is will be modified.\n * @requiredField fieldName\n * @returns Updated patch.\n */\n removeField(fieldName: string): WixDataPatch\n\n /**\n * Executes patch\n * @public\n * @documentationMaturity preview\n * @returns Modified data item.\n */\n\n run(options?: WixDataOptions): Promise<WixDataItem | null>\n}\n"],"mappings":""}
@@ -10,15 +10,18 @@ function isHttpError(error) {
10
10
  var _response;
11
11
  return !!((_response = error.response) != null && _response.status);
12
12
  }
13
- function parseHookError(data) {
14
- if (data != null && data.jsErrorValue) {
13
+ function parseHookError(error) {
14
+ const data = error.details.applicationError.data;
15
+ const errorData = (data == null ? void 0 : data.jsErrorValue) || !(data != null && data.value) && error.details.applicationError; // fallback to use default hook error message data
16
+ if (errorData) {
15
17
  const {
16
18
  name,
17
19
  message,
18
- code
19
- } = data.jsErrorValue;
20
- const result = new Error(message);
21
- result.name = name;
20
+ code,
21
+ description
22
+ } = errorData;
23
+ const result = new Error(message || description);
24
+ result.name = name || description;
22
25
  // @ts-expect-error
23
26
  result.code = code;
24
27
  return result;
@@ -35,7 +38,7 @@ function parseError(error) {
35
38
  var _details$applicationE, _error$details2;
36
39
  const details = error.details ?? {};
37
40
  if (((_details$applicationE = details.applicationError) == null ? void 0 : _details$applicationE.code) === 'WDE0078') {
38
- const hookError = parseHookError(details.applicationError.data);
41
+ const hookError = parseHookError(error);
39
42
  if (hookError) {
40
43
  return hookError;
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","isHttpError","error","_response","response","status","parseHookError","data","jsErrorValue","name","message","code","result","Error","value","parseValidationError","_error$details","fieldViolations","details","validationError","violations","map","v","field","description","wixDataError","join","undefined","parseError","_details$applicationE","_error$details2","applicationError","hookError"],"sources":["../../../src/api/errors.ts"],"sourcesContent":["import * as apiError from '../types/error'\nimport { wixDataError } from '../errors'\n\nexport function isHttpError(\n error: unknown\n): error is { response: { status: number; data: any } } {\n return !!(error as any).response?.status\n}\n\nexport function parseHookError(data: any) {\n if (data?.jsErrorValue) {\n const { name, message, code } = data.jsErrorValue\n const result = new Error(message)\n result.name = name\n // @ts-expect-error\n result.code = code\n return result\n }\n return data?.value\n}\n\nexport function parseValidationError(error: apiError.ServerError) {\n const fieldViolations = error.details?.validationError?.fieldViolations ?? []\n const violations = fieldViolations.map((v) => `${v.field}: ${v.description}`)\n\n return wixDataError(\n [error.message, ...violations].join('\\n'),\n undefined,\n error.details\n )\n}\n\nexport function parseError(error: apiError.ServerError): Error | null {\n const details = error.details ?? {}\n if (details.applicationError?.code === 'WDE0078') {\n const hookError = parseHookError(details.applicationError.data)\n if (hookError) {\n return hookError\n }\n }\n if (details.applicationError) {\n return wixDataError(\n details.applicationError.description!,\n undefined,\n details\n )\n }\n if (error.details?.validationError) {\n return parseValidationError(error)\n }\n return null\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,WAAWA,CACzBC,KAAc,EACwC;EAAA,IAAAC,SAAA;EACtD,OAAO,CAAC,GAAAA,SAAA,GAAED,KAAK,CAASE,QAAQ,aAAvBD,SAAA,CAAyBE,MAAM;AAC1C;AAEO,SAASC,cAAcA,CAACC,IAAS,EAAE;EACxC,IAAIA,IAAI,YAAJA,IAAI,CAAEC,YAAY,EAAE;IACtB,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAK,CAAC,GAAGJ,IAAI,CAACC,YAAY;IACjD,MAAMI,MAAM,GAAG,IAAIC,KAAK,CAACH,OAAO,CAAC;IACjCE,MAAM,CAACH,IAAI,GAAGA,IAAI;IAClB;IACAG,MAAM,CAACD,IAAI,GAAGA,IAAI;IAClB,OAAOC,MAAM;EACf;EACA,OAAOL,IAAI,oBAAJA,IAAI,CAAEO,KAAK;AACpB;AAEO,SAASC,oBAAoBA,CAACb,KAA2B,EAAE;EAAA,IAAAc,cAAA;EAChE,MAAMC,eAAe,GAAG,EAAAD,cAAA,GAAAd,KAAK,CAACgB,OAAO,cAAAF,cAAA,GAAbA,cAAA,CAAeG,eAAe,qBAA9BH,cAAA,CAAgCC,eAAe,KAAI,EAAE;EAC7E,MAAMG,UAAU,GAAGH,eAAe,CAACI,GAAG,CAAEC,CAAC,IAAM,GAAEA,CAAC,CAACC,KAAM,KAAID,CAAC,CAACE,WAAY,EAAC,CAAC;EAE7E,OAAO,IAAAC,oBAAY,EACjB,CAACvB,KAAK,CAACQ,OAAO,EAAE,GAAGU,UAAU,CAAC,CAACM,IAAI,CAAC,IAAI,CAAC,EACzCC,SAAS,EACTzB,KAAK,CAACgB,OACR,CAAC;AACH;AAEO,SAASU,UAAUA,CAAC1B,KAA2B,EAAgB;EAAA,IAAA2B,qBAAA,EAAAC,eAAA;EACpE,MAAMZ,OAAO,GAAGhB,KAAK,CAACgB,OAAO,IAAI,CAAC,CAAC;EACnC,IAAI,EAAAW,qBAAA,GAAAX,OAAO,CAACa,gBAAgB,qBAAxBF,qBAAA,CAA0BlB,IAAI,MAAK,SAAS,EAAE;IAChD,MAAMqB,SAAS,GAAG1B,cAAc,CAACY,OAAO,CAACa,gBAAgB,CAACxB,IAAI,CAAC;IAC/D,IAAIyB,SAAS,EAAE;MACb,OAAOA,SAAS;IAClB;EACF;EACA,IAAId,OAAO,CAACa,gBAAgB,EAAE;IAC5B,OAAO,IAAAN,oBAAY,EACjBP,OAAO,CAACa,gBAAgB,CAACP,WAAW,EACpCG,SAAS,EACTT,OACF,CAAC;EACH;EACA,KAAAY,eAAA,GAAI5B,KAAK,CAACgB,OAAO,aAAbY,eAAA,CAAeX,eAAe,EAAE;IAClC,OAAOJ,oBAAoB,CAACb,KAAK,CAAC;EACpC;EACA,OAAO,IAAI;AACb"}
1
+ {"version":3,"names":["_errors","require","isHttpError","error","_response","response","status","parseHookError","data","details","applicationError","errorData","jsErrorValue","value","name","message","code","description","result","Error","parseValidationError","_error$details","fieldViolations","validationError","violations","map","v","field","wixDataError","join","undefined","parseError","_details$applicationE","_error$details2","hookError"],"sources":["../../../src/api/errors.ts"],"sourcesContent":["import * as apiError from '../types/error'\nimport { wixDataError } from '../errors'\n\nexport function isHttpError(\n error: unknown\n): error is { response: { status: number; data: any } } {\n return !!(error as any).response?.status\n}\n\nexport function parseHookError(error: any) {\n const data = error.details.applicationError.data\n const errorData =\n data?.jsErrorValue || (!data?.value && error.details.applicationError) // fallback to use default hook error message data\n if (errorData) {\n const { name, message, code, description } = errorData\n const result = new Error(message || description)\n result.name = name || description\n // @ts-expect-error\n result.code = code\n return result\n }\n return data?.value\n}\n\nexport function parseValidationError(error: apiError.ServerError) {\n const fieldViolations = error.details?.validationError?.fieldViolations ?? []\n const violations = fieldViolations.map((v) => `${v.field}: ${v.description}`)\n\n return wixDataError(\n [error.message, ...violations].join('\\n'),\n undefined,\n error.details\n )\n}\n\nexport function parseError(error: apiError.ServerError): Error | null {\n const details = error.details ?? {}\n if (details.applicationError?.code === 'WDE0078') {\n const hookError = parseHookError(error)\n if (hookError) {\n return hookError\n }\n }\n if (details.applicationError) {\n return wixDataError(\n details.applicationError.description!,\n undefined,\n details\n )\n }\n if (error.details?.validationError) {\n return parseValidationError(error)\n }\n return null\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,WAAWA,CACzBC,KAAc,EACwC;EAAA,IAAAC,SAAA;EACtD,OAAO,CAAC,GAAAA,SAAA,GAAED,KAAK,CAASE,QAAQ,aAAvBD,SAAA,CAAyBE,MAAM;AAC1C;AAEO,SAASC,cAAcA,CAACJ,KAAU,EAAE;EACzC,MAAMK,IAAI,GAAGL,KAAK,CAACM,OAAO,CAACC,gBAAgB,CAACF,IAAI;EAChD,MAAMG,SAAS,GACb,CAAAH,IAAI,oBAAJA,IAAI,CAAEI,YAAY,KAAK,EAACJ,IAAI,YAAJA,IAAI,CAAEK,KAAK,KAAIV,KAAK,CAACM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ACF;EACA,IAAIzB,OAAO,CAACC,gBAAgB,EAAE;IAC5B,OAAO,IAAAkB,oBAAY,EACjBnB,OAAO,CAACC,gBAAgB,CAACO,WAAW,EACpCa,SAAS,EACTrB,OACF,CAAC;EACH;EACA,KAAAwB,eAAA,GAAI9B,KAAK,CAACM,OAAO,aAAbwB,eAAA,CAAeV,eAAe,EAAE;IAClC,OAAOH,oBAAoB,CAACjB,KAAK,CAAC;EACpC;EACA,OAAO,IAAI;AACb"}
@@ -2,11 +2,13 @@ import { wixDataError } from '../errors';
2
2
  export function isHttpError(error) {
3
3
  return !!error.response?.status;
4
4
  }
5
- export function parseHookError(data) {
6
- if (data?.jsErrorValue) {
7
- const { name, message, code } = data.jsErrorValue;
8
- const result = new Error(message);
9
- result.name = name;
5
+ export function parseHookError(error) {
6
+ const data = error.details.applicationError.data;
7
+ const errorData = data?.jsErrorValue || (!data?.value && error.details.applicationError); // fallback to use default hook error message data
8
+ if (errorData) {
9
+ const { name, message, code, description } = errorData;
10
+ const result = new Error(message || description);
11
+ result.name = name || description;
10
12
  // @ts-expect-error
11
13
  result.code = code;
12
14
  return result;
@@ -21,7 +23,7 @@ export function parseValidationError(error) {
21
23
  export function parseError(error) {
22
24
  const details = error.details ?? {};
23
25
  if (details.applicationError?.code === 'WDE0078') {
24
- const hookError = parseHookError(details.applicationError.data);
26
+ const hookError = parseHookError(error);
25
27
  if (hookError) {
26
28
  return hookError;
27
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,UAAU,WAAW,CACzB,KAAc;IAEd,OAAO,CAAC,CAAE,KAAa,CAAC,QAAQ,EAAE,MAAM,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAS;IACtC,IAAI,IAAI,EAAE,YAAY,EAAE;QACtB,MAAM,EAAE,IAAI,EAAE,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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EACzC,SAAS,EACT,KAAK,CAAC,OAAO,CACd,CAAA;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAA2B;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAA;IACnC,IAAI,OAAO,CAAC,gBAAgB,EAAE,IAAI,KAAK,SAAS,EAAE;QAChD,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,SAAS,EAAE;YACb,OAAO,SAAS,CAAA;SACjB;KACF;IACD,IAAI,OAAO,CAAC,gBAAgB,EAAE;QAC5B,OAAO,YAAY,CACjB,OAAO,CAAC,gBAAgB,CAAC,WAAY,EACrC,SAAS,EACT,OAAO,CACR,CAAA;KACF;IACD,IAAI,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE;QAClC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAA;KACnC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -4,20 +4,134 @@ export interface FieldUpdate {
4
4
  action: 'SET_FIELD' | 'REMOVE_FIELD' | 'INCREMENT_FIELD' | 'APPEND_TO_ARRAY' | 'REMOVE_FROM_ARRAY';
5
5
  actionOptions?: any;
6
6
  }
7
+ /**
8
+ * @builder
9
+ */
7
10
  export interface WixDataBulkPatch {
11
+ /**
12
+ * Increments field
13
+ * @public
14
+ * @documentationMaturity preview
15
+ * @param field - Field whose value is will be modified.
16
+ * @requiredField fieldName
17
+ * @param by - Value to increment by.
18
+ * @requiredField by
19
+ * @returns Updated patch.
20
+ */
8
21
  incrementField(fieldName: string, by: number): WixDataBulkPatch;
22
+ /**
23
+ * Sets field value
24
+ * @public
25
+ * @documentationMaturity preview
26
+ * @param field - Field whose value is will be modified.
27
+ * @requiredField fieldName
28
+ * @param value - Value to set.
29
+ * @requiredField value
30
+ * @returns Updated patch.
31
+ */
9
32
  setField(fieldName: string, value: any): WixDataBulkPatch;
33
+ /**
34
+ * Appends to array
35
+ * @public
36
+ * @documentationMaturity preview
37
+ * @param field - Field whose value is will be modified.
38
+ * @requiredField fieldName
39
+ * @param value - Value to append.
40
+ * @requiredField value
41
+ * @returns Updated patch.
42
+ */
10
43
  appendToArray(fieldName: string, value: any): WixDataBulkPatch;
44
+ /**
45
+ * Removes value from array
46
+ * @public
47
+ * @documentationMaturity preview
48
+ * @param field - Field whose value is will be modified.
49
+ * @requiredField fieldName
50
+ * @param value - Value to append.
51
+ * @requiredField value
52
+ * @returns Updated patch.
53
+ */
11
54
  removeFromArray(fieldName: string, value: any): WixDataBulkPatch;
55
+ /**
56
+ * Removes field
57
+ * @public
58
+ * @documentationMaturity preview
59
+ * @param field - Field whose value is will be modified.
60
+ * @requiredField fieldName
61
+ * @returns Updated patch.
62
+ */
12
63
  removeField(fieldName: string): WixDataBulkPatch;
64
+ /**
65
+ * Executes patch
66
+ * @public
67
+ * @documentationMaturity preview
68
+ * @returns Bulk action results.
69
+ */
13
70
  run(options?: WixDataOptions): Promise<WixDataBulkResult>;
14
71
  }
72
+ /**
73
+ * @builder
74
+ */
15
75
  export interface WixDataPatch {
76
+ /**
77
+ * Increments field
78
+ * @public
79
+ * @documentationMaturity preview
80
+ * @param field - Field whose value is will be modified.
81
+ * @requiredField fieldName
82
+ * @param by - Value to increment by.
83
+ * @requiredField by
84
+ * @returns Updated patch.
85
+ */
16
86
  incrementField(fieldName: string, by: number): WixDataPatch;
87
+ /**
88
+ * Sets field value
89
+ * @public
90
+ * @documentationMaturity preview
91
+ * @param field - Field whose value is will be modified.
92
+ * @requiredField fieldName
93
+ * @param value - Value to set.
94
+ * @requiredField value
95
+ * @returns Updated patch.
96
+ */
17
97
  setField(fieldName: string, value: any): WixDataPatch;
98
+ /**
99
+ * Appends to array
100
+ * @public
101
+ * @documentationMaturity preview
102
+ * @param field - Field whose value is will be modified.
103
+ * @requiredField fieldName
104
+ * @param value - Value to append.
105
+ * @requiredField value
106
+ * @returns Updated patch.
107
+ */
18
108
  appendToArray(fieldName: string, value: any): WixDataPatch;
109
+ /**
110
+ * Removes value from array
111
+ * @public
112
+ * @documentationMaturity preview
113
+ * @param field - Field whose value is will be modified.
114
+ * @requiredField fieldName
115
+ * @param value - Value to append.
116
+ * @requiredField value
117
+ * @returns Updated patch.
118
+ */
19
119
  removeFromArray(fieldName: string, value: any): WixDataPatch;
120
+ /**
121
+ * Removes field
122
+ * @public
123
+ * @documentationMaturity preview
124
+ * @param field - Field whose value is will be modified.
125
+ * @requiredField fieldName
126
+ * @returns Updated patch.
127
+ */
20
128
  removeField(fieldName: string): WixDataPatch;
129
+ /**
130
+ * Executes patch
131
+ * @public
132
+ * @documentationMaturity preview
133
+ * @returns Modified data item.
134
+ */
21
135
  run(options?: WixDataOptions): Promise<WixDataItem | null>;
22
136
  }
23
137
  //# sourceMappingURL=WixDataPatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WixDataPatch.d.ts","sourceRoot":"","sources":["../../../src/api/WixDataPatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAExE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EACF,WAAW,GACX,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,CAAA;IACvB,aAAa,CAAC,EAAE,GAAG,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB,CAAA;IACzD,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB,CAAA;IAC9D,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB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zD;;;;;;;;;OASG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB,CAAA;IAE9D;;;;;;;;;OASG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB,CAAA;IAEhE;;;;;;;OAOG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAEhD;;;;;OAKG;IACH,GAAG,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAAA;IAE3D;;;;;;;;;OASG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,YAAY,CAAA;IAErD;;;;;;;;;OASG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,YAAY,CAAA;IAE1D;;;;;;;;;OASG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,YAAY,CAAA;IAE5D;;;;;;;OAOG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAA;IAE5C;;;;;OAKG;IAEH,GAAG,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAC3D"}
@@ -5,7 +5,7 @@ export declare function isHttpError(error: unknown): error is {
5
5
  data: any;
6
6
  };
7
7
  };
8
- export declare function parseHookError(data: any): any;
8
+ export declare function parseHookError(error: any): any;
9
9
  export declare function parseValidationError(error: apiError.ServerError): Error;
10
10
  export declare function parseError(error: apiError.ServerError): Error | null;
11
11
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAG1C,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAA;CAAE,CAEtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,OAUvC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,SAS/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,GAAG,KAAK,GAAG,IAAI,CAmBpE"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAG1C,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,CAAA;CAAE,CAEtD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,OAaxC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,SAS/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,GAAG,KAAK,GAAG,IAAI,CAmBpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/wix-data-items-common",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Rimvydas Gimbutas",
@@ -85,5 +85,5 @@
85
85
  "wallaby": {
86
86
  "autoDetect": true
87
87
  },
88
- "falconPackageHash": "1015f04e54f01fd64f877f879b4a91730aa99e2965d4ff7b74490a03"
88
+ "falconPackageHash": "4bf44eb04766e84a522867b56c2f95d538e66dd0273903b9a942f4a8"
89
89
  }