@progressive-development/pd-spa-helper 0.9.0 → 0.9.2
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/dist/auth/AuthController.d.ts +37 -0
- package/dist/auth/AuthController.d.ts.map +1 -0
- package/dist/auth/AuthController.js +65 -0
- package/dist/auth/auth-directives.d.ts +59 -0
- package/dist/auth/auth-directives.d.ts.map +1 -0
- package/dist/auth/auth-directives.js +81 -0
- package/dist/auth/auth-utils.d.ts +45 -0
- package/dist/auth/auth-utils.d.ts.map +1 -0
- package/dist/auth/auth-utils.js +42 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/components/default-login/DefaultLogin.d.ts +15 -0
- package/dist/components/default-login/DefaultLogin.d.ts.map +1 -0
- package/dist/components/default-login/DefaultLogin.js +120 -0
- package/dist/components/default-not-found/DefaultNotFound.d.ts +6 -0
- package/dist/components/default-not-found/DefaultNotFound.d.ts.map +1 -0
- package/dist/{defaultpage/default-not-found.js → components/default-not-found/DefaultNotFound.js} +10 -3
- package/dist/components/pd-section-page/PdSectionPage.d.ts +55 -0
- package/dist/components/pd-section-page/PdSectionPage.d.ts.map +1 -0
- package/dist/components/pd-section-page/PdSectionPage.js +37 -0
- package/dist/components/pd-spa-helper/PdSpaHelper.d.ts +196 -0
- package/dist/components/pd-spa-helper/PdSpaHelper.d.ts.map +1 -0
- package/dist/components/pd-spa-helper/PdSpaHelper.js +603 -0
- package/dist/components/pd-spa-helper/controllers/ScrollController.d.ts +77 -0
- package/dist/components/pd-spa-helper/controllers/ScrollController.d.ts.map +1 -0
- package/dist/components/pd-spa-helper/controllers/ScrollController.js +102 -0
- package/dist/components/pd-spa-helper/spa-config.d.ts +95 -0
- package/dist/components/pd-spa-helper/spa-config.d.ts.map +1 -0
- package/dist/components/pd-spa-helper/spa-config.js +175 -0
- package/dist/components/pd-spa-helper/spa-events.d.ts +132 -0
- package/dist/components/pd-spa-helper/spa-events.d.ts.map +1 -0
- package/dist/components/pd-spa-helper/spa-events.js +18 -0
- package/dist/db/index.d.ts +3 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/{store → db}/indexDB.d.ts +9 -9
- package/dist/db/indexDB.d.ts.map +1 -0
- package/dist/{store → db}/indexDB.js +14 -12
- package/dist/generated/locale-wrapper/be-wrapper.d.ts +49 -14
- package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/de-wrapper.d.ts +49 -14
- package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/en-wrapper.d.ts +49 -14
- package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -1
- package/dist/generated/locales/be.d.ts +1 -15
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/be.js +1 -15
- package/dist/generated/locales/de.d.ts +1 -15
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/de.js +1 -15
- package/dist/generated/locales/en.d.ts +1 -15
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/generated/locales/en.js +1 -15
- package/dist/helper/logger.d.ts +11 -12
- package/dist/helper/logger.d.ts.map +1 -1
- package/dist/helper/logger.js +10 -49
- package/dist/helper/refresh-id-token.d.ts.map +1 -1
- package/dist/helper/refresh-id-token.js +6 -4
- package/dist/index.d.ts +31 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -50
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/spa-model.d.ts +14 -15
- package/dist/model/spa-model.d.ts.map +1 -1
- package/dist/router/PdRouterService.d.ts +4 -1
- package/dist/router/PdRouterService.d.ts.map +1 -1
- package/dist/router/PdRouterService.js +40 -16
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/screen-size/ScreenSizeController.d.ts +34 -0
- package/dist/screen-size/ScreenSizeController.d.ts.map +1 -0
- package/dist/screen-size/ScreenSizeController.js +58 -0
- package/dist/screen-size/ScreenSizeService.d.ts +49 -0
- package/dist/screen-size/ScreenSizeService.d.ts.map +1 -0
- package/dist/screen-size/ScreenSizeService.js +107 -0
- package/dist/screen-size/index.d.ts +13 -0
- package/dist/screen-size/index.d.ts.map +1 -0
- package/dist/screen-size/responsive-directives.d.ts +59 -0
- package/dist/screen-size/responsive-directives.d.ts.map +1 -0
- package/dist/screen-size/responsive-directives.js +71 -0
- package/dist/screen-size/types.d.ts +44 -0
- package/dist/screen-size/types.d.ts.map +1 -0
- package/dist/service-provider/ServiceRegistry.d.ts +67 -0
- package/dist/service-provider/ServiceRegistry.d.ts.map +1 -0
- package/dist/service-provider/ServiceRegistry.js +76 -0
- package/dist/service-provider/function-utils.d.ts +55 -0
- package/dist/service-provider/function-utils.d.ts.map +1 -0
- package/dist/service-provider/function-utils.js +30 -0
- package/dist/service-provider/index.d.ts +10 -0
- package/dist/service-provider/index.d.ts.map +1 -0
- package/dist/service-provider/interfaces/IAuthProvider.d.ts +68 -0
- package/dist/service-provider/interfaces/IAuthProvider.d.ts.map +1 -0
- package/dist/service-provider/interfaces/IDatabaseProvider.d.ts +75 -0
- package/dist/service-provider/interfaces/IDatabaseProvider.d.ts.map +1 -0
- package/dist/service-provider/interfaces/IFunctionProvider.d.ts +49 -0
- package/dist/service-provider/interfaces/IFunctionProvider.d.ts.map +1 -0
- package/dist/service-provider/interfaces/IStorageProvider.d.ts +118 -0
- package/dist/service-provider/interfaces/IStorageProvider.d.ts.map +1 -0
- package/dist/service-provider/interfaces/ServiceProvider.d.ts +24 -0
- package/dist/service-provider/interfaces/ServiceProvider.d.ts.map +1 -0
- package/dist/service-provider/interfaces/common.d.ts +5 -0
- package/dist/service-provider/interfaces/common.d.ts.map +1 -0
- package/dist/service-provider/service-provider-model.d.ts +55 -10
- package/dist/service-provider/service-provider-model.d.ts.map +1 -1
- package/dist/services/fire-once-service.d.ts +35 -0
- package/dist/services/fire-once-service.d.ts.map +1 -0
- package/dist/services/fire-once-service.js +61 -0
- package/dist/store/async-action-effects.d.ts +179 -0
- package/dist/store/async-action-effects.d.ts.map +1 -0
- package/dist/store/async-action-effects.js +98 -0
- package/dist/store/async-action-utils.d.ts +154 -0
- package/dist/store/async-action-utils.d.ts.map +1 -0
- package/dist/store/async-action-utils.js +42 -0
- package/dist/store/index.d.ts +9 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/mini-rx.store.d.ts.map +1 -1
- package/dist/store/mini-rx.store.js +1 -3
- package/dist/store/spa-app-actions.d.ts +5 -22
- package/dist/store/spa-app-actions.d.ts.map +1 -1
- package/dist/store/spa-app-actions.js +4 -8
- package/dist/store/spa-app-effects.d.ts +0 -17
- package/dist/store/spa-app-effects.d.ts.map +1 -1
- package/dist/store/spa-app-effects.js +2 -40
- package/dist/store/spa-app-reducer.d.ts +5 -10
- package/dist/store/spa-app-reducer.d.ts.map +1 -1
- package/dist/store/spa-app-reducer.js +13 -8
- package/dist/store/spa-app-selector.d.ts +2 -2
- package/dist/store/spa-app-selector.d.ts.map +1 -1
- package/dist/store/spa-app-selector.js +1 -1
- package/dist/stories/introduction.stories.d.ts +11 -0
- package/dist/stories/introduction.stories.d.ts.map +1 -0
- package/package.json +14 -9
- package/dist/PdSpaHelper.d.ts +0 -83
- package/dist/PdSpaHelper.d.ts.map +0 -1
- package/dist/PdSpaHelper.js +0 -492
- package/dist/defaultpage/default-confirm-popup.d.ts +0 -19
- package/dist/defaultpage/default-confirm-popup.d.ts.map +0 -1
- package/dist/defaultpage/default-confirm-popup.js +0 -70
- package/dist/defaultpage/default-dialog-popup.d.ts +0 -19
- package/dist/defaultpage/default-dialog-popup.d.ts.map +0 -1
- package/dist/defaultpage/default-dialog-popup.js +0 -103
- package/dist/defaultpage/default-login.d.ts +0 -6
- package/dist/defaultpage/default-login.d.ts.map +0 -1
- package/dist/defaultpage/default-login.js +0 -33
- package/dist/defaultpage/default-not-found.d.ts +0 -6
- package/dist/defaultpage/default-not-found.d.ts.map +0 -1
- package/dist/defaultpage/default-popup.d.ts +0 -7
- package/dist/defaultpage/default-popup.d.ts.map +0 -1
- package/dist/defaultpage/default-popup.js +0 -24
- package/dist/defaultpage/default-step-address.d.ts +0 -14
- package/dist/defaultpage/default-step-address.d.ts.map +0 -1
- package/dist/defaultpage/default-step-address.js +0 -77
- package/dist/defaultpage/default-step-summary.d.ts +0 -28
- package/dist/defaultpage/default-step-summary.d.ts.map +0 -1
- package/dist/defaultpage/default-step-summary.js +0 -67
- package/dist/defaultpage/default-view-page.d.ts +0 -10
- package/dist/defaultpage/default-view-page.d.ts.map +0 -1
- package/dist/defaultpage/default-view-page.js +0 -70
- package/dist/defaultpage/default-wizard.d.ts +0 -37
- package/dist/defaultpage/default-wizard.d.ts.map +0 -1
- package/dist/defaultpage/default-wizard.js +0 -255
- package/dist/defaultpage/pd-default-wizard-step.d.ts +0 -60
- package/dist/defaultpage/pd-default-wizard-step.d.ts.map +0 -1
- package/dist/defaultpage/pd-default-wizard-step.js +0 -144
- package/dist/helper/blob-helper.d.ts +0 -3
- package/dist/helper/blob-helper.d.ts.map +0 -1
- package/dist/helper/blob-helper.js +0 -35
- package/dist/helper/date-helper.d.ts +0 -27
- package/dist/helper/date-helper.d.ts.map +0 -1
- package/dist/helper/date-helper.js +0 -129
- package/dist/helper/locale-format.d.ts +0 -4
- package/dist/helper/locale-format.d.ts.map +0 -1
- package/dist/helper/locale-format.js +0 -16
- package/dist/helper/number-helper.d.ts +0 -2
- package/dist/helper/number-helper.d.ts.map +0 -1
- package/dist/helper/number-helper.js +0 -13
- package/dist/helper/price-helper.d.ts +0 -5
- package/dist/helper/price-helper.d.ts.map +0 -1
- package/dist/helper/price-helper.js +0 -22
- package/dist/helper/text-helper.d.ts +0 -3
- package/dist/helper/text-helper.d.ts.map +0 -1
- package/dist/helper/text-helper.js +0 -4
- package/dist/popup/wizard-close-popup.d.ts +0 -11
- package/dist/popup/wizard-close-popup.d.ts.map +0 -1
- package/dist/popup/wizard-close-popup.js +0 -63
- package/dist/popup/wizard-reload-popup.d.ts +0 -14
- package/dist/popup/wizard-reload-popup.d.ts.map +0 -1
- package/dist/popup/wizard-reload-popup.js +0 -76
- package/dist/service-provider/firebase/auth.d.ts +0 -19
- package/dist/service-provider/firebase/auth.d.ts.map +0 -1
- package/dist/service-provider/firebase/auth.js +0 -62
- package/dist/service-provider/firebase/firestorage-client.d.ts +0 -22
- package/dist/service-provider/firebase/firestorage-client.d.ts.map +0 -1
- package/dist/service-provider/firebase/firestorage-client.js +0 -226
- package/dist/service-provider/firebase/firestore-client.d.ts +0 -12
- package/dist/service-provider/firebase/firestore-client.d.ts.map +0 -1
- package/dist/service-provider/firebase/firestore-client.js +0 -25
- package/dist/service-provider/firebase/functions-client.d.ts +0 -10
- package/dist/service-provider/firebase/functions-client.d.ts.map +0 -1
- package/dist/service-provider/firebase/functions-client.js +0 -63
- package/dist/service-provider/firebase/messagingFirebaseClient.d.ts +0 -9
- package/dist/service-provider/firebase/messagingFirebaseClient.d.ts.map +0 -1
- package/dist/service-provider/firebase/messagingFirebaseClient.js +0 -69
- package/dist/service-provider/mock/auth.d.ts +0 -6
- package/dist/service-provider/mock/auth.d.ts.map +0 -1
- package/dist/service-provider/mock/auth.js +0 -60
- package/dist/service-provider/mock/function-client.d.ts +0 -7
- package/dist/service-provider/mock/function-client.d.ts.map +0 -1
- package/dist/service-provider/mock/function-client.js +0 -30
- package/dist/service-provider/mock/storage-client.d.ts +0 -11
- package/dist/service-provider/mock/storage-client.d.ts.map +0 -1
- package/dist/service-provider/mock/storage-client.js +0 -106
- package/dist/service-provider/service-provider-impl.d.ts +0 -27
- package/dist/service-provider/service-provider-impl.d.ts.map +0 -1
- package/dist/service-provider/service-provider-impl.js +0 -222
- package/dist/store/indexDB.d.ts.map +0 -1
- package/dist/stories/address-edit.stories.d.ts +0 -27
- package/dist/stories/address-edit.stories.d.ts.map +0 -1
- package/dist/stories/address-new.stories.d.ts +0 -33
- package/dist/stories/address-new.stories.d.ts.map +0 -1
- package/dist/stories/default-confirm-popup.stories.d.ts +0 -24
- package/dist/stories/default-confirm-popup.stories.d.ts.map +0 -1
- package/dist/stories/default-dialog-popup.stories.d.ts +0 -23
- package/dist/stories/default-dialog-popup.stories.d.ts.map +0 -1
- package/dist/stories/default-login.stories.d.ts +0 -10
- package/dist/stories/default-login.stories.d.ts.map +0 -1
- package/dist/stories/default-popup.stories.d.ts +0 -9
- package/dist/stories/default-popup.stories.d.ts.map +0 -1
- package/dist/stories/pd-loading-state.stories.d.ts +0 -30
- package/dist/stories/pd-loading-state.stories.d.ts.map +0 -1
- package/dist/stories/pd-toast.stories.d.ts +0 -27
- package/dist/stories/pd-toast.stories.d.ts.map +0 -1
- package/dist/stories/routing.stories.d.ts +0 -24
- package/dist/stories/routing.stories.d.ts.map +0 -1
- package/dist/stories/test-impls/address-test.d.ts +0 -6
- package/dist/stories/test-impls/address-test.d.ts.map +0 -1
- package/dist/stories/test-impls/test-mock-app.d.ts +0 -15
- package/dist/stories/test-impls/test-mock-app.d.ts.map +0 -1
- package/dist/stories/test-impls/test-pages/test-home-page.d.ts +0 -7
- package/dist/stories/test-impls/test-pages/test-home-page.d.ts.map +0 -1
- package/dist/stories/test-impls/test-pages/test-not-found-page.d.ts +0 -5
- package/dist/stories/test-impls/test-pages/test-not-found-page.d.ts.map +0 -1
- package/dist/stories/test-impls/test-pages/test-wizard-step.d.ts +0 -17
- package/dist/stories/test-impls/test-pages/test-wizard-step.d.ts.map +0 -1
- package/dist/stories/test-impls/test-pages/test-wizard.d.ts +0 -16
- package/dist/stories/test-impls/test-pages/test-wizard.d.ts.map +0 -1
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-error.d.ts +0 -8
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-error.d.ts.map +0 -1
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-info.d.ts +0 -8
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-info.d.ts.map +0 -1
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-warn.d.ts +0 -8
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-warn.d.ts.map +0 -1
- package/dist/stories/test-impls/test-popups/default-dialog-popup-test.d.ts +0 -13
- package/dist/stories/test-impls/test-popups/default-dialog-popup-test.d.ts.map +0 -1
- package/dist/stories/test-impls/test-popups/default-popup-test.d.ts +0 -5
- package/dist/stories/test-impls/test-popups/default-popup-test.d.ts.map +0 -1
- package/dist/stories/test-wizard-step.stories.d.ts +0 -11
- package/dist/stories/test-wizard-step.stories.d.ts.map +0 -1
- package/dist/stories/test-wizard.stories.d.ts +0 -9
- package/dist/stories/test-wizard.stories.d.ts.map +0 -1
- package/dist/tmpown/pd-loading-state.d.ts +0 -9
- package/dist/tmpown/pd-loading-state.d.ts.map +0 -1
- package/dist/tmpown/pd-loading-state.js +0 -196
- package/dist/tmpown/pd-login.d.ts +0 -13
- package/dist/tmpown/pd-login.d.ts.map +0 -1
- package/dist/tmpown/pd-login.js +0 -165
- package/dist/tmpown/pd-toast.d.ts +0 -13
- package/dist/tmpown/pd-toast.d.ts.map +0 -1
- package/dist/tmpown/pd-toast.js +0 -127
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { directive, AsyncDirective } from 'lit/async-directive.js';
|
|
2
|
+
import { screenSizeService } from './ScreenSizeService.js';
|
|
3
|
+
|
|
4
|
+
function resolveResponsiveValue(options, currentBreakpoint) {
|
|
5
|
+
const breakpointOrder = screenSizeService.breakpointOrder;
|
|
6
|
+
const currentIndex = breakpointOrder.indexOf(currentBreakpoint);
|
|
7
|
+
for (let i = currentIndex; i < breakpointOrder.length; i++) {
|
|
8
|
+
const bp = breakpointOrder[i];
|
|
9
|
+
const value = options[bp];
|
|
10
|
+
if (value !== void 0) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return options.default;
|
|
15
|
+
}
|
|
16
|
+
class ResponsiveTextDirective extends AsyncDirective {
|
|
17
|
+
render(options) {
|
|
18
|
+
this._options = options;
|
|
19
|
+
if (!this._unsubscribe) {
|
|
20
|
+
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
21
|
+
this.setValue(this._getText());
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return this._getText();
|
|
25
|
+
}
|
|
26
|
+
disconnected() {
|
|
27
|
+
this._unsubscribe?.();
|
|
28
|
+
this._unsubscribe = void 0;
|
|
29
|
+
}
|
|
30
|
+
reconnected() {
|
|
31
|
+
if (!this._unsubscribe) {
|
|
32
|
+
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
33
|
+
this.setValue(this._getText());
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
_getText() {
|
|
38
|
+
if (!this._options) return "";
|
|
39
|
+
return resolveResponsiveValue(this._options, screenSizeService.breakpoint);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class ResponsiveValueDirective extends AsyncDirective {
|
|
43
|
+
render(options) {
|
|
44
|
+
this._options = options;
|
|
45
|
+
if (!this._unsubscribe) {
|
|
46
|
+
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
47
|
+
this.setValue(this._getValue());
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return this._getValue();
|
|
51
|
+
}
|
|
52
|
+
disconnected() {
|
|
53
|
+
this._unsubscribe?.();
|
|
54
|
+
this._unsubscribe = void 0;
|
|
55
|
+
}
|
|
56
|
+
reconnected() {
|
|
57
|
+
if (!this._unsubscribe) {
|
|
58
|
+
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
59
|
+
this.setValue(this._getValue());
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
_getValue() {
|
|
64
|
+
if (!this._options) return void 0;
|
|
65
|
+
return resolveResponsiveValue(this._options, screenSizeService.breakpoint);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const responsiveText = directive(ResponsiveTextDirective);
|
|
69
|
+
const responsiveValue = directive(ResponsiveValueDirective);
|
|
70
|
+
|
|
71
|
+
export { responsiveText, responsiveValue };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screen size types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
/** Available breakpoint names (mobile-first) */
|
|
5
|
+
export type Breakpoint = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
/** Breakpoint threshold configuration (min-width values in pixels) */
|
|
7
|
+
export interface BreakpointConfig {
|
|
8
|
+
xs: number;
|
|
9
|
+
sm: number;
|
|
10
|
+
md: number;
|
|
11
|
+
lg: number;
|
|
12
|
+
xl: number;
|
|
13
|
+
}
|
|
14
|
+
/** Options for responsive text directive */
|
|
15
|
+
export interface ResponsiveTextOptions {
|
|
16
|
+
/** Default text (used when no breakpoint-specific text matches) */
|
|
17
|
+
default: string;
|
|
18
|
+
/** Text for extra small screens (< 640px) */
|
|
19
|
+
xs?: string;
|
|
20
|
+
/** Text for small screens (640px - 767px) */
|
|
21
|
+
sm?: string;
|
|
22
|
+
/** Text for medium screens (768px - 1023px) */
|
|
23
|
+
md?: string;
|
|
24
|
+
/** Text for large screens (1024px - 1279px) */
|
|
25
|
+
lg?: string;
|
|
26
|
+
/** Text for extra large screens (>= 1280px) */
|
|
27
|
+
xl?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Options for responsive value directive (generic version) */
|
|
30
|
+
export interface ResponsiveValueOptions<T> {
|
|
31
|
+
/** Default value (used when no breakpoint-specific value matches) */
|
|
32
|
+
default: T;
|
|
33
|
+
/** Value for extra small screens */
|
|
34
|
+
xs?: T;
|
|
35
|
+
/** Value for small screens */
|
|
36
|
+
sm?: T;
|
|
37
|
+
/** Value for medium screens */
|
|
38
|
+
md?: T;
|
|
39
|
+
/** Value for large screens */
|
|
40
|
+
lg?: T;
|
|
41
|
+
/** Value for extra large screens */
|
|
42
|
+
xl?: T;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/screen-size/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,4CAA4C;AAC5C,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC;IACX,oCAAoC;IACpC,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,8BAA8B;IAC9B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,+BAA+B;IAC/B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,8BAA8B;IAC9B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,oCAAoC;IACpC,EAAE,CAAC,EAAE,CAAC,CAAC;CACR"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ServiceProvider, IAuthProvider, IFunctionProvider, IStorageProvider, IDatabaseProvider } from '@progressive-development/pd-provider-interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Central service container for dependency injection
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // In app initialization (e.g., main.ts)
|
|
8
|
+
* import { services } from "pd-helper-app";
|
|
9
|
+
* import { createFirebaseProvider } from "pd-provider-firebase";
|
|
10
|
+
*
|
|
11
|
+
* services.initialize(createFirebaseProvider(firebaseConfig));
|
|
12
|
+
*
|
|
13
|
+
* // In components/services
|
|
14
|
+
* import { services } from "pd-helper-app";
|
|
15
|
+
*
|
|
16
|
+
* const user = services.auth.getCurrentUser();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class ServiceRegistry {
|
|
20
|
+
private provider;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the service registry with a provider
|
|
23
|
+
* @param provider The service provider to use
|
|
24
|
+
* @throws Error if already initialized
|
|
25
|
+
*/
|
|
26
|
+
initialize(provider: ServiceProvider): void;
|
|
27
|
+
/**
|
|
28
|
+
* Check if the registry has been initialized
|
|
29
|
+
*/
|
|
30
|
+
get isInitialized(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Ensure the registry is initialized before accessing providers
|
|
33
|
+
* @throws Error if not initialized
|
|
34
|
+
*/
|
|
35
|
+
private ensureInitialized;
|
|
36
|
+
/**
|
|
37
|
+
* Get the auth provider
|
|
38
|
+
*/
|
|
39
|
+
get auth(): IAuthProvider;
|
|
40
|
+
/**
|
|
41
|
+
* Get the functions provider
|
|
42
|
+
*/
|
|
43
|
+
get functions(): IFunctionProvider;
|
|
44
|
+
/**
|
|
45
|
+
* Get the storage provider
|
|
46
|
+
*/
|
|
47
|
+
get storage(): IStorageProvider;
|
|
48
|
+
/**
|
|
49
|
+
* Get the database provider (optional)
|
|
50
|
+
* @returns Database provider or undefined if not configured
|
|
51
|
+
*/
|
|
52
|
+
get database(): IDatabaseProvider | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Reset the registry (primarily for testing)
|
|
55
|
+
*
|
|
56
|
+
* Warning: This should only be used in tests.
|
|
57
|
+
* In production, providers should be initialized once at app startup.
|
|
58
|
+
*/
|
|
59
|
+
reset(): void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Global service registry instance
|
|
63
|
+
*
|
|
64
|
+
* This is the main entry point for accessing services throughout the application.
|
|
65
|
+
*/
|
|
66
|
+
export declare const services: ServiceRegistry;
|
|
67
|
+
//# sourceMappingURL=ServiceRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceRegistry.d.ts","sourceRoot":"","sources":["../../src/service-provider/ServiceRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iDAAiD,CAAC;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAgC;IAEhD;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAS3C;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACH,IAAI,IAAI,IAAI,aAAa,CAGxB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,iBAAiB,CAGjC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,gBAAgB,CAG9B;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,iBAAiB,GAAG,SAAS,CAG5C;IAED;;;;;OAKG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
class ServiceRegistry {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.provider = null;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Initialize the service registry with a provider
|
|
7
|
+
* @param provider The service provider to use
|
|
8
|
+
* @throws Error if already initialized
|
|
9
|
+
*/
|
|
10
|
+
initialize(provider) {
|
|
11
|
+
if (this.provider !== null) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"ServiceRegistry already initialized. Call reset() first if re-initialization is needed."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
this.provider = provider;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if the registry has been initialized
|
|
20
|
+
*/
|
|
21
|
+
get isInitialized() {
|
|
22
|
+
return this.provider !== null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Ensure the registry is initialized before accessing providers
|
|
26
|
+
* @throws Error if not initialized
|
|
27
|
+
*/
|
|
28
|
+
ensureInitialized() {
|
|
29
|
+
if (this.provider === null) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"ServiceRegistry not initialized. Call services.initialize(provider) before accessing services."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the auth provider
|
|
37
|
+
*/
|
|
38
|
+
get auth() {
|
|
39
|
+
this.ensureInitialized();
|
|
40
|
+
return this.provider.auth;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the functions provider
|
|
44
|
+
*/
|
|
45
|
+
get functions() {
|
|
46
|
+
this.ensureInitialized();
|
|
47
|
+
return this.provider.functions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the storage provider
|
|
51
|
+
*/
|
|
52
|
+
get storage() {
|
|
53
|
+
this.ensureInitialized();
|
|
54
|
+
return this.provider.storage;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the database provider (optional)
|
|
58
|
+
* @returns Database provider or undefined if not configured
|
|
59
|
+
*/
|
|
60
|
+
get database() {
|
|
61
|
+
this.ensureInitialized();
|
|
62
|
+
return this.provider?.database;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Reset the registry (primarily for testing)
|
|
66
|
+
*
|
|
67
|
+
* Warning: This should only be used in tests.
|
|
68
|
+
* In production, providers should be initialized once at app startup.
|
|
69
|
+
*/
|
|
70
|
+
reset() {
|
|
71
|
+
this.provider = null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const services = new ServiceRegistry();
|
|
75
|
+
|
|
76
|
+
export { ServiceRegistry, services };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BusinessError, FunctionResult, FunctionDefinition } from './service-provider-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a function result against the expected success codes and extracts the data.
|
|
4
|
+
*
|
|
5
|
+
* @param result - The raw function result from the provider
|
|
6
|
+
* @param functionDef - The function definition with successCodes
|
|
7
|
+
* @returns The extracted resultData, typed as T
|
|
8
|
+
* @throws BusinessError if statusCode is not in successCodes
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* public loadGalleryList(): Observable<DJGalleryItem[]> {
|
|
13
|
+
* const call = { object: "galleryList" };
|
|
14
|
+
* return from(
|
|
15
|
+
* services.functions.callFunction(handlePutFunc.name, call)
|
|
16
|
+
* .then((result) => validateFunctionResult<DJGalleryItem[]>(result, handlePutFunc))
|
|
17
|
+
* );
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateFunctionResult<T>(result: FunctionResult, functionDef: FunctionDefinition): T;
|
|
22
|
+
/**
|
|
23
|
+
* Validates a function result with a custom success code array.
|
|
24
|
+
* Use this when you don't have a full FunctionDefinition available.
|
|
25
|
+
*
|
|
26
|
+
* @param result - The raw function result from the provider
|
|
27
|
+
* @param successCodes - Array of valid status codes (default: [200])
|
|
28
|
+
* @returns The extracted resultData, typed as T
|
|
29
|
+
* @throws BusinessError if statusCode is not in successCodes
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateResult<T>(result: FunctionResult, successCodes?: number[]): T;
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to check if an error is a BusinessError.
|
|
34
|
+
* Useful in catch blocks to distinguish business errors from technical errors.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* catchError((err) => {
|
|
39
|
+
* if (isBusinessError(err)) {
|
|
40
|
+
* console.log("Business error:", err.code, err.message);
|
|
41
|
+
* }
|
|
42
|
+
* return of(failAction(err));
|
|
43
|
+
* })
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function isBusinessError(error: unknown): error is BusinessError;
|
|
47
|
+
/**
|
|
48
|
+
* Extracts error information for logging/display.
|
|
49
|
+
* Handles both BusinessError and standard Error.
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractErrorInfo(error: unknown): {
|
|
52
|
+
message: string;
|
|
53
|
+
code: number;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=function-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/service-provider/function-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAEnB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,kBAAkB,GAC9B,CAAC,CASH;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,cAAc,EACtB,YAAY,GAAE,MAAM,EAAU,GAC7B,CAAC,CASH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAQA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SC_TECHNICAL_FAILURE, BusinessError } from './service-provider-model.js';
|
|
2
|
+
|
|
3
|
+
function validateFunctionResult(result, functionDef) {
|
|
4
|
+
if (!functionDef.successCodes.includes(result.statusCode)) {
|
|
5
|
+
const message = typeof result.resultData === "string" ? result.resultData : `Function call failed with code ${result.statusCode}`;
|
|
6
|
+
throw new BusinessError(message, result.statusCode);
|
|
7
|
+
}
|
|
8
|
+
return result.resultData;
|
|
9
|
+
}
|
|
10
|
+
function validateResult(result, successCodes = [200]) {
|
|
11
|
+
if (!successCodes.includes(result.statusCode)) {
|
|
12
|
+
const message = typeof result.resultData === "string" ? result.resultData : `Function call failed with code ${result.statusCode}`;
|
|
13
|
+
throw new BusinessError(message, result.statusCode);
|
|
14
|
+
}
|
|
15
|
+
return result.resultData;
|
|
16
|
+
}
|
|
17
|
+
function isBusinessError(error) {
|
|
18
|
+
return error instanceof BusinessError;
|
|
19
|
+
}
|
|
20
|
+
function extractErrorInfo(error) {
|
|
21
|
+
if (isBusinessError(error)) {
|
|
22
|
+
return { message: error.message, code: error.code };
|
|
23
|
+
}
|
|
24
|
+
if (error instanceof Error) {
|
|
25
|
+
return { message: error.message, code: SC_TECHNICAL_FAILURE };
|
|
26
|
+
}
|
|
27
|
+
return { message: String(error), code: SC_TECHNICAL_FAILURE };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { extractErrorInfo, isBusinessError, validateFunctionResult, validateResult };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ServiceRegistry, services } from './ServiceRegistry.js';
|
|
2
|
+
export type { IAuthProvider, AuthUser, UserToken, AuthStateCallback, } from './interfaces/IAuthProvider.js';
|
|
3
|
+
export type { IFunctionProvider, FunctionDefinition, FunctionResult, } from './interfaces/IFunctionProvider.js';
|
|
4
|
+
export type { IStorageProvider, UploadFileRequest, UploadResult, StorageDocument, ListFilesOptions, GetFileOptions, } from './interfaces/IStorageProvider.js';
|
|
5
|
+
export type { IDatabaseProvider, QueryConstraint, QueryOperator, DocumentSnapshot, CollectionCallback, } from './interfaces/IDatabaseProvider.js';
|
|
6
|
+
export type { ServiceProvider } from './interfaces/ServiceProvider.js';
|
|
7
|
+
export type { Unsubscribe } from './interfaces/common.js';
|
|
8
|
+
export { SC_INVALID_USER, SC_TECHNICAL_FAILURE, BusinessError, } from './service-provider-model.js';
|
|
9
|
+
export type { ServiceProviderConfiguration, FunctionParam, FunctionsConfig, MenuElement, NavigationPage, NavigationConfig, LinkObj, Footer, StoreConfig, FileStorage, FileStorageConfig, MessagingConfig, AppConfiguration, UploadFile, CollectionContraint, } from './service-provider-model.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service-provider/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKjE,YAAY,EACV,aAAa,EACb,QAAQ,EACR,SAAS,EACT,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AAKvC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,mCAAmC,CAAC;AAK3C,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,kCAAkC,CAAC;AAK1C,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAK3C,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAKvE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,4BAA4B,EAC5B,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Unsubscribe } from './common.js';
|
|
2
|
+
/**
|
|
3
|
+
* Authenticated user information
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthUser {
|
|
6
|
+
uid: string;
|
|
7
|
+
email: string | null;
|
|
8
|
+
emailVerified: boolean;
|
|
9
|
+
displayName?: string | null;
|
|
10
|
+
photoURL?: string | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* User token with claims
|
|
14
|
+
*/
|
|
15
|
+
export interface UserToken {
|
|
16
|
+
token: string;
|
|
17
|
+
claims: Record<string, unknown>;
|
|
18
|
+
expirationTime: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Callback for auth state changes
|
|
22
|
+
*/
|
|
23
|
+
export type AuthStateCallback = (user: AuthUser | null) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Authentication provider interface
|
|
26
|
+
*
|
|
27
|
+
* Abstracts authentication operations (login, logout, state monitoring)
|
|
28
|
+
* from specific implementations (Firebase, Mock, etc.)
|
|
29
|
+
*/
|
|
30
|
+
export interface IAuthProvider {
|
|
31
|
+
/**
|
|
32
|
+
* Sign in with email and password
|
|
33
|
+
* @throws Error on authentication failure
|
|
34
|
+
*/
|
|
35
|
+
login(email: string, password: string): Promise<AuthUser>;
|
|
36
|
+
/**
|
|
37
|
+
* Sign out the current user
|
|
38
|
+
*/
|
|
39
|
+
logout(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the currently authenticated user
|
|
42
|
+
* @returns User if authenticated, null otherwise
|
|
43
|
+
*/
|
|
44
|
+
getCurrentUser(): AuthUser | null;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a user is currently authenticated
|
|
47
|
+
*/
|
|
48
|
+
isAuthenticated(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get the current user's ID token
|
|
51
|
+
* @param forceRefresh Force token refresh even if not expired
|
|
52
|
+
* @returns Token string or null if not authenticated
|
|
53
|
+
*/
|
|
54
|
+
getIdToken(forceRefresh?: boolean): Promise<string | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Get detailed token result with claims
|
|
57
|
+
* @param forceRefresh Force token refresh even if not expired
|
|
58
|
+
* @returns Token with claims or null if not authenticated
|
|
59
|
+
*/
|
|
60
|
+
getIdTokenResult(forceRefresh?: boolean): Promise<UserToken | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to authentication state changes
|
|
63
|
+
* @param callback Called when auth state changes
|
|
64
|
+
* @returns Unsubscribe function
|
|
65
|
+
*/
|
|
66
|
+
onAuthStateChanged(callback: AuthStateCallback): Unsubscribe;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=IAuthProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthProvider.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/IAuthProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE1D;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;;OAGG;IACH,cAAc,IAAI,QAAQ,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC;IAE3B;;;;OAIG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE3D;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAEpE;;;;OAIG;IACH,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,WAAW,CAAC;CAC9D"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Unsubscribe } from './common.js';
|
|
2
|
+
/**
|
|
3
|
+
* Query operators for filtering
|
|
4
|
+
*/
|
|
5
|
+
export type QueryOperator = "<" | ">" | ">=" | "<=" | "==" | "!=" | "array-contains" | "array-contains-any" | "in" | "not-in";
|
|
6
|
+
/**
|
|
7
|
+
* Query constraint for filtering collections
|
|
8
|
+
*/
|
|
9
|
+
export interface QueryConstraint {
|
|
10
|
+
type: "where";
|
|
11
|
+
field: string;
|
|
12
|
+
operator: QueryOperator;
|
|
13
|
+
value: string | number | boolean | null | Date | Array<string | number | boolean | null | Date>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Document snapshot with data and metadata
|
|
17
|
+
*/
|
|
18
|
+
export interface DocumentSnapshot<T = unknown> {
|
|
19
|
+
/** Document ID */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Document data */
|
|
22
|
+
data: T;
|
|
23
|
+
/** Whether the document exists */
|
|
24
|
+
exists: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Callback for collection changes
|
|
28
|
+
*/
|
|
29
|
+
export type CollectionCallback<T> = (documents: DocumentSnapshot<T>[] | null) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Database provider interface (optional)
|
|
32
|
+
*
|
|
33
|
+
* Abstracts database operations from specific implementations
|
|
34
|
+
* (Firestore, Mock, etc.)
|
|
35
|
+
*
|
|
36
|
+
* Note: This provider is optional - not all apps need real-time database features
|
|
37
|
+
*/
|
|
38
|
+
export interface IDatabaseProvider {
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to a collection with optional filtering
|
|
41
|
+
* @param collectionPath Path to the collection
|
|
42
|
+
* @param callback Called with documents on changes
|
|
43
|
+
* @param constraints Optional query constraints
|
|
44
|
+
* @returns Unsubscribe function
|
|
45
|
+
*/
|
|
46
|
+
onCollection<T = unknown>(collectionPath: string, callback: CollectionCallback<T>, constraints?: QueryConstraint[]): Unsubscribe;
|
|
47
|
+
/**
|
|
48
|
+
* Get a single document
|
|
49
|
+
* @param collectionPath Path to the collection
|
|
50
|
+
* @param documentId Document ID
|
|
51
|
+
* @returns Document snapshot
|
|
52
|
+
*/
|
|
53
|
+
getDocument<T = unknown>(collectionPath: string, documentId: string): Promise<DocumentSnapshot<T>>;
|
|
54
|
+
/**
|
|
55
|
+
* Set/overwrite a document
|
|
56
|
+
* @param collectionPath Path to the collection
|
|
57
|
+
* @param documentId Document ID
|
|
58
|
+
* @param data Document data
|
|
59
|
+
*/
|
|
60
|
+
setDocument<T = unknown>(collectionPath: string, documentId: string, data: T): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Update specific fields in a document
|
|
63
|
+
* @param collectionPath Path to the collection
|
|
64
|
+
* @param documentId Document ID
|
|
65
|
+
* @param data Partial document data to update
|
|
66
|
+
*/
|
|
67
|
+
updateDocument(collectionPath: string, documentId: string, data: Record<string, unknown>): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Delete a document
|
|
70
|
+
* @param collectionPath Path to the collection
|
|
71
|
+
* @param documentId Document ID
|
|
72
|
+
*/
|
|
73
|
+
deleteDocument(collectionPath: string, documentId: string): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=IDatabaseProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDatabaseProvider.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/IDatabaseProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,GAAG,GACH,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,gBAAgB,GAChB,oBAAoB,GACpB,IAAI,GACJ,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EACD,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAClC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,KACpC,IAAI,CAAC;AAEV;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,YAAY,CAAC,CAAC,GAAG,OAAO,EACtB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC/B,WAAW,CAAC,EAAE,eAAe,EAAE,GAC9B,WAAW,CAAC;IAEf;;;;;OAKG;IACH,WAAW,CAAC,CAAC,GAAG,OAAO,EACrB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,WAAW,CAAC,CAAC,GAAG,OAAO,EACrB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,CAAC,GACN,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;OAKG;IACH,cAAc,CACZ,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result from a cloud function call
|
|
3
|
+
*/
|
|
4
|
+
export interface FunctionResult {
|
|
5
|
+
resultData: unknown;
|
|
6
|
+
statusCode: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Cloud function definition
|
|
10
|
+
*/
|
|
11
|
+
export interface FunctionDefinition {
|
|
12
|
+
/** Function name */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Status codes considered successful */
|
|
15
|
+
successCodes: number[];
|
|
16
|
+
/** Show full-screen loading indicator */
|
|
17
|
+
fadeWindow: boolean;
|
|
18
|
+
/** Text shown on success */
|
|
19
|
+
successTxt: string | unknown;
|
|
20
|
+
/** Text shown while pending */
|
|
21
|
+
pendingTxt: string | unknown;
|
|
22
|
+
/** Additional parameters */
|
|
23
|
+
param?: Record<string, unknown>;
|
|
24
|
+
/** Redirect route after success */
|
|
25
|
+
redirect?: string;
|
|
26
|
+
/** Logout user on failure */
|
|
27
|
+
logoutOnFail?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Cloud functions provider interface
|
|
31
|
+
*
|
|
32
|
+
* Abstracts cloud function calls from specific implementations
|
|
33
|
+
* (Firebase Functions, Mock, REST API, etc.)
|
|
34
|
+
*/
|
|
35
|
+
export interface IFunctionProvider {
|
|
36
|
+
/**
|
|
37
|
+
* Call a cloud function
|
|
38
|
+
* @param functionName Name of the function to call
|
|
39
|
+
* @param data Data to pass to the function
|
|
40
|
+
* @returns Function result with status code
|
|
41
|
+
*/
|
|
42
|
+
callFunction(functionName: string, data: unknown): Promise<FunctionResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Configure the functions region
|
|
45
|
+
* @param region Cloud region (e.g., 'europe-west3')
|
|
46
|
+
*/
|
|
47
|
+
setRegion(region: string): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=IFunctionProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFunctionProvider.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/IFunctionProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3E;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
|