@b-jones-rfd/sp-rest-connect - v5.1.1
    Preparing search index...

    Variable createSiteConnectionConst

    createSiteConnection: SiteConnectionFactory = ...

    Binds every action to one SharePoint site.

    Credentials are captured in closures and reused for each call; nothing is sent to the server until an action is invoked, so creating a connection never performs network I/O. It does validate the shape of options and throws a TypeError for an obvious misconfiguration (a protocol inside site, a serverRelativeUrl without a leading slash, and so on).

    Site location and NTLM credentials.

    A SiteConnection whose methods each resolve to a Result and never throw.

    When options are malformed.

    import { createSiteConnection } from '@b-jones-rfd/sp-rest-connect'

    const connection = createSiteConnection({
    username: 'jsmith',
    password: process.env.SP_PASSWORD!,
    domain: 'CONTOSO',
    site: 'sharepoint.contoso.local',
    serverRelativeUrl: '/sites/finance',
    })

    const res = await connection.getListContents({ listName: 'Invoices' })
    if (res.success) console.log(res.data)