Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 327bffb

Browse files
committed
removed 'removeProperties'
1 parent 359fd81 commit 327bffb

File tree

26 files changed

+97
-111
lines changed

26 files changed

+97
-111
lines changed

examples/react/develop/simple-counter/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
"eject": "react-scripts eject",
1010
"analyze": "yarn run build && source-map-explorer 'build/static/js/*.js'",
1111
"analyze:webpack": "node scripts/analyze.js",
12-
"install:dev:agile": "yalc add @agile-ts/core @agile-ts/react @agile-ts/logger & yarn install",
13-
"install:prod:agile": "yarn add @agile-ts/core @agile-ts/react @agile-ts/logger & yarn install"
12+
"install:dev:agile": "yalc add @agile-ts/core @agile-ts/react @agile-ts/logger @agile-ts/utils & yarn install",
13+
"install:prod:agile": "yarn add @agile-ts/core @agile-ts/react @agile-ts/logger @agile-ts/utils & yarn install"
1414
},
1515
"dependencies": {
1616
"@agile-ts/core": "file:.yalc/@agile-ts/core",
1717
"@agile-ts/logger": "file:.yalc/@agile-ts/logger",
1818
"@agile-ts/react": "file:.yalc/@agile-ts/react",
19+
"@agile-ts/utils": "file:.yalc/@agile-ts/utils",
1920
"@hookstate/core": "^3.0.8",
2021
"@reduxjs/toolkit": "^1.6.1",
2122
"dotenv": "^10.0.0",

examples/react/develop/simple-counter/yarn.lock

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33

44

55
"@agile-ts/core@file:.yalc/@agile-ts/core":
6-
version "0.2.0-alpha.3"
6+
version "0.2.6"
77
dependencies:
8-
"@agile-ts/utils" "^0.0.7"
8+
"@agile-ts/utils" "^0.0.10"
99

1010
"@agile-ts/logger@file:.yalc/@agile-ts/logger":
11-
version "0.0.7"
11+
version "0.0.10"
1212
dependencies:
13-
"@agile-ts/utils" "^0.0.7"
13+
"@agile-ts/utils" "^0.0.10"
1414

1515
"@agile-ts/react@file:.yalc/@agile-ts/react":
16-
version "0.1.2"
16+
version "0.2.2"
1717

18-
"@agile-ts/utils@^0.0.7":
19-
version "0.0.7"
20-
resolved "https://registry.yarnpkg.com/@agile-ts/utils/-/utils-0.0.7.tgz#3dd1add6b9f63d0a5bf35e71f54ac46448ae047f"
21-
integrity sha512-OviTDC+ZbfyiUx8Gy8veS6YymC/tT6UeP23nT8V0EQV4F2MmuWqZ2yiKk+AYxZx8h74Ey8BVEUX6/ntpxhSNPw==
18+
"@agile-ts/utils@^0.0.10":
19+
version "0.0.10"
20+
resolved "https://registry.yarnpkg.com/@agile-ts/utils/-/utils-0.0.10.tgz#5eb2d7b7faefc00c416165ad93c79237e8448bbd"
21+
integrity sha512-eVJZS60H8HaD8atTfswObihdDxjcxNlaoHk8Crmz85KOrdIMBMdrGx41p+Zf15s+dSfal1gbgM2In3bw4zjSww==
22+
23+
"@agile-ts/utils@file:.yalc/@agile-ts/utils":
24+
version "0.0.10"
2225

2326
2427
version "7.10.4"

packages/core/src/collection/collection.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
isFunction,
66
isValidObject,
77
normalizeArray,
8-
removeProperties,
98
} from '@agile-ts/utils';
109
import { logCodeManager } from '../logCodeManager';
1110
import { Agile } from '../agile';
@@ -26,7 +25,7 @@ import { CollectionPersistent } from './collection.persistent';
2625

2726
export class Collection<
2827
DataType extends DefaultItem = DefaultItem,
29-
GroupValueType = Array<ItemKey> // To extract the Group Type Value in Integration methods like 'useAgile()'
28+
GroupValueType = Array<ItemKey> // To extract the Group Type Value in Integration methods like 'useValue()'
3029
> {
3130
// Agile Instance the Collection belongs to
3231
public agileInstance: () => Agile;
@@ -1089,10 +1088,7 @@ export class Collection<
10891088
const _itemKeys = normalizeArray(itemKeys);
10901089

10911090
// Remove itemKeys from old Group
1092-
this.getGroup(oldGroupKey)?.remove(
1093-
_itemKeys,
1094-
removeProperties(config, ['method', 'overwrite'])
1095-
);
1091+
this.getGroup(oldGroupKey)?.remove(_itemKeys, config);
10961092

10971093
// Assign itemKeys to new Group
10981094
this.getGroup(newGroupKey)?.add(_itemKeys, config);

packages/core/src/collection/group/group.observer.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
copy,
3-
defineConfig,
4-
equal,
5-
generateId,
6-
removeProperties,
7-
} from '@agile-ts/utils';
1+
import { copy, defineConfig, equal, generateId } from '@agile-ts/utils';
82
import {
93
CreateObserverConfigInterface,
104
CreateRuntimeJobConfigInterface,

packages/core/src/collection/group/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
defineConfig,
44
isValidObject,
55
normalizeArray,
6-
removeProperties,
76
} from '@agile-ts/utils';
87
import { logCodeManager } from '../../logCodeManager';
98
import {
@@ -197,7 +196,7 @@ export class Group<
197196
if (notExistingItemKeysInCollection.length >= _itemKeys.length)
198197
config.background = true;
199198

200-
this.set(newGroupValue, removeProperties(config, ['softRebuild']));
199+
this.set(newGroupValue, config);
201200

202201
return this;
203202
}
@@ -271,10 +270,7 @@ export class Group<
271270
)
272271
config.background = true;
273272

274-
this.set(
275-
newGroupValue,
276-
removeProperties(config, ['method', 'softRebuild'])
277-
);
273+
this.set(newGroupValue, config);
278274

279275
return this;
280276
}

packages/core/src/computed/computed.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
defineConfig,
3-
isAsyncFunction,
4-
removeProperties,
5-
} from '@agile-ts/utils';
1+
import { defineConfig, isAsyncFunction } from '@agile-ts/utils';
62
import { Agile } from '../agile';
73
import { extractRelevantObservers } from '../utils';
84
import {
@@ -103,10 +99,7 @@ export class Computed<ComputedValueType = any> extends State<
10399
autodetect: false,
104100
});
105101
this.compute({ autodetect: config.autodetect }).then((result) => {
106-
this.observers['value'].ingestValue(
107-
result,
108-
removeProperties(config, ['autodetect'])
109-
);
102+
this.observers['value'].ingestValue(result, config);
110103
});
111104
return this;
112105
}
@@ -157,7 +150,7 @@ export class Computed<ComputedValueType = any> extends State<
157150

158151
// Recompute to assign the new computed value to the Computed
159152
// and autodetect missing dependencies
160-
this.recompute(removeProperties(config, ['overwriteDeps']));
153+
this.recompute(config);
161154

162155
return this;
163156
}

packages/core/src/computed/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { removeProperties, defineConfig } from '@agile-ts/utils';
1+
import { defineConfig } from '@agile-ts/utils';
22
import { CreateAgileSubInstanceInterface, shared } from '../shared';
33
import {
44
Computed,
@@ -75,7 +75,7 @@ export function createComputed<ComputedValueType = any>(
7575
return new Computed<ComputedValueType>(
7676
_config.agileInstance as any,
7777
computeFunction,
78-
removeProperties(_config, ['agileInstance'])
78+
_config
7979
);
8080
}
8181

packages/core/src/runtime/observer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class Observer {
112112
* A dependent Observer is always ingested into the Runtime,
113113
* when the Observer it depends on has been ingested too.
114114
*
115-
* (Note: not mutating directly 'dependents' for better testing)
115+
* (Note: not mutating directly 'dependents' for better unit testing)
116116
*
117117
* @public
118118
* @param observer - Observer to depend on the Observer.
@@ -124,7 +124,7 @@ export class Observer {
124124
/**
125125
* Makes the specified Observer no longer depend on the Observer.
126126
*
127-
* (Note: not mutating directly 'dependents' for better testing)
127+
* (Note: not mutating directly 'dependents' for better unit testing)
128128
*
129129
* @public
130130
* @param observer - Observer to no longer depend on the Observer.

packages/core/src/runtime/subscription/sub.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, isFunction, removeProperties } from '@agile-ts/utils';
1+
import { defineConfig, isFunction } from '@agile-ts/utils';
22
import { logCodeManager } from '../../logCodeManager';
33
import { Agile } from '../../agile';
44
import {
@@ -222,7 +222,7 @@ export class SubController {
222222
const componentSubscriptionContainer = new ComponentSubscriptionContainer(
223223
componentInstance,
224224
subs,
225-
removeProperties(config, ['waitForMount'])
225+
config
226226
);
227227
this.componentSubs.add(componentSubscriptionContainer);
228228

@@ -271,7 +271,7 @@ export class SubController {
271271
const callbackSubscriptionContainer = new CallbackSubscriptionContainer(
272272
callbackFunction,
273273
subs,
274-
removeProperties(config, ['waitForMount'])
274+
config
275275
);
276276
this.callbackSubs.add(callbackSubscriptionContainer);
277277
callbackSubscriptionContainer.ready = true;

packages/core/src/state/public/createEnhancedState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, removeProperties } from '@agile-ts/utils';
1+
import { defineConfig } from '@agile-ts/utils';
22
import { shared } from '../../shared';
33
import { EnhancedState } from '../state.enhanced';
44
import { CreateStateConfigInterfaceWithAgile } from './index';
@@ -32,6 +32,6 @@ export function createEnhancedState<ValueType = any>(
3232
return new EnhancedState<ValueType>(
3333
config.agileInstance as any,
3434
initialValue,
35-
removeProperties(config, ['agileInstance'])
35+
config
3636
);
3737
}

packages/core/src/state/public/createLightState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, removeProperties } from '@agile-ts/utils';
1+
import { defineConfig } from '@agile-ts/utils';
22
import { shared } from '../../shared';
33
import { State } from '../state';
44
import { CreateStateConfigInterfaceWithAgile } from './index';
@@ -28,6 +28,6 @@ export function createLightState<ValueType = any>(
2828
return new State<ValueType>(
2929
config.agileInstance as any,
3030
initialValue,
31-
removeProperties(config, ['agileInstance'])
31+
config
3232
);
3333
}

packages/core/src/state/state.enhanced.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
isFunction,
77
isValidObject,
88
notEqual,
9-
removeProperties,
109
} from '@agile-ts/utils';
1110
import { logCodeManager } from '../logCodeManager';
1211
import { State, StateConfigInterface, StateKey } from './state';
@@ -151,7 +150,7 @@ export class EnhancedState<ValueType = any> extends State<ValueType> {
151150
}
152151

153152
// Ingest updated 'nextStateValue' into runtime
154-
this.ingest(removeProperties(config, ['addNewProperties']));
153+
this.ingest(config);
155154

156155
return this;
157156
}

packages/core/src/state/state.observer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class StateObserver<ValueType = any> extends Observer {
2626

2727
// Next value applied to the State
2828
public nextStateValue: ValueType;
29+
2930
// Current value of the State (shared with the UI)
3031
public value?: ValueType;
3132
// Previous value of the State (for handling selectors)

packages/core/src/storages/shared.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, removeProperties } from '@agile-ts/utils';
1+
import { defineConfig } from '@agile-ts/utils';
22
import { runsOnServer } from '../utils';
33
import { CreateAgileSubInstanceInterface, shared } from '../shared';
44
import { CreateStoragesConfigInterface, Storages } from './storages';
@@ -35,10 +35,7 @@ export function createStorageManager(
3535
config = defineConfig(config, {
3636
agileInstance: shared,
3737
});
38-
return new Storages(
39-
config.agileInstance as any,
40-
removeProperties(config, ['agileInstance'])
41-
);
38+
return new Storages(config.agileInstance as any, config);
4239
}
4340

4441
/**

packages/core/tests/unit/collection/collection.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,6 +2090,8 @@ describe('Collection Tests', () => {
20902090
expect(dummyGroup2.add).not.toHaveBeenCalled();
20912091
expect(dummyGroup2.remove).toHaveBeenCalledWith(['1'], {
20922092
background: true,
2093+
method: 'push', // Not required but passed for simplicity
2094+
overwrite: true, // Not required but passed for simplicity
20932095
});
20942096
});
20952097
});

packages/core/tests/unit/collection/group/group.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ describe('Group Tests', () => {
255255
},
256256
],
257257
},
258+
softRebuild: true, // Not required but passed for simplicity
258259
}
259260
);
260261
});
@@ -274,6 +275,7 @@ describe('Group Tests', () => {
274275
force: true,
275276
storage: false,
276277
any: { trackedChanges: [] },
278+
softRebuild: false, // Not required but passed for simplicity
277279
}
278280
);
279281
});
@@ -307,6 +309,7 @@ describe('Group Tests', () => {
307309
},
308310
],
309311
},
312+
softRebuild: true, // Not required but passed for simplicity
310313
});
311314
});
312315

@@ -318,6 +321,7 @@ describe('Group Tests', () => {
318321
{
319322
background: true,
320323
any: { trackedChanges: [] },
324+
softRebuild: true, // Not required but passed for simplicity
321325
}
322326
);
323327
});
@@ -334,6 +338,7 @@ describe('Group Tests', () => {
334338
{
335339
background: true,
336340
any: { trackedChanges: [] },
341+
softRebuild: true, // Not required but passed for simplicity
337342
}
338343
);
339344
}
@@ -364,6 +369,8 @@ describe('Group Tests', () => {
364369
},
365370
],
366371
},
372+
method: 'push', // Not required but passed for simplicity
373+
softRebuild: true, // Not required but passed for simplicity
367374
}
368375
);
369376
});
@@ -383,6 +390,8 @@ describe('Group Tests', () => {
383390
force: true,
384391
storage: false,
385392
any: { trackedChanges: [] },
393+
method: 'push', // Not required but passed for simplicity
394+
softRebuild: false, // Not required but passed for simplicity
386395
}
387396
);
388397
});
@@ -402,6 +411,8 @@ describe('Group Tests', () => {
402411
},
403412
],
404413
},
414+
method: 'unshift', // Not required but passed for simplicity
415+
softRebuild: true, // Not required but passed for simplicity
405416
}
406417
);
407418
});
@@ -438,6 +449,8 @@ describe('Group Tests', () => {
438449
},
439450
],
440451
},
452+
method: 'push', // Not required but passed for simplicity
453+
softRebuild: true, // Not required but passed for simplicity
441454
}
442455
);
443456
});
@@ -458,6 +471,8 @@ describe('Group Tests', () => {
458471
},
459472
],
460473
},
474+
method: 'push', // Not required but passed for simplicity
475+
softRebuild: true, // Not required but passed for simplicity
461476
}
462477
);
463478
});
@@ -487,6 +502,8 @@ describe('Group Tests', () => {
487502
},
488503
],
489504
},
505+
method: 'push', // Not required but passed for simplicity
506+
softRebuild: true, // Not required but passed for simplicity
490507
}
491508
);
492509
}

0 commit comments

Comments
 (0)