@moogodev/client 0.0.0-stage → 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.
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Type definitions for Moogo object storage API.
3
+ * Matches the API responses from https://moogo.dev
4
+ */
5
+ /** Standard API error envelope */
6
+ export interface ApiError {
7
+ code: string;
8
+ message: string;
9
+ detail?: string;
10
+ }
11
+ export interface ApiErrorResponse {
12
+ error: ApiError;
13
+ }
14
+ /** Successful response wrapper */
15
+ export interface ApiSuccessResponse {
16
+ success: true;
17
+ [key: string]: any;
18
+ }
19
+ /** Project/bucket identifiers */
20
+ export type ProjectId = string;
21
+ export type BucketId = string;
22
+ export type ObjectKey = string;
23
+ /** Base object fields present in all object responses */
24
+ export interface ObjectBase {
25
+ id: string;
26
+ bucket_id: string;
27
+ bucket: string;
28
+ key: string;
29
+ size_bytes: number;
30
+ content_type: string;
31
+ is_public: boolean;
32
+ etag: string;
33
+ url: string;
34
+ preview_url: string;
35
+ public_url: string;
36
+ public_url_base: string;
37
+ url_base: string;
38
+ created_at: string;
39
+ updated_at: string;
40
+ last_modified: string;
41
+ }
42
+ /** Object as returned by upload/list endpoints */
43
+ export interface ObjectResponse extends ObjectBase {
44
+ }
45
+ /** Bucket configuration */
46
+ export interface Bucket {
47
+ id: string;
48
+ name: string;
49
+ object_count: number;
50
+ size_bytes: number;
51
+ created_at: string;
52
+ is_public: boolean;
53
+ allowed_types: string[];
54
+ max_object_size_bytes: number;
55
+ quota_bytes: number;
56
+ }
57
+ /** Bucket creation request */
58
+ export interface CreateBucketRequest {
59
+ name: string;
60
+ allowed_types?: string[];
61
+ max_object_size_bytes?: number;
62
+ quota_bytes?: number;
63
+ }
64
+ /** Bucket update request */
65
+ export interface UpdateBucketRequest {
66
+ is_public?: boolean;
67
+ allowed_types?: string[];
68
+ max_object_size_bytes?: number;
69
+ quota_bytes?: number;
70
+ }
71
+ /** Bucket info response (GET /buckets/{project_id}/{bucket_id}) */
72
+ export interface BucketInfoResponse {
73
+ success: true;
74
+ bucket: Bucket;
75
+ storage_used_bytes: number;
76
+ quota_bytes: number;
77
+ }
78
+ /** List buckets response */
79
+ export interface ListBucketsResponse {
80
+ success: true;
81
+ buckets: Bucket[];
82
+ }
83
+ /** Object upload response */
84
+ export interface UploadResponse {
85
+ success: true;
86
+ object: ObjectResponse;
87
+ storage_used_bytes: number;
88
+ quota_bytes: number;
89
+ }
90
+ /** List objects query parameters */
91
+ export interface ListObjectsQuery {
92
+ bucket?: string;
93
+ prefix?: string;
94
+ search?: string;
95
+ order_by?: 'key' | 'size' | 'created' | 'updated' | 'contenttype';
96
+ order_dir?: 'asc' | 'desc';
97
+ limit?: number;
98
+ cursor?: string;
99
+ }
100
+ /** Paginated object list response */
101
+ export interface ListObjectsResponse {
102
+ success: true;
103
+ objects: ObjectResponse[];
104
+ next_cursor: string | null;
105
+ total: number;
106
+ }
107
+ /** Presigned URL request */
108
+ export interface PresignedUrlRequest {
109
+ method: 'GET' | 'PUT';
110
+ expires_in: number;
111
+ }
112
+ /** Presigned URL response */
113
+ export interface PresignedUrlResponse {
114
+ success: true;
115
+ url: string;
116
+ expires_at: string;
117
+ method: 'GET' | 'PUT';
118
+ }
119
+ /** Signed upload response (POST /bucket/{project_id}/sign-upload) */
120
+ export interface SignedUploadResponse {
121
+ success: true;
122
+ upload_url: string;
123
+ object: ObjectResponse;
124
+ expires_at: string;
125
+ }
126
+ /** Storage credential */
127
+ export interface StorageCredential {
128
+ id: string;
129
+ access_key_id: string;
130
+ secret_key_preview: string;
131
+ label: string;
132
+ created_at: string;
133
+ rotated_at: string | null;
134
+ revoked_at: string | null;
135
+ }
136
+ /** List credentials response */
137
+ export interface ListCredentialsResponse {
138
+ success: true;
139
+ credentials: StorageCredential[];
140
+ }
141
+ /** Create credential request */
142
+ export interface CreateCredentialRequest {
143
+ label: string;
144
+ }
145
+ /** Create credential response (includes secret once) */
146
+ export interface CreateCredentialResponse {
147
+ success: true;
148
+ credential: StorageCredential;
149
+ secret_key: string;
150
+ }
151
+ /** Rotate credential response */
152
+ export interface RotateCredentialResponse {
153
+ success: true;
154
+ credential: StorageCredential;
155
+ secret_key: string;
156
+ }
157
+ /** Generic success response for deletions */
158
+ export interface DeleteResponse {
159
+ success: true;
160
+ }
161
+ /** Configuration for the client */
162
+ export interface ClientConfig {
163
+ /** Base URL of the Moogo API (e.g., "https://api.moogo.dev") */
164
+ baseUrl: string;
165
+ /** Project ID */
166
+ projectId: string;
167
+ /** Access Key ID */
168
+ accessKeyId: string;
169
+ /** Secret Key */
170
+ secretKey: string;
171
+ /** Optional: custom fetch implementation */
172
+ fetch?: typeof fetch;
173
+ /** Optional: default timeout in ms */
174
+ timeout?: number;
175
+ }
176
+ /** Internal: parsed auth header */
177
+ export interface ParsedAuth {
178
+ accessKeyId: string;
179
+ signature: string;
180
+ timestamp: string;
181
+ signedHeaders: string;
182
+ }
183
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kCAAkC;AAClC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,IAAI,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,iCAAiC;AACjC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,yDAAyD;AACzD,MAAM,WAAW,UAAU;IACzB,EAAE,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;IACpB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,mCAAmC;AACnC,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for Moogo object storage API.
4
+ * Matches the API responses from https://moogo.dev
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@moogodev/client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Official JavaScript/TypeScript client for Moogo object storage",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsc && tsc -m ESNext --outDir dist/esm && mv dist/esm/index.js dist/index.mjs",
17
+ "dev": "tsc -w",
18
+ "test": "vitest run",
19
+ "lint": "eslint src --ext .ts"
20
+ },
21
+ "keywords": [
22
+ "moogo",
23
+ "object-storage",
24
+ "s3-compatible",
25
+ "bucket"
26
+ ],
27
+ "author": "Moogo Team",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/moogodev/moogodev.git",
32
+ "directory": "clients/js"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/moogodev/moogodev/issues"
36
+ },
37
+ "homepage": "https://moogo.dev/docs/javascript-client",
38
+ "devDependencies": {
39
+ "typescript": "^5.4.0",
40
+ "vitest": "^1.4.0",
41
+ "@types/node": "^20.11.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ }
46
+ }