@klerick/json-api-nestjs-sdk 10.0.0-beta.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +154 -0
  3. package/cjs/package.json +55 -0
  4. package/cjs/src/index.d.ts +5 -0
  5. package/cjs/src/index.js +14 -0
  6. package/cjs/src/index.js.map +1 -0
  7. package/cjs/src/lib/constants/index.d.ts +1 -0
  8. package/cjs/src/lib/constants/index.js +5 -0
  9. package/cjs/src/lib/constants/index.js.map +1 -0
  10. package/cjs/src/lib/json-api-angular.d.ts +21 -0
  11. package/cjs/src/lib/json-api-angular.js +40 -0
  12. package/cjs/src/lib/json-api-angular.js.map +1 -0
  13. package/cjs/src/lib/json-api-js.d.ts +15 -0
  14. package/cjs/src/lib/json-api-js.js +48 -0
  15. package/cjs/src/lib/json-api-js.js.map +1 -0
  16. package/cjs/src/lib/service/atomic-operations.service.d.ts +22 -0
  17. package/cjs/src/lib/service/atomic-operations.service.js +86 -0
  18. package/cjs/src/lib/service/atomic-operations.service.js.map +1 -0
  19. package/cjs/src/lib/service/fetch-inner-client.d.ts +20 -0
  20. package/cjs/src/lib/service/fetch-inner-client.js +48 -0
  21. package/cjs/src/lib/service/fetch-inner-client.js.map +1 -0
  22. package/cjs/src/lib/service/index.d.ts +3 -0
  23. package/cjs/src/lib/service/index.js +7 -0
  24. package/cjs/src/lib/service/index.js.map +1 -0
  25. package/cjs/src/lib/service/json-api-sdk.service.d.ts +21 -0
  26. package/cjs/src/lib/service/json-api-sdk.service.js +168 -0
  27. package/cjs/src/lib/service/json-api-sdk.service.js.map +1 -0
  28. package/cjs/src/lib/service/json-api-utils.service.d.ts +28 -0
  29. package/cjs/src/lib/service/json-api-utils.service.js +245 -0
  30. package/cjs/src/lib/service/json-api-utils.service.js.map +1 -0
  31. package/cjs/src/lib/token/index.d.ts +4 -0
  32. package/cjs/src/lib/token/index.js +7 -0
  33. package/cjs/src/lib/token/index.js.map +1 -0
  34. package/cjs/src/lib/types/atomic-operation.d.ts +33 -0
  35. package/cjs/src/lib/types/atomic-operation.js +3 -0
  36. package/cjs/src/lib/types/atomic-operation.js.map +1 -0
  37. package/cjs/src/lib/types/atomic-type.d.ts +23 -0
  38. package/cjs/src/lib/types/atomic-type.js +4 -0
  39. package/cjs/src/lib/types/atomic-type.js.map +1 -0
  40. package/cjs/src/lib/types/config.d.ts +14 -0
  41. package/cjs/src/lib/types/config.js +3 -0
  42. package/cjs/src/lib/types/config.js.map +1 -0
  43. package/cjs/src/lib/types/filter-operand.d.ts +10 -0
  44. package/cjs/src/lib/types/filter-operand.js +4 -0
  45. package/cjs/src/lib/types/filter-operand.js.map +1 -0
  46. package/cjs/src/lib/types/http-inner-client.d.ts +19 -0
  47. package/cjs/src/lib/types/http-inner-client.js +3 -0
  48. package/cjs/src/lib/types/http-inner-client.js.map +1 -0
  49. package/cjs/src/lib/types/http-request-params.d.ts +20 -0
  50. package/cjs/src/lib/types/http-request-params.js +3 -0
  51. package/cjs/src/lib/types/http-request-params.js.map +1 -0
  52. package/cjs/src/lib/types/index.d.ts +9 -0
  53. package/cjs/src/lib/types/index.js +13 -0
  54. package/cjs/src/lib/types/index.js.map +1 -0
  55. package/cjs/src/lib/types/promise-json-api-sdk.d.ts +16 -0
  56. package/cjs/src/lib/types/promise-json-api-sdk.js +3 -0
  57. package/cjs/src/lib/types/promise-json-api-sdk.js.map +1 -0
  58. package/cjs/src/lib/types/query-params.d.ts +47 -0
  59. package/cjs/src/lib/types/query-params.js +4 -0
  60. package/cjs/src/lib/types/query-params.js.map +1 -0
  61. package/cjs/src/lib/types/utils.d.ts +6 -0
  62. package/cjs/src/lib/types/utils.js +3 -0
  63. package/cjs/src/lib/types/utils.js.map +1 -0
  64. package/cjs/src/lib/utils/adapter-for-axios.d.ts +3 -0
  65. package/cjs/src/lib/utils/adapter-for-axios.js +56 -0
  66. package/cjs/src/lib/utils/adapter-for-axios.js.map +1 -0
  67. package/cjs/src/lib/utils/entity-array.d.ts +9 -0
  68. package/cjs/src/lib/utils/entity-array.js +28 -0
  69. package/cjs/src/lib/utils/entity-array.js.map +1 -0
  70. package/cjs/src/lib/utils/generate-atomic-body.d.ts +22 -0
  71. package/cjs/src/lib/utils/generate-atomic-body.js +75 -0
  72. package/cjs/src/lib/utils/generate-atomic-body.js.map +1 -0
  73. package/cjs/src/lib/utils/http-params.d.ts +154 -0
  74. package/cjs/src/lib/utils/http-params.js +303 -0
  75. package/cjs/src/lib/utils/http-params.js.map +1 -0
  76. package/cjs/src/lib/utils/index.d.ts +5 -0
  77. package/cjs/src/lib/utils/index.js +9 -0
  78. package/cjs/src/lib/utils/index.js.map +1 -0
  79. package/cjs/src/lib/utils/utils.d.ts +4 -0
  80. package/cjs/src/lib/utils/utils.js +24 -0
  81. package/cjs/src/lib/utils/utils.js.map +1 -0
  82. package/cjs/src/ngModule.d.ts +4 -0
  83. package/cjs/src/ngModule.js +14 -0
  84. package/cjs/src/ngModule.js.map +1 -0
  85. package/mjs/package.json +57 -0
  86. package/mjs/src/index.d.ts +5 -0
  87. package/mjs/src/index.js +5 -0
  88. package/mjs/src/index.js.map +1 -0
  89. package/mjs/src/lib/constants/index.d.ts +1 -0
  90. package/mjs/src/lib/constants/index.js +2 -0
  91. package/mjs/src/lib/constants/index.js.map +1 -0
  92. package/mjs/src/lib/json-api-angular.d.ts +21 -0
  93. package/mjs/src/lib/json-api-angular.js +33 -0
  94. package/mjs/src/lib/json-api-angular.js.map +1 -0
  95. package/mjs/src/lib/json-api-js.d.ts +15 -0
  96. package/mjs/src/lib/json-api-js.js +44 -0
  97. package/mjs/src/lib/json-api-js.js.map +1 -0
  98. package/mjs/src/lib/service/atomic-operations.service.d.ts +22 -0
  99. package/mjs/src/lib/service/atomic-operations.service.js +85 -0
  100. package/mjs/src/lib/service/atomic-operations.service.js.map +1 -0
  101. package/mjs/src/lib/service/fetch-inner-client.d.ts +20 -0
  102. package/mjs/src/lib/service/fetch-inner-client.js +50 -0
  103. package/mjs/src/lib/service/fetch-inner-client.js.map +1 -0
  104. package/mjs/src/lib/service/index.d.ts +3 -0
  105. package/mjs/src/lib/service/index.js +4 -0
  106. package/mjs/src/lib/service/index.js.map +1 -0
  107. package/mjs/src/lib/service/json-api-sdk.service.d.ts +21 -0
  108. package/mjs/src/lib/service/json-api-sdk.service.js +174 -0
  109. package/mjs/src/lib/service/json-api-sdk.service.js.map +1 -0
  110. package/mjs/src/lib/service/json-api-utils.service.d.ts +28 -0
  111. package/mjs/src/lib/service/json-api-utils.service.js +253 -0
  112. package/mjs/src/lib/service/json-api-utils.service.js.map +1 -0
  113. package/mjs/src/lib/token/index.d.ts +4 -0
  114. package/mjs/src/lib/token/index.js +4 -0
  115. package/mjs/src/lib/token/index.js.map +1 -0
  116. package/mjs/src/lib/types/atomic-operation.d.ts +33 -0
  117. package/mjs/src/lib/types/atomic-operation.js +2 -0
  118. package/mjs/src/lib/types/atomic-operation.js.map +1 -0
  119. package/mjs/src/lib/types/atomic-type.d.ts +23 -0
  120. package/mjs/src/lib/types/atomic-type.js +2 -0
  121. package/mjs/src/lib/types/atomic-type.js.map +1 -0
  122. package/mjs/src/lib/types/config.d.ts +14 -0
  123. package/mjs/src/lib/types/config.js +2 -0
  124. package/mjs/src/lib/types/config.js.map +1 -0
  125. package/mjs/src/lib/types/filter-operand.d.ts +10 -0
  126. package/mjs/src/lib/types/filter-operand.js +2 -0
  127. package/mjs/src/lib/types/filter-operand.js.map +1 -0
  128. package/mjs/src/lib/types/http-inner-client.d.ts +19 -0
  129. package/mjs/src/lib/types/http-inner-client.js +2 -0
  130. package/mjs/src/lib/types/http-inner-client.js.map +1 -0
  131. package/mjs/src/lib/types/http-request-params.d.ts +20 -0
  132. package/mjs/src/lib/types/http-request-params.js +2 -0
  133. package/mjs/src/lib/types/http-request-params.js.map +1 -0
  134. package/mjs/src/lib/types/index.d.ts +9 -0
  135. package/mjs/src/lib/types/index.js +10 -0
  136. package/mjs/src/lib/types/index.js.map +1 -0
  137. package/mjs/src/lib/types/promise-json-api-sdk.d.ts +16 -0
  138. package/mjs/src/lib/types/promise-json-api-sdk.js +2 -0
  139. package/mjs/src/lib/types/promise-json-api-sdk.js.map +1 -0
  140. package/mjs/src/lib/types/query-params.d.ts +47 -0
  141. package/mjs/src/lib/types/query-params.js +2 -0
  142. package/mjs/src/lib/types/query-params.js.map +1 -0
  143. package/mjs/src/lib/types/utils.d.ts +6 -0
  144. package/mjs/src/lib/types/utils.js +2 -0
  145. package/mjs/src/lib/types/utils.js.map +1 -0
  146. package/mjs/src/lib/utils/adapter-for-axios.d.ts +3 -0
  147. package/mjs/src/lib/utils/adapter-for-axios.js +54 -0
  148. package/mjs/src/lib/utils/adapter-for-axios.js.map +1 -0
  149. package/mjs/src/lib/utils/entity-array.d.ts +9 -0
  150. package/mjs/src/lib/utils/entity-array.js +25 -0
  151. package/mjs/src/lib/utils/entity-array.js.map +1 -0
  152. package/mjs/src/lib/utils/generate-atomic-body.d.ts +22 -0
  153. package/mjs/src/lib/utils/generate-atomic-body.js +83 -0
  154. package/mjs/src/lib/utils/generate-atomic-body.js.map +1 -0
  155. package/mjs/src/lib/utils/http-params.d.ts +154 -0
  156. package/mjs/src/lib/utils/http-params.js +300 -0
  157. package/mjs/src/lib/utils/http-params.js.map +1 -0
  158. package/mjs/src/lib/utils/index.d.ts +5 -0
  159. package/mjs/src/lib/utils/index.js +6 -0
  160. package/mjs/src/lib/utils/index.js.map +1 -0
  161. package/mjs/src/lib/utils/utils.d.ts +4 -0
  162. package/mjs/src/lib/utils/utils.js +24 -0
  163. package/mjs/src/lib/utils/utils.js.map +1 -0
  164. package/mjs/src/ngModule.d.ts +4 -0
  165. package/mjs/src/ngModule.js +4 -0
  166. package/mjs/src/ngModule.js.map +1 -0
  167. package/package.json +74 -0
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.HttpParams = exports.HttpUrlEncodingCodec = void 0;
11
+ /**
12
+ * Provides encoding and decoding of URL parameter and query-string values.
13
+ *
14
+ * Serializes and parses URL parameter keys and values to encode and decode them.
15
+ * If you pass URL query parameters without encoding,
16
+ * the query parameters can be misinterpreted at the receiving end.
17
+ *
18
+ *
19
+ * @publicApi
20
+ */
21
+ class HttpUrlEncodingCodec {
22
+ /**
23
+ * Encodes a key name for a URL parameter or query-string.
24
+ * @param key The key name.
25
+ * @returns The encoded key name.
26
+ */
27
+ encodeKey(key) {
28
+ return standardEncoding(key);
29
+ }
30
+ /**
31
+ * Encodes the value of a URL parameter or query-string.
32
+ * @param value The value.
33
+ * @returns The encoded value.
34
+ */
35
+ encodeValue(value) {
36
+ return standardEncoding(value);
37
+ }
38
+ /**
39
+ * Decodes an encoded URL parameter or query-string key.
40
+ * @param key The encoded key name.
41
+ * @returns The decoded key name.
42
+ */
43
+ decodeKey(key) {
44
+ return decodeURIComponent(key);
45
+ }
46
+ /**
47
+ * Decodes an encoded URL parameter or query-string value.
48
+ * @param value The encoded value.
49
+ * @returns The decoded value.
50
+ */
51
+ decodeValue(value) {
52
+ return decodeURIComponent(value);
53
+ }
54
+ }
55
+ exports.HttpUrlEncodingCodec = HttpUrlEncodingCodec;
56
+ function paramParser(rawParams, codec) {
57
+ const map = new Map();
58
+ if (rawParams.length > 0) {
59
+ // The `window.location.search` can be used while creating an instance of the `HttpParams` class
60
+ // (e.g. `new HttpParams({ fromString: window.location.search })`). The `window.location.search`
61
+ // may start with the `?` char, so we strip it if it's present.
62
+ const params = rawParams.replace(/^\?/, '').split('&');
63
+ params.forEach((param) => {
64
+ const eqIdx = param.indexOf('=');
65
+ const [key, val] = eqIdx == -1
66
+ ? [codec.decodeKey(param), '']
67
+ : [
68
+ codec.decodeKey(param.slice(0, eqIdx)),
69
+ codec.decodeValue(param.slice(eqIdx + 1)),
70
+ ];
71
+ const list = map.get(key) || [];
72
+ list.push(val);
73
+ map.set(key, list);
74
+ });
75
+ }
76
+ return map;
77
+ }
78
+ /**
79
+ * Encode input string with standard encodeURIComponent and then un-encode specific characters.
80
+ */
81
+ const STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
82
+ const STANDARD_ENCODING_REPLACEMENTS = {
83
+ '40': '@',
84
+ '3A': ':',
85
+ '24': '$',
86
+ '2C': ',',
87
+ '3B': ';',
88
+ '3D': '=',
89
+ '3F': '?',
90
+ '2F': '/',
91
+ };
92
+ function standardEncoding(v) {
93
+ return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => { var _a; return (_a = STANDARD_ENCODING_REPLACEMENTS[t]) !== null && _a !== void 0 ? _a : s; });
94
+ }
95
+ function valueToString(value) {
96
+ return `${value}`;
97
+ }
98
+ /**
99
+ * An HTTP request/response body that represents serialized parameters,
100
+ * per the MIME type `application/x-www-form-urlencoded`.
101
+ *
102
+ * This class is immutable; all mutation operations return a new instance.
103
+ *
104
+ * @publicApi
105
+ */
106
+ class HttpParams {
107
+ constructor(options = {}) {
108
+ this.updates = null;
109
+ this.cloneFrom = null;
110
+ this.encoder = options.encoder || new HttpUrlEncodingCodec();
111
+ if (!!options.fromString) {
112
+ if (!!options.fromObject) {
113
+ throw new Error(`Cannot specify both fromString and fromObject.`);
114
+ }
115
+ this.map = paramParser(options.fromString, this.encoder);
116
+ }
117
+ else if (!!options.fromObject) {
118
+ this.map = new Map();
119
+ Object.keys(options.fromObject).forEach((key) => {
120
+ const value = options.fromObject[key];
121
+ // convert the values to strings
122
+ const values = Array.isArray(value)
123
+ ? value.map(valueToString)
124
+ : [valueToString(value)];
125
+ this.map.set(key, values);
126
+ });
127
+ }
128
+ else {
129
+ this.map = null;
130
+ }
131
+ }
132
+ /**
133
+ * Reports whether the body includes one or more values for a given parameter.
134
+ * @param param The parameter name.
135
+ * @returns True if the parameter has one or more values,
136
+ * false if it has no value or is not present.
137
+ */
138
+ has(param) {
139
+ this.init();
140
+ return this.map.has(param);
141
+ }
142
+ /**
143
+ * Retrieves the first value for a parameter.
144
+ * @param param The parameter name.
145
+ * @returns The first value of the given parameter,
146
+ * or `null` if the parameter is not present.
147
+ */
148
+ get(param) {
149
+ this.init();
150
+ const res = this.map.get(param);
151
+ return !!res ? res[0] : null;
152
+ }
153
+ /**
154
+ * Retrieves all values for a parameter.
155
+ * @param param The parameter name.
156
+ * @returns All values in a string array,
157
+ * or `null` if the parameter not present.
158
+ */
159
+ getAll(param) {
160
+ this.init();
161
+ return this.map.get(param) || null;
162
+ }
163
+ /**
164
+ * Retrieves all the parameters for this body.
165
+ * @returns The parameter names in a string array.
166
+ */
167
+ keys() {
168
+ this.init();
169
+ return Array.from(this.map.keys());
170
+ }
171
+ /**
172
+ * Appends a new value to existing values for a parameter.
173
+ * @param param The parameter name.
174
+ * @param value The new value to add.
175
+ * @return A new body with the appended value.
176
+ */
177
+ append(param, value) {
178
+ return this.clone({ param, value, op: 'a' });
179
+ }
180
+ /**
181
+ * Constructs a new body with appended values for the given parameter name.
182
+ * @param params parameters and values
183
+ * @return A new body with the new value.
184
+ */
185
+ appendAll(params) {
186
+ const updates = [];
187
+ Object.keys(params).forEach((param) => {
188
+ const value = params[param];
189
+ if (Array.isArray(value)) {
190
+ value.forEach((_value) => {
191
+ updates.push({ param, value: _value, op: 'a' });
192
+ });
193
+ }
194
+ else {
195
+ updates.push({
196
+ param,
197
+ value: value,
198
+ op: 'a',
199
+ });
200
+ }
201
+ });
202
+ return this.clone(updates);
203
+ }
204
+ /**
205
+ * Replaces the value for a parameter.
206
+ * @param param The parameter name.
207
+ * @param value The new value.
208
+ * @return A new body with the new value.
209
+ */
210
+ set(param, value) {
211
+ return this.clone({ param, value, op: 's' });
212
+ }
213
+ /**
214
+ * Removes a given value or all values from a parameter.
215
+ * @param param The parameter name.
216
+ * @param value The value to remove, if provided.
217
+ * @return A new body with the given value removed, or with all values
218
+ * removed if no value is specified.
219
+ */
220
+ delete(param, value) {
221
+ return this.clone({ param, value, op: 'd' });
222
+ }
223
+ /**
224
+ * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
225
+ * separated by `&`s.
226
+ */
227
+ toString() {
228
+ this.init();
229
+ return (this.keys()
230
+ .map((key) => {
231
+ const eKey = this.encoder.encodeKey(key);
232
+ // `a: ['1']` produces `'a=1'`
233
+ // `b: []` produces `''`
234
+ // `c: ['1', '2']` produces `'c=1&c=2'`
235
+ return this.map.get(key)
236
+ .map((value) => eKey + '=' + this.encoder.encodeValue(value))
237
+ .join('&');
238
+ })
239
+ // filter out empty values because `b: []` produces `''`
240
+ // which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't
241
+ .filter((param) => param !== '')
242
+ .join('&'));
243
+ }
244
+ toObject() {
245
+ return this.keys().reduce((acum, key) => {
246
+ const val = this.get(key);
247
+ if (val)
248
+ acum[key] = val;
249
+ return acum;
250
+ }, {});
251
+ }
252
+ clone(update) {
253
+ const clone = new HttpParams({
254
+ encoder: this.encoder,
255
+ });
256
+ clone.cloneFrom = this.cloneFrom || this;
257
+ clone.updates = (this.updates || []).concat(update);
258
+ return clone;
259
+ }
260
+ init() {
261
+ if (this.map === null) {
262
+ this.map = new Map();
263
+ }
264
+ if (this.cloneFrom !== null) {
265
+ this.cloneFrom.init();
266
+ this.cloneFrom
267
+ .keys()
268
+ .forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
269
+ this.updates.forEach((update) => {
270
+ switch (update.op) {
271
+ case 'a':
272
+ case 's':
273
+ const base = (update.op === 'a' ? this.map.get(update.param) : undefined) ||
274
+ [];
275
+ base.push(valueToString(update.value));
276
+ this.map.set(update.param, base);
277
+ break;
278
+ case 'd':
279
+ if (update.value !== undefined) {
280
+ let base = this.map.get(update.param) || [];
281
+ const idx = base.indexOf(valueToString(update.value));
282
+ if (idx !== -1) {
283
+ base.splice(idx, 1);
284
+ }
285
+ if (base.length > 0) {
286
+ this.map.set(update.param, base);
287
+ }
288
+ else {
289
+ this.map.delete(update.param);
290
+ }
291
+ }
292
+ else {
293
+ this.map.delete(update.param);
294
+ break;
295
+ }
296
+ }
297
+ });
298
+ this.cloneFrom = this.updates = null;
299
+ }
300
+ }
301
+ }
302
+ exports.HttpParams = HttpParams;
303
+ //# sourceMappingURL=http-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-params.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/utils/http-params.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiBH;;;;;;;;;GASG;AACH,MAAa,oBAAoB;IAC/B;;;;OAIG;IACH,SAAS,CAAC,GAAW;QACnB,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,KAAa;QACvB,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,GAAW;QACnB,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,KAAa;QACvB,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACF;AApCD,oDAoCC;AAED,SAAS,WAAW,CAClB,SAAiB,EACjB,KAAyB;IAEzB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAC;IACxC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,gGAAgG;QAChG,gGAAgG;QAChG,+DAA+D;QAC/D,MAAM,MAAM,GAAa,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjE,MAAM,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;YAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAA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AAS,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACvC,CAAC;IACH,CAAC;CACF;AAtND,gCAsNC"}
@@ -0,0 +1,5 @@
1
+ export * from './http-params';
2
+ export * from './generate-atomic-body';
3
+ export * from './entity-array';
4
+ export * from './utils';
5
+ export * from './adapter-for-axios';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./http-params"), exports);
5
+ tslib_1.__exportStar(require("./generate-atomic-body"), exports);
6
+ tslib_1.__exportStar(require("./entity-array"), exports);
7
+ tslib_1.__exportStar(require("./utils"), exports);
8
+ tslib_1.__exportStar(require("./adapter-for-axios"), exports);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/utils/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,iEAAuC;AACvC,yDAA+B;AAC/B,kDAAwB;AACxB,8DAAoC"}
@@ -0,0 +1,4 @@
1
+ import { JsonApiSdkConfig, JsonSdkConfig } from '../types';
2
+ export declare function isRelation(val: any): boolean;
3
+ export declare function getTypeForReq(str: string): string;
4
+ export declare function resultConfig(partialConfig: JsonSdkConfig): JsonApiSdkConfig;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRelation = isRelation;
4
+ exports.getTypeForReq = getTypeForReq;
5
+ exports.resultConfig = resultConfig;
6
+ const change_case_commonjs_1 = require("change-case-commonjs");
7
+ const constants_1 = require("../constants");
8
+ function isRelation(val) {
9
+ const result = !(val === null ||
10
+ !val ||
11
+ ['String', 'Boolean', 'Number', 'Date'].includes(val.constructor.name));
12
+ if (!result)
13
+ return result;
14
+ return constants_1.ID_KEY in val;
15
+ }
16
+ function getTypeForReq(str) {
17
+ return (0, change_case_commonjs_1.kebabCase)(str).toLowerCase();
18
+ }
19
+ function resultConfig(partialConfig) {
20
+ return Object.assign(Object.assign({}, partialConfig), { idKey: partialConfig.idKey ? partialConfig.idKey : constants_1.ID_KEY, idIsNumber: partialConfig.idIsNumber === undefined
21
+ ? true
22
+ : !!partialConfig.idIsNumber, dateFields: partialConfig.dateFields ? partialConfig.dateFields : [] });
23
+ }
24
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/utils/utils.ts"],"names":[],"mappings":";;AAKA,gCASC;AAED,sCAEC;AAED,oCAUC;AA9BD,+DAAiD;AAEjD,4CAAsC;AAGtC,SAAgB,UAAU,CAAC,GAAQ;IACjC,MAAM,MAAM,GAAG,CAAC,CACd,GAAG,KAAK,IAAI;QACZ,CAAC,GAAG;QACJ,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CACvE,CAAC;IAEF,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,OAAO,kBAAM,IAAI,GAAG,CAAC;AACvB,CAAC;AAED,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,IAAA,gCAAS,EAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,YAAY,CAAC,aAA4B;IACvD,uCACK,aAAa,KAChB,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAM,EACzD,UAAU,EACR,aAAa,CAAC,UAAU,KAAK,SAAS;YACpC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,EAChC,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IACpE;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { FilterOperand, ResourceObject } from '@klerick/json-api-nestjs-shared';
2
+ export { AtomicFactory, provideJsonApi, JSON_API_SDK_CONFIG, getProviders, } from './lib/json-api-angular';
3
+ export { JsonApiUtilsService, JsonApiSdkService } from './lib/service';
4
+ export { AtomicOperations, JsonSdkConfig } from './lib/types';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonApiSdkService = exports.JsonApiUtilsService = exports.getProviders = exports.JSON_API_SDK_CONFIG = exports.provideJsonApi = exports.AtomicFactory = exports.FilterOperand = void 0;
4
+ var json_api_nestjs_shared_1 = require("@klerick/json-api-nestjs-shared");
5
+ Object.defineProperty(exports, "FilterOperand", { enumerable: true, get: function () { return json_api_nestjs_shared_1.FilterOperand; } });
6
+ var json_api_angular_1 = require("./lib/json-api-angular");
7
+ Object.defineProperty(exports, "AtomicFactory", { enumerable: true, get: function () { return json_api_angular_1.AtomicFactory; } });
8
+ Object.defineProperty(exports, "provideJsonApi", { enumerable: true, get: function () { return json_api_angular_1.provideJsonApi; } });
9
+ Object.defineProperty(exports, "JSON_API_SDK_CONFIG", { enumerable: true, get: function () { return json_api_angular_1.JSON_API_SDK_CONFIG; } });
10
+ Object.defineProperty(exports, "getProviders", { enumerable: true, get: function () { return json_api_angular_1.getProviders; } });
11
+ var service_1 = require("./lib/service");
12
+ Object.defineProperty(exports, "JsonApiUtilsService", { enumerable: true, get: function () { return service_1.JsonApiUtilsService; } });
13
+ Object.defineProperty(exports, "JsonApiSdkService", { enumerable: true, get: function () { return service_1.JsonApiSdkService; } });
14
+ //# sourceMappingURL=ngModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngModule.js","sourceRoot":"","sources":["../../../../../../libs/json-api/json-api-nestjs-sdk/src/ngModule.ts"],"names":[],"mappings":";;;AAAA,0EAAgF;AAAvE,uHAAA,aAAa,OAAA;AAEtB,2DAKgC;AAJ9B,iHAAA,aAAa,OAAA;AACb,kHAAA,cAAc,OAAA;AACd,uHAAA,mBAAmB,OAAA;AACnB,gHAAA,YAAY,OAAA;AAEd,yCAAuE;AAA9D,8GAAA,mBAAmB,OAAA;AAAE,4GAAA,iBAAiB,OAAA"}
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@klerick/json-api-nestjs-sdk",
3
+ "version": "10.0.0-beta.2",
4
+ "description": "Helper for client JsonAPi Plugin for NestJs",
5
+ "keywords": [
6
+ "nestjs",
7
+ "nest",
8
+ "jsonapi",
9
+ "json-api",
10
+ "typeorm",
11
+ "microorm",
12
+ "CRUD"
13
+ ],
14
+ "dependencies": {
15
+ "@angular/common": "^19.2.1",
16
+ "@angular/core": "^19.2.1",
17
+ "axios": "^1.6.0",
18
+ "change-case-commonjs": "^5.4.4",
19
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
20
+ "rxjs": "^7.1.0",
21
+ "tslib": ">2.3.0"
22
+ },
23
+ "exports": {
24
+ "./package.json": "./package.json",
25
+ ".": {
26
+ "types": "./mjs/src/index.d.ts",
27
+ "node": "./cjs/src/index.js",
28
+ "require": "./cjs/src/index.js",
29
+ "module": "./mjs/src/index.js",
30
+ "default": "./mjs/src/index.js",
31
+ "import": "./src/index.js"
32
+ },
33
+ "./ngModule": {
34
+ "types": "./mjs/src/ngModule.d.ts",
35
+ "node": "./cjs/src/ngModule.js",
36
+ "require": "./cjs/src/ngModule.js",
37
+ "module": "./mjs/src/ngModule.js",
38
+ "default": "./mjs/src/ngModule.js",
39
+ "import": "./src/ngModule.js"
40
+ }
41
+ },
42
+ "main": "./cjs/src/index.js",
43
+ "module": "./mjs/src/index.js",
44
+ "types": "./mjs/src/index.d.ts",
45
+ "typesVersions": {
46
+ "*": {
47
+ "ngModule": [
48
+ "./mjs/src/ngModule.d.ts"
49
+ ]
50
+ }
51
+ },
52
+ "peerDependencies": {
53
+ "@klerick/json-api-nestjs-shared": "1.0.0-beta.2",
54
+ "ts-toolbelt": "9.6.0"
55
+ },
56
+ "type": "module"
57
+ }
@@ -0,0 +1,5 @@
1
+ export { FilterOperand, ResourceObject, QueryField, } from '@klerick/json-api-nestjs-shared';
2
+ export { JsonApiUtilsService, JsonApiSdkService } from './lib/service';
3
+ export * from './lib/json-api-js';
4
+ export { adapterForAxios } from './lib/utils';
5
+ export { AtomicOperations, Operands, QueryParams } from './lib/types';
@@ -0,0 +1,5 @@
1
+ export { FilterOperand, QueryField, } from '@klerick/json-api-nestjs-shared';
2
+ export { JsonApiUtilsService, JsonApiSdkService } from './lib/service';
3
+ export * from './lib/json-api-js';
4
+ export { adapterForAxios } from './lib/utils';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/json-api/json-api-nestjs-sdk/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,UAAU,GACX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const ID_KEY = "id";
@@ -0,0 +1,2 @@
1
+ export const ID_KEY = 'id';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { JsonSdkConfig } from './types';
2
+ import { JsonApiUtilsService, JsonApiSdkService, AtomicOperationsService } from './service';
3
+ export declare const getProviders: (config: JsonSdkConfig) => ({
4
+ provide: import("@angular/core").InjectionToken<import("./types").JsonApiSdkConfig>;
5
+ useValue: import("./types").JsonApiSdkConfig;
6
+ useFactory?: undefined;
7
+ } | {
8
+ provide: typeof JsonApiUtilsService;
9
+ useFactory: () => JsonApiUtilsService;
10
+ useValue?: undefined;
11
+ } | {
12
+ provide: typeof JsonApiSdkService;
13
+ useFactory: () => JsonApiSdkService;
14
+ useValue?: undefined;
15
+ } | {
16
+ provide: import("@angular/core").InjectionToken<import("./types").AtomicFactory>;
17
+ useFactory: () => () => AtomicOperationsService<unknown[]>;
18
+ useValue?: undefined;
19
+ })[];
20
+ export declare const provideJsonApi: (config: JsonSdkConfig) => import("@angular/core").EnvironmentProviders;
21
+ export { AtomicFactory, JSON_API_SDK_CONFIG } from './token';
@@ -0,0 +1,33 @@
1
+ import { inject, makeEnvironmentProviders } from '@angular/core';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { AtomicFactory, JSON_API_SDK_CONFIG } from './token';
4
+ import { resultConfig } from './utils';
5
+ import { JsonApiUtilsService, JsonApiSdkService, AtomicOperationsService, } from './service';
6
+ export const getProviders = (config) => [
7
+ {
8
+ provide: JSON_API_SDK_CONFIG,
9
+ useValue: resultConfig(config),
10
+ },
11
+ {
12
+ provide: JsonApiUtilsService,
13
+ useFactory: () => new JsonApiUtilsService(inject(JSON_API_SDK_CONFIG)),
14
+ },
15
+ {
16
+ provide: JsonApiSdkService,
17
+ useFactory: () => new JsonApiSdkService(inject(HttpClient), inject(JsonApiUtilsService), inject(JSON_API_SDK_CONFIG)),
18
+ },
19
+ {
20
+ provide: AtomicFactory,
21
+ useFactory: () => {
22
+ const jsonApiUtilsService = inject(JsonApiUtilsService);
23
+ const config = inject(JSON_API_SDK_CONFIG);
24
+ const httpClient = inject(HttpClient);
25
+ return () => {
26
+ return new AtomicOperationsService(jsonApiUtilsService, config, httpClient);
27
+ };
28
+ },
29
+ },
30
+ ];
31
+ export const provideJsonApi = (config) => makeEnvironmentProviders(getProviders(config));
32
+ export { AtomicFactory, JSON_API_SDK_CONFIG } from './token';
33
+ //# sourceMappingURL=json-api-angular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-angular.js","sourceRoot":"","sources":["../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/json-api-angular.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAE,EAAE,CAAC;IACrD;QACE,OAAO,EAAE,mBAAmB;QAC5B,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC;KAC/B;IACD;QACE,OAAO,EAAE,mBAAmB;QAC5B,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;KACvE;IACD;QACE,OAAO,EAAE,iBAAiB;QAC1B,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,iBAAiB,CACnB,MAAM,CAAkB,UAAiB,CAAC,EAC1C,MAAM,CAAC,mBAAmB,CAAC,EAC3B,MAAM,CAAC,mBAAmB,CAAC,CAC5B;KACJ;IACD;QACE,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,GAAG,EAAE;YACf,MAAM,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAC3C,MAAM,UAAU,GAAG,MAAM,CAAkB,UAAiB,CAAC,CAAC;YAE9D,OAAO,GAAG,EAAE;gBACV,OAAO,IAAI,uBAAuB,CAChC,mBAAmB,EACnB,MAAM,EACN,UAAU,CACX,CAAC;YACJ,CAAC,CAAC;QACJ,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAqB,EAAE,EAAE,CACtD,wBAAwB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { AtomicFactory, AtomicFactoryPromise, JsonConfig, PromiseJsonApiSdkService } from './types';
2
+ import { JsonApiSdkService, JsonApiUtilsService } from './service';
3
+ export type JsonSdkPromise = {
4
+ jsonApiUtilsService: JsonApiUtilsService;
5
+ jonApiSdkService: PromiseJsonApiSdkService;
6
+ atomicFactory: AtomicFactoryPromise;
7
+ };
8
+ export type JsonSdkGeneral = {
9
+ jsonApiUtilsService: JsonApiUtilsService;
10
+ jonApiSdkService: JsonApiSdkService;
11
+ atomicFactory: AtomicFactory;
12
+ };
13
+ type JsonSdk<P extends boolean | undefined> = P extends true ? JsonSdkPromise : JsonSdkGeneral;
14
+ export declare function JsonApiJs<P extends true | boolean>(config: JsonConfig, returnPromise?: P): JsonSdk<P>;
15
+ export {};
@@ -0,0 +1,44 @@
1
+ import { resultConfig } from './utils';
2
+ import { AtomicOperationsService, JsonApiSdkService, JsonApiUtilsService, } from './service';
3
+ import { FetchInnerClient } from './service/fetch-inner-client';
4
+ import { lastValueFrom } from 'rxjs';
5
+ const jsonSdk = {};
6
+ export function JsonApiJs(config, returnPromise) {
7
+ if (Object.keys(jsonSdk).length > 0)
8
+ return jsonSdk;
9
+ const { adapter, ...jsonSdkConfig } = config;
10
+ const resultJsonConfig = resultConfig(jsonSdkConfig);
11
+ const jsonApiUtilsService = new JsonApiUtilsService(resultJsonConfig);
12
+ const httpInnerClient = adapter ? adapter : new FetchInnerClient();
13
+ const jonApiSdkService = new JsonApiSdkService(httpInnerClient, jsonApiUtilsService, resultJsonConfig);
14
+ jsonSdk['jsonApiUtilsService'] = jsonApiUtilsService;
15
+ jsonSdk['jonApiSdkService'] = jonApiSdkService;
16
+ jsonSdk['atomicFactory'] = () => new AtomicOperationsService(jsonApiUtilsService, resultJsonConfig, httpInnerClient);
17
+ if (returnPromise) {
18
+ jsonSdk['jonApiSdkService'] = new Proxy(jonApiSdkService, {
19
+ get(target, p) {
20
+ return (...arg) => lastValueFrom(target[p].apply(target, arg));
21
+ },
22
+ });
23
+ jsonSdk['atomicFactory'] = () => {
24
+ const proxy = new Proxy(new AtomicOperationsService(jsonApiUtilsService, resultJsonConfig, httpInnerClient), {
25
+ get(target, p) {
26
+ if (p === 'run') {
27
+ return () => lastValueFrom(target.run());
28
+ }
29
+ if (typeof target[p] === 'function') {
30
+ return (...arg) => {
31
+ // @ts-ignore
32
+ target[p](...arg);
33
+ return proxy;
34
+ };
35
+ }
36
+ return target[p];
37
+ },
38
+ });
39
+ return proxy;
40
+ };
41
+ }
42
+ return jsonSdk;
43
+ }
44
+ //# sourceMappingURL=json-api-js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-js.js","sourceRoot":"","sources":["../../../../../../../libs/json-api/json-api-nestjs-sdk/src/lib/json-api-js.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAkBrC,MAAM,OAAO,GAAG,EAAS,CAAC;AAE1B,MAAM,UAAU,SAAS,CACvB,MAAkB,EAClB,aAAiB;IAEjB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IACpD,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,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AK,UAAU,EAAE,CAAC;wBACpC,OAAO,CAAC,GAAG,GAAQ,EAAE,EAAE;4BACrB,aAAa;4BACb,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;4BAClB,OAAO,KAAK,CAAC;wBACf,CAAC,CAAC;oBACJ,CAAC;oBACD,OAAO,MAAM,CAAC,CAAC,CAAQ,CAAC;gBAC1B,CAAC;aACF,CACF,CAAC;YAEF,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Observable } from 'rxjs';
2
+ import { RelationKeys } from '@klerick/json-api-nestjs-shared';
3
+ import { JsonApiUtilsService } from './json-api-utils.service';
4
+ import { AtomicOperations, HttpInnerClient, JsonApiSdkConfig, ReturnIfArray } from '../types';
5
+ export declare class AtomicOperationsService<T extends unknown[]> implements AtomicOperations<T> {
6
+ private jsonApiUtilsService;
7
+ private jsonApiSdkConfig;
8
+ private httpInnerClient;
9
+ private generateAtomicBody;
10
+ constructor(jsonApiUtilsService: JsonApiUtilsService, jsonApiSdkConfig: JsonApiSdkConfig, httpInnerClient: HttpInnerClient);
11
+ private addBody;
12
+ run(): Observable<T>;
13
+ deleteOne<Entity extends object>(entity: Entity): AtomicOperations<[...T]>;
14
+ deleteOne<Entity extends object>(entity: Entity, skipEmpty: true): AtomicOperations<[...T]>;
15
+ deleteOne<Entity extends object>(entity: Entity, skipEmpty: false): AtomicOperations<[...T, 'EMPTY']>;
16
+ patchOne<Entity extends object>(entity: Entity): AtomicOperations<[...T, Entity]>;
17
+ postOne<Entity extends object>(entity: Entity): AtomicOperations<[...T, Entity]>;
18
+ deleteRelationships<Entity extends object, Rel extends RelationKeys<Entity>>(entity: Entity, relationType: Rel): AtomicOperations<T>;
19
+ patchRelationships<Entity extends object, Rel extends RelationKeys<Entity>>(entity: Entity, relationType: Rel): AtomicOperations<[...T, ReturnIfArray<Entity[Rel], string>]>;
20
+ postRelationships<Entity extends object, Rel extends RelationKeys<Entity>>(entity: Entity, relationType: Rel): AtomicOperations<[...T, ReturnIfArray<Entity[Rel], string>]>;
21
+ private setToBody;
22
+ }