@acontext/acontext 0.0.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.
- package/README.md +80 -0
- package/dist/client-types.d.ts +16 -0
- package/dist/client-types.js +5 -0
- package/dist/client.d.ts +41 -0
- package/dist/client.js +283 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +8 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +45 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +34 -0
- package/dist/messages.d.ts +52 -0
- package/dist/messages.js +90 -0
- package/dist/resources/blocks.d.ts +32 -0
- package/dist/resources/blocks.js +84 -0
- package/dist/resources/disks.d.ts +46 -0
- package/dist/resources/disks.js +99 -0
- package/dist/resources/index.d.ts +7 -0
- package/dist/resources/index.js +23 -0
- package/dist/resources/sessions.d.ts +48 -0
- package/dist/resources/sessions.js +135 -0
- package/dist/resources/spaces.d.ts +22 -0
- package/dist/resources/spaces.js +48 -0
- package/dist/types/block.d.ts +18 -0
- package/dist/types/block.js +20 -0
- package/dist/types/disk.d.ts +75 -0
- package/dist/types/disk.js +42 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +23 -0
- package/dist/types/session.d.ts +121 -0
- package/dist/types/session.js +74 -0
- package/dist/types/space.d.ts +24 -0
- package/dist/types/space.js +19 -0
- package/dist/uploads.d.ts +22 -0
- package/dist/uploads.js +45 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +30 -0
- package/package.json +53 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for disk and artifact resources.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const DiskSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
project_id: z.ZodString;
|
|
8
|
+
created_at: z.ZodString;
|
|
9
|
+
updated_at: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type Disk = z.infer<typeof DiskSchema>;
|
|
12
|
+
export declare const ListDisksOutputSchema: z.ZodObject<{
|
|
13
|
+
items: z.ZodArray<z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
project_id: z.ZodString;
|
|
16
|
+
created_at: z.ZodString;
|
|
17
|
+
updated_at: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
has_more: z.ZodBoolean;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type ListDisksOutput = z.infer<typeof ListDisksOutputSchema>;
|
|
23
|
+
export declare const ArtifactSchema: z.ZodObject<{
|
|
24
|
+
disk_id: z.ZodString;
|
|
25
|
+
path: z.ZodString;
|
|
26
|
+
filename: z.ZodString;
|
|
27
|
+
meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
28
|
+
created_at: z.ZodString;
|
|
29
|
+
updated_at: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type Artifact = z.infer<typeof ArtifactSchema>;
|
|
32
|
+
export declare const FileContentSchema: z.ZodObject<{
|
|
33
|
+
type: z.ZodString;
|
|
34
|
+
raw: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type FileContent = z.infer<typeof FileContentSchema>;
|
|
37
|
+
export declare const GetArtifactRespSchema: z.ZodObject<{
|
|
38
|
+
artifact: z.ZodObject<{
|
|
39
|
+
disk_id: z.ZodString;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
filename: z.ZodString;
|
|
42
|
+
meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
43
|
+
created_at: z.ZodString;
|
|
44
|
+
updated_at: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
public_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
48
|
+
type: z.ZodString;
|
|
49
|
+
raw: z.ZodString;
|
|
50
|
+
}, z.core.$strip>>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type GetArtifactResp = z.infer<typeof GetArtifactRespSchema>;
|
|
53
|
+
export declare const ListArtifactsRespSchema: z.ZodObject<{
|
|
54
|
+
artifacts: z.ZodArray<z.ZodObject<{
|
|
55
|
+
disk_id: z.ZodString;
|
|
56
|
+
path: z.ZodString;
|
|
57
|
+
filename: z.ZodString;
|
|
58
|
+
meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
59
|
+
created_at: z.ZodString;
|
|
60
|
+
updated_at: z.ZodString;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
directories: z.ZodArray<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type ListArtifactsResp = z.infer<typeof ListArtifactsRespSchema>;
|
|
65
|
+
export declare const UpdateArtifactRespSchema: z.ZodObject<{
|
|
66
|
+
artifact: z.ZodObject<{
|
|
67
|
+
disk_id: z.ZodString;
|
|
68
|
+
path: z.ZodString;
|
|
69
|
+
filename: z.ZodString;
|
|
70
|
+
meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
71
|
+
created_at: z.ZodString;
|
|
72
|
+
updated_at: z.ZodString;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type UpdateArtifactResp = z.infer<typeof UpdateArtifactRespSchema>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type definitions for disk and artifact resources.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UpdateArtifactRespSchema = exports.ListArtifactsRespSchema = exports.GetArtifactRespSchema = exports.FileContentSchema = exports.ArtifactSchema = exports.ListDisksOutputSchema = exports.DiskSchema = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
exports.DiskSchema = zod_1.z.object({
|
|
9
|
+
id: zod_1.z.string(),
|
|
10
|
+
project_id: zod_1.z.string(),
|
|
11
|
+
created_at: zod_1.z.string(),
|
|
12
|
+
updated_at: zod_1.z.string(),
|
|
13
|
+
});
|
|
14
|
+
exports.ListDisksOutputSchema = zod_1.z.object({
|
|
15
|
+
items: zod_1.z.array(exports.DiskSchema),
|
|
16
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
17
|
+
has_more: zod_1.z.boolean(),
|
|
18
|
+
});
|
|
19
|
+
exports.ArtifactSchema = zod_1.z.object({
|
|
20
|
+
disk_id: zod_1.z.string(),
|
|
21
|
+
path: zod_1.z.string(),
|
|
22
|
+
filename: zod_1.z.string(),
|
|
23
|
+
meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
24
|
+
created_at: zod_1.z.string(),
|
|
25
|
+
updated_at: zod_1.z.string(),
|
|
26
|
+
});
|
|
27
|
+
exports.FileContentSchema = zod_1.z.object({
|
|
28
|
+
type: zod_1.z.string(),
|
|
29
|
+
raw: zod_1.z.string(),
|
|
30
|
+
});
|
|
31
|
+
exports.GetArtifactRespSchema = zod_1.z.object({
|
|
32
|
+
artifact: exports.ArtifactSchema,
|
|
33
|
+
public_url: zod_1.z.string().nullable().optional(),
|
|
34
|
+
content: exports.FileContentSchema.nullable().optional(),
|
|
35
|
+
});
|
|
36
|
+
exports.ListArtifactsRespSchema = zod_1.z.object({
|
|
37
|
+
artifacts: zod_1.z.array(exports.ArtifactSchema),
|
|
38
|
+
directories: zod_1.z.array(zod_1.z.string()),
|
|
39
|
+
});
|
|
40
|
+
exports.UpdateArtifactRespSchema = zod_1.z.object({
|
|
41
|
+
artifact: exports.ArtifactSchema,
|
|
42
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type exports
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./space"), exports);
|
|
21
|
+
__exportStar(require("./session"), exports);
|
|
22
|
+
__exportStar(require("./disk"), exports);
|
|
23
|
+
__exportStar(require("./block"), exports);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for session, message, and task resources.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const AssetSchema: z.ZodObject<{
|
|
6
|
+
bucket: z.ZodString;
|
|
7
|
+
s3_key: z.ZodString;
|
|
8
|
+
etag: z.ZodString;
|
|
9
|
+
sha256: z.ZodString;
|
|
10
|
+
mime: z.ZodString;
|
|
11
|
+
size_b: z.ZodNumber;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type Asset = z.infer<typeof AssetSchema>;
|
|
14
|
+
export declare const PartSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodString;
|
|
16
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
18
|
+
bucket: z.ZodString;
|
|
19
|
+
s3_key: z.ZodString;
|
|
20
|
+
etag: z.ZodString;
|
|
21
|
+
sha256: z.ZodString;
|
|
22
|
+
mime: z.ZodString;
|
|
23
|
+
size_b: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
filename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type Part = z.infer<typeof PartSchema>;
|
|
29
|
+
export declare const MessageSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
session_id: z.ZodString;
|
|
32
|
+
parent_id: z.ZodNullable<z.ZodString>;
|
|
33
|
+
role: z.ZodString;
|
|
34
|
+
meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
35
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
36
|
+
type: z.ZodString;
|
|
37
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
asset: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
39
|
+
bucket: z.ZodString;
|
|
40
|
+
s3_key: z.ZodString;
|
|
41
|
+
etag: z.ZodString;
|
|
42
|
+
sha256: z.ZodString;
|
|
43
|
+
mime: z.ZodString;
|
|
44
|
+
size_b: z.ZodNumber;
|
|
45
|
+
}, z.core.$strip>>>;
|
|
46
|
+
filename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
task_id: z.ZodNullable<z.ZodString>;
|
|
50
|
+
session_task_process_status: z.ZodString;
|
|
51
|
+
created_at: z.ZodString;
|
|
52
|
+
updated_at: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type Message = z.infer<typeof MessageSchema>;
|
|
55
|
+
export declare const SessionSchema: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
project_id: z.ZodString;
|
|
58
|
+
space_id: z.ZodNullable<z.ZodString>;
|
|
59
|
+
configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
60
|
+
created_at: z.ZodString;
|
|
61
|
+
updated_at: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type Session = z.infer<typeof SessionSchema>;
|
|
64
|
+
export declare const TaskSchema: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
session_id: z.ZodString;
|
|
67
|
+
project_id: z.ZodString;
|
|
68
|
+
order: z.ZodNumber;
|
|
69
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
70
|
+
status: z.ZodString;
|
|
71
|
+
is_planning: z.ZodBoolean;
|
|
72
|
+
space_digested: z.ZodBoolean;
|
|
73
|
+
created_at: z.ZodString;
|
|
74
|
+
updated_at: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export type Task = z.infer<typeof TaskSchema>;
|
|
77
|
+
export declare const ListSessionsOutputSchema: z.ZodObject<{
|
|
78
|
+
items: z.ZodArray<z.ZodObject<{
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
project_id: z.ZodString;
|
|
81
|
+
space_id: z.ZodNullable<z.ZodString>;
|
|
82
|
+
configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
83
|
+
created_at: z.ZodString;
|
|
84
|
+
updated_at: z.ZodString;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
has_more: z.ZodBoolean;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type ListSessionsOutput = z.infer<typeof ListSessionsOutputSchema>;
|
|
90
|
+
export declare const PublicURLSchema: z.ZodObject<{
|
|
91
|
+
url: z.ZodString;
|
|
92
|
+
expire_at: z.ZodString;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type PublicURL = z.infer<typeof PublicURLSchema>;
|
|
95
|
+
export declare const GetMessagesOutputSchema: z.ZodObject<{
|
|
96
|
+
items: z.ZodArray<z.ZodUnknown>;
|
|
97
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
has_more: z.ZodBoolean;
|
|
99
|
+
public_urls: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
100
|
+
url: z.ZodString;
|
|
101
|
+
expire_at: z.ZodString;
|
|
102
|
+
}, z.core.$strip>>>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export type GetMessagesOutput = z.infer<typeof GetMessagesOutputSchema>;
|
|
105
|
+
export declare const GetTasksOutputSchema: z.ZodObject<{
|
|
106
|
+
items: z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
session_id: z.ZodString;
|
|
109
|
+
project_id: z.ZodString;
|
|
110
|
+
order: z.ZodNumber;
|
|
111
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
112
|
+
status: z.ZodString;
|
|
113
|
+
is_planning: z.ZodBoolean;
|
|
114
|
+
space_digested: z.ZodBoolean;
|
|
115
|
+
created_at: z.ZodString;
|
|
116
|
+
updated_at: z.ZodString;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
|
+
has_more: z.ZodBoolean;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type GetTasksOutput = z.infer<typeof GetTasksOutputSchema>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type definitions for session, message, and task resources.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
exports.AssetSchema = zod_1.z.object({
|
|
9
|
+
bucket: zod_1.z.string(),
|
|
10
|
+
s3_key: zod_1.z.string(),
|
|
11
|
+
etag: zod_1.z.string(),
|
|
12
|
+
sha256: zod_1.z.string(),
|
|
13
|
+
mime: zod_1.z.string(),
|
|
14
|
+
size_b: zod_1.z.number(),
|
|
15
|
+
});
|
|
16
|
+
exports.PartSchema = zod_1.z.object({
|
|
17
|
+
type: zod_1.z.string(),
|
|
18
|
+
text: zod_1.z.string().nullable().optional(),
|
|
19
|
+
asset: exports.AssetSchema.nullable().optional(),
|
|
20
|
+
filename: zod_1.z.string().nullable().optional(),
|
|
21
|
+
meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable().optional(),
|
|
22
|
+
});
|
|
23
|
+
exports.MessageSchema = zod_1.z.object({
|
|
24
|
+
id: zod_1.z.string(),
|
|
25
|
+
session_id: zod_1.z.string(),
|
|
26
|
+
parent_id: zod_1.z.string().nullable(),
|
|
27
|
+
role: zod_1.z.string(),
|
|
28
|
+
meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
29
|
+
parts: zod_1.z.array(exports.PartSchema),
|
|
30
|
+
task_id: zod_1.z.string().nullable(),
|
|
31
|
+
session_task_process_status: zod_1.z.string(),
|
|
32
|
+
created_at: zod_1.z.string(),
|
|
33
|
+
updated_at: zod_1.z.string(),
|
|
34
|
+
});
|
|
35
|
+
exports.SessionSchema = zod_1.z.object({
|
|
36
|
+
id: zod_1.z.string(),
|
|
37
|
+
project_id: zod_1.z.string(),
|
|
38
|
+
space_id: zod_1.z.string().nullable(),
|
|
39
|
+
configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
40
|
+
created_at: zod_1.z.string(),
|
|
41
|
+
updated_at: zod_1.z.string(),
|
|
42
|
+
});
|
|
43
|
+
exports.TaskSchema = zod_1.z.object({
|
|
44
|
+
id: zod_1.z.string(),
|
|
45
|
+
session_id: zod_1.z.string(),
|
|
46
|
+
project_id: zod_1.z.string(),
|
|
47
|
+
order: zod_1.z.number(),
|
|
48
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
49
|
+
status: zod_1.z.string(),
|
|
50
|
+
is_planning: zod_1.z.boolean(),
|
|
51
|
+
space_digested: zod_1.z.boolean(),
|
|
52
|
+
created_at: zod_1.z.string(),
|
|
53
|
+
updated_at: zod_1.z.string(),
|
|
54
|
+
});
|
|
55
|
+
exports.ListSessionsOutputSchema = zod_1.z.object({
|
|
56
|
+
items: zod_1.z.array(exports.SessionSchema),
|
|
57
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
58
|
+
has_more: zod_1.z.boolean(),
|
|
59
|
+
});
|
|
60
|
+
exports.PublicURLSchema = zod_1.z.object({
|
|
61
|
+
url: zod_1.z.string(),
|
|
62
|
+
expire_at: zod_1.z.string(),
|
|
63
|
+
});
|
|
64
|
+
exports.GetMessagesOutputSchema = zod_1.z.object({
|
|
65
|
+
items: zod_1.z.array(zod_1.z.unknown()),
|
|
66
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
67
|
+
has_more: zod_1.z.boolean(),
|
|
68
|
+
public_urls: zod_1.z.record(zod_1.z.string(), exports.PublicURLSchema).nullable().optional(),
|
|
69
|
+
});
|
|
70
|
+
exports.GetTasksOutputSchema = zod_1.z.object({
|
|
71
|
+
items: zod_1.z.array(exports.TaskSchema),
|
|
72
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
73
|
+
has_more: zod_1.z.boolean(),
|
|
74
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for space resources.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const SpaceSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
project_id: z.ZodString;
|
|
8
|
+
configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
created_at: z.ZodString;
|
|
10
|
+
updated_at: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type Space = z.infer<typeof SpaceSchema>;
|
|
13
|
+
export declare const ListSpacesOutputSchema: z.ZodObject<{
|
|
14
|
+
items: z.ZodArray<z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
project_id: z.ZodString;
|
|
17
|
+
configs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
18
|
+
created_at: z.ZodString;
|
|
19
|
+
updated_at: z.ZodString;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
has_more: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type ListSpacesOutput = z.infer<typeof ListSpacesOutputSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type definitions for space resources.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
exports.SpaceSchema = zod_1.z.object({
|
|
9
|
+
id: zod_1.z.string(),
|
|
10
|
+
project_id: zod_1.z.string(),
|
|
11
|
+
configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
12
|
+
created_at: zod_1.z.string(),
|
|
13
|
+
updated_at: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
exports.ListSpacesOutputSchema = zod_1.z.object({
|
|
16
|
+
items: zod_1.z.array(exports.SpaceSchema),
|
|
17
|
+
next_cursor: zod_1.z.string().nullable().optional(),
|
|
18
|
+
has_more: zod_1.z.boolean(),
|
|
19
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for working with file uploads.
|
|
3
|
+
*/
|
|
4
|
+
export declare class FileUpload {
|
|
5
|
+
filename: string;
|
|
6
|
+
content: Buffer | NodeJS.ReadableStream;
|
|
7
|
+
contentType?: string | null;
|
|
8
|
+
constructor(options: {
|
|
9
|
+
filename: string;
|
|
10
|
+
content: Buffer | NodeJS.ReadableStream;
|
|
11
|
+
contentType?: string | null;
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Convert to a format suitable for form-data.
|
|
15
|
+
*/
|
|
16
|
+
asFormData(): {
|
|
17
|
+
filename: string;
|
|
18
|
+
content: Buffer | NodeJS.ReadableStream;
|
|
19
|
+
contentType: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function normalizeFileUpload(upload: FileUpload | [string, Buffer | NodeJS.ReadableStream] | [string, Buffer | NodeJS.ReadableStream, string | null]): FileUpload;
|
package/dist/uploads.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utilities for working with file uploads.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileUpload = void 0;
|
|
7
|
+
exports.normalizeFileUpload = normalizeFileUpload;
|
|
8
|
+
class FileUpload {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.filename = options.filename;
|
|
11
|
+
this.content = options.content;
|
|
12
|
+
this.contentType = options.contentType ?? null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert to a format suitable for form-data.
|
|
16
|
+
*/
|
|
17
|
+
asFormData() {
|
|
18
|
+
return {
|
|
19
|
+
filename: this.filename,
|
|
20
|
+
content: this.content,
|
|
21
|
+
contentType: this.contentType || 'application/octet-stream',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.FileUpload = FileUpload;
|
|
26
|
+
function normalizeFileUpload(upload) {
|
|
27
|
+
if (upload instanceof FileUpload) {
|
|
28
|
+
return upload;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(upload)) {
|
|
31
|
+
if (upload.length === 2) {
|
|
32
|
+
const [filename, content] = upload;
|
|
33
|
+
return new FileUpload({ filename, content });
|
|
34
|
+
}
|
|
35
|
+
if (upload.length === 3) {
|
|
36
|
+
const [filename, content, contentType] = upload;
|
|
37
|
+
return new FileUpload({
|
|
38
|
+
filename,
|
|
39
|
+
content,
|
|
40
|
+
contentType: contentType ?? null,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw new TypeError('Unsupported file upload payload');
|
|
45
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for the acontext TypeScript client.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Convert a boolean value to string representation used by the API.
|
|
6
|
+
*/
|
|
7
|
+
export declare function boolToStr(value: boolean): string;
|
|
8
|
+
/**
|
|
9
|
+
* Build query parameters dictionary, filtering None values and converting booleans.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildParams(params: Record<string, unknown>): Record<string, string | number>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for the acontext TypeScript client.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.boolToStr = boolToStr;
|
|
7
|
+
exports.buildParams = buildParams;
|
|
8
|
+
/**
|
|
9
|
+
* Convert a boolean value to string representation used by the API.
|
|
10
|
+
*/
|
|
11
|
+
function boolToStr(value) {
|
|
12
|
+
return value ? 'true' : 'false';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build query parameters dictionary, filtering None values and converting booleans.
|
|
16
|
+
*/
|
|
17
|
+
function buildParams(params) {
|
|
18
|
+
const result = {};
|
|
19
|
+
for (const [key, value] of Object.entries(params)) {
|
|
20
|
+
if (value !== null && value !== undefined) {
|
|
21
|
+
if (typeof value === 'boolean') {
|
|
22
|
+
result[key] = boolToStr(value);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
result[key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acontext/acontext",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript SDK for the Acontext API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"dev": "tsc --watch",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"lint": "eslint src",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"acontext",
|
|
16
|
+
"sdk",
|
|
17
|
+
"client",
|
|
18
|
+
"api",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"zod": "^4.1.12"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/jest": "^30.0.0",
|
|
28
|
+
"@types/node": "^24.10.0",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
30
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
31
|
+
"eslint": "^9.39.1",
|
|
32
|
+
"jest": "^30.2.0",
|
|
33
|
+
"ts-jest": "^29.4.5",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"node-fetch": "^3.3.2",
|
|
38
|
+
"form-data": "^4.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"node-fetch": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"form-data": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"README.md"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
|