@ph-cms/client-sdk 0.1.5 → 0.1.7
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/README.md +366 -135
- package/dist/auth/base-provider.d.ts +151 -0
- package/dist/auth/base-provider.js +210 -0
- package/dist/auth/firebase-provider.d.ts +46 -12
- package/dist/auth/firebase-provider.js +54 -42
- package/dist/auth/interfaces.d.ts +25 -2
- package/dist/auth/jwt-utils.d.ts +53 -0
- package/dist/auth/jwt-utils.js +85 -0
- package/dist/auth/local-provider.d.ts +34 -17
- package/dist/auth/local-provider.js +45 -39
- package/dist/client.d.ts +23 -0
- package/dist/client.js +116 -26
- package/dist/context.d.ts +10 -0
- package/dist/context.js +18 -7
- package/dist/hooks/useFirebaseAuthSync.d.ts +108 -0
- package/dist/hooks/useFirebaseAuthSync.js +221 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +9 -6
- package/dist/modules/auth.d.ts +2 -2
- package/dist/modules/auth.js +11 -20
- package/dist/types.d.ts +15 -1
- package/dist/types.js +7 -15
- package/package.json +1 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FirebaseAuthSync = exports.useFirebaseAuthSync = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const context_1 = require("../context");
|
|
39
|
+
/**
|
|
40
|
+
* `useFirebaseAuthSync`
|
|
41
|
+
*
|
|
42
|
+
* Subscribes to Firebase `onAuthStateChanged` and automatically synchronizes
|
|
43
|
+
* the Firebase authentication state with the PH-CMS backend:
|
|
44
|
+
*
|
|
45
|
+
* - **Firebase user signs in** and PH-CMS is not yet authenticated →
|
|
46
|
+
* obtains a Firebase ID token and calls `loginWithFirebase({ idToken })`
|
|
47
|
+
* which exchanges the token for PH-CMS access/refresh tokens and then
|
|
48
|
+
* fetches the user profile via `/auth/me`.
|
|
49
|
+
*
|
|
50
|
+
* - **Firebase user signs out** and PH-CMS is still authenticated →
|
|
51
|
+
* calls `logout()` on PH-CMS (configurable via `logoutOnFirebaseSignOut`).
|
|
52
|
+
*
|
|
53
|
+
* The hook must be rendered **inside** `<PHCMSProvider>` because it relies
|
|
54
|
+
* on context values (`isAuthenticated`, `isLoading`) and the `loginWithFirebase`
|
|
55
|
+
* / `logout` actions exposed by the auth module.
|
|
56
|
+
*
|
|
57
|
+
* ### Example
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* import { useFirebaseAuthSync } from '@ph-cms/client-sdk';
|
|
61
|
+
* import { getAuth } from 'firebase/auth';
|
|
62
|
+
*
|
|
63
|
+
* const firebaseAuth = getAuth(firebaseApp);
|
|
64
|
+
*
|
|
65
|
+
* function App() {
|
|
66
|
+
* useFirebaseAuthSync({ firebaseAuth });
|
|
67
|
+
* return <MainContent />;
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
const useFirebaseAuthSync = (options) => {
|
|
72
|
+
const { firebaseAuth, logoutOnFirebaseSignOut = true, onSyncSuccess, onSyncError, } = options;
|
|
73
|
+
const { client, isAuthenticated, isLoading, refreshUser } = (0, context_1.usePHCMSContext)();
|
|
74
|
+
// Use refs for values that change frequently but should not re-trigger
|
|
75
|
+
// the effect (which would tear down and re-create the Firebase listener).
|
|
76
|
+
const isAuthenticatedRef = (0, react_1.useRef)(isAuthenticated);
|
|
77
|
+
const isLoadingRef = (0, react_1.useRef)(isLoading);
|
|
78
|
+
const syncInProgressRef = (0, react_1.useRef)(false);
|
|
79
|
+
const isSyncingStateRef = (0, react_1.useRef)(false);
|
|
80
|
+
const [isSyncing, setIsSyncing] = react_1.default.useState(false);
|
|
81
|
+
// Keep refs up to date.
|
|
82
|
+
(0, react_1.useEffect)(() => {
|
|
83
|
+
isAuthenticatedRef.current = isAuthenticated;
|
|
84
|
+
}, [isAuthenticated]);
|
|
85
|
+
(0, react_1.useEffect)(() => {
|
|
86
|
+
isLoadingRef.current = isLoading;
|
|
87
|
+
}, [isLoading]);
|
|
88
|
+
// Stable callback refs so the effect closure doesn't go stale.
|
|
89
|
+
const onSyncSuccessRef = (0, react_1.useRef)(onSyncSuccess);
|
|
90
|
+
const onSyncErrorRef = (0, react_1.useRef)(onSyncError);
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
onSyncSuccessRef.current = onSyncSuccess;
|
|
93
|
+
}, [onSyncSuccess]);
|
|
94
|
+
(0, react_1.useEffect)(() => {
|
|
95
|
+
onSyncErrorRef.current = onSyncError;
|
|
96
|
+
}, [onSyncError]);
|
|
97
|
+
const handleFirebaseUser = (0, react_1.useCallback)(async (fbUser) => {
|
|
98
|
+
if (fbUser) {
|
|
99
|
+
// Firebase user is signed in.
|
|
100
|
+
// Only exchange if PH-CMS is not already authenticated and not loading.
|
|
101
|
+
if (!isAuthenticatedRef.current &&
|
|
102
|
+
!isLoadingRef.current &&
|
|
103
|
+
!syncInProgressRef.current) {
|
|
104
|
+
syncInProgressRef.current = true;
|
|
105
|
+
isSyncingStateRef.current = true;
|
|
106
|
+
setIsSyncing(true);
|
|
107
|
+
try {
|
|
108
|
+
const idToken = await fbUser.getIdToken();
|
|
109
|
+
await client.auth.loginWithFirebase({ idToken });
|
|
110
|
+
// loginWithFirebase stores the tokens in the provider.
|
|
111
|
+
// Now refresh the context so `isAuthenticated` and `user` update.
|
|
112
|
+
await refreshUser();
|
|
113
|
+
onSyncSuccessRef.current?.();
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('[useFirebaseAuthSync] Token exchange failed:', error);
|
|
117
|
+
onSyncErrorRef.current?.(error);
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
syncInProgressRef.current = false;
|
|
121
|
+
isSyncingStateRef.current = false;
|
|
122
|
+
setIsSyncing(false);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Firebase user signed out.
|
|
128
|
+
if (logoutOnFirebaseSignOut && isAuthenticatedRef.current) {
|
|
129
|
+
try {
|
|
130
|
+
await client.auth.logout();
|
|
131
|
+
await refreshUser();
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error('[useFirebaseAuthSync] Logout failed:', error);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// `client`, `refreshUser`, and `logoutOnFirebaseSignOut` are stable
|
|
140
|
+
// across renders (client is a singleton, refreshUser is memoized,
|
|
141
|
+
// logoutOnFirebaseSignOut is typically a constant).
|
|
142
|
+
[client, refreshUser, logoutOnFirebaseSignOut]);
|
|
143
|
+
(0, react_1.useEffect)(() => {
|
|
144
|
+
// Dynamically import the listener so that this file has zero runtime
|
|
145
|
+
// dependency on firebase/auth at the module level. The `Auth` object
|
|
146
|
+
// passed in already carries the implementation; we just need the
|
|
147
|
+
// `onAuthStateChanged` function reference from it.
|
|
148
|
+
//
|
|
149
|
+
// Firebase Auth's `onAuthStateChanged` is available on the Auth object
|
|
150
|
+
// via the modular API through the standalone function, but we can also
|
|
151
|
+
// call it as `firebaseAuth.onAuthStateChanged(...)` which works on the
|
|
152
|
+
// Auth instance directly (compat style). However, the recommended
|
|
153
|
+
// modular approach is to use the standalone function.
|
|
154
|
+
//
|
|
155
|
+
// To avoid directly importing from 'firebase/auth' at the top level
|
|
156
|
+
// (since it's an optional peer dep), we use a dynamic import wrapped
|
|
157
|
+
// in a try-catch. If the import fails, we fall back to a noop.
|
|
158
|
+
let unsubscribe = null;
|
|
159
|
+
let cancelled = false;
|
|
160
|
+
const setup = async () => {
|
|
161
|
+
try {
|
|
162
|
+
// Dynamic import so builds without firebase don't break.
|
|
163
|
+
const firebaseAuthModule = await Promise.resolve().then(() => __importStar(require('firebase/auth')));
|
|
164
|
+
if (cancelled)
|
|
165
|
+
return;
|
|
166
|
+
unsubscribe = firebaseAuthModule.onAuthStateChanged(firebaseAuth, (fbUser) => {
|
|
167
|
+
// Fire and forget; errors are caught inside handleFirebaseUser.
|
|
168
|
+
void handleFirebaseUser(fbUser);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// firebase/auth is not installed — this is fine, it's optional.
|
|
173
|
+
console.warn('[useFirebaseAuthSync] firebase/auth could not be imported. ' +
|
|
174
|
+
'Make sure it is installed if you intend to use Firebase auth sync.');
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
void setup();
|
|
178
|
+
return () => {
|
|
179
|
+
cancelled = true;
|
|
180
|
+
unsubscribe?.();
|
|
181
|
+
};
|
|
182
|
+
}, [firebaseAuth, handleFirebaseUser]);
|
|
183
|
+
return { isSyncing };
|
|
184
|
+
};
|
|
185
|
+
exports.useFirebaseAuthSync = useFirebaseAuthSync;
|
|
186
|
+
/**
|
|
187
|
+
* `<FirebaseAuthSync>`
|
|
188
|
+
*
|
|
189
|
+
* A convenience wrapper component that calls `useFirebaseAuthSync` internally.
|
|
190
|
+
* Place it **inside** `<PHCMSProvider>` and wrap the part of the tree that
|
|
191
|
+
* should wait for or react to Firebase↔PH-CMS auth synchronization.
|
|
192
|
+
*
|
|
193
|
+
* ### Example
|
|
194
|
+
*
|
|
195
|
+
* ```tsx
|
|
196
|
+
* import { PHCMSProvider, FirebaseAuthSync } from '@ph-cms/client-sdk';
|
|
197
|
+
* import { getAuth } from 'firebase/auth';
|
|
198
|
+
*
|
|
199
|
+
* const firebaseAuth = getAuth(firebaseApp);
|
|
200
|
+
*
|
|
201
|
+
* function App() {
|
|
202
|
+
* return (
|
|
203
|
+
* <PHCMSProvider client={client}>
|
|
204
|
+
* <FirebaseAuthSync firebaseAuth={firebaseAuth}>
|
|
205
|
+
* <MainContent />
|
|
206
|
+
* </FirebaseAuthSync>
|
|
207
|
+
* </PHCMSProvider>
|
|
208
|
+
* );
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
const FirebaseAuthSync = ({ firebaseAuth, logoutOnFirebaseSignOut, onSyncSuccess, onSyncError, children, }) => {
|
|
213
|
+
(0, exports.useFirebaseAuthSync)({
|
|
214
|
+
firebaseAuth,
|
|
215
|
+
logoutOnFirebaseSignOut,
|
|
216
|
+
onSyncSuccess,
|
|
217
|
+
onSyncError,
|
|
218
|
+
});
|
|
219
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
220
|
+
};
|
|
221
|
+
exports.FirebaseAuthSync = FirebaseAuthSync;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
export * from './auth/base-provider';
|
|
2
|
+
export * from './auth/firebase-provider';
|
|
1
3
|
export * from './auth/interfaces';
|
|
4
|
+
export * from './auth/jwt-utils';
|
|
2
5
|
export * from './auth/local-provider';
|
|
3
|
-
export * from './auth/firebase-provider';
|
|
4
|
-
export * from './errors';
|
|
5
6
|
export * from './client';
|
|
7
|
+
export * from './errors';
|
|
6
8
|
export * from './modules/auth';
|
|
7
|
-
export * from './modules/content';
|
|
8
9
|
export * from './modules/channel';
|
|
9
|
-
export * from './modules/
|
|
10
|
+
export * from './modules/content';
|
|
10
11
|
export * from './modules/media';
|
|
12
|
+
export * from './modules/terms';
|
|
11
13
|
export * from './context';
|
|
12
14
|
export * from './hooks/useAuth';
|
|
13
|
-
export * from './hooks/useContent';
|
|
14
15
|
export * from './hooks/useChannel';
|
|
15
|
-
export * from './hooks/
|
|
16
|
+
export * from './hooks/useContent';
|
|
17
|
+
export * from './hooks/useFirebaseAuthSync';
|
|
16
18
|
export * from './hooks/useMedia';
|
|
19
|
+
export * from './hooks/useTerms';
|
|
17
20
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -14,20 +14,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth/base-provider"), exports);
|
|
18
|
+
__exportStar(require("./auth/firebase-provider"), exports);
|
|
17
19
|
__exportStar(require("./auth/interfaces"), exports);
|
|
20
|
+
__exportStar(require("./auth/jwt-utils"), exports);
|
|
18
21
|
__exportStar(require("./auth/local-provider"), exports);
|
|
19
|
-
__exportStar(require("./auth/firebase-provider"), exports);
|
|
20
|
-
__exportStar(require("./errors"), exports);
|
|
21
22
|
__exportStar(require("./client"), exports);
|
|
23
|
+
__exportStar(require("./errors"), exports);
|
|
22
24
|
__exportStar(require("./modules/auth"), exports);
|
|
23
|
-
__exportStar(require("./modules/content"), exports);
|
|
24
25
|
__exportStar(require("./modules/channel"), exports);
|
|
25
|
-
__exportStar(require("./modules/
|
|
26
|
+
__exportStar(require("./modules/content"), exports);
|
|
26
27
|
__exportStar(require("./modules/media"), exports);
|
|
28
|
+
__exportStar(require("./modules/terms"), exports);
|
|
27
29
|
__exportStar(require("./context"), exports);
|
|
28
30
|
__exportStar(require("./hooks/useAuth"), exports);
|
|
29
|
-
__exportStar(require("./hooks/useContent"), exports);
|
|
30
31
|
__exportStar(require("./hooks/useChannel"), exports);
|
|
31
|
-
__exportStar(require("./hooks/
|
|
32
|
+
__exportStar(require("./hooks/useContent"), exports);
|
|
33
|
+
__exportStar(require("./hooks/useFirebaseAuthSync"), exports);
|
|
32
34
|
__exportStar(require("./hooks/useMedia"), exports);
|
|
35
|
+
__exportStar(require("./hooks/useTerms"), exports);
|
|
33
36
|
__exportStar(require("./types"), exports);
|
package/dist/modules/auth.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { AuthResponse, FirebaseExchangeRequest, LoginRequest, RegisterRequest, UserDto } from "@ph-cms/api-contract";
|
|
1
2
|
import { AxiosInstance } from "axios";
|
|
2
3
|
import { AuthProvider } from "../auth/interfaces";
|
|
3
|
-
import { LoginRequest, RegisterRequest, AuthResponse, UserDto, FirebaseExchangeRequest } from "@ph-cms/api-contract";
|
|
4
4
|
export declare class AuthModule {
|
|
5
5
|
private client;
|
|
6
6
|
private provider?;
|
|
7
7
|
constructor(client: AxiosInstance, provider?: AuthProvider | undefined);
|
|
8
8
|
/**
|
|
9
|
-
* Logs in the user and updates the AuthProvider
|
|
9
|
+
* Logs in the user and updates the AuthProvider tokens automatically.
|
|
10
10
|
*/
|
|
11
11
|
login(data: LoginRequest): Promise<AuthResponse>;
|
|
12
12
|
/**
|
package/dist/modules/auth.js
CHANGED
|
@@ -9,7 +9,7 @@ class AuthModule {
|
|
|
9
9
|
this.provider = provider;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Logs in the user and updates the AuthProvider
|
|
12
|
+
* Logs in the user and updates the AuthProvider tokens automatically.
|
|
13
13
|
*/
|
|
14
14
|
async login(data) {
|
|
15
15
|
const validation = api_contract_1.LoginSchema.safeParse(data);
|
|
@@ -17,17 +17,8 @@ class AuthModule {
|
|
|
17
17
|
throw new errors_1.ValidationError("Invalid login data", validation.error.errors);
|
|
18
18
|
}
|
|
19
19
|
const response = await this.client.post('/api/auth/login', data);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// We need to cast to LocalAuthProvider to access setTokens,
|
|
23
|
-
// but strictly speaking we shouldn't assume implementation details here.
|
|
24
|
-
// However, for this SDK, it's a practical coupling.
|
|
25
|
-
// Or we assume the user handles it.
|
|
26
|
-
// Let's assume the user handles it via the response for now,
|
|
27
|
-
// OR we can try to update it if the method exists.
|
|
28
|
-
if ('setTokens' in this.provider) {
|
|
29
|
-
this.provider.setTokens(response.accessToken, response.refreshToken);
|
|
30
|
-
}
|
|
20
|
+
if (this.provider) {
|
|
21
|
+
this.provider.setTokens(response.accessToken, response.refreshToken);
|
|
31
22
|
}
|
|
32
23
|
return response;
|
|
33
24
|
}
|
|
@@ -40,8 +31,7 @@ class AuthModule {
|
|
|
40
31
|
throw new errors_1.ValidationError("Invalid Firebase token data", validation.error.errors);
|
|
41
32
|
}
|
|
42
33
|
const response = await this.client.post('/api/auth/firebase/exchange', data);
|
|
43
|
-
|
|
44
|
-
if (this.provider && ('setTokens' in this.provider)) {
|
|
34
|
+
if (this.provider) {
|
|
45
35
|
this.provider.setTokens(response.accessToken, response.refreshToken);
|
|
46
36
|
}
|
|
47
37
|
return response;
|
|
@@ -51,23 +41,24 @@ class AuthModule {
|
|
|
51
41
|
if (!validation.success) {
|
|
52
42
|
throw new errors_1.ValidationError("Invalid register data", validation.error.errors);
|
|
53
43
|
}
|
|
54
|
-
|
|
44
|
+
const response = await this.client.post('/api/auth/register', data);
|
|
45
|
+
if (this.provider) {
|
|
46
|
+
this.provider.setTokens(response.accessToken, response.refreshToken);
|
|
47
|
+
}
|
|
48
|
+
return response;
|
|
55
49
|
}
|
|
56
50
|
async me() {
|
|
57
51
|
return this.client.get('/api/auth/me');
|
|
58
52
|
}
|
|
59
53
|
async refresh(refreshToken) {
|
|
60
|
-
// Validate refreshToken string? It's just a string.
|
|
61
54
|
return this.client.post('/api/auth/refresh', { refreshToken });
|
|
62
55
|
}
|
|
63
56
|
async logout() {
|
|
64
57
|
if (this.provider) {
|
|
65
58
|
await this.provider.logout();
|
|
66
59
|
}
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// But if we want to invalidate on server (blacklist), we call endpoint.
|
|
70
|
-
// Routes has /api/auth/logout.
|
|
60
|
+
// Call the server endpoint to invalidate the session if applicable.
|
|
61
|
+
// JWT-based auth is stateless, but the server may implement a blacklist.
|
|
71
62
|
await this.client.post('/api/auth/logout').catch(() => { }); // Ignore error on logout
|
|
72
63
|
}
|
|
73
64
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type { AuthProvider } from './auth/interfaces';
|
|
2
|
+
export type { JwtPayload } from './auth/jwt-utils';
|
|
3
|
+
export type { PHCMSClientConfig } from './client';
|
|
4
|
+
export type { AuthStatus, PHCMSContextType, PHCMSProviderProps } from './context';
|
|
5
|
+
export type { FirebaseAuthSyncProps, UseFirebaseAuthSyncOptions, UseFirebaseAuthSyncReturn } from './hooks/useFirebaseAuthSync';
|
|
6
|
+
export type { AuthResponse, FirebaseExchangeRequest, LoginRequest, RefreshTokenRequest, RegisterRequest } from '@ph-cms/api-contract';
|
|
7
|
+
export type { UserDto } from '@ph-cms/api-contract';
|
|
8
|
+
export type { ChannelDto, CheckHierarchyQuery, CreateChannelDto, ListChannelQuery, PagedChannelListResponse } from '@ph-cms/api-contract';
|
|
9
|
+
export type { ContentDto, ContentMediaDto, CreateContentRequest, ListContentQuery, PagedContentListResponse, UpdateContentRequest } from '@ph-cms/api-contract';
|
|
10
|
+
export type { HierarchySetDto } from '@ph-cms/api-contract';
|
|
11
|
+
export type { PermissionPolicySetDto } from '@ph-cms/api-contract';
|
|
12
|
+
export type { ListTermsQuery, PagedTermListResponse, TermDto } from '@ph-cms/api-contract';
|
|
13
|
+
export type { BoundsQuery, GeoJSON } from '@ph-cms/api-contract';
|
|
14
|
+
export type { MediaUploadTicketBatchRequest, MediaUploadTicketBatchResponse, MediaUploadTicketRequest, MediaUploadTicketResponse } from '@ph-cms/api-contract';
|
|
15
|
+
export type { PagedResponse } from '@ph-cms/api-contract';
|
package/dist/types.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// PH-CMS Client SDK — Centralized Type Exports
|
|
4
|
+
//
|
|
5
|
+
// This file re-exports all types used across the SDK so that consumers can
|
|
6
|
+
// import them from a single entry point (`@ph-cms/client-sdk`) without needing
|
|
7
|
+
// to dig into `@ph-cms/api-contract` (which ships as a pre-built dependency).
|
|
8
|
+
// =============================================================================
|
|
16
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("@ph-cms/api-contract"), exports);
|