@pierre/storage 0.3.0 → 0.4.0
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 +25 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/package.json +38 -39
- package/src/index.ts +30 -0
- package/src/types.ts +9 -0
package/dist/index.d.cts
CHANGED
|
@@ -490,6 +490,13 @@ interface CreateRepoOptions extends GitStorageInvocationOptions {
|
|
|
490
490
|
baseRepo?: BaseRepo;
|
|
491
491
|
defaultBranch?: string;
|
|
492
492
|
}
|
|
493
|
+
interface DeleteRepoOptions extends GitStorageInvocationOptions {
|
|
494
|
+
id: string;
|
|
495
|
+
}
|
|
496
|
+
interface DeleteRepoResult {
|
|
497
|
+
repoId: string;
|
|
498
|
+
message: string;
|
|
499
|
+
}
|
|
493
500
|
interface GetFileOptions extends GitStorageInvocationOptions {
|
|
494
501
|
path: string;
|
|
495
502
|
ref?: string;
|
|
@@ -882,6 +889,12 @@ declare class GitStorage {
|
|
|
882
889
|
* @returns The found repository
|
|
883
890
|
*/
|
|
884
891
|
findOne(options: FindOneOptions): Promise<Repo | null>;
|
|
892
|
+
/**
|
|
893
|
+
* Delete a repository by ID
|
|
894
|
+
* @param options The delete options containing the repo ID
|
|
895
|
+
* @returns The deletion result
|
|
896
|
+
*/
|
|
897
|
+
deleteRepo(options: DeleteRepoOptions): Promise<DeleteRepoResult>;
|
|
885
898
|
/**
|
|
886
899
|
* Get the current configuration
|
|
887
900
|
* @returns The client configuration
|
|
@@ -897,4 +910,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
897
910
|
|
|
898
911
|
type StorageOptions = GitStorageOptions;
|
|
899
912
|
|
|
900
|
-
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetRemoteURLOptions, type GitFileMode, GitStorage, type GitStorageOptions, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, type RawFilteredFile, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
913
|
+
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetRemoteURLOptions, type GitFileMode, GitStorage, type GitStorageOptions, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, type RawFilteredFile, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -490,6 +490,13 @@ interface CreateRepoOptions extends GitStorageInvocationOptions {
|
|
|
490
490
|
baseRepo?: BaseRepo;
|
|
491
491
|
defaultBranch?: string;
|
|
492
492
|
}
|
|
493
|
+
interface DeleteRepoOptions extends GitStorageInvocationOptions {
|
|
494
|
+
id: string;
|
|
495
|
+
}
|
|
496
|
+
interface DeleteRepoResult {
|
|
497
|
+
repoId: string;
|
|
498
|
+
message: string;
|
|
499
|
+
}
|
|
493
500
|
interface GetFileOptions extends GitStorageInvocationOptions {
|
|
494
501
|
path: string;
|
|
495
502
|
ref?: string;
|
|
@@ -882,6 +889,12 @@ declare class GitStorage {
|
|
|
882
889
|
* @returns The found repository
|
|
883
890
|
*/
|
|
884
891
|
findOne(options: FindOneOptions): Promise<Repo | null>;
|
|
892
|
+
/**
|
|
893
|
+
* Delete a repository by ID
|
|
894
|
+
* @param options The delete options containing the repo ID
|
|
895
|
+
* @returns The deletion result
|
|
896
|
+
*/
|
|
897
|
+
deleteRepo(options: DeleteRepoOptions): Promise<DeleteRepoResult>;
|
|
885
898
|
/**
|
|
886
899
|
* Get the current configuration
|
|
887
900
|
* @returns The client configuration
|
|
@@ -897,4 +910,4 @@ declare function createClient(options: GitStorageOptions): GitStorage;
|
|
|
897
910
|
|
|
898
911
|
type StorageOptions = GitStorageOptions;
|
|
899
912
|
|
|
900
|
-
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetRemoteURLOptions, type GitFileMode, GitStorage, type GitStorageOptions, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, type RawFilteredFile, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
|
913
|
+
export { ApiError, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateRepoOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FilteredFile, type FindOneOptions, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetRemoteURLOptions, type GitFileMode, GitStorage, type GitStorageOptions, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawFileDiff, type RawFilteredFile, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -444,7 +444,7 @@ function concatChunks(a, b) {
|
|
|
444
444
|
|
|
445
445
|
// package.json
|
|
446
446
|
var package_default = {
|
|
447
|
-
version: "0.
|
|
447
|
+
version: "0.4.0"};
|
|
448
448
|
|
|
449
449
|
// src/version.ts
|
|
450
450
|
var PACKAGE_NAME = "code-storage-sdk";
|
|
@@ -1897,6 +1897,30 @@ var GitStorage = class _GitStorage {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
return new RepoImpl(options.id, this.options, this.generateJWT.bind(this));
|
|
1899
1899
|
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Delete a repository by ID
|
|
1902
|
+
* @param options The delete options containing the repo ID
|
|
1903
|
+
* @returns The deletion result
|
|
1904
|
+
*/
|
|
1905
|
+
async deleteRepo(options) {
|
|
1906
|
+
const ttl = resolveInvocationTtlSeconds(options, DEFAULT_TOKEN_TTL_SECONDS);
|
|
1907
|
+
const jwt = await this.generateJWT(options.id, {
|
|
1908
|
+
permissions: ["repo:write"],
|
|
1909
|
+
ttl
|
|
1910
|
+
});
|
|
1911
|
+
const resp = await this.api.delete("repos/delete", jwt, { allowedStatus: [404, 409] });
|
|
1912
|
+
if (resp.status === 404) {
|
|
1913
|
+
throw new Error("Repository not found");
|
|
1914
|
+
}
|
|
1915
|
+
if (resp.status === 409) {
|
|
1916
|
+
throw new Error("Repository already deleted");
|
|
1917
|
+
}
|
|
1918
|
+
const body = await resp.json();
|
|
1919
|
+
return {
|
|
1920
|
+
repoId: body.repo_id,
|
|
1921
|
+
message: body.message
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1900
1924
|
/**
|
|
1901
1925
|
* Get the current configuration
|
|
1902
1926
|
* @returns The client configuration
|