@tanstack/angular-query-experimental 5.25.0 → 5.26.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.
Files changed (27) hide show
  1. package/build/esm2022/create-base-query.mjs +11 -7
  2. package/build/esm2022/inject-is-fetching.mjs +6 -3
  3. package/build/esm2022/inject-is-mutating.mjs +6 -3
  4. package/build/esm2022/inject-mutation-state.mjs +24 -18
  5. package/build/esm2022/inject-mutation.mjs +26 -17
  6. package/build/esm2022/util/lazy-init/lazy-init.mjs +31 -0
  7. package/build/esm2022/util/lazy-signal-initializer/lazy-signal-initializer.mjs +14 -0
  8. package/build/fesm2022/tanstack-angular-query-experimental.mjs +75 -39
  9. package/build/fesm2022/tanstack-angular-query-experimental.mjs.map +1 -1
  10. package/build/inject-mutation.d.ts +1 -1
  11. package/build/util/lazy-signal-initializer/lazy-signal-initializer.d.ts +4 -0
  12. package/package.json +1 -1
  13. package/src/__tests__/inject-mutation-state.test.ts +71 -2
  14. package/src/__tests__/inject-mutation.test.ts +102 -3
  15. package/src/__tests__/inject-query.test.ts +31 -2
  16. package/src/__tests__/test-utils.ts +48 -1
  17. package/src/__tests__/util/lazy-init/lazy-init.test.ts +126 -0
  18. package/src/__tests__/util/lazy-signal-initializer/lazy-signal-initializer.test.ts +130 -0
  19. package/src/create-base-query.ts +25 -17
  20. package/src/inject-is-fetching.ts +5 -2
  21. package/src/inject-is-mutating.ts +5 -2
  22. package/src/inject-mutation-state.ts +41 -25
  23. package/src/inject-mutation.ts +63 -32
  24. package/src/{lazy-init.ts → util/lazy-init/lazy-init.ts} +3 -1
  25. package/src/util/lazy-signal-initializer/lazy-signal-initializer.ts +28 -0
  26. package/build/esm2022/lazy-init.mjs +0 -30
  27. /package/build/{lazy-init.d.ts → util/lazy-init/lazy-init.d.ts} +0 -0
@@ -0,0 +1,126 @@
1
+ import { describe, expect, test } from 'vitest'
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ type WritableSignal,
6
+ computed,
7
+ effect,
8
+ input,
9
+ signal,
10
+ } from '@angular/core'
11
+ import { TestBed } from '@angular/core/testing'
12
+ import { flushQueue, setFixtureSignalInputs } from '../../test-utils'
13
+ import { lazyInit } from '../../../util/lazy-init/lazy-init'
14
+
15
+ describe('lazyInit', () => {
16
+ test('should init lazily in next tick when not accessing manually', async () => {
17
+ const mockFn = vi.fn()
18
+
19
+ TestBed.runInInjectionContext(() => {
20
+ lazyInit(() => {
21
+ mockFn()
22
+ return {
23
+ data: signal(true),
24
+ }
25
+ })
26
+ })
27
+
28
+ expect(mockFn).not.toHaveBeenCalled()
29
+
30
+ await new Promise(setImmediate)
31
+
32
+ expect(mockFn).toHaveBeenCalled()
33
+ })
34
+
35
+ test('should init eagerly accessing manually', async () => {
36
+ const mockFn = vi.fn()
37
+
38
+ TestBed.runInInjectionContext(() => {
39
+ const lazySignal = lazyInit(() => {
40
+ mockFn()
41
+ return {
42
+ data: signal(true),
43
+ }
44
+ })
45
+
46
+ lazySignal.data()
47
+
48
+ console.log(lazySignal)
49
+ })
50
+
51
+ expect(mockFn).toHaveBeenCalled()
52
+ })
53
+
54
+ test('should init lazily and only once', async () => {
55
+ const initCallFn = vi.fn()
56
+ const registerDataValue = vi.fn<[number]>()
57
+
58
+ let value!: { data: WritableSignal<number> }
59
+ const outerSignal = signal(0)
60
+
61
+ TestBed.runInInjectionContext(() => {
62
+ value = lazyInit(() => {
63
+ initCallFn()
64
+
65
+ void outerSignal()
66
+
67
+ return { data: signal(0) }
68
+ })
69
+
70
+ effect(() => registerDataValue(value.data()))
71
+ })
72
+
73
+ value.data()
74
+
75
+ await flushQueue()
76
+
77
+ expect(outerSignal).toBeDefined()
78
+
79
+ expect(initCallFn).toHaveBeenCalledTimes(1)
80
+
81
+ outerSignal.set(1)
82
+ await flushQueue()
83
+ outerSignal.set(2)
84
+ await flushQueue()
85
+ value.data.set(4)
86
+ await flushQueue()
87
+
88
+ expect(initCallFn).toHaveBeenCalledTimes(1)
89
+ expect(registerDataValue).toHaveBeenCalledTimes(2)
90
+ })
91
+
92
+ test('should support required signal input', async () => {
93
+ @Component({
94
+ standalone: true,
95
+ template: `{{ call }} - {{ lazySignal.data() }}`,
96
+ changeDetection: ChangeDetectionStrategy.OnPush,
97
+ })
98
+ class Test {
99
+ readonly title = input.required<string>()
100
+ call = 0
101
+
102
+ lazySignal = lazyInit(() => {
103
+ this.call++
104
+ return {
105
+ data: computed(() => this.title()),
106
+ }
107
+ })
108
+ }
109
+
110
+ const fixture = TestBed.createComponent(Test)
111
+
112
+ setFixtureSignalInputs(fixture, { title: 'newValue' })
113
+ expect(fixture.debugElement.nativeElement.textContent).toBe('0 - newValue')
114
+ await flushQueue()
115
+
116
+ setFixtureSignalInputs(fixture, { title: 'updatedValue' })
117
+ expect(fixture.debugElement.nativeElement.textContent).toBe(
118
+ '1 - updatedValue',
119
+ )
120
+
121
+ setFixtureSignalInputs(fixture, { title: 'newUpdatedValue' })
122
+ expect(fixture.debugElement.nativeElement.textContent).toBe(
123
+ '1 - newUpdatedValue',
124
+ )
125
+ })
126
+ })
@@ -0,0 +1,130 @@
1
+ import { describe, expect, test } from 'vitest'
2
+ import {
3
+ Component,
4
+ type Signal,
5
+ type WritableSignal,
6
+ effect,
7
+ input,
8
+ signal,
9
+ } from '@angular/core'
10
+ import { TestBed } from '@angular/core/testing'
11
+ import { lazySignalInitializer } from '../../../util/lazy-signal-initializer/lazy-signal-initializer'
12
+ import { flushQueue, setFixtureSignalInputs } from '../../test-utils'
13
+
14
+ describe('lazySignalInitializer', () => {
15
+ test('should init lazily in next tick when not accessing manually', async () => {
16
+ const mockFn = vi.fn()
17
+
18
+ TestBed.runInInjectionContext(() => {
19
+ lazySignalInitializer(() => {
20
+ mockFn()
21
+ return signal(true)
22
+ })
23
+ })
24
+
25
+ expect(mockFn).not.toHaveBeenCalled()
26
+
27
+ await new Promise(setImmediate)
28
+
29
+ expect(mockFn).toHaveBeenCalled()
30
+ })
31
+
32
+ test('should init eagerly accessing manually', async () => {
33
+ const mockFn = vi.fn()
34
+
35
+ TestBed.runInInjectionContext(() => {
36
+ const lazySignal = lazySignalInitializer(() => {
37
+ mockFn()
38
+ return signal(true)
39
+ })
40
+
41
+ lazySignal()
42
+ })
43
+
44
+ expect(mockFn).toHaveBeenCalled()
45
+ })
46
+
47
+ test('should init lazily and only once', async () => {
48
+ const initCallFn = vi.fn()
49
+ const registerEffectValue = vi.fn<[number]>()
50
+
51
+ let value!: Signal<number>
52
+ const outerSignal = signal(0)
53
+ let innerSignal!: WritableSignal<number>
54
+
55
+ TestBed.runInInjectionContext(() => {
56
+ value = lazySignalInitializer(() => {
57
+ initCallFn()
58
+ innerSignal = signal(0)
59
+
60
+ void outerSignal()
61
+
62
+ return innerSignal
63
+ })
64
+
65
+ effect(() => registerEffectValue(value()))
66
+ })
67
+
68
+ value()
69
+
70
+ await flushQueue()
71
+
72
+ expect(outerSignal).toBeDefined()
73
+ expect(innerSignal).toBeDefined()
74
+
75
+ expect(initCallFn).toHaveBeenCalledTimes(1)
76
+
77
+ innerSignal.set(1)
78
+ await flushQueue()
79
+ outerSignal.set(2)
80
+ await flushQueue()
81
+
82
+ expect(initCallFn).toHaveBeenCalledTimes(1)
83
+ expect(registerEffectValue).toHaveBeenCalledTimes(2)
84
+ })
85
+
86
+ test('should init lazily', async () => {
87
+ @Component({
88
+ standalone: true,
89
+ template: `{{ subscribed }}`,
90
+ })
91
+ class Test {
92
+ subscribed = false
93
+
94
+ lazySignal = lazySignalInitializer(() => {
95
+ this.subscribed = true
96
+ return signal('value')
97
+ })
98
+ }
99
+
100
+ const fixture = TestBed.createComponent(Test)
101
+ const { debugElement } = fixture
102
+ fixture.detectChanges()
103
+
104
+ expect(debugElement.nativeElement.textContent).toBe('false')
105
+
106
+ await new Promise(setImmediate)
107
+
108
+ fixture.detectChanges()
109
+
110
+ expect(debugElement.nativeElement.textContent).toBe('true')
111
+ })
112
+
113
+ test('should support required signal input', () => {
114
+ @Component({
115
+ standalone: true,
116
+ template: `{{ subscribed }}`,
117
+ })
118
+ class Test {
119
+ readonly title = input.required<string>()
120
+ subscribed = false
121
+
122
+ lazySignal = lazySignalInitializer(() => {
123
+ return signal(this.title())
124
+ })
125
+ }
126
+
127
+ const fixture = TestBed.createComponent(Test)
128
+ setFixtureSignalInputs(fixture, { title: 'newValue' })
129
+ })
130
+ })
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DestroyRef,
3
3
  Injector,
4
+ NgZone,
4
5
  computed,
5
6
  effect,
6
7
  inject,
@@ -10,8 +11,13 @@ import {
10
11
  } from '@angular/core'
11
12
  import { notifyManager } from '@tanstack/query-core'
12
13
  import { signalProxy } from './signal-proxy'
13
- import { lazyInit } from './lazy-init'
14
- import type { QueryClient, QueryKey, QueryObserver } from '@tanstack/query-core'
14
+ import { lazyInit } from './util/lazy-init/lazy-init'
15
+ import type {
16
+ QueryClient,
17
+ QueryKey,
18
+ QueryObserver,
19
+ QueryObserverResult,
20
+ } from '@tanstack/query-core'
15
21
  import type { CreateBaseQueryOptions, CreateBaseQueryResult } from './types'
16
22
 
17
23
  /**
@@ -37,6 +43,7 @@ export function createBaseQuery<
37
43
  queryClient: QueryClient,
38
44
  ): CreateBaseQueryResult<TData, TError> {
39
45
  const injector = inject(Injector)
46
+ const ngZone = inject(NgZone)
40
47
 
41
48
  return lazyInit(() => {
42
49
  return runInInjectionContext(injector, () => {
@@ -67,24 +74,25 @@ export function createBaseQuery<
67
74
  observer.getOptimisticResult(defaultedOptionsSignal()),
68
75
  )
69
76
 
70
- // Effects should not be called inside reactive contexts
71
- untracked(() =>
72
- effect(() => {
73
- const defaultedOptions = defaultedOptionsSignal()
74
- observer.setOptions(defaultedOptions, {
75
- // Do not notify on updates because of changes in the options because
76
- // these changes should already be reflected in the optimistic result.
77
- listeners: false,
78
- })
79
- untracked(() => {
80
- resultSignal.set(observer.getOptimisticResult(defaultedOptions))
81
- })
82
- }),
83
- )
77
+ effect(() => {
78
+ const defaultedOptions = defaultedOptionsSignal()
79
+ observer.setOptions(defaultedOptions, {
80
+ // Do not notify on updates because of changes in the options because
81
+ // these changes should already be reflected in the optimistic result.
82
+ listeners: false,
83
+ })
84
+ untracked(() => {
85
+ resultSignal.set(observer.getOptimisticResult(defaultedOptions))
86
+ })
87
+ })
84
88
 
85
89
  // observer.trackResult is not used as this optimization is not needed for Angular
86
90
  const unsubscribe = observer.subscribe(
87
- notifyManager.batchCalls((val) => resultSignal.set(val)),
91
+ notifyManager.batchCalls((val: QueryObserverResult<TData, TError>) => {
92
+ ngZone.run(() => {
93
+ resultSignal.set(val)
94
+ })
95
+ }),
88
96
  )
89
97
  destroyRef.onDestroy(unsubscribe)
90
98
 
@@ -1,4 +1,4 @@
1
- import { DestroyRef, inject, signal } from '@angular/core'
1
+ import { DestroyRef, NgZone, inject, signal } from '@angular/core'
2
2
  import { type QueryFilters, notifyManager } from '@tanstack/query-core'
3
3
  import { assertInjector } from './util/assert-injector/assert-injector'
4
4
  import { injectQueryClient } from './inject-query-client'
@@ -11,6 +11,7 @@ export function injectIsFetching(
11
11
  return assertInjector(injectIsFetching, injector, () => {
12
12
  const queryClient = injectQueryClient()
13
13
  const destroyRef = inject(DestroyRef)
14
+ const ngZone = inject(NgZone)
14
15
 
15
16
  const cache = queryClient.getQueryCache()
16
17
  // isFetching is the prev value initialized on mount *
@@ -24,7 +25,9 @@ export function injectIsFetching(
24
25
  if (isFetching !== newIsFetching) {
25
26
  // * and update with each change
26
27
  isFetching = newIsFetching
27
- result.set(isFetching)
28
+ ngZone.run(() => {
29
+ result.set(isFetching)
30
+ })
28
31
  }
29
32
  }),
30
33
  )
@@ -1,4 +1,4 @@
1
- import { DestroyRef, inject, signal } from '@angular/core'
1
+ import { DestroyRef, NgZone, inject, signal } from '@angular/core'
2
2
  import { type MutationFilters, notifyManager } from '@tanstack/query-core'
3
3
  import { assertInjector } from './util/assert-injector/assert-injector'
4
4
  import { injectQueryClient } from './inject-query-client'
@@ -11,6 +11,7 @@ export function injectIsMutating(
11
11
  return assertInjector(injectIsMutating, injector, () => {
12
12
  const queryClient = injectQueryClient()
13
13
  const destroyRef = inject(DestroyRef)
14
+ const ngZone = inject(NgZone)
14
15
 
15
16
  const cache = queryClient.getMutationCache()
16
17
  // isMutating is the prev value initialized on mount *
@@ -24,7 +25,9 @@ export function injectIsMutating(
24
25
  if (isMutating !== newIsMutating) {
25
26
  // * and update with each change
26
27
  isMutating = newIsMutating
27
- result.set(isMutating)
28
+ ngZone.run(() => {
29
+ result.set(isMutating)
30
+ })
28
31
  }
29
32
  }),
30
33
  )
@@ -1,4 +1,11 @@
1
- import { DestroyRef, effect, inject, signal, untracked } from '@angular/core'
1
+ import {
2
+ DestroyRef,
3
+ NgZone,
4
+ effect,
5
+ inject,
6
+ signal,
7
+ untracked,
8
+ } from '@angular/core'
2
9
  import {
3
10
  type DefaultError,
4
11
  type Mutation,
@@ -10,6 +17,7 @@ import {
10
17
  } from '@tanstack/query-core'
11
18
  import { assertInjector } from './util/assert-injector/assert-injector'
12
19
  import { injectQueryClient } from './inject-query-client'
20
+ import { lazySignalInitializer } from './util/lazy-signal-initializer/lazy-signal-initializer'
13
21
  import type { Injector, Signal } from '@angular/core'
14
22
 
15
23
  type MutationStateOptions<TResult = MutationState> = {
@@ -46,36 +54,44 @@ export function injectMutationState<TResult = MutationState>(
46
54
  return assertInjector(injectMutationState, options?.injector, () => {
47
55
  const destroyRef = inject(DestroyRef)
48
56
  const queryClient = injectQueryClient()
57
+ const ngZone = inject(NgZone)
49
58
 
50
59
  const mutationCache = queryClient.getMutationCache()
51
60
 
52
- const result = signal<Array<TResult>>(
53
- getResult(mutationCache, mutationStateOptionsFn()),
54
- )
61
+ return lazySignalInitializer((injector) => {
62
+ const result = signal<Array<TResult>>(
63
+ getResult(mutationCache, mutationStateOptionsFn()),
64
+ )
55
65
 
56
- effect(() => {
57
- const mutationStateOptions = mutationStateOptionsFn()
58
- untracked(() => {
59
- // Setting the signal from an effect because it's both 'computed' from options()
60
- // and needs to be set imperatively in the mutationCache listener.
61
- result.set(getResult(mutationCache, mutationStateOptions))
62
- })
63
- })
66
+ effect(
67
+ () => {
68
+ const mutationStateOptions = mutationStateOptionsFn()
69
+ untracked(() => {
70
+ // Setting the signal from an effect because it's both 'computed' from options()
71
+ // and needs to be set imperatively in the mutationCache listener.
72
+ result.set(getResult(mutationCache, mutationStateOptions))
73
+ })
74
+ },
75
+ { injector },
76
+ )
64
77
 
65
- const unsubscribe = mutationCache.subscribe(
66
- notifyManager.batchCalls(() => {
67
- const nextResult = replaceEqualDeep(
68
- result(),
69
- getResult(mutationCache, mutationStateOptionsFn()),
70
- )
71
- if (result() !== nextResult) {
72
- result.set(nextResult)
73
- }
74
- }),
75
- )
78
+ const unsubscribe = mutationCache.subscribe(
79
+ notifyManager.batchCalls(() => {
80
+ const nextResult = replaceEqualDeep(
81
+ result(),
82
+ getResult(mutationCache, mutationStateOptionsFn()),
83
+ )
84
+ if (result() !== nextResult) {
85
+ ngZone.run(() => {
86
+ result.set(nextResult)
87
+ })
88
+ }
89
+ }),
90
+ )
76
91
 
77
- destroyRef.onDestroy(unsubscribe)
92
+ destroyRef.onDestroy(unsubscribe)
78
93
 
79
- return result
94
+ return result
95
+ })
80
96
  })
81
97
  }
@@ -1,12 +1,25 @@
1
- import { DestroyRef, computed, effect, inject, signal } from '@angular/core'
1
+ import {
2
+ DestroyRef,
3
+ Injector,
4
+ NgZone,
5
+ computed,
6
+ effect,
7
+ inject,
8
+ runInInjectionContext,
9
+ signal,
10
+ } from '@angular/core'
2
11
  import { MutationObserver, notifyManager } from '@tanstack/query-core'
3
12
  import { assertInjector } from './util/assert-injector/assert-injector'
4
13
  import { signalProxy } from './signal-proxy'
5
14
  import { injectQueryClient } from './inject-query-client'
6
15
  import { noop } from './util'
7
- import type { DefaultError, QueryClient } from '@tanstack/query-core'
8
- import type { Injector } from '@angular/core'
9
16
 
17
+ import { lazyInit } from './util/lazy-init/lazy-init'
18
+ import type {
19
+ DefaultError,
20
+ MutationObserverResult,
21
+ QueryClient,
22
+ } from '@tanstack/query-core'
10
23
  import type {
11
24
  CreateMutateFunction,
12
25
  CreateMutationOptions,
@@ -26,42 +39,60 @@ export function injectMutation<
26
39
  ): CreateMutationResult<TData, TError, TVariables, TContext> {
27
40
  return assertInjector(injectMutation, injector, () => {
28
41
  const queryClient = injectQueryClient()
42
+ const currentInjector = inject(Injector)
29
43
  const destroyRef = inject(DestroyRef)
44
+ const ngZone = inject(NgZone)
30
45
 
31
- const observer = new MutationObserver<TData, TError, TVariables, TContext>(
32
- queryClient,
33
- options(queryClient),
34
- )
35
- const mutate: CreateMutateFunction<TData, TError, TVariables, TContext> = (
36
- variables,
37
- mutateOptions,
38
- ) => {
39
- observer.mutate(variables, mutateOptions).catch(noop)
40
- }
46
+ return lazyInit(() =>
47
+ runInInjectionContext(currentInjector, () => {
48
+ const observer = new MutationObserver<
49
+ TData,
50
+ TError,
51
+ TVariables,
52
+ TContext
53
+ >(queryClient, options(queryClient))
54
+ const mutate: CreateMutateFunction<
55
+ TData,
56
+ TError,
57
+ TVariables,
58
+ TContext
59
+ > = (variables, mutateOptions) => {
60
+ observer.mutate(variables, mutateOptions).catch(noop)
61
+ }
41
62
 
42
- effect(() => {
43
- observer.setOptions(options(queryClient))
44
- })
63
+ effect(() => {
64
+ observer.setOptions(options(queryClient))
65
+ })
45
66
 
46
- const result = signal(observer.getCurrentResult())
67
+ const result = signal(observer.getCurrentResult())
47
68
 
48
- const unsubscribe = observer.subscribe(
49
- notifyManager.batchCalls((val) => result.set(val)),
50
- )
69
+ const unsubscribe = observer.subscribe(
70
+ notifyManager.batchCalls(
71
+ (
72
+ val: MutationObserverResult<TData, TError, TVariables, TContext>,
73
+ ) => {
74
+ ngZone.run(() => {
75
+ result.set(val)
76
+ })
77
+ },
78
+ ),
79
+ )
51
80
 
52
- destroyRef.onDestroy(unsubscribe)
81
+ destroyRef.onDestroy(unsubscribe)
53
82
 
54
- const resultSignal = computed(() => ({
55
- ...result(),
56
- mutate,
57
- mutateAsync: result().mutate,
58
- }))
83
+ const resultSignal = computed(() => ({
84
+ ...result(),
85
+ mutate,
86
+ mutateAsync: result().mutate,
87
+ }))
59
88
 
60
- return signalProxy(resultSignal) as unknown as CreateMutationResult<
61
- TData,
62
- TError,
63
- TVariables,
64
- TContext
65
- >
89
+ return signalProxy(resultSignal) as unknown as CreateMutationResult<
90
+ TData,
91
+ TError,
92
+ TVariables,
93
+ TContext
94
+ >
95
+ }),
96
+ )
66
97
  })
67
98
  }
@@ -1,9 +1,11 @@
1
+ import { untracked } from '@angular/core'
2
+
1
3
  export function lazyInit<T extends object>(initializer: () => T): T {
2
4
  let object: T | null = null
3
5
 
4
6
  const initializeObject = () => {
5
7
  if (!object) {
6
- object = initializer()
8
+ object = untracked(() => initializer())
7
9
  }
8
10
  }
9
11
 
@@ -0,0 +1,28 @@
1
+ import {
2
+ Injector,
3
+ type Signal,
4
+ computed,
5
+ inject,
6
+ untracked,
7
+ } from '@angular/core'
8
+
9
+ type SignalInitializerFn<T> = (injector: Injector) => Signal<T>
10
+
11
+ export function lazySignalInitializer<T>(
12
+ initializerFn: SignalInitializerFn<T>,
13
+ ) {
14
+ const injector = inject(Injector)
15
+
16
+ let source: Signal<T> | null = null
17
+
18
+ const unwrapSignal = () => {
19
+ if (!source) {
20
+ source = untracked(() => initializerFn(injector))
21
+ }
22
+ return source()
23
+ }
24
+
25
+ queueMicrotask(() => unwrapSignal())
26
+
27
+ return computed(unwrapSignal)
28
+ }
@@ -1,30 +0,0 @@
1
- export function lazyInit(initializer) {
2
- let object = null;
3
- const initializeObject = () => {
4
- if (!object) {
5
- object = initializer();
6
- }
7
- };
8
- queueMicrotask(() => initializeObject());
9
- return new Proxy({}, {
10
- get(_, prop, receiver) {
11
- initializeObject();
12
- return Reflect.get(object, prop, receiver);
13
- },
14
- has(_, prop) {
15
- initializeObject();
16
- return Reflect.has(object, prop);
17
- },
18
- ownKeys() {
19
- initializeObject();
20
- return Reflect.ownKeys(object);
21
- },
22
- getOwnPropertyDescriptor() {
23
- return {
24
- enumerable: true,
25
- configurable: true,
26
- };
27
- },
28
- });
29
- }
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS1pbml0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xhenktaW5pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLFVBQVUsUUFBUSxDQUFtQixXQUFvQjtJQUM3RCxJQUFJLE1BQU0sR0FBYSxJQUFJLENBQUE7SUFFM0IsTUFBTSxnQkFBZ0IsR0FBRyxHQUFHLEVBQUU7UUFDNUIsSUFBSSxDQUFDLE1BQU0sRUFBRTtZQUNYLE1BQU0sR0FBRyxXQUFXLEVBQUUsQ0FBQTtTQUN2QjtJQUNILENBQUMsQ0FBQTtJQUVELGNBQWMsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxnQkFBZ0IsRUFBRSxDQUFDLENBQUE7SUFFeEMsT0FBTyxJQUFJLEtBQUssQ0FBSSxFQUFPLEVBQUU7UUFDM0IsR0FBRyxDQUFDLENBQUMsRUFBRSxJQUFJLEVBQUUsUUFBUTtZQUNuQixnQkFBZ0IsRUFBRSxDQUFBO1lBQ2xCLE9BQU8sT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFXLEVBQUUsSUFBSSxFQUFFLFFBQVEsQ0FBQyxDQUFBO1FBQ2pELENBQUM7UUFDRCxHQUFHLENBQUMsQ0FBQyxFQUFFLElBQUk7WUFDVCxnQkFBZ0IsRUFBRSxDQUFBO1lBQ2xCLE9BQU8sT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFXLEVBQUUsSUFBSSxDQUFDLENBQUE7UUFDdkMsQ0FBQztRQUNELE9BQU87WUFDTCxnQkFBZ0IsRUFBRSxDQUFBO1lBQ2xCLE9BQU8sT0FBTyxDQUFDLE9BQU8sQ0FBQyxNQUFXLENBQUMsQ0FBQTtRQUNyQyxDQUFDO1FBQ0Qsd0JBQXdCO1lBQ3RCLE9BQU87Z0JBQ0wsVUFBVSxFQUFFLElBQUk7Z0JBQ2hCLFlBQVksRUFBRSxJQUFJO2FBQ25CLENBQUE7UUFDSCxDQUFDO0tBQ0YsQ0FBQyxDQUFBO0FBQ0osQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBsYXp5SW5pdDxUIGV4dGVuZHMgb2JqZWN0Pihpbml0aWFsaXplcjogKCkgPT4gVCk6IFQge1xuICBsZXQgb2JqZWN0OiBUIHwgbnVsbCA9IG51bGxcblxuICBjb25zdCBpbml0aWFsaXplT2JqZWN0ID0gKCkgPT4ge1xuICAgIGlmICghb2JqZWN0KSB7XG4gICAgICBvYmplY3QgPSBpbml0aWFsaXplcigpXG4gICAgfVxuICB9XG5cbiAgcXVldWVNaWNyb3Rhc2soKCkgPT4gaW5pdGlhbGl6ZU9iamVjdCgpKVxuXG4gIHJldHVybiBuZXcgUHJveHk8VD4oe30gYXMgVCwge1xuICAgIGdldChfLCBwcm9wLCByZWNlaXZlcikge1xuICAgICAgaW5pdGlhbGl6ZU9iamVjdCgpXG4gICAgICByZXR1cm4gUmVmbGVjdC5nZXQob2JqZWN0IGFzIFQsIHByb3AsIHJlY2VpdmVyKVxuICAgIH0sXG4gICAgaGFzKF8sIHByb3ApIHtcbiAgICAgIGluaXRpYWxpemVPYmplY3QoKVxuICAgICAgcmV0dXJuIFJlZmxlY3QuaGFzKG9iamVjdCBhcyBULCBwcm9wKVxuICAgIH0sXG4gICAgb3duS2V5cygpIHtcbiAgICAgIGluaXRpYWxpemVPYmplY3QoKVxuICAgICAgcmV0dXJuIFJlZmxlY3Qub3duS2V5cyhvYmplY3QgYXMgVClcbiAgICB9LFxuICAgIGdldE93blByb3BlcnR5RGVzY3JpcHRvcigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgIH1cbiAgICB9LFxuICB9KVxufVxuIl19