@cbxss/eoka 0.0.0-stage → 0.1.0-beta.10

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 (48) hide show
  1. package/README.md +170 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/browser-install-diagnostics.d.ts +1 -0
  4. package/dist/browser-install-diagnostics.js +21 -0
  5. package/dist/browser-install-engine.d.ts +10 -0
  6. package/dist/browser-install-engine.js +286 -0
  7. package/dist/browser-install-inventory.d.ts +34 -0
  8. package/dist/browser-install-inventory.js +107 -0
  9. package/dist/browser-install-worker.d.ts +21 -0
  10. package/dist/browser-install-worker.js +65 -0
  11. package/dist/browser-install.d.ts +22 -0
  12. package/dist/browser-install.js +7 -0
  13. package/dist/browser.d.ts +62 -0
  14. package/dist/browser.js +452 -0
  15. package/dist/client.d.ts +11 -0
  16. package/dist/client.js +1 -0
  17. package/dist/cloudflare.d.ts +12 -0
  18. package/dist/cloudflare.js +19 -0
  19. package/dist/errors.d.ts +33 -0
  20. package/dist/errors.js +44 -0
  21. package/dist/generated/protocol.d.ts +4878 -0
  22. package/dist/generated/protocol.js +2 -0
  23. package/dist/generated/schema-bundle.json +23846 -0
  24. package/dist/index.d.ts +22 -0
  25. package/dist/index.js +11 -0
  26. package/dist/install-errors.d.ts +4 -0
  27. package/dist/install-errors.js +6 -0
  28. package/dist/operations.d.ts +22 -0
  29. package/dist/operations.js +87 -0
  30. package/dist/page.d.ts +107 -0
  31. package/dist/page.js +299 -0
  32. package/dist/platform.d.ts +4 -0
  33. package/dist/platform.js +27 -0
  34. package/dist/recording.d.ts +27 -0
  35. package/dist/recording.js +124 -0
  36. package/dist/release-manifest.json +101 -0
  37. package/dist/release.d.ts +36 -0
  38. package/dist/release.js +76 -0
  39. package/dist/server-binary.d.ts +12 -0
  40. package/dist/server-binary.js +130 -0
  41. package/dist/transport.d.ts +89 -0
  42. package/dist/transport.js +737 -0
  43. package/examples/capture.mjs +36 -0
  44. package/examples/consume-schema.mjs +7 -0
  45. package/examples/explicit-paths.mjs +42 -0
  46. package/examples/install-browser.mjs +20 -0
  47. package/examples/offline.mjs +20 -0
  48. package/package.json +70 -4
@@ -0,0 +1,19 @@
1
+ import { ConfigurationError } from './errors.js';
2
+ export function resolveCloudflareOptions(value) {
3
+ if (value === undefined || value === false)
4
+ return undefined;
5
+ const options = value === true ? {} : value;
6
+ for (const name of Object.keys(options)) {
7
+ if (name !== 'intervalMs' && name !== 'timeoutMs')
8
+ throw new ConfigurationError(`autoSolveCloudflare.${name} is not supported; the server solves challenges and reports them in its log`);
9
+ }
10
+ const intervalMs = options.intervalMs ?? 500;
11
+ const timeoutMs = options.timeoutMs ?? 30_000;
12
+ if (!Number.isInteger(intervalMs) || intervalMs < 100 || intervalMs > 60_000) {
13
+ throw new ConfigurationError('autoSolveCloudflare.intervalMs must be an integer between 100 and 60000 milliseconds');
14
+ }
15
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 120_000) {
16
+ throw new ConfigurationError('autoSolveCloudflare.timeoutMs must be an integer between 1 and 120000 milliseconds');
17
+ }
18
+ return { intervalMs, timeoutMs };
19
+ }
@@ -0,0 +1,33 @@
1
+ import type { ActionReceipt, ServerError } from './generated/protocol.js';
2
+ export type RequestState = 'not_sent' | 'may_have_been_sent' | 'acknowledged';
3
+ export interface ErrorDetails {
4
+ requestId?: number | undefined;
5
+ operationId?: string | undefined;
6
+ requestState?: RequestState | undefined;
7
+ receipt?: ActionReceipt | undefined;
8
+ data?: unknown;
9
+ stderr?: string | undefined;
10
+ cause?: unknown;
11
+ }
12
+ export declare class EokaError extends Error {
13
+ readonly code: string;
14
+ requestId?: number | undefined;
15
+ operationId?: string | undefined;
16
+ requestState?: RequestState | undefined;
17
+ receipt?: ActionReceipt | undefined;
18
+ data?: unknown;
19
+ stderr?: string | undefined;
20
+ constructor(code: string, message: string, details?: ErrorDetails);
21
+ }
22
+ export declare class ConfigurationError extends EokaError {
23
+ constructor(message: string, details?: ErrorDetails);
24
+ }
25
+ export declare class TransportError extends EokaError {
26
+ }
27
+ export declare class ProtocolError extends EokaError {
28
+ constructor(message: string, details?: ErrorDetails);
29
+ }
30
+ export declare class ServerOperationError extends EokaError {
31
+ readonly wireError: ServerError;
32
+ constructor(wireError: ServerError, details?: ErrorDetails);
33
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,44 @@
1
+ export class EokaError extends Error {
2
+ code;
3
+ requestId;
4
+ operationId;
5
+ requestState;
6
+ receipt;
7
+ data;
8
+ stderr;
9
+ constructor(code, message, details = {}) {
10
+ super(message, { cause: details.cause });
11
+ this.name = new.target.name;
12
+ this.code = code;
13
+ this.requestId = details.requestId;
14
+ this.operationId = details.operationId;
15
+ this.requestState = details.requestState;
16
+ this.receipt = details.receipt;
17
+ this.data = details.data;
18
+ this.stderr = details.stderr;
19
+ }
20
+ }
21
+ export class ConfigurationError extends EokaError {
22
+ constructor(message, details = {}) {
23
+ super('Configuration', message, details);
24
+ }
25
+ }
26
+ export class TransportError extends EokaError {
27
+ }
28
+ export class ProtocolError extends EokaError {
29
+ constructor(message, details = {}) {
30
+ super('Protocol', message, details);
31
+ }
32
+ }
33
+ export class ServerOperationError extends EokaError {
34
+ wireError;
35
+ constructor(wireError, details = {}) {
36
+ super(wireError.code, wireError.message, {
37
+ ...details,
38
+ data: wireError.data,
39
+ operationId: wireError.data?.operation_id ?? details.operationId,
40
+ receipt: wireError.data?.receipt ?? details.receipt,
41
+ });
42
+ this.wireError = wireError;
43
+ }
44
+ }