@ocxp/client 0.2.6 → 0.2.7
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.
- package/dist/index.cjs +84 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +206 -163
- package/dist/index.d.ts +206 -163
- package/dist/index.js +84 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -7
package/dist/index.d.cts
CHANGED
|
@@ -2899,7 +2899,7 @@ type RepoDeleteResponse = {
|
|
|
2899
2899
|
*
|
|
2900
2900
|
* Deleted repository UUID
|
|
2901
2901
|
*/
|
|
2902
|
-
id
|
|
2902
|
+
id?: string | null;
|
|
2903
2903
|
/**
|
|
2904
2904
|
* Repo Id
|
|
2905
2905
|
*
|
|
@@ -7185,7 +7185,7 @@ declare const listDownloadedRepos: <ThrowOnError extends boolean = false>(option
|
|
|
7185
7185
|
/**
|
|
7186
7186
|
* Delete repository
|
|
7187
7187
|
*
|
|
7188
|
-
* Permanently deletes a downloaded repository.
|
|
7188
|
+
* Permanently deletes a downloaded repository. Accepts UUID or owner/repo format.
|
|
7189
7189
|
*/
|
|
7190
7190
|
declare const deleteRepo: <ThrowOnError extends boolean = false>(options: Options<DeleteRepoData, ThrowOnError>) => RequestResult<DeleteRepoResponses, DeleteRepoErrors, ThrowOnError, "fields">;
|
|
7191
7191
|
/**
|
|
@@ -7431,6 +7431,182 @@ declare const getCurrentUser: <ThrowOnError extends boolean = false>(options?: O
|
|
|
7431
7431
|
*/
|
|
7432
7432
|
declare const listWorkspaces: <ThrowOnError extends boolean = false>(options?: Options<ListWorkspacesData, ThrowOnError>) => RequestResult<ListWorkspacesResponses, ListWorkspacesErrors, ThrowOnError, "fields">;
|
|
7433
7433
|
|
|
7434
|
+
/**
|
|
7435
|
+
* OCXP Error Types
|
|
7436
|
+
*
|
|
7437
|
+
* Typed error classes for the OCXP SDK providing structured error handling
|
|
7438
|
+
* with error codes, HTTP status codes, and detailed context.
|
|
7439
|
+
*/
|
|
7440
|
+
/**
|
|
7441
|
+
* Error codes for OCXP operations
|
|
7442
|
+
*/
|
|
7443
|
+
declare enum OCXPErrorCode {
|
|
7444
|
+
/** Network-level error (connection failed, timeout, etc.) */
|
|
7445
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
7446
|
+
/** Request or response validation failed */
|
|
7447
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
7448
|
+
/** Authentication or authorization failed */
|
|
7449
|
+
AUTH_ERROR = "AUTH_ERROR",
|
|
7450
|
+
/** Resource not found */
|
|
7451
|
+
NOT_FOUND = "NOT_FOUND",
|
|
7452
|
+
/** Rate limit exceeded */
|
|
7453
|
+
RATE_LIMITED = "RATE_LIMITED",
|
|
7454
|
+
/** Conflict (e.g., etag mismatch) */
|
|
7455
|
+
CONFLICT = "CONFLICT",
|
|
7456
|
+
/** Operation timed out */
|
|
7457
|
+
TIMEOUT = "TIMEOUT",
|
|
7458
|
+
/** Server-side error */
|
|
7459
|
+
SERVER_ERROR = "SERVER_ERROR",
|
|
7460
|
+
/** Unknown error */
|
|
7461
|
+
UNKNOWN = "UNKNOWN"
|
|
7462
|
+
}
|
|
7463
|
+
/**
|
|
7464
|
+
* Base error class for all OCXP errors
|
|
7465
|
+
*/
|
|
7466
|
+
declare class OCXPError extends Error {
|
|
7467
|
+
/** Error code for programmatic handling */
|
|
7468
|
+
readonly code: OCXPErrorCode;
|
|
7469
|
+
/** HTTP status code if applicable */
|
|
7470
|
+
readonly statusCode: number;
|
|
7471
|
+
/** Additional error details */
|
|
7472
|
+
readonly details?: Record<string, unknown>;
|
|
7473
|
+
/** Request ID for debugging */
|
|
7474
|
+
readonly requestId?: string;
|
|
7475
|
+
/** Original cause of the error */
|
|
7476
|
+
readonly cause?: Error;
|
|
7477
|
+
constructor(message: string, code?: OCXPErrorCode, statusCode?: number, options?: {
|
|
7478
|
+
details?: Record<string, unknown>;
|
|
7479
|
+
requestId?: string;
|
|
7480
|
+
cause?: Error;
|
|
7481
|
+
});
|
|
7482
|
+
/**
|
|
7483
|
+
* Convert error to JSON for logging/serialization
|
|
7484
|
+
*/
|
|
7485
|
+
toJSON(): Record<string, unknown>;
|
|
7486
|
+
}
|
|
7487
|
+
/**
|
|
7488
|
+
* Network-level error (connection failed, DNS resolution, etc.)
|
|
7489
|
+
*/
|
|
7490
|
+
declare class OCXPNetworkError extends OCXPError {
|
|
7491
|
+
constructor(message: string, options?: {
|
|
7492
|
+
details?: Record<string, unknown>;
|
|
7493
|
+
requestId?: string;
|
|
7494
|
+
cause?: Error;
|
|
7495
|
+
});
|
|
7496
|
+
}
|
|
7497
|
+
/**
|
|
7498
|
+
* Validation error (request or response validation failed)
|
|
7499
|
+
*/
|
|
7500
|
+
declare class OCXPValidationError extends OCXPError {
|
|
7501
|
+
/** Field-level validation errors */
|
|
7502
|
+
readonly validationErrors?: Record<string, string[]>;
|
|
7503
|
+
constructor(message: string, validationErrors?: Record<string, string[]>, options?: {
|
|
7504
|
+
details?: Record<string, unknown>;
|
|
7505
|
+
requestId?: string;
|
|
7506
|
+
cause?: Error;
|
|
7507
|
+
});
|
|
7508
|
+
}
|
|
7509
|
+
/**
|
|
7510
|
+
* Authentication or authorization error
|
|
7511
|
+
*/
|
|
7512
|
+
declare class OCXPAuthError extends OCXPError {
|
|
7513
|
+
constructor(message: string, options?: {
|
|
7514
|
+
details?: Record<string, unknown>;
|
|
7515
|
+
requestId?: string;
|
|
7516
|
+
cause?: Error;
|
|
7517
|
+
});
|
|
7518
|
+
}
|
|
7519
|
+
/**
|
|
7520
|
+
* Resource not found error
|
|
7521
|
+
*/
|
|
7522
|
+
declare class OCXPNotFoundError extends OCXPError {
|
|
7523
|
+
/** The resource path that was not found */
|
|
7524
|
+
readonly path?: string;
|
|
7525
|
+
constructor(message: string, path?: string, options?: {
|
|
7526
|
+
details?: Record<string, unknown>;
|
|
7527
|
+
requestId?: string;
|
|
7528
|
+
cause?: Error;
|
|
7529
|
+
});
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* Rate limit exceeded error
|
|
7533
|
+
*/
|
|
7534
|
+
declare class OCXPRateLimitError extends OCXPError {
|
|
7535
|
+
/** Seconds until rate limit resets */
|
|
7536
|
+
readonly retryAfter?: number;
|
|
7537
|
+
constructor(message?: string, retryAfter?: number, options?: {
|
|
7538
|
+
details?: Record<string, unknown>;
|
|
7539
|
+
requestId?: string;
|
|
7540
|
+
cause?: Error;
|
|
7541
|
+
});
|
|
7542
|
+
}
|
|
7543
|
+
/**
|
|
7544
|
+
* Conflict error (e.g., etag mismatch, concurrent modification)
|
|
7545
|
+
*/
|
|
7546
|
+
declare class OCXPConflictError extends OCXPError {
|
|
7547
|
+
/** Expected etag value */
|
|
7548
|
+
readonly expectedEtag?: string;
|
|
7549
|
+
/** Actual etag value */
|
|
7550
|
+
readonly actualEtag?: string;
|
|
7551
|
+
constructor(message: string, options?: {
|
|
7552
|
+
expectedEtag?: string;
|
|
7553
|
+
actualEtag?: string;
|
|
7554
|
+
details?: Record<string, unknown>;
|
|
7555
|
+
requestId?: string;
|
|
7556
|
+
cause?: Error;
|
|
7557
|
+
});
|
|
7558
|
+
}
|
|
7559
|
+
/**
|
|
7560
|
+
* Operation timeout error
|
|
7561
|
+
*/
|
|
7562
|
+
declare class OCXPTimeoutError extends OCXPError {
|
|
7563
|
+
/** Timeout duration in milliseconds */
|
|
7564
|
+
readonly timeoutMs?: number;
|
|
7565
|
+
constructor(message?: string, timeoutMs?: number, options?: {
|
|
7566
|
+
details?: Record<string, unknown>;
|
|
7567
|
+
requestId?: string;
|
|
7568
|
+
cause?: Error;
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7571
|
+
/**
|
|
7572
|
+
* Type guard to check if an error is an OCXPError
|
|
7573
|
+
*/
|
|
7574
|
+
declare function isOCXPError(error: unknown): error is OCXPError;
|
|
7575
|
+
/**
|
|
7576
|
+
* Type guard for specific error types
|
|
7577
|
+
*/
|
|
7578
|
+
declare function isOCXPNetworkError(error: unknown): error is OCXPNetworkError;
|
|
7579
|
+
declare function isOCXPValidationError(error: unknown): error is OCXPValidationError;
|
|
7580
|
+
declare function isOCXPAuthError(error: unknown): error is OCXPAuthError;
|
|
7581
|
+
declare function isOCXPNotFoundError(error: unknown): error is OCXPNotFoundError;
|
|
7582
|
+
declare function isOCXPRateLimitError(error: unknown): error is OCXPRateLimitError;
|
|
7583
|
+
declare function isOCXPConflictError(error: unknown): error is OCXPConflictError;
|
|
7584
|
+
declare function isOCXPTimeoutError(error: unknown): error is OCXPTimeoutError;
|
|
7585
|
+
/**
|
|
7586
|
+
* Map HTTP status code to appropriate OCXP error
|
|
7587
|
+
*/
|
|
7588
|
+
declare function mapHttpError(statusCode: number, message: string, options?: {
|
|
7589
|
+
details?: Record<string, unknown>;
|
|
7590
|
+
requestId?: string;
|
|
7591
|
+
path?: string;
|
|
7592
|
+
retryAfter?: number;
|
|
7593
|
+
}): OCXPError;
|
|
7594
|
+
|
|
7595
|
+
/**
|
|
7596
|
+
* OCXP Type Exports
|
|
7597
|
+
*/
|
|
7598
|
+
|
|
7599
|
+
/**
|
|
7600
|
+
* Project Credentials for frontend authentication
|
|
7601
|
+
*/
|
|
7602
|
+
interface ProjectCredentials {
|
|
7603
|
+
url?: string;
|
|
7604
|
+
username?: string;
|
|
7605
|
+
password?: string;
|
|
7606
|
+
createdAt?: string;
|
|
7607
|
+
updatedAt?: string;
|
|
7608
|
+
}
|
|
7609
|
+
|
|
7434
7610
|
interface ListEntry$1 {
|
|
7435
7611
|
name: string;
|
|
7436
7612
|
type: string;
|
|
@@ -8009,6 +8185,34 @@ declare class OCXPClient {
|
|
|
8009
8185
|
deleteGitHubToken(): Promise<{
|
|
8010
8186
|
success: boolean;
|
|
8011
8187
|
}>;
|
|
8188
|
+
/**
|
|
8189
|
+
* Get project credentials for frontend authentication
|
|
8190
|
+
* @param projectId - Project ID
|
|
8191
|
+
* @returns Project credentials
|
|
8192
|
+
*/
|
|
8193
|
+
getProjectCredentials(projectId: string): Promise<ProjectCredentials>;
|
|
8194
|
+
/**
|
|
8195
|
+
* Update project credentials for frontend authentication
|
|
8196
|
+
* @param projectId - Project ID
|
|
8197
|
+
* @param updates - Partial credential updates
|
|
8198
|
+
* @returns Updated project credentials
|
|
8199
|
+
*/
|
|
8200
|
+
updateProjectCredentials(projectId: string, updates: Partial<ProjectCredentials>): Promise<ProjectCredentials>;
|
|
8201
|
+
/**
|
|
8202
|
+
* Test project credentials
|
|
8203
|
+
* @param projectId - Project ID
|
|
8204
|
+
* @returns Test result with success flag and optional message
|
|
8205
|
+
*/
|
|
8206
|
+
testProjectCredentials(projectId: string): Promise<{
|
|
8207
|
+
success: boolean;
|
|
8208
|
+
message?: string;
|
|
8209
|
+
}>;
|
|
8210
|
+
/**
|
|
8211
|
+
* Delete project credentials
|
|
8212
|
+
* @param projectId - Project ID
|
|
8213
|
+
* @returns void
|
|
8214
|
+
*/
|
|
8215
|
+
deleteProjectCredentials(projectId: string): Promise<void>;
|
|
8012
8216
|
private _mission?;
|
|
8013
8217
|
private _project?;
|
|
8014
8218
|
private _session?;
|
|
@@ -8810,167 +9014,6 @@ declare class WebSocketService {
|
|
|
8810
9014
|
*/
|
|
8811
9015
|
declare function createWebSocketService(options: WebSocketServiceOptions): WebSocketService;
|
|
8812
9016
|
|
|
8813
|
-
/**
|
|
8814
|
-
* OCXP Error Types
|
|
8815
|
-
*
|
|
8816
|
-
* Typed error classes for the OCXP SDK providing structured error handling
|
|
8817
|
-
* with error codes, HTTP status codes, and detailed context.
|
|
8818
|
-
*/
|
|
8819
|
-
/**
|
|
8820
|
-
* Error codes for OCXP operations
|
|
8821
|
-
*/
|
|
8822
|
-
declare enum OCXPErrorCode {
|
|
8823
|
-
/** Network-level error (connection failed, timeout, etc.) */
|
|
8824
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
8825
|
-
/** Request or response validation failed */
|
|
8826
|
-
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
8827
|
-
/** Authentication or authorization failed */
|
|
8828
|
-
AUTH_ERROR = "AUTH_ERROR",
|
|
8829
|
-
/** Resource not found */
|
|
8830
|
-
NOT_FOUND = "NOT_FOUND",
|
|
8831
|
-
/** Rate limit exceeded */
|
|
8832
|
-
RATE_LIMITED = "RATE_LIMITED",
|
|
8833
|
-
/** Conflict (e.g., etag mismatch) */
|
|
8834
|
-
CONFLICT = "CONFLICT",
|
|
8835
|
-
/** Operation timed out */
|
|
8836
|
-
TIMEOUT = "TIMEOUT",
|
|
8837
|
-
/** Server-side error */
|
|
8838
|
-
SERVER_ERROR = "SERVER_ERROR",
|
|
8839
|
-
/** Unknown error */
|
|
8840
|
-
UNKNOWN = "UNKNOWN"
|
|
8841
|
-
}
|
|
8842
|
-
/**
|
|
8843
|
-
* Base error class for all OCXP errors
|
|
8844
|
-
*/
|
|
8845
|
-
declare class OCXPError extends Error {
|
|
8846
|
-
/** Error code for programmatic handling */
|
|
8847
|
-
readonly code: OCXPErrorCode;
|
|
8848
|
-
/** HTTP status code if applicable */
|
|
8849
|
-
readonly statusCode: number;
|
|
8850
|
-
/** Additional error details */
|
|
8851
|
-
readonly details?: Record<string, unknown>;
|
|
8852
|
-
/** Request ID for debugging */
|
|
8853
|
-
readonly requestId?: string;
|
|
8854
|
-
/** Original cause of the error */
|
|
8855
|
-
readonly cause?: Error;
|
|
8856
|
-
constructor(message: string, code?: OCXPErrorCode, statusCode?: number, options?: {
|
|
8857
|
-
details?: Record<string, unknown>;
|
|
8858
|
-
requestId?: string;
|
|
8859
|
-
cause?: Error;
|
|
8860
|
-
});
|
|
8861
|
-
/**
|
|
8862
|
-
* Convert error to JSON for logging/serialization
|
|
8863
|
-
*/
|
|
8864
|
-
toJSON(): Record<string, unknown>;
|
|
8865
|
-
}
|
|
8866
|
-
/**
|
|
8867
|
-
* Network-level error (connection failed, DNS resolution, etc.)
|
|
8868
|
-
*/
|
|
8869
|
-
declare class OCXPNetworkError extends OCXPError {
|
|
8870
|
-
constructor(message: string, options?: {
|
|
8871
|
-
details?: Record<string, unknown>;
|
|
8872
|
-
requestId?: string;
|
|
8873
|
-
cause?: Error;
|
|
8874
|
-
});
|
|
8875
|
-
}
|
|
8876
|
-
/**
|
|
8877
|
-
* Validation error (request or response validation failed)
|
|
8878
|
-
*/
|
|
8879
|
-
declare class OCXPValidationError extends OCXPError {
|
|
8880
|
-
/** Field-level validation errors */
|
|
8881
|
-
readonly validationErrors?: Record<string, string[]>;
|
|
8882
|
-
constructor(message: string, validationErrors?: Record<string, string[]>, options?: {
|
|
8883
|
-
details?: Record<string, unknown>;
|
|
8884
|
-
requestId?: string;
|
|
8885
|
-
cause?: Error;
|
|
8886
|
-
});
|
|
8887
|
-
}
|
|
8888
|
-
/**
|
|
8889
|
-
* Authentication or authorization error
|
|
8890
|
-
*/
|
|
8891
|
-
declare class OCXPAuthError extends OCXPError {
|
|
8892
|
-
constructor(message: string, options?: {
|
|
8893
|
-
details?: Record<string, unknown>;
|
|
8894
|
-
requestId?: string;
|
|
8895
|
-
cause?: Error;
|
|
8896
|
-
});
|
|
8897
|
-
}
|
|
8898
|
-
/**
|
|
8899
|
-
* Resource not found error
|
|
8900
|
-
*/
|
|
8901
|
-
declare class OCXPNotFoundError extends OCXPError {
|
|
8902
|
-
/** The resource path that was not found */
|
|
8903
|
-
readonly path?: string;
|
|
8904
|
-
constructor(message: string, path?: string, options?: {
|
|
8905
|
-
details?: Record<string, unknown>;
|
|
8906
|
-
requestId?: string;
|
|
8907
|
-
cause?: Error;
|
|
8908
|
-
});
|
|
8909
|
-
}
|
|
8910
|
-
/**
|
|
8911
|
-
* Rate limit exceeded error
|
|
8912
|
-
*/
|
|
8913
|
-
declare class OCXPRateLimitError extends OCXPError {
|
|
8914
|
-
/** Seconds until rate limit resets */
|
|
8915
|
-
readonly retryAfter?: number;
|
|
8916
|
-
constructor(message?: string, retryAfter?: number, options?: {
|
|
8917
|
-
details?: Record<string, unknown>;
|
|
8918
|
-
requestId?: string;
|
|
8919
|
-
cause?: Error;
|
|
8920
|
-
});
|
|
8921
|
-
}
|
|
8922
|
-
/**
|
|
8923
|
-
* Conflict error (e.g., etag mismatch, concurrent modification)
|
|
8924
|
-
*/
|
|
8925
|
-
declare class OCXPConflictError extends OCXPError {
|
|
8926
|
-
/** Expected etag value */
|
|
8927
|
-
readonly expectedEtag?: string;
|
|
8928
|
-
/** Actual etag value */
|
|
8929
|
-
readonly actualEtag?: string;
|
|
8930
|
-
constructor(message: string, options?: {
|
|
8931
|
-
expectedEtag?: string;
|
|
8932
|
-
actualEtag?: string;
|
|
8933
|
-
details?: Record<string, unknown>;
|
|
8934
|
-
requestId?: string;
|
|
8935
|
-
cause?: Error;
|
|
8936
|
-
});
|
|
8937
|
-
}
|
|
8938
|
-
/**
|
|
8939
|
-
* Operation timeout error
|
|
8940
|
-
*/
|
|
8941
|
-
declare class OCXPTimeoutError extends OCXPError {
|
|
8942
|
-
/** Timeout duration in milliseconds */
|
|
8943
|
-
readonly timeoutMs?: number;
|
|
8944
|
-
constructor(message?: string, timeoutMs?: number, options?: {
|
|
8945
|
-
details?: Record<string, unknown>;
|
|
8946
|
-
requestId?: string;
|
|
8947
|
-
cause?: Error;
|
|
8948
|
-
});
|
|
8949
|
-
}
|
|
8950
|
-
/**
|
|
8951
|
-
* Type guard to check if an error is an OCXPError
|
|
8952
|
-
*/
|
|
8953
|
-
declare function isOCXPError(error: unknown): error is OCXPError;
|
|
8954
|
-
/**
|
|
8955
|
-
* Type guard for specific error types
|
|
8956
|
-
*/
|
|
8957
|
-
declare function isOCXPNetworkError(error: unknown): error is OCXPNetworkError;
|
|
8958
|
-
declare function isOCXPValidationError(error: unknown): error is OCXPValidationError;
|
|
8959
|
-
declare function isOCXPAuthError(error: unknown): error is OCXPAuthError;
|
|
8960
|
-
declare function isOCXPNotFoundError(error: unknown): error is OCXPNotFoundError;
|
|
8961
|
-
declare function isOCXPRateLimitError(error: unknown): error is OCXPRateLimitError;
|
|
8962
|
-
declare function isOCXPConflictError(error: unknown): error is OCXPConflictError;
|
|
8963
|
-
declare function isOCXPTimeoutError(error: unknown): error is OCXPTimeoutError;
|
|
8964
|
-
/**
|
|
8965
|
-
* Map HTTP status code to appropriate OCXP error
|
|
8966
|
-
*/
|
|
8967
|
-
declare function mapHttpError(statusCode: number, message: string, options?: {
|
|
8968
|
-
details?: Record<string, unknown>;
|
|
8969
|
-
requestId?: string;
|
|
8970
|
-
path?: string;
|
|
8971
|
-
retryAfter?: number;
|
|
8972
|
-
}): OCXPError;
|
|
8973
|
-
|
|
8974
9017
|
/**
|
|
8975
9018
|
* Common Zod Schemas for OCXP API
|
|
8976
9019
|
*
|