@adobe/spacecat-helix-content-sdk v1.4.13
Spacecat Helix Content SDK
This library offers a minimal SDK around content bus modifications for Helix. It currently supports 2 backends:
- Microsoft Sharepoint, via an application service principal
- Google Drive, via a service account
:warning: Still early stage, so use at your own risk knowing we have:
- No input validation
- Some error handling
- Some tests
Install
Just run:
npm install @adobe/spacecat-helix-content-sdkGiving access to the client
Google Drive
- Go to your Google Cloud console
- Select the project to create the API access in
- Enable the
Google Drive API,Google Docs API&Google Sheets API - Create a new service account
- Create a new key for the service account
- Share the Google Drive folder for the project with the service account email
Microsoft Sharepoint
- Create a new App Registration in your azure portal
- Create a client credential (certificate or secret) for it
- Set the API permissions to
Files.SelectedOperations.SelectedandSites.Selected - Give the app access to the desired Sharepoint site collection: https://devblogs.microsoft.com/microsoft365dev/controlling-app-access-on-specific-sharepoint-site-collections/
Usage
Google Drive
import { createFrom } from '../src/index.js';
const gdriveclient = await createFrom({
client_email: '',
private_key: '',
private_key_id: '',
project_id: '',
client_id: '',
type: '',
auth_uri: '',
token_uri: '',
auth_provider_x509_cert_url: '',
client_x509_cert_url: '',
universe_domain: '',
}, { url: 'GOOGLE_DRIVE_URL', type: 'drive.google' });
const document = await gdriveclient.getDocument('/index');
const redirects = await gdriveclient.get();
const metadata = await document.getMetadata();
metadata.set('testkey', { value: 'testvalue', type: 'text' });
const results = await document.updateMetadata(metadata);
console.log(results);
await redirects.append([{ from: '/from1', to: '/to2' }, { from: '/from3', to: '/to2' }]);Microsoft Sharepoint Drive
import { createFrom } from '../src/index.js';
const onedriveclient = await createFrom({
clientId: '',
clientSecret: '',
authority: '',
domainId: '',
}, { url: 'ONEDRIVE_URL', type: 'onedrive' });
const document = await onedriveclient.getDocument('./index.docx');
const sheet = await gdriveclient.getSheet();
const metadata = document.getMetadata();
console.log(metadata);
metadata.set('testkey', { value: 'testvalue', type: 'text' });
await document.updateMetadata(metadata);
await sheet.append([{ from: '/from1', to: '/to2' }, { from: '/from3', to: '/to2' }]);Client API
See: client.interface.js
6 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
7 months ago
7 months ago
12 months ago
7 months ago
12 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
6 months ago
9 months ago
6 months ago
9 months ago
12 months ago
5 months ago
9 months ago
5 months ago
9 months ago
9 months ago
9 months ago
8 months ago
8 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago