1.2.3 • Published 8 months ago
@adobe/spacecat-helix-content-sdk v1.2.3
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
- No error handling
- No tests
Install
Just run:
npm install @adobe/spacecat-helix-content-sdk
Giving 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.Selected
andSites.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' });
document = await gdriveclient.read('/index');
metadata = document.getMetadata();
metadata.set('testkey', { value: 'testvalue', type: 'text' });
const results = await document.updateMetadata(metadata);
console.log(results);
Microsoft Sharepoint Drive
import { createFrom } from '../src/index.js';
const onedriveclient = await createFrom({
clientId: '',
clientSecret: '',
authority: '',
domainId: '',
}, { url: 'ONEDRIVE_URL', type: 'onedrive' });
let document = await onedriveclient.read('./index.docx');
let metadata = document.getMetadata();
console.log(metadata);
metadata.set('testkey', { value: 'testvalue', type: 'text' });
document.updateMetadata(metadata);
await onedriveclient.save(document);
Client API
See: client.interface.js
1.2.3
8 months ago
1.2.2
8 months ago
1.2.1
8 months ago
1.2.0
9 months ago
1.1.16
9 months ago
1.1.15
9 months ago
1.1.14
9 months ago
1.1.13
9 months ago
1.1.12
9 months ago
1.1.11
9 months ago
1.1.10
9 months ago
1.1.9
9 months ago
1.1.8
10 months ago
1.1.7
10 months ago
1.1.6
10 months ago
1.1.5
10 months ago
1.1.4
10 months ago
1.1.3
10 months ago
1.1.2
10 months ago
1.1.1
10 months ago