@phpsandbox/sdk 0.0.68 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +10 -13
  2. package/dist/auth.d.ts +0 -1
  3. package/dist/auth.js +0 -3
  4. package/dist/beacon/index.d.ts +2 -0
  5. package/dist/beacon/index.js +5 -0
  6. package/dist/browser/phpsandbox-sdk.esm.js +306 -1010
  7. package/dist/browser/phpsandbox-sdk.esm.min.js +24 -24
  8. package/dist/browser/phpsandbox-sdk.iife.js +306 -1010
  9. package/dist/browser/phpsandbox-sdk.iife.min.js +24 -24
  10. package/dist/filesystem.d.ts +2 -1
  11. package/dist/filesystem.js +35 -2
  12. package/dist/index.d.ts +14 -19
  13. package/dist/index.js +16 -24
  14. package/dist/publications.d.ts +222 -0
  15. package/dist/{deployments.js → publications.js} +64 -69
  16. package/dist/repl.d.ts +0 -2
  17. package/dist/repl.js +0 -3
  18. package/dist/schemas/{deployments.d.ts → publications.d.ts} +68 -68
  19. package/dist/schemas/publications.js +133 -0
  20. package/dist/shell.d.ts +43 -22
  21. package/dist/shell.js +103 -75
  22. package/dist/terminal.d.ts +1 -3
  23. package/dist/terminal.js +2 -5
  24. package/docs/api-summary.md +13 -10
  25. package/docs/cdn-usage.md +4 -4
  26. package/docs/getting-started.md +6 -6
  27. package/examples/README.md +8 -9
  28. package/examples/basic.ts +1 -1
  29. package/examples/git-merge-smoke.ts +2 -2
  30. package/examples/laravel-load-test.ts +13 -18
  31. package/examples/notebook-readonly-smoke.ts +8 -8
  32. package/examples/publication-provider-label.ts +11 -0
  33. package/examples/{deploy-cloudflare-container.ts → publish-cloudflare-container.ts} +11 -11
  34. package/examples/{deploy-laravel-cloud.ts → publish-laravel-cloud.ts} +11 -11
  35. package/examples/{deploy-ssh-agent.ts → publish-ssh-agent.ts} +15 -16
  36. package/package.json +7 -2
  37. package/dist/deployments.d.ts +0 -251
  38. package/dist/laravel.d.ts +0 -22
  39. package/dist/laravel.js +0 -11
  40. package/dist/schemas/deployments.js +0 -133
  41. package/examples/deployment-provider-label.ts +0 -11
@@ -454,7 +454,8 @@ export declare class Filesystem {
454
454
  constructor(okra: NotebookInstance, registerReconnect?: ((handler: () => void) => Disposable) | null);
455
455
  private registerReconnectHandler;
456
456
  info(path: string): Promise<FileInfo>;
457
- write(path: string, contents: string): Promise<boolean>;
457
+ write(path: string, contents: string | Uint8Array | ReadableStream<Uint8Array>, options?: FileWriteOptions): Promise<boolean>;
458
+ read(path: string): ReadableStream<Uint8Array>;
458
459
  find(query: string, options?: Partial<FileSearchOptions>): Promise<FileResult[]>;
459
460
  search(query: TextSearchQuery, options?: Partial<TextSearchOptions>, onMatch?: (result: TextSearchResult | false) => boolean | Promise<boolean> | void | Promise<void>): Promise<[boolean, TextSearchMatch[]]>;
460
461
  mkdir(path: string): Promise<boolean>;
@@ -87,8 +87,26 @@ export class Filesystem {
87
87
  info(path) {
88
88
  return this.okra.invoke('fs.info', { path });
89
89
  }
90
- write(path, contents) {
91
- return this.okra.invoke('fs.write', { path, contents: contents });
90
+ async write(path, contents, options = { overwrite: true, create: true, unlock: false, atomic: false }) {
91
+ if (typeof contents === 'string') {
92
+ return this.okra.invoke('fs.write', { path, contents });
93
+ }
94
+ const bytes = contents instanceof Uint8Array ? contents : await collectBytes(contents);
95
+ await this.writeFile(path, bytes, options);
96
+ return true;
97
+ }
98
+ read(path) {
99
+ return new ReadableStream({
100
+ start: async (controller) => {
101
+ try {
102
+ controller.enqueue(await this.readFile(path));
103
+ controller.close();
104
+ }
105
+ catch (error) {
106
+ controller.error(error);
107
+ }
108
+ },
109
+ });
92
110
  }
93
111
  find(query, options = {
94
112
  useIgnoreFiles: false,
@@ -275,3 +293,18 @@ export class Filesystem {
275
293
  throw e;
276
294
  }
277
295
  }
296
+ async function collectBytes(stream) {
297
+ const chunks = [];
298
+ let length = 0;
299
+ for await (const chunk of stream) {
300
+ chunks.push(chunk);
301
+ length += chunk.byteLength;
302
+ }
303
+ const output = new Uint8Array(length);
304
+ let offset = 0;
305
+ for (const chunk of chunks) {
306
+ output.set(chunk, offset);
307
+ offset += chunk.byteLength;
308
+ }
309
+ return output;
310
+ }
package/dist/index.d.ts CHANGED
@@ -1,24 +1,21 @@
1
1
  import { Filesystem, FilesystemActions, FilesystemEvents } from './filesystem.js';
2
- import Terminal, { TerminalEvents, TerminalActions } from './terminal.js';
2
+ import Terminal, { TerminalEvents, TerminalActions, type SpawnOptions } from './terminal.js';
3
3
  import Container, { ContainerActions, ContainerEvents, PortInfo, TelemetryFeature } from './container.js';
4
4
  import Auth, { AuthActions } from './auth.js';
5
5
  import Lsp, { LspActions, LspEvents } from './lsp.js';
6
6
  import Composer, { ComposerActions, ComposerEvents } from './composer.js';
7
7
  import Log, { LogActions, LogEvents } from './log.js';
8
- import Laravel, { LaravelActions, LaravelEvents } from './laravel.js';
9
8
  import Repl, { ReplActions, ReplEvents } from './repl.js';
10
- import Shell, { ShellEvents, ShellActions } from './shell.js';
9
+ import Shell, { ShellEvents, ShellActions, type ShellProcess } from './shell.js';
11
10
  import Services, { ServiceActions, ServiceEvents } from './services.js';
12
11
  import Config, { ConfigActions } from './config.js';
13
12
  import { EventDispatcher } from './events/index.js';
14
13
  import Git, { GitActions, GitCredentials, GitEvents } from './git.js';
15
14
  import { Disposable } from './types.js';
16
- import { Beacon, BeaconOptions } from './beacon/index.js';
17
15
  import { NotebookUnavailableError } from './errors/index.js';
18
- import { DeploymentApi, NotebookDeploymentApi, type DeploymentInstance, type DeploymentRun, type PublishInput } from './deployments.js';
16
+ import { PublicationApi, NotebookPublicationApi, type PublicationInstance, type PublicationRun, type PublishInput } from './publications.js';
19
17
  import { ServerApi } from './servers.js';
20
18
  export * from './types.js';
21
- export { Transport } from './socket/index.js';
22
19
  export * from './lsp.js';
23
20
  export * from './filesystem.js';
24
21
  export * from './container.js';
@@ -28,9 +25,8 @@ export * from './git.js';
28
25
  export * from './services.js';
29
26
  export * from './config.js';
30
27
  export * from './utils/promise.js';
31
- export * from './beacon/index.js';
32
28
  export * from './errors/index.js';
33
- export * from './deployments.js';
29
+ export * from './publications.js';
34
30
  export * from './servers.js';
35
31
  interface Result<TType extends 'success' | 'error' | 'running', TData extends object> {
36
32
  type: TType;
@@ -100,11 +96,11 @@ export interface Action<Args = object, Response = void> {
100
96
  args: Args;
101
97
  response: Response;
102
98
  }
103
- export type Events = TerminalEvents & ContainerEvents & LspEvents & ComposerEvents & LogEvents & ServiceEvents & LaravelEvents & NotebookEvents & ReplEvents & ShellEvents & FilesystemEvents & GitEvents;
99
+ export type Events = TerminalEvents & ContainerEvents & LspEvents & ComposerEvents & LogEvents & ServiceEvents & NotebookEvents & ReplEvents & ShellEvents & FilesystemEvents & GitEvents;
104
100
  interface SystemActions {
105
101
  ping: Action<object, 'pong'>;
106
102
  }
107
- export type Invokable = SystemActions & TerminalActions & ContainerActions & FilesystemActions & AuthActions & LspActions & LaravelActions & ComposerActions & LogActions & ServiceActions & ConfigActions & NotebookActions & ReplActions & ShellActions & GitActions;
103
+ export type Invokable = SystemActions & TerminalActions & ContainerActions & FilesystemActions & AuthActions & LspActions & ComposerActions & LogActions & ServiceActions & ConfigActions & NotebookActions & ReplActions & ShellActions & GitActions;
108
104
  export interface CreateNotebookImportAuthInput {
109
105
  access_token: string;
110
106
  }
@@ -289,15 +285,14 @@ export declare class NotebookApi {
289
285
  readonly composerCredentials: NotebookComposerCredentialApi;
290
286
  readonly preview: NotebookPreviewApi;
291
287
  readonly mail: NotebookMailApi;
292
- readonly deployment: NotebookDeploymentApi;
288
+ readonly publication: NotebookPublicationApi;
293
289
  constructor(client: Client);
294
290
  create(template: string, input?: Partial<CreateNotebookInput>, init?: boolean): Promise<NotebookInstance>;
295
291
  get(id: string): Promise<NotebookInstance>;
296
292
  update(id: string, input?: Partial<UpdateNotebookInput>): Promise<NotebookInstance>;
297
- delete(id: string): Promise<void>;
293
+ destroy(id: string): Promise<void>;
298
294
  fork(id: string, input?: Partial<ForkNotebookInput>): Promise<NotebookInstance>;
299
295
  gitCredentials(id: string): Promise<GitCredentials>;
300
- open(id: string): Promise<NotebookInstance>;
301
296
  openFromData(data: NotebookData): Promise<NotebookInstance>;
302
297
  private init;
303
298
  }
@@ -312,7 +307,7 @@ export interface PHPSandboxClientOptions {
312
307
  export type RuntimeTransport = 'realtime' | 'rest';
313
308
  export declare class Client {
314
309
  readonly notebook: NotebookApi;
315
- readonly deployments: DeploymentApi;
310
+ readonly publications: PublicationApi;
316
311
  readonly servers: ServerApi;
317
312
  readonly options: PHPSandboxClientOptions;
318
313
  protected runtimeTransportValue: RuntimeTransport;
@@ -397,7 +392,6 @@ export declare class NotebookInstance {
397
392
  readonly log: Log;
398
393
  readonly repl: Repl;
399
394
  readonly container: Container;
400
- readonly laravel: Laravel;
401
395
  readonly shell: Shell;
402
396
  readonly git: Git;
403
397
  readonly services: Services;
@@ -414,10 +408,12 @@ export declare class NotebookInstance {
414
408
  constructor(data: NotebookData, client: Client);
415
409
  ready(): Promise<NotebookInitSuccessResult>;
416
410
  fork(input?: Partial<ForkNotebookInput>): Promise<NotebookInstance>;
417
- deployment(): Promise<DeploymentInstance | null>;
418
- publish(input?: PublishInput): Promise<DeploymentRun>;
411
+ publication(): Promise<PublicationInstance | null>;
412
+ publish(input: PublishInput): Promise<PublicationRun>;
413
+ run(command: string | string[], opts?: SpawnOptions): ShellProcess;
414
+ run(command: string, args: string[], opts?: SpawnOptions): ShellProcess;
419
415
  gitCredentials(): Promise<GitCredentials>;
420
- delete(): Promise<void>;
416
+ destroy(): Promise<void>;
421
417
  stop(): Promise<void>;
422
418
  restart(): Promise<void>;
423
419
  invoke<T extends keyof Invokable>(action: T, data?: Invokable[T]['args'], options?: CallOption): Promise<Invokable[T]['response']>;
@@ -437,7 +433,6 @@ export declare class NotebookInstance {
437
433
  update(input: Partial<UpdateNotebookInput>): Promise<NotebookInstance>;
438
434
  onDidInitialize(handler: (result: NotebookInitResult) => void): Disposable;
439
435
  reconnect(): Promise<NotebookInstance>;
440
- beacon(iframe: HTMLIFrameElement, options?: BeaconOptions): Promise<Beacon>;
441
436
  private realtimeSocket;
442
437
  }
443
438
  export declare class NotebookSecrets {
package/dist/index.js CHANGED
@@ -17,7 +17,6 @@ import Auth from './auth.js';
17
17
  import Lsp from './lsp.js';
18
18
  import Composer from './composer.js';
19
19
  import Log from './log.js';
20
- import Laravel from './laravel.js';
21
20
  import Repl from './repl.js';
22
21
  import Shell from './shell.js';
23
22
  import Services from './services.js';
@@ -25,13 +24,11 @@ import Config from './config.js';
25
24
  import { Transport } from './socket/index.js';
26
25
  import EventManager from './events/index.js';
27
26
  import Git from './git.js';
28
- import { createBeacon } from './beacon/index.js';
29
27
  import { NotebookUnavailableError, UnsupportedRuntimeTransportError } from './errors/index.js';
30
- import { DeploymentApi, NotebookDeploymentApi } from './deployments.js';
28
+ import { PublicationApi, NotebookPublicationApi } from './publications.js';
31
29
  import { ServerApi } from './servers.js';
32
30
  import { RestRuntimeInvoker } from './runtime/rest.js';
33
31
  export * from './types.js';
34
- export { Transport } from './socket/index.js';
35
32
  export * from './lsp.js';
36
33
  export * from './filesystem.js';
37
34
  export * from './container.js';
@@ -41,9 +38,8 @@ export * from './git.js';
41
38
  export * from './services.js';
42
39
  export * from './config.js';
43
40
  export * from './utils/promise.js';
44
- export * from './beacon/index.js';
45
41
  export * from './errors/index.js';
46
- export * from './deployments.js';
42
+ export * from './publications.js';
47
43
  export * from './servers.js';
48
44
  function normalizeNotebookSecretInputs(input) {
49
45
  if (Array.isArray(input)) {
@@ -101,7 +97,7 @@ export class NotebookApi {
101
97
  this.composerCredentials = new NotebookComposerCredentialApi(client);
102
98
  this.preview = new NotebookPreviewApi(client);
103
99
  this.mail = new NotebookMailApi(client);
104
- this.deployment = new NotebookDeploymentApi(client);
100
+ this.publication = new NotebookPublicationApi(client);
105
101
  }
106
102
  async create(template, input = {}, init = true) {
107
103
  const response = await this.client.post('/notebook', { template, ...input });
@@ -119,7 +115,7 @@ export class NotebookApi {
119
115
  const response = await this.client.put(`/notebook/${id}`, input);
120
116
  return new NotebookInstance(response.data, this.client);
121
117
  }
122
- async delete(id) {
118
+ async destroy(id) {
123
119
  await this.client.delete(`/notebook/${id}`);
124
120
  }
125
121
  async fork(id, input = {}) {
@@ -130,10 +126,6 @@ export class NotebookApi {
130
126
  const response = await this.client.post(`/notebook/${id}/git/credentials`);
131
127
  return response.data;
132
128
  }
133
- async open(id) {
134
- const response = await this.client.get(`/notebook/${id}`);
135
- return new NotebookInstance(response.data, this.client);
136
- }
137
129
  openFromData(data) {
138
130
  return this.init(new NotebookInstance(data, this.client));
139
131
  }
@@ -157,7 +149,7 @@ export class Client {
157
149
  constructor(token, url = 'https://api.phpsandbox.io/v1', options = {}) {
158
150
  this.runtimeTransportValue = 'realtime';
159
151
  this.fetch = globalThis.fetch;
160
- this.deployments = new DeploymentApi(this);
152
+ this.publications = new PublicationApi(this);
161
153
  this.notebook = new NotebookApi(this);
162
154
  this.servers = new ServerApi(this);
163
155
  this.options = Object.assign({ startClosed: true }, options);
@@ -383,7 +375,6 @@ export class NotebookInstance {
383
375
  this.log = new Log(this);
384
376
  this.repl = new Repl(this);
385
377
  this.container = new Container(this);
386
- this.laravel = new Laravel(this);
387
378
  this.shell = new Shell(this);
388
379
  this.git = new Git(this, client);
389
380
  this.services = new Services(this);
@@ -418,17 +409,23 @@ export class NotebookInstance {
418
409
  fork(input = {}) {
419
410
  return this.client.notebook.fork(this.data.id, input);
420
411
  }
421
- deployment() {
422
- return this.client.notebook.deployment.current(this.data.id);
412
+ publication() {
413
+ return this.client.notebook.publication.current(this.data.id);
423
414
  }
424
415
  publish(input) {
425
- return this.client.notebook.deployment.publish(this.data.id, input);
416
+ return this.client.notebook.publication.publish(this.data.id, input);
417
+ }
418
+ run(command, argsOrOpts = [], opts) {
419
+ if (Array.isArray(argsOrOpts)) {
420
+ return this.shell.run(command, argsOrOpts, opts);
421
+ }
422
+ return this.shell.run(command, argsOrOpts);
426
423
  }
427
424
  gitCredentials() {
428
425
  return this.client.notebook.gitCredentials(this.data.id);
429
426
  }
430
- delete() {
431
- return this.client.notebook.delete(this.data.id).then(() => {
427
+ destroy() {
428
+ return this.client.notebook.destroy(this.data.id).then(() => {
432
429
  this.socket?.terminate(new NotebookUnavailableError('Notebook has been deleted.', { id: this.data.id }));
433
430
  });
434
431
  }
@@ -581,11 +578,6 @@ export class NotebookInstance {
581
578
  // Wait for initialization to complete
582
579
  return this.ready().then(() => this);
583
580
  }
584
- async beacon(iframe, options) {
585
- const result = await this.ready();
586
- iframe.src = result.data.previewUrl;
587
- return createBeacon(iframe, options);
588
- }
589
581
  realtimeSocket() {
590
582
  if (this.socket === null) {
591
583
  throw new UnsupportedRuntimeTransportError('This operation requires the realtime transport.');
@@ -0,0 +1,222 @@
1
+ import { type Client, type SecretRef } from './index.js';
2
+ import type { PublicationBuildStatus, PublicationDomainDnsRecordType, PublicationEventData, PublicationJurisdiction, PublicationLogChunkData, PublicationProtectionMode, PublicationRegion, PublicationReleaseStatus, PublicationSize, PublicationStatus, PublishStreamEvent, PublishStreamResult } from './schemas/publications.js';
3
+ export * from './schemas/publications.js';
4
+ export interface PublicationPlacement {
5
+ regions?: PublicationRegion[];
6
+ jurisdiction?: PublicationJurisdiction;
7
+ }
8
+ export type LaravelCloudRegion = 'us-east-2' | 'us-east-1' | 'ca-central-1' | 'eu-central-1' | 'eu-west-1' | 'eu-west-2' | 'me-central-1' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-northeast-1';
9
+ export interface PublicationProtectionData {
10
+ mode: PublicationProtectionMode;
11
+ enabled: boolean;
12
+ token?: string;
13
+ expiresAt?: string;
14
+ url?: string;
15
+ }
16
+ export interface PublicationFeedbackData {
17
+ enabled: boolean;
18
+ config: Record<string, unknown>;
19
+ }
20
+ export type PublicationProtectionInput = {
21
+ mode: 'none';
22
+ password?: never;
23
+ } | {
24
+ mode: 'password';
25
+ password: string;
26
+ };
27
+ export interface PublicationFeedbackInput {
28
+ enabled: boolean;
29
+ config?: Record<string, unknown>;
30
+ }
31
+ export interface CloudflareContainersProviderOptions {
32
+ size?: PublicationSize;
33
+ sleepAfter?: string;
34
+ placement?: PublicationPlacement;
35
+ instances?: number;
36
+ }
37
+ export interface SshServerProviderOptions {
38
+ serverId: string;
39
+ }
40
+ export interface LaravelCloudProviderData {
41
+ region?: LaravelCloudRegion;
42
+ repository?: string;
43
+ branch?: string;
44
+ sourceControlProviderType?: 'github' | 'gitlab' | 'bitbucket';
45
+ apiKeyConfigured?: boolean;
46
+ }
47
+ export interface LaravelCloudProviderInput {
48
+ apiKey: SecretRef;
49
+ region?: LaravelCloudRegion;
50
+ }
51
+ export interface PublicationProviderInputs {
52
+ 'cloudflare-containers': CloudflareContainersProviderOptions;
53
+ 'ssh-server': SshServerProviderOptions;
54
+ 'laravel-cloud': LaravelCloudProviderInput;
55
+ }
56
+ export interface PublicationProviderData {
57
+ 'cloudflare-containers': CloudflareContainersProviderOptions;
58
+ 'ssh-server': SshServerProviderOptions;
59
+ 'laravel-cloud': LaravelCloudProviderData;
60
+ }
61
+ export type PublicationProviderName = Extract<keyof PublicationProviderInputs, string>;
62
+ export type PublicationProviderInput<TName extends PublicationProviderName = PublicationProviderName> = {
63
+ [Name in TName]: {
64
+ name: Name;
65
+ } & PublicationProviderInputs[Name];
66
+ }[TName];
67
+ export type PublicationProvider<TName extends PublicationProviderName = PublicationProviderName> = {
68
+ [Name in TName]: {
69
+ name: Name;
70
+ } & PublicationProviderData[Name];
71
+ }[TName];
72
+ export interface PublishInput<TName extends PublicationProviderName = PublicationProviderName> {
73
+ slug: string;
74
+ provider: PublicationProviderInput<TName>;
75
+ protection?: PublicationProtectionInput;
76
+ feedback?: PublicationFeedbackInput;
77
+ metadata?: Record<string, unknown>;
78
+ }
79
+ export interface PublicationBuildData<TProvider extends PublicationProviderName = PublicationProviderName> {
80
+ id: string;
81
+ status: PublicationBuildStatus;
82
+ strategy: string;
83
+ provider: PublicationProvider<TProvider>;
84
+ errorMessage: string | null;
85
+ startedAt: string | null;
86
+ finishedAt: string | null;
87
+ }
88
+ export interface PublicationReleaseData {
89
+ id: string;
90
+ status: PublicationReleaseStatus;
91
+ manifest: Record<string, unknown>;
92
+ }
93
+ export interface PublicationDomainDnsData {
94
+ type: PublicationDomainDnsRecordType;
95
+ name: string;
96
+ value: string;
97
+ }
98
+ export interface PublicationDomainData {
99
+ id: string;
100
+ publicationId: string | null;
101
+ hostname: string;
102
+ status: string;
103
+ provider: string;
104
+ providerHostnameId: string | null;
105
+ dns: PublicationDomainDnsData;
106
+ ssl: {
107
+ status: string | null;
108
+ };
109
+ validationErrors: unknown[];
110
+ validationRecords: unknown[];
111
+ metadata: Record<string, unknown>;
112
+ verifiedAt: string | null;
113
+ createdAt: string | null;
114
+ updatedAt: string | null;
115
+ }
116
+ export interface CreatePublicationDomainInput {
117
+ hostname: string;
118
+ }
119
+ export interface PublicationData<TProvider extends PublicationProviderName = PublicationProviderName> {
120
+ id: string;
121
+ slug: string;
122
+ url: string;
123
+ status: PublicationStatus;
124
+ strategy: string;
125
+ provider: PublicationProvider<TProvider>;
126
+ protection: PublicationProtectionData;
127
+ feedback: PublicationFeedbackData;
128
+ eventStreamUrl: string | null;
129
+ originUrl: string | null;
130
+ currentRelease?: PublicationReleaseData | null;
131
+ domains?: PublicationDomainData[];
132
+ latestBuild?: PublicationBuildData<TProvider> | null;
133
+ deployedAt: string | null;
134
+ createdAt: string | null;
135
+ updatedAt: string | null;
136
+ }
137
+ export interface UpdatePublicationProtectionInput {
138
+ mode: PublicationProtectionMode;
139
+ password?: string;
140
+ }
141
+ export interface PublicationProtectionSessionData {
142
+ previewSessionId: string;
143
+ token: string;
144
+ expiresAt: string;
145
+ url: string;
146
+ }
147
+ export interface UpdatePublicationFeedbackInput {
148
+ enabled: boolean;
149
+ config?: Record<string, unknown>;
150
+ }
151
+ export declare class NotebookPublicationApi {
152
+ private readonly client;
153
+ constructor(client: Client);
154
+ current<TProvider extends PublicationProviderName = PublicationProviderName>(notebookId: string): Promise<PublicationInstance<TProvider> | null>;
155
+ publish<TProvider extends PublicationProviderName = PublicationProviderName>(notebookId: string, input?: PublishInput): Promise<PublicationRun<TProvider>>;
156
+ }
157
+ export declare class PublicationApi {
158
+ private readonly client;
159
+ constructor(client: Client);
160
+ get<TProvider extends PublicationProviderName = PublicationProviderName>(id: string): Promise<PublicationInstance<TProvider>>;
161
+ destroy(id: string): Promise<void>;
162
+ setProtection<TProvider extends PublicationProviderName = PublicationProviderName>(id: string, input: UpdatePublicationProtectionInput): Promise<PublicationInstance<TProvider>>;
163
+ protection(id: string): Promise<PublicationProtectionData>;
164
+ createProtectionSession(id: string): Promise<PublicationProtectionSessionData>;
165
+ disableProtection<TProvider extends PublicationProviderName = PublicationProviderName>(id: string): Promise<PublicationInstance<TProvider>>;
166
+ setFeedback<TProvider extends PublicationProviderName = PublicationProviderName>(id: string, input: UpdatePublicationFeedbackInput): Promise<PublicationInstance<TProvider>>;
167
+ listDomains(id: string): Promise<PublicationDomainData[]>;
168
+ createDomain(id: string, input: CreatePublicationDomainInput): Promise<PublicationDomainData>;
169
+ refreshDomain(id: string, domainId: string): Promise<PublicationDomainData>;
170
+ deleteDomain(id: string, domainId: string): Promise<void>;
171
+ events(id: string): Promise<ReadableStream<PublicationEventData>>;
172
+ buildLogs(id: string, buildId: string): Promise<ReadableStream<PublicationLogChunkData>>;
173
+ logs(id: string): Promise<ReadableStream<PublicationLogChunkData>>;
174
+ }
175
+ export declare class PublicationRun<TProvider extends PublicationProviderName = PublicationProviderName> {
176
+ readonly initial: PublicationInstance<TProvider>;
177
+ private readonly client;
178
+ private started;
179
+ private completed;
180
+ private finalError;
181
+ private finalResult;
182
+ private resultPromise;
183
+ private resolveResult;
184
+ private rejectResult;
185
+ private readonly bufferedEvents;
186
+ private readonly subscribers;
187
+ constructor(initial: PublicationInstance<TProvider>, client: Client);
188
+ events(): AsyncIterable<PublishStreamEvent>;
189
+ result(): Promise<PublishStreamResult>;
190
+ publication(): Promise<PublicationInstance<TProvider>>;
191
+ start(): this;
192
+ private subscribe;
193
+ private consumeStream;
194
+ private publish;
195
+ private closeSubscribers;
196
+ private fail;
197
+ }
198
+ export declare class PublicationInstance<TProvider extends PublicationProviderName = PublicationProviderName> {
199
+ readonly data: PublicationData<TProvider>;
200
+ private readonly client;
201
+ private readonly notebookId?;
202
+ constructor(data: PublicationData<TProvider>, client: Client, notebookId?: string);
203
+ refresh(): Promise<PublicationInstance<TProvider>>;
204
+ publish(): Promise<PublicationRun<TProvider>>;
205
+ destroy(): Promise<void>;
206
+ wait(options?: {
207
+ intervalMs?: number;
208
+ timeoutMs?: number;
209
+ }): Promise<PublicationInstance<TProvider>>;
210
+ events(): Promise<ReadableStream<PublicationEventData>>;
211
+ buildLogs(buildId?: string): Promise<ReadableStream<PublicationLogChunkData>>;
212
+ logs(): Promise<ReadableStream<PublicationLogChunkData>>;
213
+ setProtection(input: UpdatePublicationProtectionInput): Promise<PublicationInstance<TProvider>>;
214
+ protection(): Promise<PublicationProtectionData>;
215
+ createProtectionSession(): Promise<PublicationProtectionSessionData>;
216
+ disableProtection(): Promise<PublicationInstance<TProvider>>;
217
+ setFeedback(input: UpdatePublicationFeedbackInput): Promise<PublicationInstance<TProvider>>;
218
+ domains(): Promise<PublicationDomainData[]>;
219
+ addDomain(input: CreatePublicationDomainInput): Promise<PublicationDomainData>;
220
+ refreshDomain(domainId: string): Promise<PublicationDomainData>;
221
+ deleteDomain(domainId: string): Promise<void>;
222
+ }