@wix/wix-data-items-common 1.0.52

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.
Files changed (228) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/api/ApiClient.js +186 -0
  3. package/dist/cjs/api/ApiClient.js.map +1 -0
  4. package/dist/cjs/api/QueryBase.js +200 -0
  5. package/dist/cjs/api/QueryBase.js.map +1 -0
  6. package/dist/cjs/api/QueryValidator.js +36 -0
  7. package/dist/cjs/api/QueryValidator.js.map +1 -0
  8. package/dist/cjs/api/WixDataAggregate.js +4 -0
  9. package/dist/cjs/api/WixDataAggregate.js.map +1 -0
  10. package/dist/cjs/api/WixDataApi.js +800 -0
  11. package/dist/cjs/api/WixDataApi.js.map +1 -0
  12. package/dist/cjs/api/WixDataFilter.js +2 -0
  13. package/dist/cjs/api/WixDataFilter.js.map +1 -0
  14. package/dist/cjs/api/WixDataPatch.js +139 -0
  15. package/dist/cjs/api/WixDataPatch.js.map +1 -0
  16. package/dist/cjs/api/WixDataQuery.js +4 -0
  17. package/dist/cjs/api/WixDataQuery.js.map +1 -0
  18. package/dist/cjs/api/WixDataResult.js +4 -0
  19. package/dist/cjs/api/WixDataResult.js.map +1 -0
  20. package/dist/cjs/api/common.js +14 -0
  21. package/dist/cjs/api/common.js.map +1 -0
  22. package/dist/cjs/api/errors.js +67 -0
  23. package/dist/cjs/api/errors.js.map +1 -0
  24. package/dist/cjs/api/impl/WixDataAggregateImpl.js +193 -0
  25. package/dist/cjs/api/impl/WixDataAggregateImpl.js.map +1 -0
  26. package/dist/cjs/api/impl/WixDataQueryImpl.js +116 -0
  27. package/dist/cjs/api/impl/WixDataQueryImpl.js.map +1 -0
  28. package/dist/cjs/api/impl/WixDataResultImpl.js +111 -0
  29. package/dist/cjs/api/impl/WixDataResultImpl.js.map +1 -0
  30. package/dist/cjs/api/index.js +32 -0
  31. package/dist/cjs/api/index.js.map +1 -0
  32. package/dist/cjs/api/types.js +2 -0
  33. package/dist/cjs/api/types.js.map +1 -0
  34. package/dist/cjs/errors/base-validator.js +92 -0
  35. package/dist/cjs/errors/base-validator.js.map +1 -0
  36. package/dist/cjs/errors/errors.js +155 -0
  37. package/dist/cjs/errors/errors.js.map +1 -0
  38. package/dist/cjs/errors/index.js +15 -0
  39. package/dist/cjs/errors/index.js.map +1 -0
  40. package/dist/cjs/errors/validations.js +91 -0
  41. package/dist/cjs/errors/validations.js.map +1 -0
  42. package/dist/cjs/external-types.d.js +2 -0
  43. package/dist/cjs/external-types.d.js.map +1 -0
  44. package/dist/cjs/filter/FilterTree.js +154 -0
  45. package/dist/cjs/filter/FilterTree.js.map +1 -0
  46. package/dist/cjs/filter/WithFilter.js +2 -0
  47. package/dist/cjs/filter/WithFilter.js.map +1 -0
  48. package/dist/cjs/filter/filterBuilder.js +53 -0
  49. package/dist/cjs/filter/filterBuilder.js.map +1 -0
  50. package/dist/cjs/filter/filterMixin.js +144 -0
  51. package/dist/cjs/filter/filterMixin.js.map +1 -0
  52. package/dist/cjs/filter/index.js +16 -0
  53. package/dist/cjs/filter/index.js.map +1 -0
  54. package/dist/cjs/index.js +120 -0
  55. package/dist/cjs/index.js.map +1 -0
  56. package/dist/cjs/sort/sortMixin.js +79 -0
  57. package/dist/cjs/sort/sortMixin.js.map +1 -0
  58. package/dist/cjs/test-types.d.js +2 -0
  59. package/dist/cjs/test-types.d.js.map +1 -0
  60. package/dist/cjs/types/api.js +4 -0
  61. package/dist/cjs/types/api.js.map +1 -0
  62. package/dist/cjs/types/data-item-types.js +46 -0
  63. package/dist/cjs/types/data-item-types.js.map +1 -0
  64. package/dist/cjs/types/error.js +2 -0
  65. package/dist/cjs/types/error.js.map +1 -0
  66. package/dist/cjs/types/index.js +16 -0
  67. package/dist/cjs/types/index.js.map +1 -0
  68. package/dist/cjs/utils/base64url.js +51 -0
  69. package/dist/cjs/utils/base64url.js.map +1 -0
  70. package/dist/cjs/utils/clone.js +21 -0
  71. package/dist/cjs/utils/clone.js.map +1 -0
  72. package/dist/cjs/utils/codec.js +64 -0
  73. package/dist/cjs/utils/codec.js.map +1 -0
  74. package/dist/cjs/utils/field-key-utils.js +18 -0
  75. package/dist/cjs/utils/field-key-utils.js.map +1 -0
  76. package/dist/cjs/utils/index.js +25 -0
  77. package/dist/cjs/utils/index.js.map +1 -0
  78. package/dist/cjs/utils/type-utils.js +54 -0
  79. package/dist/cjs/utils/type-utils.js.map +1 -0
  80. package/dist/esm/api/ApiClient.js +174 -0
  81. package/dist/esm/api/ApiClient.js.map +1 -0
  82. package/dist/esm/api/QueryBase.js +117 -0
  83. package/dist/esm/api/QueryBase.js.map +1 -0
  84. package/dist/esm/api/QueryValidator.js +32 -0
  85. package/dist/esm/api/QueryValidator.js.map +1 -0
  86. package/dist/esm/api/WixDataAggregate.js +2 -0
  87. package/dist/esm/api/WixDataAggregate.js.map +1 -0
  88. package/dist/esm/api/WixDataApi.js +829 -0
  89. package/dist/esm/api/WixDataApi.js.map +1 -0
  90. package/dist/esm/api/WixDataFilter.js +2 -0
  91. package/dist/esm/api/WixDataFilter.js.map +1 -0
  92. package/dist/esm/api/WixDataPatch.js +134 -0
  93. package/dist/esm/api/WixDataPatch.js.map +1 -0
  94. package/dist/esm/api/WixDataQuery.js +2 -0
  95. package/dist/esm/api/WixDataQuery.js.map +1 -0
  96. package/dist/esm/api/WixDataResult.js +2 -0
  97. package/dist/esm/api/WixDataResult.js.map +1 -0
  98. package/dist/esm/api/common.js +10 -0
  99. package/dist/esm/api/common.js.map +1 -0
  100. package/dist/esm/api/errors.js +52 -0
  101. package/dist/esm/api/errors.js.map +1 -0
  102. package/dist/esm/api/impl/WixDataAggregateImpl.js +214 -0
  103. package/dist/esm/api/impl/WixDataAggregateImpl.js.map +1 -0
  104. package/dist/esm/api/impl/WixDataQueryImpl.js +119 -0
  105. package/dist/esm/api/impl/WixDataQueryImpl.js.map +1 -0
  106. package/dist/esm/api/impl/WixDataResultImpl.js +100 -0
  107. package/dist/esm/api/impl/WixDataResultImpl.js.map +1 -0
  108. package/dist/esm/api/index.js +5 -0
  109. package/dist/esm/api/index.js.map +1 -0
  110. package/dist/esm/api/types.js +2 -0
  111. package/dist/esm/api/types.js.map +1 -0
  112. package/dist/esm/errors/base-validator.js +71 -0
  113. package/dist/esm/errors/base-validator.js.map +1 -0
  114. package/dist/esm/errors/errors.js +147 -0
  115. package/dist/esm/errors/errors.js.map +1 -0
  116. package/dist/esm/errors/index.js +5 -0
  117. package/dist/esm/errors/index.js.map +1 -0
  118. package/dist/esm/errors/validations.js +114 -0
  119. package/dist/esm/errors/validations.js.map +1 -0
  120. package/dist/esm/filter/FilterTree.js +148 -0
  121. package/dist/esm/filter/FilterTree.js.map +1 -0
  122. package/dist/esm/filter/WithFilter.js +2 -0
  123. package/dist/esm/filter/WithFilter.js.map +1 -0
  124. package/dist/esm/filter/filterBuilder.js +43 -0
  125. package/dist/esm/filter/filterBuilder.js.map +1 -0
  126. package/dist/esm/filter/filterMixin.js +137 -0
  127. package/dist/esm/filter/filterMixin.js.map +1 -0
  128. package/dist/esm/filter/index.js +5 -0
  129. package/dist/esm/filter/index.js.map +1 -0
  130. package/dist/esm/index.js +9 -0
  131. package/dist/esm/index.js.map +1 -0
  132. package/dist/esm/sort/sortMixin.js +74 -0
  133. package/dist/esm/sort/sortMixin.js.map +1 -0
  134. package/dist/esm/types/api.js +2 -0
  135. package/dist/esm/types/api.js.map +1 -0
  136. package/dist/esm/types/data-item-types.js +35 -0
  137. package/dist/esm/types/data-item-types.js.map +1 -0
  138. package/dist/esm/types/error.js +2 -0
  139. package/dist/esm/types/error.js.map +1 -0
  140. package/dist/esm/types/index.js +3 -0
  141. package/dist/esm/types/index.js.map +1 -0
  142. package/dist/esm/utils/base64url.js +57 -0
  143. package/dist/esm/utils/base64url.js.map +1 -0
  144. package/dist/esm/utils/clone.js +18 -0
  145. package/dist/esm/utils/clone.js.map +1 -0
  146. package/dist/esm/utils/codec.js +60 -0
  147. package/dist/esm/utils/codec.js.map +1 -0
  148. package/dist/esm/utils/field-key-utils.js +14 -0
  149. package/dist/esm/utils/field-key-utils.js.map +1 -0
  150. package/dist/esm/utils/index.js +7 -0
  151. package/dist/esm/utils/index.js.map +1 -0
  152. package/dist/esm/utils/type-utils.js +40 -0
  153. package/dist/esm/utils/type-utils.js.map +1 -0
  154. package/dist/types/api/ApiClient.d.ts +30 -0
  155. package/dist/types/api/ApiClient.d.ts.map +1 -0
  156. package/dist/types/api/QueryBase.d.ts +111 -0
  157. package/dist/types/api/QueryBase.d.ts.map +1 -0
  158. package/dist/types/api/QueryValidator.d.ts +12 -0
  159. package/dist/types/api/QueryValidator.d.ts.map +1 -0
  160. package/dist/types/api/WixDataAggregate.d.ts +320 -0
  161. package/dist/types/api/WixDataAggregate.d.ts.map +1 -0
  162. package/dist/types/api/WixDataApi.d.ts +52 -0
  163. package/dist/types/api/WixDataApi.d.ts.map +1 -0
  164. package/dist/types/api/WixDataFilter.d.ts +424 -0
  165. package/dist/types/api/WixDataFilter.d.ts.map +1 -0
  166. package/dist/types/api/WixDataPatch.d.ts +80 -0
  167. package/dist/types/api/WixDataPatch.d.ts.map +1 -0
  168. package/dist/types/api/WixDataQuery.d.ts +702 -0
  169. package/dist/types/api/WixDataQuery.d.ts.map +1 -0
  170. package/dist/types/api/WixDataResult.d.ts +144 -0
  171. package/dist/types/api/WixDataResult.d.ts.map +1 -0
  172. package/dist/types/api/common.d.ts +3 -0
  173. package/dist/types/api/common.d.ts.map +1 -0
  174. package/dist/types/api/errors.d.ts +12 -0
  175. package/dist/types/api/errors.d.ts.map +1 -0
  176. package/dist/types/api/impl/WixDataAggregateImpl.d.ts +76 -0
  177. package/dist/types/api/impl/WixDataAggregateImpl.d.ts.map +1 -0
  178. package/dist/types/api/impl/WixDataQueryImpl.d.ts +72 -0
  179. package/dist/types/api/impl/WixDataQueryImpl.d.ts.map +1 -0
  180. package/dist/types/api/impl/WixDataResultImpl.d.ts +34 -0
  181. package/dist/types/api/impl/WixDataResultImpl.d.ts.map +1 -0
  182. package/dist/types/api/index.d.ts +11 -0
  183. package/dist/types/api/index.d.ts.map +1 -0
  184. package/dist/types/api/types.d.ts +163 -0
  185. package/dist/types/api/types.d.ts.map +1 -0
  186. package/dist/types/errors/base-validator.d.ts +28 -0
  187. package/dist/types/errors/base-validator.d.ts.map +1 -0
  188. package/dist/types/errors/errors.d.ts +108 -0
  189. package/dist/types/errors/errors.d.ts.map +1 -0
  190. package/dist/types/errors/index.d.ts +5 -0
  191. package/dist/types/errors/index.d.ts.map +1 -0
  192. package/dist/types/errors/validations.d.ts +25 -0
  193. package/dist/types/errors/validations.d.ts.map +1 -0
  194. package/dist/types/filter/FilterTree.d.ts +56 -0
  195. package/dist/types/filter/FilterTree.d.ts.map +1 -0
  196. package/dist/types/filter/WithFilter.d.ts +470 -0
  197. package/dist/types/filter/WithFilter.d.ts.map +1 -0
  198. package/dist/types/filter/filterBuilder.d.ts +105 -0
  199. package/dist/types/filter/filterBuilder.d.ts.map +1 -0
  200. package/dist/types/filter/filterMixin.d.ts +61 -0
  201. package/dist/types/filter/filterMixin.d.ts.map +1 -0
  202. package/dist/types/filter/index.d.ts +8 -0
  203. package/dist/types/filter/index.d.ts.map +1 -0
  204. package/dist/types/index.d.ts +13 -0
  205. package/dist/types/index.d.ts.map +1 -0
  206. package/dist/types/sort/sortMixin.d.ts +46 -0
  207. package/dist/types/sort/sortMixin.d.ts.map +1 -0
  208. package/dist/types/types/api.d.ts +36 -0
  209. package/dist/types/types/api.d.ts.map +1 -0
  210. package/dist/types/types/data-item-types.d.ts +1448 -0
  211. package/dist/types/types/data-item-types.d.ts.map +1 -0
  212. package/dist/types/types/error.d.ts +23 -0
  213. package/dist/types/types/error.d.ts.map +1 -0
  214. package/dist/types/types/index.d.ts +4 -0
  215. package/dist/types/types/index.d.ts.map +1 -0
  216. package/dist/types/utils/base64url.d.ts +2 -0
  217. package/dist/types/utils/base64url.d.ts.map +1 -0
  218. package/dist/types/utils/clone.d.ts +2 -0
  219. package/dist/types/utils/clone.d.ts.map +1 -0
  220. package/dist/types/utils/codec.d.ts +3 -0
  221. package/dist/types/utils/codec.d.ts.map +1 -0
  222. package/dist/types/utils/field-key-utils.d.ts +2 -0
  223. package/dist/types/utils/field-key-utils.d.ts.map +1 -0
  224. package/dist/types/utils/index.d.ts +7 -0
  225. package/dist/types/utils/index.d.ts.map +1 -0
  226. package/dist/types/utils/type-utils.d.ts +11 -0
  227. package/dist/types/utils/type-utils.d.ts.map +1 -0
  228. package/package.json +89 -0
@@ -0,0 +1,52 @@
1
+ import { HttpApiClientFactory } from '../types/api';
2
+ import * as apiTypes from '../types/data-item-types';
3
+ import { Provider, WixDataBulkResult, WixDataItem, WixDataItemOrId, WixDataOptions, WixDataQueryReferencedOptions, WixDataReadOptions, WixDataReadWithProjectionOptions, WixDataReference, WixDataUpdateOptions } from './types';
4
+ import { WixDataQuery } from './WixDataQuery';
5
+ import { WixDataResultImpl } from './impl/WixDataResultImpl';
6
+ import { WixDataPatch, WixDataBulkPatch } from './WixDataPatch';
7
+ import { WixDataAggregate } from './WixDataAggregate';
8
+ import { WixDataFilter } from './WixDataFilter';
9
+ import { WixDataResult } from './WixDataResult';
10
+ type ProvidedOpt<T> = T | undefined | Provider<T | undefined>;
11
+ type TraceWith = (label: string, opts?: object) => <T>(fn: () => Promise<T>) => Promise<T>;
12
+ export declare class WixDataApi {
13
+ private readonly environment?;
14
+ private readonly gridAppId?;
15
+ private readonly tracer?;
16
+ private client;
17
+ constructor(clientFactory: HttpApiClientFactory<any>, allowGet: boolean, environment?: apiTypes.Environment | undefined, gridAppId?: ProvidedOpt<string>, tracer?: TraceWith | undefined);
18
+ get wixData(): WixDataApi;
19
+ get filter(): WixDataFilter;
20
+ truncate: (collectionName: string, options?: WixDataOptions | undefined) => Promise<void>;
21
+ get: (collectionName: string, itemId: string, options?: WixDataReadWithProjectionOptions | undefined) => Promise<WixDataItem | null>;
22
+ insert: (collectionName: string, item: Partial<WixDataItem>, options?: WixDataUpdateOptions | undefined) => Promise<WixDataItem>;
23
+ save: (collectionName: string, item: Partial<WixDataItem>, options?: WixDataUpdateOptions | undefined) => Promise<WixDataItem>;
24
+ update: (collectionName: string, item: WixDataItem, options?: WixDataUpdateOptions | undefined) => Promise<WixDataItem>;
25
+ remove: (collectionName: string, itemId: string, options?: WixDataOptions | undefined) => Promise<WixDataItem | null>;
26
+ private toFieldUpdateApi;
27
+ patch: (collectionName: string, itemId: string) => WixDataPatch;
28
+ bulkPatch: (collectionName: string, itemIds: string[]) => WixDataBulkPatch;
29
+ query: (collectionName: string) => WixDataQuery;
30
+ fetch: (collectionName: string, cursor: string, limit?: number | undefined, options?: WixDataReadOptions | undefined) => Promise<WixDataResult<WixDataItem>>;
31
+ aggregate: (collectionName: string) => WixDataAggregate;
32
+ fetchAggregate: (collectionName: string, cursor: string, limit?: number | undefined, options?: WixDataReadOptions | undefined) => Promise<WixDataResultImpl<Record<string, any>>>;
33
+ bulkRemove: (collectionName: string, itemIds: string[], options?: WixDataOptions | undefined) => Promise<WixDataBulkResult>;
34
+ private runBulkSave;
35
+ bulkInsert: (collectionName: string, items: Partial<WixDataItem>[], options?: (WixDataOptions & {
36
+ overrideExisting?: boolean | undefined;
37
+ }) | undefined) => Promise<WixDataBulkResult>;
38
+ bulkSave: (collectionName: string, items: Partial<WixDataItem>[], options?: WixDataOptions | undefined) => Promise<WixDataBulkResult>;
39
+ bulkUpdate: (collectionName: string, items: WixDataItem[], options?: WixDataOptions | undefined) => Promise<WixDataBulkResult>;
40
+ fetchReferenced: (collectionName: string, cursor: string, limit?: number | undefined, options?: WixDataReadWithProjectionOptions | undefined) => Promise<WixDataResult<string | WixDataItem>>;
41
+ queryReferenced: (collectionName: string, holdingItem: WixDataItemOrId, relationshipAttribute: string, options?: WixDataQueryReferencedOptions | undefined) => Promise<WixDataResult<WixDataItem>>;
42
+ insertReference: {
43
+ (collectionName: string, refs: WixDataReference[], options?: WixDataOptions): Promise<void>;
44
+ (collectionName: string, relationshipAttribute: string, left: WixDataItemOrId, right: WixDataItemOrId | WixDataItemOrId[], options?: WixDataOptions): Promise<void>;
45
+ };
46
+ replaceReferences: (collectionName: string, relationshipAttribute: string, left: WixDataItemOrId, right: WixDataItemOrId | WixDataItemOrId[], options?: WixDataOptions | undefined) => Promise<void>;
47
+ removeReference: (collectionName: string, relationshipAttribute: string, left: WixDataItemOrId, right: WixDataItemOrId | WixDataItemOrId[], options?: WixDataOptions | undefined) => Promise<void>;
48
+ isReferenced: (collectionName: string, relationshipAttribute: string, left: WixDataItemOrId, right: WixDataItemOrId, options?: WixDataReadOptions | undefined) => Promise<boolean>;
49
+ private trace;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=WixDataApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WixDataApi.d.ts","sourceRoot":"","sources":["../../../src/api/WixDataApi.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAA;AAIpD,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,6BAA6B,EAC7B,kBAAkB,EAClB,gCAAgC,EAChC,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAIzE,OAAO,EAAE,YAAY,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC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EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,CAAA;QAEhB,CACE,cAAc,EAAE,MAAM,EACtB,qBAAqB,EAAE,MAAM,EAC7B,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,eAAe,GAAG,eAAe,EAAE,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,CAAA;KACjB,CA+CA;IAED,iBAAiB,oLAiChB;IAED,eAAe,oLAmCd;IAED,YAAY,uKAiCX;IAED,OAAO,CAAC,KAAK;CAsBd"}
@@ -0,0 +1,424 @@
1
+ type Comparable = string | number | Date;
2
+ /**
3
+ * @builder
4
+ */
5
+ export interface WixDataFilter {
6
+ /**
7
+ * Refines a filter to match items whose specified property value equals the specified value.
8
+ *
9
+ * The `eq()` function refines this filter to only
10
+ * match items where the value of the specified property equals the specified `value`.
11
+ *
12
+ * It only matches values of the same type. For example, a number value stored
13
+ * as a String type does not match the same number stored as a Number type.
14
+ *
15
+ * Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`.
16
+ *
17
+ * If `field` points to a collection field of type Array, `eq()` includes the item
18
+ * as long as at least one Array element matches the specified `value`.
19
+ * @public
20
+ * @documentationMaturity preview
21
+ * @param field - The property whose value will be compared with `value`.
22
+ * @requiredField field
23
+ * @param value - The value to match against.
24
+ * @requiredField value
25
+ * @returns An object representing the refined filter.
26
+ */
27
+ eq(field: string, value: any): WixDataFilter;
28
+ /**
29
+ * Refines a filter to match items whose specified property value does not equal the specified value.
30
+ *
31
+ * The `ne()` function refines this filter to only
32
+ * match items where the value of the specified property does not equal the specified `value`.
33
+ *
34
+ * It only matches values of the same type. For example, a number value stored
35
+ * as a String type is considered not equal to the same number stored as a Number type.
36
+ *
37
+ * Matching strings with `ne()` is case sensitive, so `"text"` is not equal to `"Text"`.
38
+ *
39
+ * If the value of the `field` property is an Array, `ne()` includes items
40
+ * in which none of the elements of the Array match the specified `value`.
41
+ * @public
42
+ * @documentationMaturity preview
43
+ * @param field - The property whose value will be compared with `value`.
44
+ * @requiredField field
45
+ * @param value - The value to match against.
46
+ * @requiredField value
47
+ * @returns An object representing the refined filter.
48
+ */
49
+ ne(field: string, value: any): WixDataFilter;
50
+ /**
51
+ * Refines a filter to match items whose specified property value is greater than or equal to the specified
52
+ * value.
53
+ *
54
+ * The `ge()` function refines this filter to only
55
+ * match items where the value of the specified property is greater than or
56
+ * equal to the specified `value`.
57
+ *
58
+ * It only matches values of the same type. For example, a number value stored
59
+ * as a String type does not match the same number stored as a Number type.
60
+ *
61
+ * If a property contains a number as a String, that value will be compared
62
+ * alphabetically and not numerically. Items that do not have a value for the
63
+ * specified property are ranked lowest.
64
+ *
65
+ * The following types of properties can be compared:
66
+ * - Number: Compares numerically.
67
+ * - Date: Compares JavaScript Date objects.
68
+ * - String: Compares lexicographically,
69
+ * so `"abc"` is greater than or equal to `"ABC"` (because of the greater than),
70
+ * but `"ABC"` is not greater than or equal to `"abc"`.
71
+ * - Reference: Compares by the ID of the referenced item as a String.
72
+ * @public
73
+ * @documentationMaturity preview
74
+ * @param field - The property whose value will be compared with `value`.
75
+ * @requiredField field
76
+ * @param value - The value to match against.
77
+ * @requiredField value
78
+ * @returns An object representing the refined filter.
79
+ */
80
+ ge(field: string, value: Comparable): WixDataFilter;
81
+ /**
82
+ * Refines a filter to match items whose specified property value is greater than the specified value.
83
+ *
84
+ * The `gt()` function refines this filter to only match
85
+ * items where the value of the specified property is greater than the specified `value`.
86
+ *
87
+ * It only matches values of the same type. For example, a number value stored
88
+ * as a String type does not match the same number stored as a Number type.
89
+ *
90
+ * If a property contains a number as a String, that value will be compared
91
+ * alphabetically and not numerically. Items that do not have a value for the
92
+ * specified property are ranked lowest.
93
+ *
94
+ * The following types of properties can be compared:
95
+ * - Number: Compares numerically.
96
+ * - Date: Compares JavaScript Date objects.
97
+ * - String: Compares lexicographically, so `"text"` is greater than `"Text"`.
98
+ * - Reference: Compares by the ID of the referenced item as a String.
99
+ * @public
100
+ * @documentationMaturity preview
101
+ * @param field - The property whose value will be compared with `value`.
102
+ * @requiredField field
103
+ * @param value - The value to match against.
104
+ * @requiredField value
105
+ * @returns An object with the filter definition, based on the supplied parameters.
106
+ */
107
+ gt(field: string, value: Comparable): WixDataFilter;
108
+ /**
109
+ * Refines a filter to match items whose specified property value is less than or equal to the specified
110
+ * value.
111
+ *
112
+ * The `le()` function refines this filter to only match
113
+ * items where the value of the specified property is less than or equal to the
114
+ * specified `value`.
115
+ *
116
+ * It only matches values of the same type. For example, a number value stored
117
+ * as a String type does not match the same number stored as a Number type.
118
+ *
119
+ * If a property contains a number as a String, that value will be compared
120
+ * alphabetically and not numerically. Items that do not have a value for the
121
+ * specified property are ranked lowest.
122
+ *
123
+ * The following types of properties can be compared:
124
+ * - Number: Compares numerically.
125
+ * - Date: Compares JavaScript Date objects.
126
+ * - String: Compares lexicographically,
127
+ * so `"ABC"` is less than or equal to `"abc"` (because of the less than),
128
+ * but `"abc"` is not less than or equal to `"ABC"`.
129
+ * - Reference: Compares by the ID of the referenced item as a String.
130
+ * @public
131
+ * @documentationMaturity preview
132
+ * @param field - The property whose value will be compared with `value`.
133
+ * @requiredField field
134
+ * @param value - The value to match against.
135
+ * @requiredField value
136
+ * @returns An object representing the refined filter.
137
+ */
138
+ le(field: string, value: Comparable): WixDataFilter;
139
+ /**
140
+ * Refines a filter to match items whose specified property value is less than the specified value.
141
+ *
142
+ * The `lt()` function refines this filter to only match
143
+ * items where the value of the specified property is less than the specified `value`.
144
+ *
145
+ * It only matches values of the same type. For example, a number value stored
146
+ * as a String type does not match the same number stored as a Number type.
147
+ *
148
+ * If a property contains a number as a String, that value will be compared
149
+ * alphabetically and not numerically. Items that do not have a value for the
150
+ * specified property are ranked lowest.
151
+ *
152
+ * The following types of properties can be compared:
153
+ * - Number: Compares numerically.
154
+ * - Date: Compares JavaScript Date objects.
155
+ * - String: Compares lexicographically, so `"Text"` is less than `"text"`.
156
+ * - Reference: Compares by the ID of the referenced item as a String.
157
+ * @public
158
+ * @documentationMaturity preview
159
+ * @param field - The property whose value will be compared with `value`.
160
+ * @requiredField field
161
+ * @param value - The value to match against.
162
+ * @requiredField value
163
+ * @returns An object with the filter definition, based on the supplied parameters.
164
+ */
165
+ lt(field: string, value: Comparable): WixDataFilter;
166
+ /**
167
+ * Refines a filter to match items whose specified property has any value.
168
+ *
169
+ * The `isNotEmpty()` function refines this filter to only match items where the
170
+ * value of the specified property is not `null` or `undefined`.
171
+ *
172
+ * If the property contains any value at all for a given item, including the
173
+ * empty string or an invalid value, that item will match the filter.
174
+ * @public
175
+ * @documentationMaturity preview
176
+ * @param field - The property in which to check for a value.
177
+ * @requiredField field
178
+ * @returns An object representing the refined filter.
179
+ */
180
+ isNotEmpty(field: string): WixDataFilter;
181
+ /**
182
+ * Refines a filter to match items whose specified property does not exist or does not have any value.
183
+ *
184
+ * The `isEmpty()` function refines this filter to only match items where the
185
+ * value of the specified property is `null` or `undefined` or the property does
186
+ * not exist.
187
+ *
188
+ * If the property contains any value at all for a given item, including the
189
+ * empty string or an invalid value, that item will match the filter.
190
+ * @public
191
+ * @documentationMaturity preview
192
+ * @param field - The property in which to check for a value.
193
+ * @requiredField field
194
+ * @returns An object representing the refined filter.
195
+ */
196
+ isEmpty(field: string): WixDataFilter;
197
+ /**
198
+ * Refines a filter to match items whose specified property value starts with a specified string.
199
+ *
200
+ * The `startsWith()` function refines this filter to
201
+ * only match items where the value of the specified property starts with the
202
+ * defined `string`. Matching with `startsWith()` is not case sensitive, so `"TEXT"` starts
203
+ * with `"tex"`.
204
+ *
205
+ * You can only use `startsWith()` with a property whose value is a String or Reference.
206
+ * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.
207
+ * @public
208
+ * @documentationMaturity preview
209
+ * @param field - The property whose value will be compared with the `value` parameter.
210
+ * @requiredField field
211
+ * @param value - The string to look for at the beginning of the specified property value.
212
+ * @requiredField value
213
+ * @returns An object representing the refined filter.
214
+ */
215
+ startsWith(field: string, value: string): WixDataFilter;
216
+ /**
217
+ * Refines a filter to match items whose specified property value ends with a specified string.
218
+ *
219
+ * The `endsWith()` function refines this filter to only
220
+ * match items where the value of the specified property ends with the specified
221
+ * `string`. Matching with `endsWith()` is not case sensitive, so `"TEXT"` ends
222
+ * with `"ext"`.
223
+ *
224
+ * You can only use `endsWith()` with a property whose value is a String or Reference.
225
+ * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.
226
+ * @public
227
+ * @documentationMaturity preview
228
+ * @param field - The property whose value will be compared with the string.
229
+ * @requiredField field
230
+ * @param value - The string to look for at the end of the specified property value.
231
+ * @requiredField value
232
+ * @returns An object representing the refined filter.
233
+ */
234
+ endsWith(field: string, value: string): WixDataFilter;
235
+ /**
236
+ * Refines a filter to match items whose specified property value contains a specified string.
237
+ *
238
+ * The `contains()` function refines this filter to
239
+ * only match items where the value of the specified property contains the
240
+ * specified `string`. Matching with `contains()` is not case sensitive, so
241
+ * `"text"` does contain `"Tex"`.
242
+ *
243
+ * You can use `contains()` with a property whose value is a String or a Reference.
244
+ * For properties of type reference it is recommended that you use the [`eq()`](#eq)
245
+ * function instead of `contains()`. With properties that are References, `contains()`
246
+ * matches by the ID of the referenced item as a String.
247
+ * @public
248
+ * @documentationMaturity preview
249
+ * @param field - The property whose value will be compared with the string.
250
+ * @requiredField field
251
+ * @param value - The string to look for inside the specified property value.
252
+ * @requiredField value
253
+ * @returns An object representing the refined filter.
254
+ */
255
+ contains(field: string, value: string): WixDataFilter;
256
+ /**
257
+ * Refines a filter to match items whose specified property value equals any of the specified `values`
258
+ * parameters.
259
+ *
260
+ * The `hasSome()` function refines this filter to
261
+ * only match items where the value of the specified property equals any of
262
+ * the specified values.
263
+ *
264
+ * Matching strings with `hasSome()` is case sensitive, so `"text"` is not equal to `"Text"`.
265
+ *
266
+ * If the value of the specified property is an array, `hasSome()` will match
267
+ * if any of the elements of that array match any of the specified values.
268
+ *
269
+ * If the specified property contains multiple references, pass item IDs in the
270
+ * `value` property. In such a case, `hasSome()` will match if any of the
271
+ * multiple references match any of the specified ID values.
272
+ *
273
+ * You can specify a list of values to match by providing an array of
274
+ * String, Number, or Date types as the `value` parameters.
275
+ * @public
276
+ * @documentationMaturity preview
277
+ * @param field - The property whose value will be compared with `value`.
278
+ * @requiredField field
279
+ * @param values - The values to match against.
280
+ * @requiredField values
281
+ * @returns An object representing the refined filter.
282
+ */
283
+ hasSome(field: string, ...values: Comparable[]): WixDataFilter;
284
+ /**
285
+ * Overload for `hasSome()`
286
+ * @public
287
+ * @documentationMaturity preview
288
+ */
289
+ hasSome(field: string, values: Comparable[]): WixDataFilter;
290
+ /**
291
+ * Refines a filter to match items whose specified property values equals all of the specified `value`
292
+ * parameters.
293
+ *
294
+ * The `hasAll()` function refines this filter to
295
+ * only match items where the value of the specified property equals all of
296
+ * the specified values.
297
+ *
298
+ * Matching strings with `hasAll()` is case sensitive, so `"text"` is not equal to `"Text"`.
299
+ *
300
+ * If the value of the specified property is an array, `hasAll()` will match
301
+ * if there is a match in the elements of that array for all of the specified
302
+ * values.
303
+ *
304
+ * You can specify a list of values to match by providing an array of
305
+ * String, Number, or Date types as the `value` parameters.
306
+ * @public
307
+ * @documentationMaturity preview
308
+ * @param field - The property whose value will be compared with `value`.
309
+ * @requiredField field
310
+ * @param values - The values to match against.
311
+ * @requiredField values
312
+ * @returns An object representing the refined filter.
313
+ */
314
+ hasAll(field: string, ...values: Comparable[]): WixDataFilter;
315
+ /**
316
+ * Overload for `hasAll()`
317
+ * @public
318
+ * @documentationMaturity preview
319
+ */
320
+ hasAll(field: string, values: Comparable[]): WixDataFilter;
321
+ /**
322
+ * Adds an `or` condition to the filter.
323
+ *
324
+ * The `or()` function adds an inclusive `or` condition to this filter. A filter
325
+ * with an `or` returns all the items that match the filter as defined up to
326
+ * the `or` function, the items that match the filter passed to the `or`
327
+ * function, and the items that match both.
328
+ *
329
+ * The 'or()' function is designed to work with 2 or more queries or filters.
330
+ * If you use it on its own, it will return all the items in a collection.
331
+ * @public
332
+ * @documentationMaturity preview
333
+ * @param filter - A filter to add to the initial filter as an `or` condition.
334
+ * @requiredField filter
335
+ * @returns An object representing the refined filter.
336
+ */
337
+ or(filter: WixDataFilter): WixDataFilter;
338
+ /**
339
+ * Adds an `and` condition to the filter.
340
+ *
341
+ * The `and()` function adds an and condition to this filter. A filter with an `and` returns all the items
342
+ * that match the filter as defined up to the `and` function and also match the filter passed to
343
+ * the `and` function.
344
+ *
345
+ * Note that when chaining multiple `WixDataFilter` functions to a filter an and condition is assumed. In such cases,
346
+ * you do not need to add a call to the `and()` function. For example, this filter returns results where status is
347
+ * active **and** age is greater than 25.
348
+ * ```js
349
+ * wixClient.items.filter().eq("status", "active").gt("age", 25);
350
+ * ```
351
+ *
352
+ * The `and()` function is needed when performing compound queries. For example, the final filter in this set of
353
+ * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater
354
+ * than 65.
355
+ * ```js
356
+ * let statusFilter = wixClient.items.filter()
357
+ * .eq("status", "pending")
358
+ * .or(wixClient.items.filter().eq("status", "rejected"));
359
+ *
360
+ * let ageFilter = wixClient.items.filter()
361
+ * .lt("age", 25)
362
+ * .or(wixData.items.filter().gt("age", 65));
363
+ *
364
+ * let statusAndAgeFilter = statusFilter.and(ageFilter);
365
+ * ```
366
+ *
367
+ * The `and()` function is designed to work with 2 or more queries or filters. If you use it on its own, it will
368
+ * return all the items in a collection.
369
+ * @public
370
+ * @documentationMaturity preview
371
+ * @param filter - A filter to add to the initial filter as an `and` condition.
372
+ * @requiredField filter
373
+ * @returns An object representing the refined filter.
374
+ */
375
+ and(filter: WixDataFilter): WixDataFilter;
376
+ /**
377
+ * Adds a `not` condition to the filter.
378
+ *
379
+ * The `not()` function adds a `not` condition to this filter. A filter with a `not`
380
+ * returns all the items that match the filter as defined up to the `not`
381
+ * function, but don't match the filter passed to the `not` function.
382
+ *
383
+ * If the filter only contains a `not()` function, it returns all the items
384
+ * that don't match the filter defined by the `not` method.
385
+ *
386
+ * @public
387
+ * @documentationMaturity preview
388
+ * @param filter - A filter to add to the initial filter as a `not` condition.
389
+ * @requiredField filter
390
+ * @returns An object representing the refined filter.
391
+ */
392
+ not(filter: WixDataFilter): WixDataFilter;
393
+ /**
394
+ * Refines a filter to match items whose specified property value is within a specified range.
395
+ *
396
+ * The `between()` function refines this filter to only match items where the value of the specified property is
397
+ * greater than or equal to `rangeStart` and less than `rangeEnd`.
398
+ *
399
+ * It only matches values of the same type. For example, a number value stored as a String type does not match the
400
+ * same number stored as a Number type.
401
+ *
402
+ * If a property contains a number as a String, that value will be compared alphabetically and not numerically. Items
403
+ * that do not have a value for the specified property are ranked lowest.
404
+ *
405
+ * The following types of properties can be compared:
406
+ * - Number: Compares numerically.
407
+ * - Date: Compares JavaScript Date objects.
408
+ * - String: Compares lexicographically, so
409
+ * - `"A"` and `"M"` are between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not.
410
+ * - `"A"`, `"M"`, `"Z"`, and `"a"` are between `"A"` and `"z"`, but `"z"` is not.
411
+ * @public
412
+ * @documentationMaturity preview
413
+ * @param field - The property whose value will be compared with rangeStart and rangeEnd.
414
+ * @requiredField field
415
+ * @param rangeStart - The beginning value of the range to match against.
416
+ * @requiredField rangeStart
417
+ * @param rangeEnd - The ending value of the range to match against.
418
+ * @requiredField rangeEnd
419
+ * @returns An object representing the refined filter.
420
+ */
421
+ between<T extends Comparable>(field: string, rangeStart: T, rangeEnd: T): WixDataFilter;
422
+ }
423
+ export {};
424
+ //# sourceMappingURL=WixDataFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WixDataFilter.d.ts","sourceRoot":"","sources":["../../../src/api/WixDataFilter.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAExC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,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,aAAa,CAAA;IAE9D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAA;IAE3D;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAA;IAE7D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAA;IAE1D;;;;;;;;;;;;;;;OAeG;IACH,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAAA;IAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAAA;IAEzC;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAAA;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,EAC1B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,CAAC,EACb,QAAQ,EAAE,CAAC,GACV,aAAa,CAAA;CACjB"}
@@ -0,0 +1,80 @@
1
+ import { WixDataOptions, WixDataItem, WixDataBulkResult } from './types';
2
+ import { AggregatingValidator } from '../errors';
3
+ export interface FieldUpdate {
4
+ fieldPath: string;
5
+ action: 'SET_FIELD' | 'REMOVE_FIELD' | 'INCREMENT_FIELD' | 'APPEND_TO_ARRAY' | 'REMOVE_FROM_ARRAY';
6
+ actionOptions?: any;
7
+ }
8
+ interface BulkPatchParams {
9
+ collectionName: string;
10
+ itemIds: string[];
11
+ invalidArguments: string[];
12
+ fieldUpdates: FieldUpdate[];
13
+ }
14
+ interface PatchParams {
15
+ collectionName: string;
16
+ itemId: string;
17
+ invalidArguments: string[];
18
+ fieldUpdates: FieldUpdate[];
19
+ }
20
+ type OnRun = (args: IArguments, params: PatchParams, options?: WixDataOptions) => Promise<WixDataItem | null>;
21
+ type OnBulkRun = (args: IArguments, params: BulkPatchParams, options?: WixDataOptions) => Promise<WixDataBulkResult>;
22
+ declare abstract class WixDataPatchBase<Self> {
23
+ protected readonly fieldUpdates: FieldUpdate[];
24
+ protected readonly collectionName: string;
25
+ protected readonly ownInvalidArguments: string[];
26
+ constructor(origin: {
27
+ collectionName: string;
28
+ invalidArguments?: string[];
29
+ fieldUpdates?: FieldUpdate[];
30
+ });
31
+ protected abstract copy(params: {
32
+ invalidArguments?: string[];
33
+ addFieldUpdate: FieldUpdate;
34
+ }): Self;
35
+ incrementField(fieldName: string, by: number): Self;
36
+ setField(fieldName: string, value: any): Self;
37
+ appendToArray(fieldName: string, value: any): Self;
38
+ removeFromArray(fieldName: string, value: any): Self;
39
+ removeField(fieldName: string): Self;
40
+ private patchValidator;
41
+ }
42
+ export declare class WixDataBulkPatch extends WixDataPatchBase<WixDataBulkPatch> {
43
+ private readonly onRun;
44
+ readonly itemIds: string[];
45
+ constructor(origin: {
46
+ collectionName: string;
47
+ itemIds: string[];
48
+ invalidArguments?: string[];
49
+ fieldUpdates?: FieldUpdate[];
50
+ onRun: OnBulkRun;
51
+ });
52
+ protected copy(params: {
53
+ invalidArguments?: string[];
54
+ addFieldUpdate: FieldUpdate;
55
+ }): WixDataBulkPatch;
56
+ run(options?: WixDataOptions): Promise<WixDataBulkResult>;
57
+ }
58
+ export declare class WixDataPatch extends WixDataPatchBase<WixDataPatch> {
59
+ private readonly onRun;
60
+ readonly itemId: string;
61
+ constructor(origin: {
62
+ collectionName: string;
63
+ itemId: string;
64
+ invalidArguments?: string[];
65
+ fieldUpdates?: FieldUpdate[];
66
+ onRun: OnRun;
67
+ });
68
+ protected copy(params: {
69
+ invalidArguments?: string[];
70
+ addFieldUpdate: FieldUpdate;
71
+ }): WixDataPatch;
72
+ run(options?: WixDataOptions): Promise<WixDataItem | null>;
73
+ }
74
+ export declare class PatchValidator extends AggregatingValidator {
75
+ operatorName: string;
76
+ constructor(operatorName: string, previousInvalidArguments: string[]);
77
+ isNumber(specifier: string, operand: any): this;
78
+ }
79
+ export {};
80
+ //# sourceMappingURL=WixDataPatch.d.ts.map
@@ -0,0 +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;AACxE,OAAO,EAAE,oBAAoB,EAAY,MAAM,WAAW,CAAA;AAG1D,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,UAAU,eAAe;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B;AAED,UAAU,WAAW;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B;AAED,KAAK,KAAK,GAAG,CACX,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;AAEhC,KAAK,SAAS,GAAG,CACf,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE/B,uBAAe,gBAAgB,CAAC,IAAI;IAClC,SAAS,CAAC,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