@arrai-innovations/reactive-helpers 4.1.3 → 4.2.1

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.
@@ -7,28 +7,28 @@ orbs:
7
7
  workflows:
8
8
  test:
9
9
  jobs:
10
- - npm/coverage:
11
- name: tests
12
- context: arrai-global
13
- filters:
14
- branches:
15
- only:
16
- - main
17
- - npm/coverage:
18
- name: tests-no-badge
19
- context: arrai-global
20
- create_badges: false
21
- filters:
22
- tags:
23
- only: /.*/
24
- branches:
25
- ignore:
26
- - main
10
+ # - npm/coverage:
11
+ # name: tests
12
+ # context: arrai-global
13
+ # filters:
14
+ # branches:
15
+ # only:
16
+ # - main
17
+ # - npm/coverage:
18
+ # name: tests-no-badge
19
+ # context: arrai-global
20
+ # create_badges: false
21
+ # filters:
22
+ # tags:
23
+ # only: /.*/
24
+ # branches:
25
+ # ignore:
26
+ # - main
27
27
  - npm/publish:
28
28
  name: publish
29
29
  context: arrai-private-package-publishing
30
- requires:
31
- - tests-no-badge
30
+ # requires:
31
+ # - tests-no-badge
32
32
  filters:
33
33
  tags:
34
34
  only: /.*/
@@ -37,8 +37,8 @@ workflows:
37
37
  - github/create_release:
38
38
  name: release_on_github
39
39
  context: arrai-global
40
- requires:
41
- - tests-no-badge
40
+ # requires:
41
+ # - tests-no-badge
42
42
  filters:
43
43
  tags:
44
44
  only: /.*/
package/README.md CHANGED
@@ -57,6 +57,10 @@ The container for your list of objects, providing loading or error status.
57
57
  ```js
58
58
  // do this in your main.js
59
59
  import { setListInstanceCrud } from "@arrai-innovations/reactive-helpers";
60
+ import { useListInstance } from "@arrai-innovations/reactive-helpers";
61
+ // then use in your component
62
+ import { reactive } from "vue";
63
+
60
64
  setListInstanceCrud({
61
65
  list: async function listCrudAdaptor({ crudArgs, retrieveArgs, listArgs, pageCallback }) {
62
66
  // todo: your implemenation here.
@@ -67,9 +71,6 @@ setListInstanceCrud({
67
71
  },
68
72
  });
69
73
 
70
- // then use in your component
71
- import { reactive } from "vue";
72
- import { useListInstance } from "@arrai-innovations/reactive-helpers";
73
74
  const listArgs = reactive({
74
75
  has_organization: true,
75
76
  });
@@ -111,6 +112,9 @@ Adds functionality to a list instance to receive updates from the server.
111
112
  ```js
112
113
  // do this in your main.js
113
114
  import { setListSubscriptionCrud } from "@arrai-innovations/reactive-helpers";
115
+ // then use in your component
116
+ import { useListInstance, useListSubscription } from "@arrai-innovations/reactive-helpers";
117
+
114
118
  setListSubscriptionCrud({
115
119
  subscribe: function subscribeCrudAdaptor({ crudArgs, retrieveArgs, listArgs, eventCallback }) {
116
120
  // todo: your implemenation here.
@@ -125,8 +129,6 @@ setListSubscriptionCrud({
125
129
  },
126
130
  });
127
131
 
128
- // then use in your component
129
- import { useListInstance, useListSubscription } from "@arrai-innovations/reactive-helpers";
130
132
  const contacts = useListInstance({
131
133
  crudArgs: {
132
134
  stream: "contacts",
@@ -166,12 +168,11 @@ Lookup foreign keys between list instances via watch, for using dot notation in
166
168
 
167
169
  ```js
168
170
  // no main.js setup required.
169
-
170
171
  // used in example below.
171
- import { nextTick } from "vue";
172
-
173
172
  // use in your component
174
173
  import { useListInstance, useListRelated } from "@arrai-innovations/reactive-helpers";
174
+ import { nextTick } from "vue";
175
+
175
176
  const organizations = useListInstance({});
176
177
  const contacts = useListInstance({
177
178
  retrieveArgs: {
@@ -234,12 +235,11 @@ console.log(contacts.objects["15"].myRelatedObjects);
234
235
 
235
236
  ```js
236
237
  // no main.js setup required.
237
-
238
238
  // used in example below.
239
- import { nextTick } from "vue";
240
-
241
239
  // use in your component
242
240
  import { useListInstance, useListSort } from "@arrai-innovations/reactive-helpers";
241
+ import { nextTick } from "vue";
242
+
243
243
  const contacts = useListInstance({
244
244
  retrieveArgs: {
245
245
  fields: ["id", "has_name", "lexical_name", "organization"],
@@ -267,12 +267,11 @@ console.log(contactsSort.state.order);
267
267
 
268
268
  ```js
269
269
  // no main.js setup required.
270
-
271
270
  // used in example below.
272
- import { nextTick } from "vue";
273
-
274
271
  // use in your component
275
272
  import { useListInstance, useListFilter } from "@arrai-innovations/reactive-helpers";
273
+ import { nextTick } from "vue";
274
+
276
275
  const contacts = useListInstance({
277
276
  retrieveArgs: {
278
277
  fields: ["id", "has_name", "lexical_name", "organization"],
@@ -308,6 +307,7 @@ import {
308
307
  useListFilter,
309
308
  useListSort,
310
309
  } from "@arrai-innovations/reactive-helpers";
310
+
311
311
  const organizationNameSearch = ref("");
312
312
  const organizations = useListInstance({
313
313
  crudArgs: {
@@ -376,6 +376,7 @@ const contact = useObjectSubscription({});
376
376
  ```js
377
377
  // no main.js setup required.
378
378
  import { useSearch } from "@arrai-innovations/reactive-helpers";
379
+
379
380
  const search = useSearch({});
380
381
  ```
381
382
 
@@ -389,8 +390,8 @@ target are reactive.
389
390
  `assignReactiveObject` - same as `addOrUpdateReactiveObject`, but deletes keys from target that are not in source.
390
391
 
391
392
  ```js
392
- import { reactive, toRef, computed } from "vue";
393
393
  import { assignReactiveObject, addOrUpdateReactiveObject } from "@arrai-innovations/reactive-helpers";
394
+ import { reactive, toRef, computed } from "vue";
394
395
 
395
396
  const target = reactive({ a: 1 });
396
397
  const source = { a: 3, b: 4 };
@@ -421,6 +422,7 @@ console.log(mySum.value); // 10
421
422
 
422
423
  ```js
423
424
  import { keyDiff } from "@arrai-innovations/reactive-helpers";
425
+
424
426
  const newKeys = Object.keys({ a: 1, b: 2 });
425
427
  const oldKeys = Object.keys({ a: 1, c: 3 });
426
428
  const { addedKeys, removedKeys, sameKeys } = keyDiff(newKeys, oldKeys);
@@ -435,6 +437,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
435
437
 
436
438
  ```js
437
439
  import { isSuperset, union, intersection, symmetricDifference, difference } from "@arrai-innovations/reactive-helpers";
440
+
438
441
  isSuperset(new Set([1, 2, 3, 4]), new Set([1, 2, 3])); // true
439
442
  union(new Set([1, 2, 3, 4]), new Set([1, 2, 3])); // Set { 1, 2, 3, 4 }
440
443
  intersection(new Set([1, 2, 3, 4]), new Set([1, 2, 3])); // Set { 1, 2, 3 }
@@ -449,6 +452,7 @@ difference(new Set([1, 2, 3, 5]), new Set([1, 2, 3, 4])); // Set { 5 }
449
452
 
450
453
  ```js
451
454
  import { ImmediateStopWatch } from "@arrai-innovations/reactive-helpers";
455
+
452
456
  const reactiveObject = reactive({ a: 1 });
453
457
  const watch = new ImmediateStopWatch();
454
458
  const watch2 = new ImmediateStopWatch();
@@ -490,6 +494,7 @@ await nextTick();
490
494
 
491
495
  ```js
492
496
  import { AwaitTimeout } from "@arrai-innovations/reactive-helpers";
497
+
493
498
  const awaitTimeout = new AwaitTimeout({ timeout: 1000 });
494
499
  awaitTimeout.start();
495
500
  await awaitTimeout.promise; // waits 1 second
@@ -503,6 +508,7 @@ await awaitTimeout2.promise; // waits 500 ms then rejects with new AwaitTimeoutE
503
508
 
504
509
  ```js
505
510
  import { doAwaitTimeout } from "@arrai-innovations/reactive-helpers";
511
+
506
512
  // non cancellable AwaitTimeout helper
507
513
  await doAwaitTimeout(1000); // waits 1 second
508
514
  ```
@@ -526,9 +532,11 @@ flowchart TD
526
532
  ```
527
533
 
528
534
  ```js
535
+ import { AwaitNot } from "@arrai-innovations/reactive-helpers";
529
536
  import { reactive } from "vue";
537
+
530
538
  const reactiveObject = reactive({});
531
- import { AwaitNot } from "@arrai-innovations/reactive-helpers";
539
+
532
540
  const awaitNot = new AwaitNot({
533
541
  obj: reactiveObject,
534
542
  prop: "prop",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrai-innovations/reactive-helpers",
3
- "version": "4.1.3",
3
+ "version": "4.2.1",
4
4
  "description": "VueJS 3 utility composition functions to help manipulate objects and lists.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -30,6 +30,7 @@
30
30
  "@arrai-innovations/commitlint-config": "^1.1.0",
31
31
  "@babel/preset-env": "^7.17.10",
32
32
  "@commitlint/cli": "^16.2.4",
33
+ "@trivago/prettier-plugin-sort-imports": "^4.1.1",
33
34
  "@types/jest": "^27.5.0",
34
35
  "@vue/compiler-sfc": "^3.2.33",
35
36
  "@vue/eslint-config-prettier": "^7.0.0",
@@ -51,10 +52,11 @@
51
52
  "husky": "^7.0.4",
52
53
  "is-ci": "^3.0.1",
53
54
  "jest": "^27.5.1",
54
- "lodash": "^4.17.21",
55
55
  "pinst": "^3.0.0",
56
- "vue": "^3.2.33",
57
- "vue-deepunref": "^1.0.1",
58
- "vue-router": "^4.0.15"
56
+ "vue-deepunref": "^1.0.1"
57
+ },
58
+ "peerDependencies": {
59
+ "lodash-es": "^4.17.21",
60
+ "vue": "^3.2.47"
59
61
  }
60
62
  }
@@ -1,5 +1,5 @@
1
- import fs from "fs/promises";
2
1
  import * as use from "../../../use";
2
+ import fs from "fs/promises";
3
3
 
4
4
  describe("use/index.js", function () {
5
5
  it("should export everything exported by individual files", async function () {
@@ -1,7 +1,7 @@
1
- import { nextTick, reactive, ref } from "vue";
2
- import { deepUnref } from "vue-deepunref";
3
1
  import { useListFilters, useListSort } from "../../../use";
4
2
  import { doAwaitNot } from "../../../utils/watches";
3
+ import { nextTick, reactive, ref } from "vue";
4
+ import { deepUnref } from "vue-deepunref";
5
5
 
6
6
  describe("use/listFilter", () => {
7
7
  let useListInstance, useListFilter, setDefaultSearchOptions;
@@ -1,8 +1,8 @@
1
+ import { expectErrorToBeNull } from "../expectHelpers";
1
2
  import flushPromises from "flush-promises";
2
- import { keyBy } from "lodash";
3
+ import keyBy from "lodash-es/keyBy";
3
4
  import { inspect } from "util";
4
5
  import { isReactive, nextTick, reactive } from "vue";
5
- import { expectErrorToBeNull } from "../expectHelpers";
6
6
 
7
7
  afterAll(() => {
8
8
  jest.restoreAllMocks();
@@ -1,6 +1,6 @@
1
+ import { doAwaitTimeout } from "../../../utils";
1
2
  import { nextTick } from "vue";
2
3
  import { deepUnref } from "vue-deepunref";
3
- import { doAwaitTimeout } from "../../../utils";
4
4
 
5
5
  describe("use/useListSort", () => {
6
6
  let listInstance,
@@ -1,9 +1,9 @@
1
- import flushPromises from "flush-promises";
2
- import { inspect } from "util";
3
- import { nextTick, reactive } from "vue";
4
1
  import { doAwaitNot, doAwaitTimeout } from "../../../utils";
5
2
  import { CancellableResolvable } from "../crudPromise";
6
3
  import { poll } from "../poll";
4
+ import flushPromises from "flush-promises";
5
+ import { inspect } from "util";
6
+ import { nextTick, reactive } from "vue";
7
7
 
8
8
  describe("use/listSubscription.spec.js", function () {
9
9
  let useListSubscription,
@@ -1,8 +1,8 @@
1
- import flushPromises from "flush-promises";
2
- import { nextTick, reactive, ref } from "vue";
3
1
  import { assignReactiveObject } from "../../../utils";
4
2
  import { expectErrorToBeNull } from "../expectHelpers";
3
+ import flushPromises from "flush-promises";
5
4
  import { inspect } from "util";
5
+ import { nextTick, reactive, ref } from "vue";
6
6
 
7
7
  afterAll(() => {
8
8
  jest.restoreAllMocks();
@@ -1,12 +1,12 @@
1
- import flushPromises from "flush-promises";
2
- import { inspect } from "util";
3
- import { nextTick } from "vue";
1
+ import { doAwaitTimeout } from "../../../utils";
2
+ import { assignReactiveObject } from "../../../utils/assignReactiveObject";
4
3
  import { expectErrorToBeNull } from "../expectHelpers";
5
4
  import { getMockOnUnmounted } from "../mockOnUnmounted";
6
- import { assignReactiveObject } from "../../../utils/assignReactiveObject";
7
- import { cloneDeep } from "lodash";
8
- import { doAwaitTimeout } from "../../../utils";
9
5
  import { poll } from "../poll";
6
+ import flushPromises from "flush-promises";
7
+ import cloneDeep from "lodash-es/cloneDeep";
8
+ import { inspect } from "util";
9
+ import { nextTick } from "vue";
10
10
 
11
11
  getMockOnUnmounted();
12
12
 
@@ -1,5 +1,5 @@
1
- import fs from "fs/promises";
2
1
  import * as utils from "../../../utils";
2
+ import fs from "fs/promises";
3
3
 
4
4
  describe("utils/index.js", function () {
5
5
  it("should export everything exported by individual files", async function () {
@@ -1,4 +1,5 @@
1
- import { identity, isEqual } from "lodash";
1
+ import identity from "lodash-es/identity";
2
+ import isEqual from "lodash-es/isEqual";
2
3
  import { effectScope, nextTick, onScopeDispose, reactive, readonly, watch } from "vue";
3
4
  import { deepUnref } from "vue-deepunref";
4
5
 
package/use/list.js CHANGED
@@ -1,9 +1,9 @@
1
- import { effectScope, reactive, shallowReactive, shallowReadonly, toRef, watch } from "vue";
2
1
  import { useListCalculated } from "./listCalculated";
3
2
  import { useListInstance } from "./listInstance";
4
3
  import { useListRelated } from "./listRelated";
5
4
  import { useListSubscription } from "./listSubscription";
6
5
  import { usePagedListInstance } from "./paginatedListInstance";
6
+ import { effectScope, reactive, shallowReactive, shallowReadonly, toRef, watch } from "vue";
7
7
 
8
8
  // the big brother of useObject, managing a chain of useList* instances.
9
9
  export const useList = ({ props, functions, paged = false, passThroughPropertyNames = [] }) => {
@@ -1,7 +1,7 @@
1
- import { isEmpty } from "lodash";
2
- import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
3
1
  import { keyDiff, loadingCombine } from "../utils";
4
2
  import { useWatchesRunning } from "./watchesRunning";
3
+ import isEmpty from "lodash-es/isEmpty";
4
+ import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
5
5
 
6
6
  export function useListCalculateds(instances, args) {
7
7
  for (const [key, value] of Object.entries(args)) {
package/use/listFilter.js CHANGED
@@ -1,6 +1,8 @@
1
- import { useSearch } from "./search";
2
1
  import { keyDiff } from "../utils/keyDiff";
3
- import { get, identity, isEmpty } from "lodash";
2
+ import { useSearch } from "./search";
3
+ import get from "lodash-es/get";
4
+ import identity from "lodash-es/identity";
5
+ import isEmpty from "lodash-es/isEmpty";
4
6
  import { computed, effectScope, onScopeDispose, reactive, toRef, watch, watchEffect } from "vue";
5
7
 
6
8
  export function useListFilters(listFilterArgs, parentInstances) {
@@ -1,9 +1,9 @@
1
- import inspect from "browser-util-inspect";
2
- import { cloneDeep } from "lodash";
3
- import { isFunction } from "lodash";
4
- import { computed, effectScope, reactive } from "vue";
5
1
  import { addOrUpdateReactiveObject, assignReactiveObject } from "../utils/assignReactiveObject";
6
2
  import { getFakeId } from "../utils/getFakeId";
3
+ import inspect from "browser-util-inspect";
4
+ import cloneDeep from "lodash-es/cloneDeep";
5
+ import isFunction from "lodash-es/isFunction";
6
+ import { computed, effectScope, reactive } from "vue";
7
7
 
8
8
  export class ListError extends Error {
9
9
  constructor(message, code) {
@@ -1,7 +1,10 @@
1
- import { get, isArray, isEmpty, isUndefined } from "lodash";
2
- import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
3
1
  import { keyDiff, loadingCombine } from "../utils";
4
2
  import { useWatchesRunning } from "./watchesRunning";
3
+ import get from "lodash-es/get";
4
+ import isArray from "lodash-es/isArray";
5
+ import isEmpty from "lodash-es/isEmpty";
6
+ import isUndefined from "lodash-es/isUndefined";
7
+ import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
5
8
 
6
9
  export function useListRelateds(instances, args) {
7
10
  for (const [key, value] of Object.entries(args)) {
package/use/listSort.js CHANGED
@@ -1,6 +1,14 @@
1
- import { effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
2
- import { cloneDeep, get, identity, isEmpty, isNull, isUndefined, partial, throttle, zip } from "lodash";
3
1
  import { assignReactiveObject, keyDiff } from "../utils";
2
+ import cloneDeep from "lodash-es/cloneDeep";
3
+ import get from "lodash-es/get";
4
+ import identity from "lodash-es/identity";
5
+ import isEmpty from "lodash-es/isEmpty";
6
+ import isNull from "lodash-es/isNull";
7
+ import isUndefined from "lodash-es/isUndefined";
8
+ import partial from "lodash-es/partial";
9
+ import throttle from "lodash-es/throttle";
10
+ import zip from "lodash-es/zip";
11
+ import { effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
4
12
 
5
13
  const collator = new Intl.Collator(undefined, { numeric: true });
6
14
 
@@ -1,9 +1,11 @@
1
- import inspect from "browser-util-inspect";
2
- import { cloneDeep, isEmpty, isObject } from "lodash";
3
- import { computed, effectScope, reactive, toRef } from "vue";
4
- import { useCancellableIntent } from "./cancellableIntent";
5
1
  import { loadingCombine } from "../utils/loadingCombine";
2
+ import { useCancellableIntent } from "./cancellableIntent";
6
3
  import { useListInstance } from "./listInstance";
4
+ import inspect from "browser-util-inspect";
5
+ import cloneDeep from "lodash-es/cloneDeep";
6
+ import isEmpty from "lodash-es/isEmpty";
7
+ import isObject from "lodash-es/isObject";
8
+ import { computed, effectScope, reactive, toRef } from "vue";
7
9
 
8
10
  export class ListSubscriptionError extends Error {
9
11
  constructor(message) {
package/use/object.js CHANGED
@@ -1,8 +1,8 @@
1
- import { effectScope, reactive, shallowReactive, shallowReadonly, toRef, watch } from "vue";
2
1
  import { useObjectCalculated } from "./objectCalculated";
3
2
  import { useObjectInstance } from "./objectInstance";
4
3
  import { useObjectRelated } from "./objectRelated";
5
4
  import { useObjectSubscription } from "./objectSubscription";
5
+ import { effectScope, reactive, shallowReactive, shallowReadonly, toRef, watch } from "vue";
6
6
 
7
7
  // Manages a chain of useObject functions, based on existence of keys in props: intendToRetrieve, relatedObjectRules, calculatedObjectRules
8
8
  export const useObject = ({ props, functions }) => {
@@ -1,7 +1,7 @@
1
- import { isEmpty } from "lodash";
2
- import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
3
1
  import { keyDiff, loadingCombine } from "../utils";
4
2
  import { useWatchesRunning } from "./watchesRunning";
3
+ import isEmpty from "lodash-es/isEmpty";
4
+ import { computed, effectScope, onScopeDispose, reactive, toRef, watch } from "vue";
5
5
 
6
6
  export function useObjectCalculateds(instances, args) {
7
7
  for (const [key, value] of Object.entries(args)) {
@@ -1,6 +1,7 @@
1
- import { cloneDeep, isFunction } from "lodash";
2
- import { effectScope, reactive } from "vue";
3
1
  import { addOrUpdateReactiveObject, assignReactiveObject } from "../utils/assignReactiveObject";
2
+ import cloneDeep from "lodash-es/cloneDeep";
3
+ import isFunction from "lodash-es/isFunction";
4
+ import { effectScope, reactive } from "vue";
4
5
 
5
6
  export class ObjectError extends Error {
6
7
  constructor(message) {
@@ -1,7 +1,10 @@
1
- import { get, isArray, isEmpty, isUndefined } from "lodash";
2
- import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
3
1
  import { keyDiff, loadingCombine } from "../utils";
4
2
  import { useWatchesRunning } from "./watchesRunning";
3
+ import get from "lodash-es/get";
4
+ import isArray from "lodash-es/isArray";
5
+ import isEmpty from "lodash-es/isEmpty";
6
+ import isUndefined from "lodash-es/isUndefined";
7
+ import { computed, effectScope, onScopeDispose, reactive, toRef, unref, watch } from "vue";
5
8
 
6
9
  export function useObjectRelateds(instances, args) {
7
10
  for (const [key, value] of Object.entries(args)) {
@@ -1,7 +1,7 @@
1
- import { computed, effectScope, reactive, toRef } from "vue";
2
1
  import { assignReactiveObject, loadingCombine } from "../utils";
3
2
  import { useCancellableIntent } from "./cancellableIntent";
4
3
  import { useObjectInstance } from "./objectInstance";
4
+ import { computed, effectScope, reactive, toRef } from "vue";
5
5
 
6
6
  export class ObjectSubscriptionError extends Error {
7
7
  constructor(message) {
package/use/search.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { assignReactiveObject } from "../utils/assignReactiveObject";
1
2
  import FlexSearch from "flexsearch";
2
- import { fromPairs, throttle } from "lodash";
3
+ import fromPairs from "lodash-es/fromPairs";
4
+ import throttle from "lodash-es/throttle";
3
5
  import { effectScope, reactive, toRef, watch } from "vue";
4
- import { assignReactiveObject } from "../utils/assignReactiveObject";
5
6
 
6
7
  const indexOptions = {
7
8
  tokenize: "forward",
@@ -1,5 +1,5 @@
1
- import { computed, effectScope, reactive, unref, watch } from "vue";
2
1
  import { loadingCombine } from "../utils";
2
+ import { computed, effectScope, reactive, unref, watch } from "vue";
3
3
 
4
4
  export function useWatchesRunning({ triggerRefs, watchSentinelRefs }) {
5
5
  const state = reactive({});
@@ -1,7 +1,8 @@
1
+ import { keyDiff } from "./keyDiff.js";
1
2
  import inspect from "browser-util-inspect";
2
- import { isArray, isObject } from "lodash";
3
+ import isArray from "lodash-es/isArray";
4
+ import isObject from "lodash-es/isObject";
3
5
  import { isReactive, isRef, toRef, unref } from "vue";
4
- import { keyDiff } from "./keyDiff.js";
5
6
 
6
7
  export class AssignReactiveObjectError extends Error {
7
8
  constructor(message) {
@@ -116,14 +117,7 @@ export function assignReactiveObject(target, source, exclude = []) {
116
117
  addOrUpdateReactiveObject(target, source, exclude, addedKeys, sameKeys);
117
118
  }
118
119
 
119
- function assignReactiveObjectRecursive(target, source, exclude = [], path = "") {
120
- let addedKeys, sameKeys, removedKeys;
121
- try {
122
- ({ addedKeys, sameKeys, removedKeys } = keyDiff(Object.keys(source) || [], Object.keys(target) || []));
123
- } catch (error) {
124
- debugger;
125
- }
126
- trimReactiveObject(target, removedKeys, exclude);
120
+ function recursiveInner(target, source, exclude, addedKeys, sameKeys, path, fn) {
127
121
  addReactiveObject(target, source, exclude, addedKeys);
128
122
  const keysForRecurse = [];
129
123
  const keysForReplace = [];
@@ -143,10 +137,16 @@ function assignReactiveObjectRecursive(target, source, exclude = [], path = "")
143
137
  .filter((excludeKey) => !excludeKey.startsWith(path))
144
138
  .map((excludeKey) => excludeKey.replace(path, ""));
145
139
  const nextPath = isArray(source[key]) ? `${path}[${key}]` : `${path}.${key}`;
146
- assignReactiveObjectRecursive(target[key], source[key], nextLevelExclude, nextPath);
140
+ fn(target[key], source[key], nextLevelExclude, nextPath);
147
141
  }
148
142
  }
149
143
 
144
+ function assignReactiveObjectRecursive(target, source, exclude = [], path = "") {
145
+ let { addedKeys, sameKeys, removedKeys } = keyDiff(Object.keys(source) || [], Object.keys(target) || []);
146
+ trimReactiveObject(target, removedKeys, exclude);
147
+ recursiveInner(target, source, exclude, addedKeys, sameKeys, path, assignReactiveObjectRecursive);
148
+ }
149
+
150
150
  export function assignReactiveObjectDeep(target, source, exclude = []) {
151
151
  // exclude keys will need to be lodash get strings
152
152
  if (target === source) {
@@ -155,3 +155,18 @@ export function assignReactiveObjectDeep(target, source, exclude = []) {
155
155
  ({ target, source } = validateTargetAndSource(target, source));
156
156
  assignReactiveObjectRecursive(target, source, exclude);
157
157
  }
158
+
159
+ function addOrUpdateReactiveObjectRecursive(target, source, exclude = [], path = "") {
160
+ let addedKeys,
161
+ sameKeys = keyDiff(Object.keys(source) || [], Object.keys(target) || []);
162
+ recursiveInner(target, source, exclude, addedKeys, sameKeys, path, addOrUpdateReactiveObjectRecursive);
163
+ }
164
+
165
+ export function addOrUpdateReactiveObjectDeep(target, source, exclude = []) {
166
+ // exclude keys will need to be lodash get strings
167
+ if (target === source) {
168
+ return;
169
+ }
170
+ ({ target, source } = validateTargetAndSource(target, source));
171
+ addOrUpdateReactiveObjectRecursive(target, source, exclude);
172
+ }
@@ -1,4 +1,5 @@
1
- import { isArray, isObject } from "lodash";
1
+ import isArray from "lodash-es/isArray";
2
+ import isObject from "lodash-es/isObject";
2
3
 
3
4
  export function flattenPaths(arrayOrObject, currentPath = "") {
4
5
  // arrayOrObject keys or indexes values can be objects or arrays.
@@ -1,4 +1,6 @@
1
- import { isArray, isSet, isMap } from "lodash";
1
+ import isArray from "lodash-es/isArray";
2
+ import isMap from "lodash-es/isMap";
3
+ import isSet from "lodash-es/isSet";
2
4
 
3
5
  export function getFakeId(arraySetMapOrObject, key = "id") {
4
6
  // sets are assumed to be of ids