craft-hub / WorkspaceSubscriptionService
Class: WorkspaceSubscriptionService
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:44
Persist subscriptions as an atomic snapshot; discovery never materializes editable project configuration.
Constructors
Constructor
new WorkspaceSubscriptionService(
dataDir,workspaces,providers,ownerScopes?):WorkspaceSubscriptionService
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:48
Parameters
dataDir
string
workspaces
providers
ownerScopes?
Returns
WorkspaceSubscriptionService
Methods
apply()
apply(
input):Promise<WorkspaceSubscriptionPreview>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:164
Validate every selected workspace, then atomically replace only this subscription's snapshot.
Parameters
input
expectedRevision
string
id?
string
selectedWorkspaceIds?
string[]
url?
string
Returns
Promise<WorkspaceSubscriptionPreview>
configure()
configure(
input):Promise<Omit<{autoFollow?:boolean;branch:string;directory:string;id:string;lastImportedAt:string;lastRevision:string;name?:string;ownerScopeId?:string;providerId:string;repository:string;selectedWorkspaceIds:string[];snapshot: {$schema?:string;id:string;name:string;schemaVersion:1;workspaces:object[]; };sourceId:string;url:string; },"snapshot"> &object>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:138
Save a named source for later selection without applying its workspaces.
Parameters
input
expectedSourceRevision?
string
id?
string
name
string
url
string
Returns
Promise<Omit<{ autoFollow?: boolean; branch: string; directory: string; id: string; lastImportedAt: string; lastRevision: string; name?: string; ownerScopeId?: string; providerId: string; repository: string; selectedWorkspaceIds: string[]; snapshot: { $schema?: string; id: string; name: string; schemaVersion: 1; workspaces: object[]; }; sourceId: string; url: string; }, "snapshot"> & object>
copy()
copy(
id,sourceWorkspaceId):Promise<WorkspaceRecord>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:201
Copy one selected source workspace into an independent, editable Personal workspace.
Parameters
id
string
sourceWorkspaceId
string
Returns
Promise<WorkspaceRecord>
export()
export(
id):Promise<{autoFollow?:boolean;branch:string;directory:string;id:string;lastImportedAt:string;lastRevision:string;name?:string;ownerScopeId?:string;providerId:string;repository:string;selectedWorkspaceIds:string[];snapshot: {$schema?:string;id:string;name:string;schemaVersion:1;workspaces:object[]; };sourceId:string;url:string; }>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:184
Export the last applied portable snapshot without network access or local paths.
Parameters
id
string
Returns
Promise<{ autoFollow?: boolean; branch: string; directory: string; id: string; lastImportedAt: string; lastRevision: string; name?: string; ownerScopeId?: string; providerId: string; repository: string; selectedWorkspaceIds: string[]; snapshot: { $schema?: string; id: string; name: string; schemaVersion: 1; workspaces: object[]; }; sourceId: string; url: string; }>
followTeams()
followTeams():
Promise<object[]>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:87
Follow the source branch atomically; a failed read leaves the previous usable snapshot intact.
Returns
Promise<object[]>
joinTeam()
joinTeam(
url):Promise<{id:string;kind:"team";name:string; }>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:67
Join a repository-backed Team without requiring a local checkout or granting execution trust.
Parameters
url
string
Returns
Promise<{ id: string; kind: "team"; name: string; }>
list()
list():
Promise<Omit<{autoFollow?:boolean;branch:string;directory:string;id:string;lastImportedAt:string;lastRevision:string;name?:string;ownerScopeId?:string;providerId:string;repository:string;selectedWorkspaceIds:string[];snapshot: {$schema?:string;id:string;name:string;schemaVersion:1;workspaces:object[]; };sourceId:string;url:string; },"snapshot">[]>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:55
List cached subscription metadata without contacting repositories.
Returns
Promise<Omit<{ autoFollow?: boolean; branch: string; directory: string; id: string; lastImportedAt: string; lastRevision: string; name?: string; ownerScopeId?: string; providerId: string; repository: string; selectedWorkspaceIds: string[]; snapshot: { $schema?: string; id: string; name: string; schemaVersion: 1; workspaces: object[]; }; sourceId: string; url: string; }, "snapshot">[]>
portableSnapshot()
portableSnapshot():
Promise<object[]>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:112
Export subscription choices and cached portable definitions for account synchronization.
Returns
Promise<object[]>
preview()
preview(
url?,id?):Promise<WorkspaceSubscriptionPreview>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:158
Preview a fresh immutable remote revision and report workspaces removed upstream.
Parameters
url?
string
id?
string
Returns
Promise<WorkspaceSubscriptionPreview>
projectedWorkspaces()
projectedWorkspaces():
Promise<SubscribedWorkspace[]>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:60
Render all selected workspaces from the last valid applied state, including while offline.
Returns
Promise<SubscribedWorkspace[]>
remove()
remove(
id):Promise<void>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:189
Stop tracking this source; never remove a checkout, local binding, or independent workspace.
Parameters
id
string
Returns
Promise<void>
replacePortableSnapshot()
replacePortableSnapshot(
input):Promise<void>
Defined in: packages/craft-hub/src/workspace-subscriptions.ts:117
Restore validated subscriptions, retaining device-local bindings and execution permissions.
Parameters
input
unknown
Returns
Promise<void>