@looker/api-explorer 0.9.26 → 0.9.29
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.
- package/CHANGELOG.md +80 -1
- package/e2e/e2e.spec.ts +1 -1
- package/lib/ApiExplorer.d.ts +2 -6
- package/lib/ApiExplorer.js +53 -74
- package/lib/ApiExplorer.js.map +1 -1
- package/lib/StandaloneApiExplorer.js +35 -47
- package/lib/StandaloneApiExplorer.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +8 -0
- package/lib/components/Banner/Banner.js +70 -0
- package/lib/components/Banner/Banner.js.map +1 -0
- package/lib/components/Banner/index.d.ts +1 -0
- package/lib/components/Banner/index.js +14 -0
- package/lib/components/Banner/index.js.map +1 -0
- package/lib/components/DocPseudo/DocParam.js +3 -1
- package/lib/components/DocPseudo/DocParam.js.map +1 -1
- package/lib/components/DocSDKs/DocSDKs.js +3 -3
- package/lib/components/DocSDKs/DocSDKs.js.map +1 -1
- package/lib/components/ExploreType/ExploreType.js +3 -5
- package/lib/components/ExploreType/ExploreType.js.map +1 -1
- package/lib/components/Header/Header.d.ts +2 -5
- package/lib/components/Header/Header.js +1 -5
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/SelectorContainer/ApiSpecSelector.d.ts +2 -5
- package/lib/components/SelectorContainer/ApiSpecSelector.js +5 -5
- package/lib/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/components/SelectorContainer/SelectorContainer.d.ts +2 -5
- package/lib/components/SelectorContainer/SelectorContainer.js +3 -7
- package/lib/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/components/SideNav/SideNav.d.ts +2 -5
- package/lib/components/SideNav/SideNav.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +8 -0
- package/lib/components/index.js.map +1 -1
- package/lib/esm/ApiExplorer.js +54 -74
- package/lib/esm/ApiExplorer.js.map +1 -1
- package/lib/esm/StandaloneApiExplorer.js +34 -48
- package/lib/esm/StandaloneApiExplorer.js.map +1 -1
- package/lib/esm/components/Banner/Banner.js +54 -0
- package/lib/esm/components/Banner/Banner.js.map +1 -0
- package/lib/esm/components/Banner/index.js +2 -0
- package/lib/esm/components/Banner/index.js.map +1 -0
- package/lib/esm/components/DocPseudo/DocParam.js +2 -1
- package/lib/esm/components/DocPseudo/DocParam.js.map +1 -1
- package/lib/esm/components/DocSDKs/DocSDKs.js +2 -2
- package/lib/esm/components/DocSDKs/DocSDKs.js.map +1 -1
- package/lib/esm/components/ExploreType/ExploreType.js +3 -4
- package/lib/esm/components/ExploreType/ExploreType.js.map +1 -1
- package/lib/esm/components/Header/Header.js +1 -5
- package/lib/esm/components/Header/Header.js.map +1 -1
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js +4 -5
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/esm/components/SelectorContainer/SelectorContainer.js +3 -7
- package/lib/esm/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/esm/components/SideNav/SideNav.js.map +1 -1
- package/lib/esm/components/index.js +1 -0
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/routes/AppRouter.js +3 -7
- package/lib/esm/routes/AppRouter.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DiffScene.js +43 -99
- package/lib/esm/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js +9 -13
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js +2 -2
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/esm/scenes/MethodScene/MethodScene.js +4 -5
- package/lib/esm/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/esm/state/index.js +1 -0
- package/lib/esm/state/index.js.map +1 -1
- package/lib/esm/state/specs/index.js +3 -0
- package/lib/esm/state/specs/index.js.map +1 -0
- package/lib/esm/state/specs/sagas.js +58 -0
- package/lib/esm/state/specs/sagas.js.map +1 -0
- package/lib/esm/state/specs/selectors.js +8 -0
- package/lib/esm/state/specs/selectors.js.map +1 -0
- package/lib/esm/state/specs/slice.js +55 -0
- package/lib/esm/state/specs/slice.js.map +1 -0
- package/lib/esm/state/store.js +53 -2
- package/lib/esm/state/store.js.map +1 -1
- package/lib/esm/test-utils/redux.js +9 -5
- package/lib/esm/test-utils/redux.js.map +1 -1
- package/lib/esm/utils/adaptorUtils.js +101 -0
- package/lib/esm/utils/adaptorUtils.js.map +1 -0
- package/lib/esm/utils/apixAdaptor.js +48 -0
- package/lib/esm/utils/apixAdaptor.js.map +1 -0
- package/lib/esm/utils/index.js +3 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/path.js +27 -2
- package/lib/esm/utils/path.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -1
- package/lib/routes/AppRouter.d.ts +1 -5
- package/lib/routes/AppRouter.js +3 -7
- package/lib/routes/AppRouter.js.map +1 -1
- package/lib/scenes/DiffScene/DiffScene.js +45 -100
- package/lib/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js +9 -13
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js +2 -2
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/scenes/MethodScene/MethodScene.d.ts +0 -4
- package/lib/scenes/MethodScene/MethodScene.js +5 -5
- package/lib/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.js +13 -0
- package/lib/state/index.js.map +1 -1
- package/lib/state/settings/selectors.d.ts +1 -1
- package/lib/state/settings/slice.d.ts +1 -1
- package/lib/state/specs/index.d.ts +2 -0
- package/lib/state/specs/index.js +32 -0
- package/lib/state/specs/index.js.map +1 -0
- package/lib/state/specs/sagas.d.ts +1 -0
- package/lib/state/specs/sagas.js +67 -0
- package/lib/state/specs/sagas.js.map +1 -0
- package/lib/state/specs/selectors.d.ts +4 -0
- package/lib/state/specs/selectors.js +20 -0
- package/lib/state/specs/selectors.js.map +1 -0
- package/lib/state/specs/slice.d.ts +49 -0
- package/lib/state/specs/slice.js +70 -0
- package/lib/state/specs/slice.js.map +1 -0
- package/lib/state/store.d.ts +3 -0
- package/lib/state/store.js +56 -2
- package/lib/state/store.js.map +1 -1
- package/lib/test-data/declarations.d.ts +2 -0
- package/lib/test-data/examples.d.ts +2 -0
- package/lib/test-data/index.d.ts +3 -0
- package/lib/test-data/index.js +12 -42
- package/lib/test-data/index.js.map +1 -1
- package/lib/test-data/specs.d.ts +10 -0
- package/lib/test-data/specs.js +6 -6
- package/lib/test-data/specs.js.map +1 -1
- package/lib/test-utils/redux.d.ts +2 -1
- package/lib/test-utils/redux.js +9 -4
- package/lib/test-utils/redux.js.map +1 -1
- package/lib/utils/adaptorUtils.d.ts +30 -0
- package/lib/utils/adaptorUtils.js +124 -0
- package/lib/utils/adaptorUtils.js.map +1 -0
- package/lib/utils/apixAdaptor.d.ts +15 -0
- package/lib/utils/apixAdaptor.js +67 -0
- package/lib/utils/apixAdaptor.js.map +1 -0
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +45 -30
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/path.d.ts +3 -0
- package/lib/utils/path.js +32 -2
- package/lib/utils/path.js.map +1 -1
- package/package.json +10 -10
- package/src/ApiExplorer.tsx +47 -74
- package/src/StandaloneApiExplorer.tsx +37 -52
- package/src/components/Banner/Banner.spec.tsx +99 -0
- package/src/components/Banner/Banner.tsx +87 -0
- package/src/{reducers → components/Banner}/index.ts +1 -1
- package/src/components/DocPseudo/DocParam.spec.tsx +2 -1
- package/src/components/DocPseudo/DocParam.tsx +2 -1
- package/src/components/DocSDKs/DocSDKs.tsx +4 -5
- package/src/components/ExploreType/ExploreType.spec.tsx +0 -23
- package/src/components/ExploreType/ExploreType.tsx +5 -6
- package/src/components/ExploreType/exploreUtils.spec.tsx +1 -1
- package/src/components/Header/Header.spec.tsx +9 -30
- package/src/components/Header/Header.tsx +3 -10
- package/src/components/SelectorContainer/ApiSpecSelector.spec.tsx +31 -44
- package/src/components/SelectorContainer/ApiSpecSelector.tsx +6 -12
- package/src/components/SelectorContainer/SelectorContainer.spec.tsx +7 -26
- package/src/components/SelectorContainer/SelectorContainer.tsx +4 -10
- package/src/components/SideNav/SideNav.spec.tsx +12 -45
- package/src/components/SideNav/SideNav.tsx +1 -7
- package/src/components/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/routes/AppRouter.tsx +25 -37
- package/src/scenes/DiffScene/DiffScene.tsx +47 -84
- package/src/scenes/DiffScene/DocDiff/DiffItem.spec.tsx +9 -16
- package/src/scenes/DiffScene/DocDiff/DiffItem.tsx +11 -12
- package/src/scenes/DiffScene/DocDiff/DocDiff.tsx +2 -2
- package/src/scenes/MethodScene/MethodScene.tsx +4 -10
- package/src/state/index.ts +1 -0
- package/src/{reducers/spec → state/specs}/index.ts +2 -3
- package/src/state/specs/sagas.spec.ts +135 -0
- package/src/state/specs/sagas.ts +81 -0
- package/src/{reducers/spec/actions.spec.ts → state/specs/selectors.ts} +12 -11
- package/src/state/specs/slice.ts +109 -0
- package/src/state/store.ts +58 -0
- package/src/test-data/index.ts +1 -8
- package/src/test-data/specs.ts +6 -6
- package/src/test-utils/redux.tsx +15 -4
- package/src/utils/adaptorUtils.ts +181 -0
- package/src/utils/apixAdaptor.ts +72 -0
- package/src/utils/index.ts +3 -7
- package/src/utils/path.ts +25 -2
- package/lib/esm/reducers/index.js +0 -2
- package/lib/esm/reducers/index.js.map +0 -1
- package/lib/esm/reducers/spec/actions.js +0 -19
- package/lib/esm/reducers/spec/actions.js.map +0 -1
- package/lib/esm/reducers/spec/index.js +0 -4
- package/lib/esm/reducers/spec/index.js.map +0 -1
- package/lib/esm/reducers/spec/reducer.js +0 -62
- package/lib/esm/reducers/spec/reducer.js.map +0 -1
- package/lib/esm/reducers/spec/utils.js +0 -74
- package/lib/esm/reducers/spec/utils.js.map +0 -1
- package/lib/reducers/index.d.ts +0 -1
- package/lib/reducers/index.js +0 -19
- package/lib/reducers/index.js.map +0 -1
- package/lib/reducers/spec/actions.d.ts +0 -20
- package/lib/reducers/spec/actions.js +0 -31
- package/lib/reducers/spec/actions.js.map +0 -1
- package/lib/reducers/spec/index.d.ts +0 -3
- package/lib/reducers/spec/index.js +0 -45
- package/lib/reducers/spec/index.js.map +0 -1
- package/lib/reducers/spec/reducer.d.ts +0 -7
- package/lib/reducers/spec/reducer.js +0 -73
- package/lib/reducers/spec/reducer.js.map +0 -1
- package/lib/reducers/spec/utils.d.ts +0 -7
- package/lib/reducers/spec/utils.js +0 -91
- package/lib/reducers/spec/utils.js.map +0 -1
- package/src/reducers/spec/actions.ts +0 -62
- package/src/reducers/spec/reducer.spec.ts +0 -44
- package/src/reducers/spec/reducer.ts +0 -69
- package/src/reducers/spec/utils.spec.ts +0 -138
- package/src/reducers/spec/utils.ts +0 -123
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2021 Looker Data Sciences, Inc.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
import type { PayloadAction } from '@reduxjs/toolkit'
|
|
27
|
+
import { createSlice } from '@reduxjs/toolkit'
|
|
28
|
+
import type { ApiModel, SpecList } from '@looker/sdk-codegen'
|
|
29
|
+
import { createSliceHooks } from '@looker/redux'
|
|
30
|
+
|
|
31
|
+
import { saga } from './sagas'
|
|
32
|
+
|
|
33
|
+
export interface SpecState {
|
|
34
|
+
specs: SpecList
|
|
35
|
+
currentSpecKey: string
|
|
36
|
+
error?: Error
|
|
37
|
+
working: boolean
|
|
38
|
+
description?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const defaultSpecsState: SpecState = {
|
|
42
|
+
specs: {},
|
|
43
|
+
currentSpecKey: '',
|
|
44
|
+
working: true,
|
|
45
|
+
description: undefined,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface InitSpecsAction {
|
|
49
|
+
specKey: string | null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface InitSpecsSuccessPayload {
|
|
53
|
+
specs: SpecList
|
|
54
|
+
currentSpecKey: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface SetCurrentSpecAction {
|
|
58
|
+
currentSpecKey: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface SetCurrentSpecSuccessAction {
|
|
62
|
+
api: ApiModel
|
|
63
|
+
currentSpecKey: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const specsSlice = createSlice({
|
|
67
|
+
name: 'specs',
|
|
68
|
+
initialState: defaultSpecsState,
|
|
69
|
+
reducers: {
|
|
70
|
+
initSpecsAction(state, _action: PayloadAction<InitSpecsAction>) {
|
|
71
|
+
state.working = true
|
|
72
|
+
state.description = 'Fetching specifications...'
|
|
73
|
+
},
|
|
74
|
+
initSpecsSuccessAction(
|
|
75
|
+
state,
|
|
76
|
+
action: PayloadAction<InitSpecsSuccessPayload>
|
|
77
|
+
) {
|
|
78
|
+
state.specs = action.payload.specs
|
|
79
|
+
state.currentSpecKey = action.payload.currentSpecKey
|
|
80
|
+
state.working = false
|
|
81
|
+
state.description = undefined
|
|
82
|
+
},
|
|
83
|
+
initSpecsFailureAction(state, action: PayloadAction<Error>) {
|
|
84
|
+
state.working = false
|
|
85
|
+
state.error = action.payload
|
|
86
|
+
},
|
|
87
|
+
setCurrentSpecAction(state, action: PayloadAction<SetCurrentSpecAction>) {
|
|
88
|
+
state.working = true
|
|
89
|
+
state.description = `Fetching API ${action.payload.currentSpecKey} spec`
|
|
90
|
+
},
|
|
91
|
+
setCurrentSpecSuccessAction(
|
|
92
|
+
state,
|
|
93
|
+
action: PayloadAction<SetCurrentSpecSuccessAction>
|
|
94
|
+
) {
|
|
95
|
+
state.currentSpecKey = action.payload.currentSpecKey
|
|
96
|
+
state.specs[state.currentSpecKey].api = action.payload.api
|
|
97
|
+
state.description = undefined
|
|
98
|
+
state.working = false
|
|
99
|
+
},
|
|
100
|
+
setCurrentSpecFailureAction(state, action: PayloadAction<Error>) {
|
|
101
|
+
state.working = false
|
|
102
|
+
state.error = action.payload
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
export const specActions = specsSlice.actions
|
|
108
|
+
export const { useActions: useSpecActions, useStoreState: useSpecStoreState } =
|
|
109
|
+
createSliceHooks(specsSlice, saga)
|
package/src/state/store.ts
CHANGED
|
@@ -24,24 +24,82 @@
|
|
|
24
24
|
|
|
25
25
|
*/
|
|
26
26
|
import { createStore } from '@looker/redux'
|
|
27
|
+
import type { PayloadAction } from '@reduxjs/toolkit'
|
|
28
|
+
import type { Action } from 'redux'
|
|
29
|
+
import map from 'lodash/map'
|
|
30
|
+
import type { SpecList } from '@looker/sdk-codegen'
|
|
27
31
|
|
|
28
32
|
import type { SettingState } from './settings'
|
|
29
33
|
import { defaultSettingsState, settingsSlice } from './settings'
|
|
30
34
|
import type { LodesState } from './lodes'
|
|
31
35
|
import { lodesSlice, defaultLodesState } from './lodes'
|
|
36
|
+
import type { SpecState, InitSpecsSuccessPayload } from './specs'
|
|
37
|
+
import { defaultSpecsState, specsSlice } from './specs'
|
|
38
|
+
|
|
39
|
+
const isInitSuccessAction = (
|
|
40
|
+
action: any
|
|
41
|
+
): action is PayloadAction<InitSpecsSuccessPayload> => !!action.payload?.specs
|
|
42
|
+
|
|
43
|
+
const actionSanitizer = <A extends Partial<Action>>(
|
|
44
|
+
action: A,
|
|
45
|
+
_id: number
|
|
46
|
+
): A => {
|
|
47
|
+
if (isInitSuccessAction(action)) {
|
|
48
|
+
action = {
|
|
49
|
+
...action,
|
|
50
|
+
payload: {
|
|
51
|
+
...action.payload,
|
|
52
|
+
specs: sanitizeSpecs(action.payload.specs),
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return action
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const stateSanitizer = <S extends Partial<RootState>>(
|
|
60
|
+
state: S,
|
|
61
|
+
_index: number
|
|
62
|
+
): S => {
|
|
63
|
+
if (state.specs) {
|
|
64
|
+
return {
|
|
65
|
+
...state,
|
|
66
|
+
specs: {
|
|
67
|
+
...state.specs,
|
|
68
|
+
specs: sanitizeSpecs(state.specs.specs),
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return state
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const sanitizeSpecs = (specList: SpecList) =>
|
|
76
|
+
map(specList, (spec) => ({
|
|
77
|
+
...spec,
|
|
78
|
+
api: spec.api ? '<api>' : undefined,
|
|
79
|
+
specContent: spec.specContent ? '<specContent>' : undefined,
|
|
80
|
+
})) as unknown as SpecList
|
|
81
|
+
|
|
82
|
+
const devTools =
|
|
83
|
+
process.env.NODE_ENV !== 'production'
|
|
84
|
+
? { actionSanitizer, stateSanitizer }
|
|
85
|
+
: false
|
|
32
86
|
|
|
33
87
|
export const store = createStore({
|
|
88
|
+
devTools,
|
|
34
89
|
preloadedState: {
|
|
35
90
|
settings: defaultSettingsState,
|
|
36
91
|
lodes: defaultLodesState,
|
|
92
|
+
specs: defaultSpecsState,
|
|
37
93
|
},
|
|
38
94
|
reducer: {
|
|
39
95
|
settings: settingsSlice.reducer,
|
|
40
96
|
lodes: lodesSlice.reducer,
|
|
97
|
+
specs: specsSlice.reducer,
|
|
41
98
|
},
|
|
42
99
|
})
|
|
43
100
|
|
|
44
101
|
export interface RootState {
|
|
45
102
|
settings: SettingState
|
|
46
103
|
lodes: LodesState
|
|
104
|
+
specs: SpecState
|
|
47
105
|
}
|
package/src/test-data/index.ts
CHANGED
package/src/test-data/specs.ts
CHANGED
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import type { SpecList } from '@looker/sdk-codegen'
|
|
27
27
|
import { ApiModel } from '@looker/sdk-codegen'
|
|
28
|
-
|
|
29
|
-
import {
|
|
28
|
+
import type { SpecState } from '../state'
|
|
29
|
+
import { defaultSpecsState } from '../state'
|
|
30
30
|
|
|
31
31
|
export const specs: SpecList = {
|
|
32
32
|
'3.1': {
|
|
@@ -47,8 +47,6 @@ export const specs: SpecList = {
|
|
|
47
47
|
},
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export const specState = initDefaultSpecState(specs, window.location)
|
|
51
|
-
|
|
52
50
|
export const api = ApiModel.fromJson(specs['3.1'].specContent)
|
|
53
51
|
export const api40 = ApiModel.fromJson(specs['4.0'].specContent)
|
|
54
52
|
|
|
@@ -59,5 +57,7 @@ export const getLoadedSpecs = () => {
|
|
|
59
57
|
return loadedSpecs
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
export const
|
|
63
|
-
|
|
60
|
+
export const specState: SpecState = {
|
|
61
|
+
...defaultSpecsState,
|
|
62
|
+
specs: getLoadedSpecs(),
|
|
63
|
+
}
|
package/src/test-utils/redux.tsx
CHANGED
|
@@ -34,19 +34,21 @@ import { createStore } from '@looker/redux'
|
|
|
34
34
|
import { BrowserAdaptor, registerEnvAdaptor } from '@looker/extension-utils'
|
|
35
35
|
import { initRunItSdk } from '@looker/run-it'
|
|
36
36
|
|
|
37
|
-
import type { LodesState, RootState, SettingState } from '../state'
|
|
37
|
+
import type { LodesState, RootState, SettingState, SpecState } from '../state'
|
|
38
38
|
import {
|
|
39
39
|
settingsSlice,
|
|
40
40
|
defaultLodesState,
|
|
41
41
|
defaultSettingsState,
|
|
42
|
-
store as defaultStore,
|
|
43
42
|
lodesSlice,
|
|
43
|
+
defaultSpecsState,
|
|
44
|
+
specsSlice,
|
|
44
45
|
} from '../state'
|
|
46
|
+
import { specState } from '../test-data'
|
|
45
47
|
import { renderWithRouter } from './router'
|
|
46
48
|
|
|
47
49
|
export const withReduxProvider = (
|
|
48
50
|
consumers: ReactElement<any>,
|
|
49
|
-
store: Store<RootState> =
|
|
51
|
+
store: Store<RootState> = createTestStore()
|
|
50
52
|
) => {
|
|
51
53
|
registerEnvAdaptor(new BrowserAdaptor(initRunItSdk()))
|
|
52
54
|
return <Provider store={store}>{consumers}</Provider>
|
|
@@ -69,6 +71,7 @@ export const renderWithRouterAndReduxProvider = (
|
|
|
69
71
|
export const preloadedState: RootState = {
|
|
70
72
|
settings: defaultSettingsState,
|
|
71
73
|
lodes: defaultLodesState,
|
|
74
|
+
specs: defaultSpecsState,
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
type DeepPartial<T> = {
|
|
@@ -86,6 +89,14 @@ export const createTestStore = (overrides?: DeepPartial<RootState>) =>
|
|
|
86
89
|
...defaultLodesState,
|
|
87
90
|
...overrides?.lodes,
|
|
88
91
|
} as LodesState,
|
|
92
|
+
specs: {
|
|
93
|
+
...specState,
|
|
94
|
+
...overrides?.specs,
|
|
95
|
+
} as SpecState,
|
|
96
|
+
},
|
|
97
|
+
reducer: {
|
|
98
|
+
settings: settingsSlice.reducer,
|
|
99
|
+
lodes: lodesSlice.reducer,
|
|
100
|
+
specs: specsSlice.reducer,
|
|
89
101
|
},
|
|
90
|
-
reducer: { settings: settingsSlice.reducer, lodes: lodesSlice.reducer },
|
|
91
102
|
})
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2021 Looker Data Sciences, Inc.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ILookerVersions, SpecItem, SpecList } from '@looker/sdk-codegen'
|
|
28
|
+
import { ApiModel, upgradeSpecObject } from '@looker/sdk-codegen'
|
|
29
|
+
import { api_spec } from '@looker/sdk'
|
|
30
|
+
import { getEnvAdaptor } from '@looker/extension-utils'
|
|
31
|
+
import type { RunItValues } from '@looker/run-it'
|
|
32
|
+
import { getUrl } from '@looker/run-it'
|
|
33
|
+
|
|
34
|
+
export type StorageLocation = 'session' | 'local'
|
|
35
|
+
|
|
36
|
+
/** Object returned from storage service */
|
|
37
|
+
export interface IStorageValue {
|
|
38
|
+
/** Location of the stored object */
|
|
39
|
+
location: StorageLocation
|
|
40
|
+
/** Stored string representation of the value (usually JSON) */
|
|
41
|
+
value: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** function to retrieve a spec based on version and name */
|
|
45
|
+
export type ApiSpecFetcher = (
|
|
46
|
+
version: string,
|
|
47
|
+
name: string
|
|
48
|
+
) => Promise<string | RunItValues>
|
|
49
|
+
|
|
50
|
+
/** Either the spec is parsed or it's undefined */
|
|
51
|
+
export type ParsedSpec = ApiModel | undefined
|
|
52
|
+
|
|
53
|
+
/** service abstraction for extension and browser based usage */
|
|
54
|
+
export interface RunItConfigurator {
|
|
55
|
+
getStorage: (key: string, defaultValue?: string) => IStorageValue
|
|
56
|
+
setStorage(key: string, value: string, location: 'local' | 'session'): string
|
|
57
|
+
removeStorage(key: string): void
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Processed specifications */
|
|
61
|
+
export interface ILoadedSpecs {
|
|
62
|
+
/** API server url */
|
|
63
|
+
baseUrl: string
|
|
64
|
+
/** Web server url */
|
|
65
|
+
webUrl: string
|
|
66
|
+
/** should APIX run headless? */
|
|
67
|
+
headless: boolean
|
|
68
|
+
/** loaded specifications */
|
|
69
|
+
specs: SpecList
|
|
70
|
+
/** communication errors */
|
|
71
|
+
fetchResult: string
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Extends versions payload with headless toggle for API Explorer */
|
|
75
|
+
export interface IAPIXConfig extends ILookerVersions {
|
|
76
|
+
headless?: boolean
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Convert content into an ApiModel
|
|
81
|
+
* @param content to convert
|
|
82
|
+
*/
|
|
83
|
+
const makeApi = (content: string | RunItValues) => {
|
|
84
|
+
let json
|
|
85
|
+
if (typeof content === 'string') {
|
|
86
|
+
json = JSON.parse(content)
|
|
87
|
+
} else {
|
|
88
|
+
json = content
|
|
89
|
+
}
|
|
90
|
+
json = upgradeSpecObject(json)
|
|
91
|
+
return ApiModel.fromJson(json)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Ensure the URI is a full URL
|
|
96
|
+
* @param uri possible relative path
|
|
97
|
+
* @param baseUrl base url for qualifying full path
|
|
98
|
+
*/
|
|
99
|
+
export const fullify = (uri: string, baseUrl: string): string => {
|
|
100
|
+
if (uri.match(/^https?:/)) {
|
|
101
|
+
return uri
|
|
102
|
+
}
|
|
103
|
+
const url = new URL(uri, baseUrl)
|
|
104
|
+
return url.toString()
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* parse spec url into version and name for api_spec cccall
|
|
108
|
+
* @param spec to parse
|
|
109
|
+
*/
|
|
110
|
+
const apiSpecBits = (spec: SpecItem): string[] =>
|
|
111
|
+
spec.specURL?.split('/').slice(-2) || []
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Use the functional api_spec fetch
|
|
115
|
+
* @param version to retrieve
|
|
116
|
+
* @param name to retrieve
|
|
117
|
+
*/
|
|
118
|
+
export const funFetch = (version: string, name: string): Promise<string> => {
|
|
119
|
+
const sdk = getEnvAdaptor().sdk
|
|
120
|
+
return sdk.ok(api_spec(sdk, version, name))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* try to fetch a spec by URL, trap any errors and return undefined
|
|
125
|
+
* @param url to convert to an API spec
|
|
126
|
+
*/
|
|
127
|
+
export const specUrlFetch = async (url: string): Promise<ParsedSpec> => {
|
|
128
|
+
try {
|
|
129
|
+
const content = await getUrl(url)
|
|
130
|
+
return makeApi(content)
|
|
131
|
+
} catch (error) {
|
|
132
|
+
return undefined
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* fetch and compile an API specification to an ApiModel if it's not already available
|
|
138
|
+
*
|
|
139
|
+
* **NOTE**: This uses Looker API 4.0 to fetch the specification so fetch works with CORS
|
|
140
|
+
*
|
|
141
|
+
* @param spec to fetch and compile
|
|
142
|
+
* @param fetcher function to retrieve API spec content
|
|
143
|
+
*/
|
|
144
|
+
export const sdkSpecFetch = async (
|
|
145
|
+
spec: SpecItem,
|
|
146
|
+
fetcher: ApiSpecFetcher
|
|
147
|
+
): Promise<ParsedSpec> => {
|
|
148
|
+
if (spec.api) return spec.api
|
|
149
|
+
if (!spec.specURL) return undefined
|
|
150
|
+
const [version, name] = apiSpecBits(spec)
|
|
151
|
+
const content = await fetcher(version, name)
|
|
152
|
+
return makeApi(content)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Attempt to retrieve spec by URL, then api_spec SDK call
|
|
156
|
+
*
|
|
157
|
+
* @param spec to fetch
|
|
158
|
+
* @param fetcher function to retrieve and parse spec
|
|
159
|
+
*/
|
|
160
|
+
export const fallbackFetch = async (
|
|
161
|
+
spec: SpecItem,
|
|
162
|
+
fetcher: ApiSpecFetcher
|
|
163
|
+
): Promise<ParsedSpec> => {
|
|
164
|
+
if (spec.api) return spec.api
|
|
165
|
+
if (!spec.specURL) return undefined
|
|
166
|
+
let api: ParsedSpec
|
|
167
|
+
try {
|
|
168
|
+
api = await specUrlFetch(spec.specURL)
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.error({ error })
|
|
171
|
+
}
|
|
172
|
+
if (!api) {
|
|
173
|
+
const sdk = getEnvAdaptor().sdk
|
|
174
|
+
const authed = sdk.authSession.isAuthenticated()
|
|
175
|
+
if (!authed) {
|
|
176
|
+
await sdk.authSession.login()
|
|
177
|
+
}
|
|
178
|
+
api = await sdkSpecFetch(spec, fetcher)
|
|
179
|
+
}
|
|
180
|
+
return api
|
|
181
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2021 Looker Data Sciences, Inc.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
import type { IEnvironmentAdaptor } from '@looker/extension-utils'
|
|
27
|
+
import { BrowserAdaptor, getEnvAdaptor } from '@looker/extension-utils'
|
|
28
|
+
import type { IAPIMethods } from '@looker/sdk-rtl'
|
|
29
|
+
import type { SpecItem, SpecList } from '@looker/sdk-codegen'
|
|
30
|
+
import { getSpecsFromVersions } from '@looker/sdk-codegen'
|
|
31
|
+
import { RunItConfigKey, RunItNoConfig } from '@looker/run-it'
|
|
32
|
+
import cloneDeep from 'lodash/cloneDeep'
|
|
33
|
+
|
|
34
|
+
import { fullify, fallbackFetch, funFetch } from './adaptorUtils'
|
|
35
|
+
|
|
36
|
+
export interface IApixAdaptor extends IEnvironmentAdaptor {
|
|
37
|
+
fetchSpecList(versionsUrl?: string): Promise<SpecList>
|
|
38
|
+
fetchSpec(spec: SpecItem): Promise<SpecItem>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const getApixAdaptor = () => getEnvAdaptor() as IApixAdaptor
|
|
42
|
+
|
|
43
|
+
export class ApixAdaptor extends BrowserAdaptor implements IApixAdaptor {
|
|
44
|
+
constructor(sdk: IAPIMethods, private readonly fallbackVersionsUrl: string) {
|
|
45
|
+
super(sdk)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async fetchSpecList(versionsUrl?: string): Promise<SpecList> {
|
|
49
|
+
const data = await this.localStorageGetItem(RunItConfigKey)
|
|
50
|
+
const config = data ? JSON.parse(data) : RunItNoConfig
|
|
51
|
+
let url: string
|
|
52
|
+
|
|
53
|
+
if (versionsUrl) {
|
|
54
|
+
url = versionsUrl
|
|
55
|
+
} else {
|
|
56
|
+
url = config.base_url
|
|
57
|
+
? `${config.base_url}/versions`
|
|
58
|
+
: `${this.fallbackVersionsUrl}/versions.json`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const versions = await this.sdk.authSession.transport.rawRequest('GET', url)
|
|
62
|
+
const specs = await getSpecsFromVersions(JSON.parse(versions.body))
|
|
63
|
+
return specs
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async fetchSpec(spec: SpecItem): Promise<SpecItem> {
|
|
67
|
+
const _spec = cloneDeep(spec)
|
|
68
|
+
_spec.specURL = fullify(spec.specURL!, origin)
|
|
69
|
+
_spec.api = await fallbackFetch(_spec, funFetch)
|
|
70
|
+
return _spec
|
|
71
|
+
}
|
|
72
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -24,12 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
*/
|
|
26
26
|
export { highlightHTML } from './highlight'
|
|
27
|
-
export
|
|
28
|
-
buildPath,
|
|
29
|
-
buildMethodPath,
|
|
30
|
-
buildTypePath,
|
|
31
|
-
diffPath,
|
|
32
|
-
oAuthPath,
|
|
33
|
-
} from './path'
|
|
27
|
+
export * from './path'
|
|
34
28
|
export { getLoded } from './lodeUtils'
|
|
35
29
|
export { useWindowSize } from './useWindowSize'
|
|
30
|
+
export * from './apixAdaptor'
|
|
31
|
+
export * from './adaptorUtils'
|
package/src/utils/path.ts
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import type { ApiModel, IMethod, IType } from '@looker/sdk-codegen'
|
|
28
|
-
import { firstMethodRef
|
|
28
|
+
import { firstMethodRef } from '@looker/sdk-codegen'
|
|
29
|
+
import type { Location as HLocation } from 'history'
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Builds a path matching the route used by MethodScene
|
|
@@ -66,6 +67,12 @@ const getMethodTag = (api: ApiModel, methodName: string) => {
|
|
|
66
67
|
.map(([methodTag]) => methodTag)[0]
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Is this item a method? Check without requiring `instanceof Method`
|
|
72
|
+
* @param item to check for method or type
|
|
73
|
+
*/
|
|
74
|
+
export const isMethod = (item: IMethod | IType) => 'params' in item
|
|
75
|
+
|
|
69
76
|
/**
|
|
70
77
|
* Return the tag for a give type
|
|
71
78
|
* @param api Parsed api
|
|
@@ -89,7 +96,7 @@ export const buildPath = (
|
|
|
89
96
|
specKey: string
|
|
90
97
|
) => {
|
|
91
98
|
let path
|
|
92
|
-
if (item
|
|
99
|
+
if (isMethod(item)) {
|
|
93
100
|
const tag = getMethodTag(api, item.name)
|
|
94
101
|
path = buildMethodPath(specKey, tag, item.name)
|
|
95
102
|
} else {
|
|
@@ -98,3 +105,19 @@ export const buildPath = (
|
|
|
98
105
|
}
|
|
99
106
|
return path
|
|
100
107
|
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Determine API specification keys from URL pattern
|
|
111
|
+
* @param location service to examine
|
|
112
|
+
*/
|
|
113
|
+
export const getSpecKey = (location: HLocation | Location): string | null => {
|
|
114
|
+
const pathname = location.pathname
|
|
115
|
+
let match
|
|
116
|
+
if (pathname.startsWith(`/${diffPath}`)) {
|
|
117
|
+
const pattern = new RegExp(`(?:/${diffPath})/(?<specKey>\\w+.\\w+)`)
|
|
118
|
+
match = pathname.match(pattern)
|
|
119
|
+
} else {
|
|
120
|
+
match = pathname.match(/\/(?<specKey>\w+\.\w+).*/)
|
|
121
|
+
}
|
|
122
|
+
return match?.groups?.specKey || null
|
|
123
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/reducers/index.ts"],"names":[],"mappings":"AAyBA,cAAc,QAAd","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './spec'\n"],"file":"index.js"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export var Actions;
|
|
2
|
-
|
|
3
|
-
(function (Actions) {
|
|
4
|
-
Actions["SELECT_SPEC"] = "SELECT_SPEC";
|
|
5
|
-
Actions["UPDATE_SPEC_API"] = "UPDATE_SPEC_API";
|
|
6
|
-
})(Actions || (Actions = {}));
|
|
7
|
-
|
|
8
|
-
export var selectSpec = specKey => ({
|
|
9
|
-
type: Actions.SELECT_SPEC,
|
|
10
|
-
payload: specKey
|
|
11
|
-
});
|
|
12
|
-
export var updateSpecApi = (specKey, api) => ({
|
|
13
|
-
type: Actions.UPDATE_SPEC_API,
|
|
14
|
-
payload: {
|
|
15
|
-
specKey,
|
|
16
|
-
api
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/reducers/spec/actions.ts"],"names":["Actions","selectSpec","specKey","type","SELECT_SPEC","payload","updateSpecApi","api","UPDATE_SPEC_API"],"mappings":"AA4BA,WAAYA,OAAZ;;WAAYA,O;AAAAA,EAAAA,O;AAAAA,EAAAA,O;GAAAA,O,KAAAA,O;;AAsBZ,OAAO,IAAMC,UAAU,GAAIC,OAAD,KAAwC;AAChEC,EAAAA,IAAI,EAAEH,OAAO,CAACI,WADkD;AAEhEC,EAAAA,OAAO,EAAEH;AAFuD,CAAxC,CAAnB;AAKP,OAAO,IAAMI,aAAa,GAAG,CAC3BJ,OAD2B,EAE3BK,GAF2B,MAGF;AACzBJ,EAAAA,IAAI,EAAEH,OAAO,CAACQ,eADW;AAEzBH,EAAAA,OAAO,EAAE;AAAEH,IAAAA,OAAF;AAAWK,IAAAA;AAAX;AAFgB,CAHE,CAAtB","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ApiModel } from '@looker/sdk-codegen'\n\nexport enum Actions {\n SELECT_SPEC = 'SELECT_SPEC',\n UPDATE_SPEC_API = 'UPDATE_SPEC_API',\n}\n\nexport interface ApiUpdatePayload {\n specKey: string\n api: ApiModel\n}\n\nexport interface UpdateSpecApiAction {\n type: Actions.UPDATE_SPEC_API\n payload: ApiUpdatePayload\n}\n\nexport interface SelectSpecAction {\n type: Actions.SELECT_SPEC\n payload: string\n}\n\nexport type SpecAction = SelectSpecAction | UpdateSpecApiAction\n\nexport const selectSpec = (specKey: string): SelectSpecAction => ({\n type: Actions.SELECT_SPEC,\n payload: specKey,\n})\n\nexport const updateSpecApi = (\n specKey: string,\n api: ApiModel\n): UpdateSpecApiAction => ({\n type: Actions.UPDATE_SPEC_API,\n payload: { specKey, api },\n})\n"],"file":"actions.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/reducers/spec/index.ts"],"names":[],"mappings":"AAyBA,cAAc,SAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './utils'\nexport * from './actions'\nexport * from './reducer'\n"],"file":"index.js"}
|