@operato/shell 8.0.0-beta.0 → 8.0.0-beta.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.
@@ -1,173 +0,0 @@
1
- /*
2
- * [ Caution ]
3
- * Since this module is being used by a service worker, be very careful about adding imports or using functions for browsers.
4
- */
5
-
6
- type OxObjectStore = {
7
- add: (value: any, key?: IDBValidKey | undefined) => IDBValidKey
8
- delete: (query: IDBValidKey | IDBKeyRange) => undefined
9
- clear: () => undefined
10
- get: (query: IDBValidKey | IDBKeyRange) => any
11
- getAll: (query?: IDBValidKey | IDBKeyRange | null | undefined, count?: number | undefined) => any[]
12
- getAllKeys: (query?: IDBValidKey | IDBKeyRange | null | undefined, count?: number | undefined) => IDBValidKey[]
13
- count: (query?: IDBValidKey | IDBKeyRange | undefined) => number
14
- put: (value: any, key?: IDBValidKey | undefined) => IDBValidKey
15
- openCursor: (
16
- query?: IDBValidKey | IDBKeyRange | null | undefined,
17
- direction?: IDBCursorDirection | undefined
18
- ) => IDBCursorWithValue | null
19
- openKeyCursor: (
20
- query?: IDBValidKey | IDBKeyRange | null | undefined,
21
- direction?: IDBCursorDirection | undefined
22
- ) => IDBCursor | null
23
- limit: (limit?: number) => undefined
24
- }
25
-
26
- /* promise queue */
27
- class Queue {
28
- private static queue: {
29
- promise: Promise<IDBDatabase>
30
- resolve: (db: IDBDatabase) => void
31
- reject: (reason?: any) => void
32
- }[] = []
33
-
34
- private static workingOnPromise: boolean = false
35
-
36
- static enqueue(promise: Promise<any>) {
37
- return new Promise((resolve, reject) => {
38
- this.queue.push({
39
- promise,
40
- resolve,
41
- reject
42
- })
43
- this.dequeue()
44
- })
45
- }
46
-
47
- static dequeue() {
48
- if (this.workingOnPromise) {
49
- return false
50
- }
51
- const item = this.queue.shift()
52
- if (!item) {
53
- return false
54
- }
55
- try {
56
- this.workingOnPromise = true
57
- item.promise
58
- .then(value => {
59
- this.workingOnPromise = false
60
- item.resolve(value)
61
- this.dequeue()
62
- })
63
- .catch(err => {
64
- this.workingOnPromise = false
65
- item.reject(err)
66
- this.dequeue()
67
- })
68
- } catch (err) {
69
- this.workingOnPromise = false
70
- item.reject(err)
71
- this.dequeue()
72
- }
73
- return true
74
- }
75
- }
76
-
77
- function getStore(storeName: string): OxObjectStore {
78
- return [
79
- 'add',
80
- 'delete',
81
- 'clear',
82
- 'get',
83
- 'getAll',
84
- 'getAllKeys',
85
- 'count',
86
- 'put',
87
- 'openCursor',
88
- 'openKeyCursor'
89
- ].reduce(
90
- (sum, m) => {
91
- sum[m] = async (...params: any) => {
92
- const db = (await getIndexDB()) as IDBDatabase
93
-
94
- const transaction = db.transaction(storeName, 'readwrite')
95
- const store = transaction.objectStore(storeName)
96
- const method: (...p: any) => any = (store as any)[m]
97
- const request = method.apply(store, params)
98
-
99
- return await new Promise((resolve, reject) => {
100
- request.onsuccess = (event: Event) => {
101
- resolve((event.target as IDBRequest)?.result)
102
- }
103
-
104
- request.onerror = (event: Event) => {
105
- reject(event)
106
- }
107
- })
108
- }
109
-
110
- return sum
111
- },
112
- {
113
- async limit(this: OxObjectStore, limit = 50) {
114
- const keys = (await this.getAllKeys()).slice(0, -limit)
115
- for (let i = 0; i < keys.length; i++) {
116
- await this.delete(keys[i])
117
- }
118
- }
119
- } as any
120
- )
121
- }
122
-
123
- function getIndexedDB(): IDBFactory {
124
- if (typeof window !== 'undefined') {
125
- return window.indexedDB
126
- } else {
127
- return self.indexedDB
128
- }
129
- }
130
-
131
- var db: IDBDatabase
132
-
133
- function getIndexDB() {
134
- if (db) {
135
- return db
136
- }
137
-
138
- return Queue.enqueue(
139
- new Promise(function (resolve, reject) {
140
- const indexedDB = getIndexedDB()
141
-
142
- if (!indexedDB) {
143
- reject('this browser does not support indexedDB')
144
- }
145
- const request = indexedDB.open('things-factory-database')
146
-
147
- request.onerror = function (event) {
148
- console.log("Why didn't you allow my web app to use IndexedDB?!")
149
- reject(event)
150
- }
151
-
152
- request.onupgradeneeded = function (event: IDBVersionChangeEvent) {
153
- var db: IDBDatabase = (event.target as IDBRequest)?.result
154
-
155
- var store = db.createObjectStore('notifications', { keyPath: 'id', autoIncrement: true })
156
- store.createIndex('notification_id_unqiue', 'id', { unique: true })
157
-
158
- var store = db.createObjectStore('client_settings', { keyPath: 'key', autoIncrement: true })
159
- store.createIndex('client_setting_key_unqiue', 'key', { unique: true })
160
- }
161
-
162
- request.onsuccess = function (event) {
163
- console.log('IndexedDB opened successfully')
164
- db = request.result
165
- resolve(db)
166
- }
167
- })
168
- )
169
- }
170
-
171
- /* ready indexedDB Stores */
172
- export const clientSettingStore: OxObjectStore = getStore('client_settings')
173
- export const notificationStore: OxObjectStore = getStore('notifications')
@@ -1,48 +0,0 @@
1
- import { getPathInfo } from '@operato/utils'
2
-
3
- import { SET_DOMAINS, UPDATE_BASE_URL, UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions/app.js'
4
-
5
- const INITIAL_STATE: {
6
- baseUrl: string
7
- contextPath: string
8
- domains: {
9
- name: string
10
- subdomain: string
11
- }[]
12
- } = {
13
- baseUrl: location.origin,
14
- contextPath: getPathInfo(location.pathname).contextPath,
15
- domains: []
16
- }
17
-
18
- const app = (state = INITIAL_STATE, action: any) => {
19
- switch (action.type) {
20
- case UPDATE_MODULES:
21
- return {
22
- ...state,
23
- modules: action.modules
24
- }
25
- case UPDATE_BASE_URL:
26
- return {
27
- ...state,
28
- baseUrl: action.baseUrl
29
- }
30
- case UPDATE_CONTEXT_PATH:
31
- return {
32
- ...state,
33
- contextPath: action.contextPath
34
- }
35
-
36
- case SET_DOMAINS:
37
- return {
38
- ...state,
39
- domains: action.domains,
40
- domain: action.domain
41
- }
42
-
43
- default:
44
- return state
45
- }
46
- }
47
-
48
- export default app
@@ -1,21 +0,0 @@
1
- import { UPDATE_BUSY } from '../actions/busy.js'
2
-
3
- const INITIAL_STATE: {
4
- busy: boolean
5
- } = {
6
- busy: false
7
- }
8
-
9
- const busy = (state = INITIAL_STATE, action: any) => {
10
- switch (action.type) {
11
- case UPDATE_BUSY:
12
- return {
13
- busy: action.busy
14
- }
15
-
16
- default:
17
- return state
18
- }
19
- }
20
-
21
- export default busy
@@ -1,77 +0,0 @@
1
- import startCase from 'lodash-es/startCase'
2
- import { updateMetadata } from 'pwa-helpers/metadata.js'
3
-
4
- import {
5
- REGISTER_NAVIGATION_CALLBACK,
6
- UNREGISTER_NAVIGATION_CALLBACK,
7
- UPDATE_ACTIVE_PAGE,
8
- UPDATE_CONTEXT,
9
- UPDATE_PAGE
10
- } from '../actions/const'
11
-
12
- const APP_TITLE_EL = document.querySelector('meta[name="application-name"]') as HTMLMetaElement
13
-
14
- var appTitle: string | undefined
15
- if (APP_TITLE_EL) {
16
- appTitle = APP_TITLE_EL.content
17
- }
18
-
19
- const INITIAL_STATE: {
20
- page: string
21
- resourceId: string
22
- params: any
23
- activePage: any
24
- context: any
25
- callbacks: any[]
26
- } = {
27
- page: '',
28
- resourceId: '',
29
- params: {},
30
- activePage: null,
31
- context: {},
32
- callbacks: []
33
- }
34
-
35
- const route = (state = INITIAL_STATE, action: any) => {
36
- switch (action.type) {
37
- case UPDATE_PAGE:
38
- return {
39
- ...state,
40
- page: action.page,
41
- resourceId: action.resourceId,
42
- params: action.params
43
- }
44
- case UPDATE_CONTEXT:
45
- let title = action.context?.title
46
- let text = typeof title === 'object' ? title.text : title
47
-
48
- updateMetadata({
49
- title: appTitle + (text ? ` - ${startCase(text)}` : '')
50
- })
51
- return {
52
- ...state,
53
- context: action.context || (state.activePage && state.activePage.context) || {}
54
- }
55
- case UPDATE_ACTIVE_PAGE:
56
- return {
57
- ...state,
58
- activePage: action.activePage
59
- }
60
-
61
- case REGISTER_NAVIGATION_CALLBACK:
62
- return {
63
- ...state,
64
- callbacks: [...state.callbacks, action.callback]
65
- }
66
- case UNREGISTER_NAVIGATION_CALLBACK:
67
- return {
68
- ...state,
69
- callbacks: state.callbacks.filter(callback => callback !== action.callback)
70
- }
71
-
72
- default:
73
- return state
74
- }
75
- }
76
-
77
- export default route
package/src/store.ts DELETED
@@ -1,36 +0,0 @@
1
- import { lazyReducerEnhancer, LazyStore } from 'pwa-helpers/lazy-reducer-enhancer.js'
2
- import { Action, applyMiddleware, combineReducers, compose, createStore, Store } from 'redux'
3
- import thunk from 'redux-thunk'
4
-
5
- import app from './reducers/app'
6
- import route from './reducers/route'
7
- import busy from './reducers/busy'
8
-
9
- declare global {
10
- var __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any
11
- }
12
-
13
- // Sets up a Chrome extension for time travel debugging.
14
- // See https://github.com/zalmoxisus/redux-devtools-extension for more information.
15
- const devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
16
-
17
- // Only for providing test environment - combineReducers 에서 process.env.NODE_ENV를 접근하기 때문에.
18
- if (typeof window.process == 'undefined') {
19
- window.process = {
20
- env: {
21
- NODE_ENV: JSON.stringify('development')
22
- }
23
- } as any
24
- }
25
-
26
- export const store: Store<unknown, Action<any>> & LazyStore = createStore(
27
- state => state,
28
- devCompose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
29
- )
30
-
31
- // Initially loaded reducers.
32
- store.addReducers({
33
- app,
34
- route,
35
- busy
36
- })
@@ -1,22 +0,0 @@
1
- export class Domain {
2
- readonly id?: string
3
-
4
- name?: string
5
- description?: string
6
-
7
- subdomain?: string
8
-
9
- extType?: string
10
- timezone?: string
11
- systemFlag?: boolean
12
-
13
- brandName?: string
14
- brandImage?: string
15
- contentImage?: string
16
-
17
- owner?: string
18
- theme?: string
19
-
20
- createdAt?: Date
21
- updatedAt?: Date
22
- }
@@ -1,5 +0,0 @@
1
- export * from './domain'
2
- export * from './privilege'
3
- export * from './role'
4
- export * from './user'
5
- export * from './types'
@@ -1,28 +0,0 @@
1
- import { Role } from './role'
2
- import { User } from './user'
3
-
4
- export class Privilege {
5
- id?: string
6
-
7
- name?: string
8
-
9
- category?: string
10
-
11
- nullable?: true
12
-
13
- description?: string
14
-
15
- roles?: Role[]
16
-
17
- creator?: User
18
-
19
- creatorId?: string
20
-
21
- updater?: User
22
-
23
- updaterId?: string
24
-
25
- createdAt?: Date
26
-
27
- updatedAt?: Date
28
- }
package/src/types/role.ts DELETED
@@ -1,33 +0,0 @@
1
- import { Domain } from './domain'
2
- import { User } from './user'
3
- import { Privilege } from './privilege'
4
-
5
- export class Role {
6
- readonly id?: string
7
-
8
- domain?: Domain
9
-
10
- domainId?: string
11
-
12
- name?: string
13
-
14
- users?: User[]
15
-
16
- privileges?: Privilege[]
17
-
18
- nullable?: true
19
-
20
- description?: string
21
-
22
- creator?: User
23
-
24
- creatorId?: string
25
-
26
- updater?: User
27
-
28
- updaterId?: string
29
-
30
- createdAt?: Date
31
-
32
- updatedAt?: Date
33
- }
@@ -1,5 +0,0 @@
1
- export enum InheritedValueType {
2
- None = 'None',
3
- Include = 'Include',
4
- Only = 'Only'
5
- }
package/src/types/user.ts DELETED
@@ -1,23 +0,0 @@
1
- export enum UserStatus {
2
- INACTIVE = 'inactive',
3
- ACTIVATED = 'activated',
4
- DELETED = 'deleted',
5
- LOCKED = 'locked',
6
- BANNED = 'banned',
7
- PWD_RESET_REQUIRED = 'password_reset_required'
8
- }
9
-
10
- export class User {
11
- readonly id?: string
12
-
13
- name?: string
14
- description?: string
15
-
16
- email?: string
17
-
18
- creator?: User
19
- updater?: User
20
-
21
- createdAt?: Date
22
- updatedAt?: Date
23
- }
@@ -1,51 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import { css, html, render, TemplateResult } from 'lit'
4
- import '../src/app/app.js'
5
-
6
- export default {
7
- title: 'things-app',
8
- component: 'things-app',
9
- argTypes: {
10
- label: { control: 'string' }
11
- }
12
- }
13
-
14
- interface Story<T> {
15
- (args: T): TemplateResult
16
- args?: Partial<T>
17
- argTypes?: Record<string, unknown>
18
- }
19
-
20
- interface ArgTypes {
21
- label?: string
22
- }
23
-
24
- const Template: Story<ArgTypes> = ({ label = '' }: ArgTypes) => html`
25
- <link href="/themes/app-theme.css" rel="stylesheet" />
26
- <link
27
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
28
- rel="stylesheet"
29
- />
30
- <link
31
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
32
- rel="stylesheet"
33
- />
34
- <link
35
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
36
- rel="stylesheet"
37
- />
38
-
39
- <style>
40
- body {
41
- background-color: var(--md-sys-color-surface);
42
- }
43
- </style>
44
-
45
- <things-app></things-app>
46
- `
47
-
48
- export const Regular = Template.bind({})
49
- Regular.args = {
50
- label: 'common header styles'
51
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2017", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "useDefineForClassFields": false,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "./",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true,
21
- "types": ["node", "mocha"]
22
- },
23
- "include": ["**/*.ts"]
24
- }
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'dist/test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });