@hasna/recordings 0.1.36 → 0.2.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/README.md +43 -0
- package/dist/cli/index.js +707 -5708
- package/dist/db/feedback.d.ts +13 -0
- package/dist/db/feedback.d.ts.map +1 -0
- package/dist/http/client.d.ts +77 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +633 -5356
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +528 -5470
- package/dist/sdk/index.d.ts +16 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +140 -0
- package/dist/sdk/v1.generated.d.ts +150 -0
- package/dist/sdk/v1.generated.d.ts.map +1 -0
- package/dist/server/cloud.d.ts +49 -0
- package/dist/server/cloud.d.ts.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +6931 -0
- package/dist/server/openapi.d.ts +614 -0
- package/dist/server/openapi.d.ts.map +1 -0
- package/dist/server/repo.d.ts +44 -0
- package/dist/server/repo.d.ts.map +1 -0
- package/dist/server/serve.d.ts +11 -0
- package/dist/server/serve.d.ts.map +1 -0
- package/dist/server/v1.d.ts +6 -0
- package/dist/server/v1.d.ts.map +1 -0
- package/dist/storage.d.ts +4 -6
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +706 -5286
- package/dist/store.d.ts +40 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +13 -4
- package/scripts/generate-sdk.ts +31 -0
- package/scripts/migrate.ts +37 -0
- package/dist/cli/storage.d.ts +0 -3
- package/dist/cli/storage.d.ts.map +0 -1
- package/dist/db/pg-migrate.d.ts +0 -8
- package/dist/db/pg-migrate.d.ts.map +0 -1
- package/dist/db/storage-config.d.ts +0 -28
- package/dist/db/storage-config.d.ts.map +0 -1
- package/dist/db/storage-sync.d.ts +0 -36
- package/dist/db/storage-sync.d.ts.map +0 -1
- package/dist/mcp/storage-tools.d.ts +0 -3
- package/dist/mcp/storage-tools.d.ts.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hasna/recordings SDK — typed `/v1` cloud client.
|
|
3
|
+
*
|
|
4
|
+
* Generated from the serve OpenAPI document (src/server/openapi.ts). Regenerate
|
|
5
|
+
* with `bun run generate:sdk`.
|
|
6
|
+
*
|
|
7
|
+
* import { RecordingsV1Client } from "@hasna/recordings/sdk";
|
|
8
|
+
* const client = new RecordingsV1Client({
|
|
9
|
+
* baseUrl: process.env.RECORDINGS_API_URL!,
|
|
10
|
+
* apiKey: process.env.RECORDINGS_API_KEY!,
|
|
11
|
+
* });
|
|
12
|
+
* const { recordings } = await client.listRecordings({ limit: 20 });
|
|
13
|
+
*/
|
|
14
|
+
export { RecordingsV1Client, ApiError as RecordingsV1ApiError, } from "./v1.generated.js";
|
|
15
|
+
export type { RecordingsV1ClientOptions, Recording as RecordingsV1Recording, Agent as RecordingsV1Agent, Project as RecordingsV1Project, CreateRecordingInput as RecordingsV1CreateRecordingInput, RegisterAgentInput as RecordingsV1RegisterAgentInput, RegisterProjectInput as RecordingsV1RegisterProjectInput, } from "./v1.generated.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,kBAAkB,EAClB,QAAQ,IAAI,oBAAoB,GACjC,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,yBAAyB,EACzB,SAAS,IAAI,qBAAqB,EAClC,KAAK,IAAI,iBAAiB,EAC1B,OAAO,IAAI,mBAAmB,EAC9B,oBAAoB,IAAI,gCAAgC,EACxD,kBAAkB,IAAI,8BAA8B,EACpD,oBAAoB,IAAI,gCAAgC,GACzD,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __require = import.meta.require;
|
|
3
|
+
|
|
4
|
+
// src/sdk/v1.generated.ts
|
|
5
|
+
class ApiError extends Error {
|
|
6
|
+
status;
|
|
7
|
+
body;
|
|
8
|
+
constructor(status, message, body) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.body = body;
|
|
12
|
+
this.name = "ApiError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class RecordingsV1Client {
|
|
17
|
+
baseUrl;
|
|
18
|
+
apiKey;
|
|
19
|
+
fetchImpl;
|
|
20
|
+
baseHeaders;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
if (!options.baseUrl)
|
|
23
|
+
throw new Error("RecordingsV1Client requires a baseUrl.");
|
|
24
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
25
|
+
this.apiKey = options.apiKey;
|
|
26
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
27
|
+
this.baseHeaders = options.headers ?? {};
|
|
28
|
+
}
|
|
29
|
+
async request(method, path, opts) {
|
|
30
|
+
const url = new URL(this.baseUrl + path);
|
|
31
|
+
if (opts.query) {
|
|
32
|
+
for (const [key, value] of Object.entries(opts.query)) {
|
|
33
|
+
if (value !== undefined && value !== null)
|
|
34
|
+
url.searchParams.set(key, String(value));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const headers = { Accept: "application/json", ...this.baseHeaders, ...opts.init?.headers };
|
|
38
|
+
if (this.apiKey)
|
|
39
|
+
headers["x-api-key"] = this.apiKey;
|
|
40
|
+
let payload;
|
|
41
|
+
if (opts.body !== undefined) {
|
|
42
|
+
headers["Content-Type"] = "application/json";
|
|
43
|
+
payload = JSON.stringify(opts.body);
|
|
44
|
+
}
|
|
45
|
+
const response = await this.fetchImpl(url.toString(), { ...opts.init, method, headers, body: payload });
|
|
46
|
+
const text = await response.text();
|
|
47
|
+
const data = text ? (() => {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(text);
|
|
50
|
+
} catch {
|
|
51
|
+
return text;
|
|
52
|
+
}
|
|
53
|
+
})() : undefined;
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
throw new ApiError(response.status, `${method} ${path} failed: ${response.status}`, data);
|
|
56
|
+
}
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
async listAgents(init) {
|
|
60
|
+
return this.request("GET", `/v1/agents`, {
|
|
61
|
+
body: undefined,
|
|
62
|
+
query: undefined,
|
|
63
|
+
init
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async registerAgent(body, init) {
|
|
67
|
+
return this.request("POST", `/v1/agents`, {
|
|
68
|
+
body,
|
|
69
|
+
query: undefined,
|
|
70
|
+
init
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async getAgent(id, init) {
|
|
74
|
+
return this.request("GET", `/v1/agents/${encodeURIComponent(String(id))}`, {
|
|
75
|
+
body: undefined,
|
|
76
|
+
query: undefined,
|
|
77
|
+
init
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async listProjects(init) {
|
|
81
|
+
return this.request("GET", `/v1/projects`, {
|
|
82
|
+
body: undefined,
|
|
83
|
+
query: undefined,
|
|
84
|
+
init
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async registerProject(body, init) {
|
|
88
|
+
return this.request("POST", `/v1/projects`, {
|
|
89
|
+
body,
|
|
90
|
+
query: undefined,
|
|
91
|
+
init
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async getProject(id, init) {
|
|
95
|
+
return this.request("GET", `/v1/projects/${encodeURIComponent(String(id))}`, {
|
|
96
|
+
body: undefined,
|
|
97
|
+
query: undefined,
|
|
98
|
+
init
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async listRecordings(query, init) {
|
|
102
|
+
return this.request("GET", `/v1/recordings`, {
|
|
103
|
+
body: undefined,
|
|
104
|
+
query,
|
|
105
|
+
init
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async createRecording(body, init) {
|
|
109
|
+
return this.request("POST", `/v1/recordings`, {
|
|
110
|
+
body,
|
|
111
|
+
query: undefined,
|
|
112
|
+
init
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async getRecording(id, init) {
|
|
116
|
+
return this.request("GET", `/v1/recordings/${encodeURIComponent(String(id))}`, {
|
|
117
|
+
body: undefined,
|
|
118
|
+
query: undefined,
|
|
119
|
+
init
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async deleteRecording(id, init) {
|
|
123
|
+
return this.request("DELETE", `/v1/recordings/${encodeURIComponent(String(id))}`, {
|
|
124
|
+
body: undefined,
|
|
125
|
+
query: undefined,
|
|
126
|
+
init
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async getRecordingStats(init) {
|
|
130
|
+
return this.request("GET", `/v1/stats`, {
|
|
131
|
+
body: undefined,
|
|
132
|
+
query: undefined,
|
|
133
|
+
init
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
RecordingsV1Client,
|
|
139
|
+
ApiError as RecordingsV1ApiError
|
|
140
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export interface Recording {
|
|
2
|
+
"id"?: string;
|
|
3
|
+
"audio_path"?: string | null;
|
|
4
|
+
"raw_text"?: string;
|
|
5
|
+
"processed_text"?: string | null;
|
|
6
|
+
"processing_mode"?: "raw" | "enhanced";
|
|
7
|
+
"model_used"?: string;
|
|
8
|
+
"enhancement_model"?: string | null;
|
|
9
|
+
"duration_ms"?: number;
|
|
10
|
+
"language"?: string | null;
|
|
11
|
+
"tags"?: Array<string>;
|
|
12
|
+
"agent_id"?: string | null;
|
|
13
|
+
"project_id"?: string | null;
|
|
14
|
+
"session_id"?: string | null;
|
|
15
|
+
"goal"?: string | null;
|
|
16
|
+
"role"?: string | null;
|
|
17
|
+
"task_list_id"?: string | null;
|
|
18
|
+
"machine_id"?: string | null;
|
|
19
|
+
"metadata"?: Record<string, unknown>;
|
|
20
|
+
"created_at"?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Agent {
|
|
23
|
+
"id"?: string;
|
|
24
|
+
"name"?: string;
|
|
25
|
+
"description"?: string | null;
|
|
26
|
+
"role"?: string;
|
|
27
|
+
"metadata"?: Record<string, unknown>;
|
|
28
|
+
"created_at"?: string;
|
|
29
|
+
"last_seen_at"?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Project {
|
|
32
|
+
"id"?: string;
|
|
33
|
+
"name"?: string;
|
|
34
|
+
"path"?: string;
|
|
35
|
+
"description"?: string | null;
|
|
36
|
+
"created_at"?: string;
|
|
37
|
+
"updated_at"?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateRecordingInput {
|
|
40
|
+
"raw_text": string;
|
|
41
|
+
"audio_path"?: string;
|
|
42
|
+
"processed_text"?: string;
|
|
43
|
+
"processing_mode"?: "raw" | "enhanced";
|
|
44
|
+
"model_used"?: string;
|
|
45
|
+
"enhancement_model"?: string;
|
|
46
|
+
"duration_ms"?: number;
|
|
47
|
+
"language"?: string;
|
|
48
|
+
"tags"?: Array<string>;
|
|
49
|
+
"agent_id"?: string;
|
|
50
|
+
"project_id"?: string;
|
|
51
|
+
"session_id"?: string;
|
|
52
|
+
"goal"?: string;
|
|
53
|
+
"role"?: string;
|
|
54
|
+
"task_list_id"?: string;
|
|
55
|
+
"machine_id"?: string;
|
|
56
|
+
"metadata"?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export interface RegisterAgentInput {
|
|
59
|
+
"name": string;
|
|
60
|
+
"description"?: string;
|
|
61
|
+
"role"?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface RegisterProjectInput {
|
|
64
|
+
"name": string;
|
|
65
|
+
"path": string;
|
|
66
|
+
"description"?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface RecordingsV1ClientOptions {
|
|
69
|
+
/** Base URL, e.g. process.env.APP_API_URL. */
|
|
70
|
+
baseUrl: string;
|
|
71
|
+
/** API key, e.g. process.env.APP_API_KEY. Sent as the 'x-api-key' header. */
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
/** Custom fetch (defaults to global fetch). */
|
|
74
|
+
fetch?: typeof fetch;
|
|
75
|
+
/** Extra headers merged into every request. */
|
|
76
|
+
headers?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
export declare class ApiError extends Error {
|
|
79
|
+
readonly status: number;
|
|
80
|
+
readonly body: unknown;
|
|
81
|
+
constructor(status: number, message: string, body: unknown);
|
|
82
|
+
}
|
|
83
|
+
export declare class RecordingsV1Client {
|
|
84
|
+
private readonly baseUrl;
|
|
85
|
+
private readonly apiKey;
|
|
86
|
+
private readonly fetchImpl;
|
|
87
|
+
private readonly baseHeaders;
|
|
88
|
+
constructor(options: RecordingsV1ClientOptions);
|
|
89
|
+
private request;
|
|
90
|
+
/** List agents */
|
|
91
|
+
listAgents(init?: RequestInit): Promise<{
|
|
92
|
+
"agents"?: Array<Agent>;
|
|
93
|
+
"count"?: number;
|
|
94
|
+
}>;
|
|
95
|
+
/** Register (upsert) an agent */
|
|
96
|
+
registerAgent(body: RegisterAgentInput, init?: RequestInit): Promise<{
|
|
97
|
+
"agent"?: Agent;
|
|
98
|
+
}>;
|
|
99
|
+
/** Get an agent by id or name */
|
|
100
|
+
getAgent(id: string, init?: RequestInit): Promise<{
|
|
101
|
+
"agent"?: Agent;
|
|
102
|
+
}>;
|
|
103
|
+
/** List projects */
|
|
104
|
+
listProjects(init?: RequestInit): Promise<{
|
|
105
|
+
"projects"?: Array<Project>;
|
|
106
|
+
"count"?: number;
|
|
107
|
+
}>;
|
|
108
|
+
/** Register (upsert) a project */
|
|
109
|
+
registerProject(body: RegisterProjectInput, init?: RequestInit): Promise<{
|
|
110
|
+
"project"?: Project;
|
|
111
|
+
}>;
|
|
112
|
+
/** Get a project by id or path */
|
|
113
|
+
getProject(id: string, init?: RequestInit): Promise<{
|
|
114
|
+
"project"?: Project;
|
|
115
|
+
}>;
|
|
116
|
+
/** List recordings */
|
|
117
|
+
listRecordings(query?: {
|
|
118
|
+
"agent_id"?: string;
|
|
119
|
+
"project_id"?: string;
|
|
120
|
+
"session_id"?: string;
|
|
121
|
+
"processing_mode"?: "raw" | "enhanced";
|
|
122
|
+
"search"?: string;
|
|
123
|
+
"limit"?: number;
|
|
124
|
+
"offset"?: number;
|
|
125
|
+
}, init?: RequestInit): Promise<{
|
|
126
|
+
"recordings"?: Array<Recording>;
|
|
127
|
+
"count"?: number;
|
|
128
|
+
}>;
|
|
129
|
+
/** Create a recording */
|
|
130
|
+
createRecording(body: CreateRecordingInput, init?: RequestInit): Promise<{
|
|
131
|
+
"recording"?: Recording;
|
|
132
|
+
}>;
|
|
133
|
+
/** Get a recording by id */
|
|
134
|
+
getRecording(id: string, init?: RequestInit): Promise<{
|
|
135
|
+
"recording"?: Recording;
|
|
136
|
+
}>;
|
|
137
|
+
/** Delete a recording by id */
|
|
138
|
+
deleteRecording(id: string, init?: RequestInit): Promise<{
|
|
139
|
+
"deleted"?: boolean;
|
|
140
|
+
}>;
|
|
141
|
+
/** Aggregate recording statistics */
|
|
142
|
+
getRecordingStats(init?: RequestInit): Promise<{
|
|
143
|
+
"total"?: number;
|
|
144
|
+
"raw"?: number;
|
|
145
|
+
"enhanced"?: number;
|
|
146
|
+
"total_duration_ms"?: number;
|
|
147
|
+
"by_model"?: Record<string, number>;
|
|
148
|
+
}>;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=v1.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v1.generated.d.ts","sourceRoot":"","sources":["../../src/sdk/v1.generated.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,SAAS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C,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAQvF,qCAAqC;IAC/B,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CAOrL"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud (A1 pure-remote) service wiring for `recordings-serve`.
|
|
3
|
+
*
|
|
4
|
+
* Per Amendment A1 the serve process reads and writes the shared cloud Postgres
|
|
5
|
+
* DIRECTLY through the repo-native async adapter (`PgAdapterAsync`) — there is
|
|
6
|
+
* NO local sync/cache in the service. Everything is lazy: nothing touches
|
|
7
|
+
* Postgres or crypto until the first `/v1` (or `/ready`) request, so the
|
|
8
|
+
* local-first CLI/MCP paths keep ZERO cloud dependencies.
|
|
9
|
+
*
|
|
10
|
+
* Auth is enforced by the vendored `@hasna/contracts` kit: stateless HMAC-signed
|
|
11
|
+
* API keys, hashed at rest in the cloud Postgres `api_keys` table, verified per request.
|
|
12
|
+
*/
|
|
13
|
+
import { type ApiKeyVerifier } from "@hasna/contracts/auth";
|
|
14
|
+
import { ApiKeyStore } from "@hasna/contracts/auth";
|
|
15
|
+
import { PgAdapterAsync } from "../db/remote-storage.js";
|
|
16
|
+
export declare const RECORDINGS_APP_SLUG = "recordings";
|
|
17
|
+
/** Resolve the remote DATABASE_URL from the supported env vars (priority order). */
|
|
18
|
+
export declare function resolveCloudDatabaseUrl(env?: NodeJS.ProcessEnv): string | undefined;
|
|
19
|
+
/** Resolve the HMAC signing secret used to verify API keys. */
|
|
20
|
+
export declare function resolveSigningSecret(env?: NodeJS.ProcessEnv): string | undefined;
|
|
21
|
+
/** True when this process is configured to serve the cloud `/v1` API. */
|
|
22
|
+
export declare function isCloudModeEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
23
|
+
/** The pure-remote Postgres adapter backing every `/v1` handler. */
|
|
24
|
+
export declare function getCloudPg(): PgAdapterAsync;
|
|
25
|
+
export declare function getApiKeyStore(): ApiKeyStore;
|
|
26
|
+
/**
|
|
27
|
+
* The framework-agnostic API-key verifier for `/v1`. Tokens are stateless,
|
|
28
|
+
* HMAC-signed by the contracts issuer; revocation is checked against the cloud Postgres
|
|
29
|
+
* `api_keys` table. Fails closed when no signing secret is configured.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCloudVerifier(): ApiKeyVerifier;
|
|
32
|
+
/**
|
|
33
|
+
* Ensure the remote schema exists: the relational recordings tables plus the
|
|
34
|
+
* contracts api-keys table. Idempotent (CREATE ... IF NOT EXISTS / ADD COLUMN IF
|
|
35
|
+
* NOT EXISTS) — safe to run against a populated DB; NEVER drops or rewrites.
|
|
36
|
+
*
|
|
37
|
+
* Per the platform isolation model the request-path role (`recordings_app`) has
|
|
38
|
+
* DML only — no DDL. DDL is owned by the `recordings_owner` role (the migration
|
|
39
|
+
* task / out-of-band apply). So when this runs under the app role and the tables
|
|
40
|
+
* already exist, a "permission denied" on the CREATE path is EXPECTED: we treat
|
|
41
|
+
* the schema as externally managed and continue. If the tables are genuinely
|
|
42
|
+
* missing we fail loudly (never a silent stub).
|
|
43
|
+
*/
|
|
44
|
+
export declare function ensureCloudSchema(): Promise<void>;
|
|
45
|
+
/** Cheap readiness probe: round-trips a trivial query to cloud Postgres. */
|
|
46
|
+
export declare function pingCloud(): Promise<boolean>;
|
|
47
|
+
/** Test/shutdown helper. */
|
|
48
|
+
export declare function closeCloud(): Promise<void>;
|
|
49
|
+
//# sourceMappingURL=cloud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/server/cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAOhG;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAO7F;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAIhF;AAOD,oEAAoE;AACpE,wBAAgB,UAAU,IAAI,cAAc,CAU3C;AAsBD,wBAAgB,cAAc,IAAI,WAAW,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,cAAc,CAejD;AAsBD;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA+BvD;AAED,4EAA4E;AAC5E,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAIlD;AAED,4BAA4B;AAC5B,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAMhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":""}
|