-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor sdk-utils to export additional functions and types
- Loading branch information
1 parent
3664d14
commit c5ccb6e
Showing
6 changed files
with
194 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as getDatabase } from './getDatabase'; | ||
export { default as getDatabaseEntry } from './getDatabaseEntry'; | ||
export { default as getDatabaseTable } from './getDatabaseTable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
export * from './getDatabase'; | ||
export * from './getDatabaseEntry'; | ||
export * from './getDatabaseRaw'; | ||
import { getDatabase, getDatabaseEntry, getDatabaseTable } from './get'; | ||
import type { STUDIOCMS_SDK } from './types'; | ||
|
||
export * from './utils'; | ||
export * from './types'; | ||
/** | ||
* ## The StudioCMS SDK | ||
* | ||
* The StudioCMS SDK provides a set of utility functions to interact with the StudioCMS database. | ||
* | ||
* @example | ||
* ```typescript | ||
* // Install and import the SDK `npm install @studiocms/core` | ||
* import StudioCMS_SDK from '@studiocms/core/sdk-utils'; | ||
* // or using the virtual module (Included by default in StudioCMS) | ||
* import StudioCMS_SDK from 'studiocms:sdk'; | ||
* | ||
* const users = await StudioCMS_SDK.GET.database('users'); | ||
* | ||
* console.log(users); | ||
* ``` | ||
*/ | ||
export const StudioCMS_SDK: STUDIOCMS_SDK = { | ||
GET: { | ||
database: async (database) => await getDatabase(database), | ||
databaseEntry: (database) => getDatabaseEntry(database), | ||
databaseTable: async (database) => await getDatabaseTable(database), | ||
}, | ||
}; | ||
|
||
export default StudioCMS_SDK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters