sharepointserver

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package sharepointserver administers site collections on SharePoint Server (Subscription Edition, on-premises) on behalf of a BPMN service task (ADR-0540).

Why it is not the sharepoint Worker Type

connector/sharepoint speaks Microsoft Graph about lists and files in SharePoint Online, in the engine or on any host. SharePoint Server has no Graph, and its site administration is the farm's PowerShell, which only runs on a server of the farm. The two share a product name and no operation, so a target inside one Worker Type would be a type with two disjoint operation tables.

How a call runs

The Worker starts Windows PowerShell for each job with a fixed program, [bootstrap]. The operation and every value travel to it as JSON in the environment, so no authored value is ever parsed as PowerShell, and the program dispatches on the operation to a fixed sequence of cmdlets: a model cannot name a cmdlet here.

Worker-only, and never supervised

The account the worker runs as can administer every site of the farm, and the cmdlets exist only on a farm server, so neither the engine nor a worker Atlas supervises beside itself can do this work. The worker is installed on the farm by an operator.

Retries

A job is delivered at least once, so the bootstrap is written for the second delivery: delete and restore that already happened succeed, changing an account that is already as asked changes nothing, and create-site resumes a site whose default groups were not made yet. A refusal a process can act on carries a code from Codes.

Index

Constants

View Source
const (
	// CodeSiteExists: a site already lives at that address.
	CodeSiteExists = "SHAREPOINT_SERVER_SITE_EXISTS"
	// CodeSiteNotFound: no site lives at that address.
	CodeSiteNotFound = "SHAREPOINT_SERVER_SITE_NOT_FOUND"
	// CodeDeletedSiteNotFound: the recycle bin holds no deleted site for that address,
	// because it was never deleted or its retention has passed.
	CodeDeletedSiteNotFound = "SHAREPOINT_SERVER_DELETED_SITE_NOT_FOUND"
	// CodeAccountNotFound: the directory does not know a named account or AD group.
	CodeAccountNotFound = "SHAREPOINT_SERVER_ACCOUNT_NOT_FOUND"
	// CodeGroupMissing: the site has no such default group, typically because it was not
	// made by this Worker.
	CodeGroupMissing = "SHAREPOINT_SERVER_GROUP_MISSING"
	// CodeOwnerRequired: the account to remove is the site's primary or secondary owner;
	// set another owner first.
	CodeOwnerRequired = "SHAREPOINT_SERVER_OWNER_REQUIRED"
	// CodeQuotaRefused: the site uses a quota template, which excludes an individual
	// quota; a person changes the template.
	CodeQuotaRefused = "SHAREPOINT_SERVER_QUOTA_REFUSED"
)

The codes of the refusals a process may have a path for. Each is a BPMN error when the task's process catches it and an ordinary failure otherwise, which keeps the retries a transient fault is owed (ADR-0461's rule). None changes on a retry. The bootstrap sets them from a check it made itself, never by reading an error's text, which SharePoint writes in the farm's language.

Variables

Codes lists every code a refusal carries, in the order the handbook explains them.

Functions

func CheckBundle

func CheckBundle(endpoint, raw string) error

CheckBundle reports whether an endpoint and settings build a client at all.

func Run

func Run(ctx context.Context, j Job, reg *Registry) (map[string]any, error)

Run performs a resolved job through the caller's own registry and returns the variables the job completes with. Everything but the Worker lookup is checked before the farm is reached, so a refused job has changed nothing.

Types

type Bundle

type Bundle struct {
	// ManagedPath is the wildcard managed path sites live under; empty is "sites".
	ManagedPath string `json:"managedPath,omitempty"`
	// TimeoutSeconds bounds one call; zero is [defaultTimeout].
	TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
}

Bundle is the optional JSON a Worker carries beside its endpoint. There is no credential field by construction: the cmdlets run as the account the worker runs as.

{"managedPath": "sites", "timeoutSeconds": 300}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client runs one operation on the farm this worker is a server of.

func NewClient

func NewClient(endpoint, raw string, opts Options) (*Client, error)

NewClient builds the client an endpoint and bundle describe. endpoint is the web application's URL. Nothing here reaches the farm.

func (*Client) Invoke

func (c *Client) Invoke(ctx context.Context, inv catalog.Invocation) ([]any, error)

Invoke runs one checked operation in a fresh PowerShell: a process per call, for Exchange's reason, and because SharePoint's objects hold unmanaged memory that a process ending frees reliably.

type Job

type Job struct {
	Connector      string         `json:"connector"`
	Operation      string         `json:"operation"`
	Parameters     map[string]any `json:"parameters,omitempty"`
	ResultVariable string         `json:"resultVariable,omitempty"`
	// ErrorCodes are the codes an error boundary or error event subprocess of the
	// task's process catches (ADR-0461); a worker has no compiled process to ask.
	ErrorCodes []string `json:"errorCodes,omitempty"`
}

Job is a SharePoint Server task with everything already evaluated: plain values, with nowhere to put a web application or an account the Worker runs as.

func Resolve

func Resolve(store VarStore, cp *compiler.CompiledProcess, detail *compiler.ConnectorTaskDetail, elementInstanceKey uint64) (Job, error)

Resolve turns a compiled task into a Job. Engine work by necessity: the parameter template is FEEL compiled at deploy and only the engine has the scope chain.

type Options

type Options struct {
	// PowerShell is the interpreter; empty is [defaultPowerShell].
	PowerShell string
}

Options are the parts of a client that belong to the host rather than to the Worker.

type Refusal

type Refusal struct {
	Code    string
	Message string
}

Refusal is an operation's refusal under one of Codes.

func (*Refusal) Error

func (r *Refusal) Error() string

type Registry

type Registry = clientreg.Registry[*Client]

Registry resolves a Worker name to the web application behind it.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry.

type Runner

type Runner interface {
	Run(ctx context.Context, bin string, args, env []string) (stdout, stderr []byte, err error)
}

Runner starts a program and returns what it wrote, so the client is testable without PowerShell or a farm.

type VarStore

type VarStore interface {
	VariablesOfScope(scope uint64, fn func(*model.VariableValue) error) error
	GetElementInstance(key uint64) (*model.ElementInstanceValue, bool, error)
}

VarStore is the slice of the state store the engine half reads.

Directories

Path Synopsis
Package catalog is the SharePoint Server Worker's operation table: which parameters a model must and may author for each low-code operation, and how each value is checked (ADR-0540).
Package catalog is the SharePoint Server Worker's operation table: which parameters a model must and may author for each low-code operation, and how each value is checked (ADR-0540).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL