@progressive-development/pd-spa-helper 1.0.0 → 1.0.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.
- 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/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/generated/locale-wrapper/be-wrapper.d.ts +0 -63
- package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +0 -1
- package/dist/generated/locale-wrapper/de-wrapper.d.ts +0 -63
- package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +0 -1
- package/dist/generated/locale-wrapper/en-wrapper.d.ts +0 -63
- package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +0 -1
- 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,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"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File upload request
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadFileRequest {
|
|
5
|
+
/** Target file name in storage */
|
|
6
|
+
fileName: string;
|
|
7
|
+
/** Base64 encoded file data URL */
|
|
8
|
+
base64DataURL: string;
|
|
9
|
+
/** Human-readable description name */
|
|
10
|
+
descriptionName: string;
|
|
11
|
+
/** Detailed description */
|
|
12
|
+
description: string;
|
|
13
|
+
/** Storage bucket/container name */
|
|
14
|
+
storageName: string;
|
|
15
|
+
/** Reference key for grouping files */
|
|
16
|
+
referenceKey: string;
|
|
17
|
+
/** Optional subfolder path */
|
|
18
|
+
subFolderName?: string;
|
|
19
|
+
/** Mark file as read-only */
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result of an upload operation
|
|
24
|
+
*/
|
|
25
|
+
export interface UploadResult {
|
|
26
|
+
/** Full storage path of uploaded file */
|
|
27
|
+
fullPath: string;
|
|
28
|
+
/** Download URL for the file */
|
|
29
|
+
downloadURL: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Stored document metadata
|
|
33
|
+
*/
|
|
34
|
+
export interface StorageDocument {
|
|
35
|
+
/** Storage bucket/container name */
|
|
36
|
+
storageName: string;
|
|
37
|
+
/** Reference key for grouping */
|
|
38
|
+
refKey: string;
|
|
39
|
+
/** File name */
|
|
40
|
+
fileName: string;
|
|
41
|
+
/** Full storage path */
|
|
42
|
+
filePath: string;
|
|
43
|
+
/** Optional subfolder */
|
|
44
|
+
subFolderName?: string;
|
|
45
|
+
/** MIME type or document type */
|
|
46
|
+
documentType?: string;
|
|
47
|
+
/** Human-readable description */
|
|
48
|
+
description?: string;
|
|
49
|
+
/** Description name */
|
|
50
|
+
descriptionName?: string;
|
|
51
|
+
/** Creation timestamp */
|
|
52
|
+
creation?: Date;
|
|
53
|
+
/** Creator user ID */
|
|
54
|
+
creator?: string;
|
|
55
|
+
/** File size in bytes */
|
|
56
|
+
size?: number;
|
|
57
|
+
/** Read-only flag */
|
|
58
|
+
readonly?: boolean;
|
|
59
|
+
/** Additional metadata */
|
|
60
|
+
metaData?: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Options for listing files
|
|
64
|
+
*/
|
|
65
|
+
export interface ListFilesOptions {
|
|
66
|
+
/** Storage bucket name */
|
|
67
|
+
storageName: string;
|
|
68
|
+
/** Reference key for filtering */
|
|
69
|
+
referenceKey: string;
|
|
70
|
+
/** Optional subfolder */
|
|
71
|
+
subFolderName?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Options for getting a single file
|
|
75
|
+
*/
|
|
76
|
+
export interface GetFileOptions {
|
|
77
|
+
/** Storage bucket name */
|
|
78
|
+
storageName: string;
|
|
79
|
+
/** Reference key */
|
|
80
|
+
referenceKey: string;
|
|
81
|
+
/** File name */
|
|
82
|
+
fileName: string;
|
|
83
|
+
/** Optional subfolder */
|
|
84
|
+
subFolderName?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* File storage provider interface
|
|
88
|
+
*
|
|
89
|
+
* Abstracts file storage operations from specific implementations
|
|
90
|
+
* (Firebase Storage, S3, Mock, etc.)
|
|
91
|
+
*/
|
|
92
|
+
export interface IStorageProvider {
|
|
93
|
+
/**
|
|
94
|
+
* Upload a file to storage
|
|
95
|
+
* @returns Upload result with path and download URL
|
|
96
|
+
*/
|
|
97
|
+
uploadFile(request: UploadFileRequest): Promise<UploadResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Download a file from storage
|
|
100
|
+
* @returns Base64 encoded data URL
|
|
101
|
+
*/
|
|
102
|
+
downloadFile(options: GetFileOptions): Promise<string>;
|
|
103
|
+
/**
|
|
104
|
+
* Delete a file from storage
|
|
105
|
+
*/
|
|
106
|
+
deleteFile(options: GetFileOptions): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* List files in a storage location
|
|
109
|
+
* @returns Array of storage documents
|
|
110
|
+
*/
|
|
111
|
+
listFiles(options: ListFilesOptions): Promise<StorageDocument[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Get metadata for a single file
|
|
114
|
+
* @returns Storage document metadata or null if not found
|
|
115
|
+
*/
|
|
116
|
+
getFile(options: GetFileOptions): Promise<StorageDocument | null>;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=IStorageProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStorageProvider.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/IStorageProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9D;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjE;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IAuthProvider } from './IAuthProvider.js';
|
|
2
|
+
import { IFunctionProvider } from './IFunctionProvider.js';
|
|
3
|
+
import { IStorageProvider } from './IStorageProvider.js';
|
|
4
|
+
import { IDatabaseProvider } from './IDatabaseProvider.js';
|
|
5
|
+
/**
|
|
6
|
+
* Complete service provider configuration
|
|
7
|
+
*
|
|
8
|
+
* This is the main type that provider packages (pd-provider-firebase,
|
|
9
|
+
* pd-provider-mock, etc.) must implement.
|
|
10
|
+
*
|
|
11
|
+
* Note: Messaging is NOT part of this interface - it remains Firebase-specific
|
|
12
|
+
* and is handled directly in pd-provider-firebase.
|
|
13
|
+
*/
|
|
14
|
+
export interface ServiceProvider {
|
|
15
|
+
/** Authentication provider (required) */
|
|
16
|
+
auth: IAuthProvider;
|
|
17
|
+
/** Cloud functions provider (required) */
|
|
18
|
+
functions: IFunctionProvider;
|
|
19
|
+
/** File storage provider (required) */
|
|
20
|
+
storage: IStorageProvider;
|
|
21
|
+
/** Database provider (optional - not all apps need real-time database) */
|
|
22
|
+
database?: IDatabaseProvider;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/ServiceProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,IAAI,EAAE,aAAa,CAAC;IAEpB,0CAA0C;IAC1C,SAAS,EAAE,iBAAiB,CAAC;IAE7B,uCAAuC;IACvC,OAAO,EAAE,gBAAgB,CAAC;IAE1B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/service-provider/interfaces/common.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC"}
|