@sapiom/tools 0.7.0 → 0.8.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/CHANGELOG.md +35 -0
- package/README.md +10 -9
- package/dist/cjs/client.d.ts +28 -2
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +12 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/content-generation/index.d.ts +64 -1
- package/dist/cjs/content-generation/index.d.ts.map +1 -1
- package/dist/cjs/content-generation/index.js +129 -5
- package/dist/cjs/content-generation/index.js.map +1 -1
- package/dist/cjs/database/errors.d.ts +16 -0
- package/dist/cjs/database/errors.d.ts.map +1 -0
- package/dist/cjs/database/errors.js +36 -0
- package/dist/cjs/database/errors.js.map +1 -0
- package/dist/cjs/database/index.d.ts +103 -0
- package/dist/cjs/database/index.d.ts.map +1 -0
- package/dist/cjs/database/index.js +120 -0
- package/dist/cjs/database/index.js.map +1 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +12 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/search/index.d.ts +132 -3
- package/dist/cjs/search/index.d.ts.map +1 -1
- package/dist/cjs/search/index.js +160 -3
- package/dist/cjs/search/index.js.map +1 -1
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +112 -2
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/esm/client.d.ts +28 -2
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +13 -1
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/content-generation/index.d.ts +64 -1
- package/dist/esm/content-generation/index.d.ts.map +1 -1
- package/dist/esm/content-generation/index.js +126 -4
- package/dist/esm/content-generation/index.js.map +1 -1
- package/dist/esm/database/errors.d.ts +16 -0
- package/dist/esm/database/errors.d.ts.map +1 -0
- package/dist/esm/database/errors.js +31 -0
- package/dist/esm/database/errors.js.map +1 -0
- package/dist/esm/database/index.d.ts +103 -0
- package/dist/esm/database/index.d.ts.map +1 -0
- package/dist/esm/database/index.js +115 -0
- package/dist/esm/database/index.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/search/index.d.ts +132 -3
- package/dist/esm/search/index.d.ts.map +1 -1
- package/dist/esm/search/index.js +157 -3
- package/dist/esm/search/index.js.map +1 -1
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +112 -2
- package/dist/esm/stub/index.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/src/content-generation/README.md +67 -0
- package/src/database/README.md +62 -0
- package/src/search/README.md +130 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `database` capability — provision an on-demand Postgres database, retrieve it,
|
|
3
|
+
* and delete it. You get back direct connection credentials, so you can connect
|
|
4
|
+
* with any standard Postgres client or driver.
|
|
5
|
+
*
|
|
6
|
+
* import { database } from "@sapiom/tools"; // ambient auth
|
|
7
|
+
* const db = await database.create({ duration: "1h", handle: "analytics" });
|
|
8
|
+
* db.connection?.connectionString; // a ready-to-use Postgres URI
|
|
9
|
+
*
|
|
10
|
+
* const again = await database.get(db.id); // or get("analytics") by handle
|
|
11
|
+
* await database.delete(db.id); // or delete("analytics")
|
|
12
|
+
*
|
|
13
|
+
* Or via an explicit client: `createClient({ apiKey }).database.create(...)`.
|
|
14
|
+
*
|
|
15
|
+
* This is a provisioning surface, not a query layer: it hands you connection
|
|
16
|
+
* credentials and you run your own SQL with the client of your choice.
|
|
17
|
+
*/
|
|
18
|
+
import { Transport } from "../_client/index.js";
|
|
19
|
+
import { DatabaseHttpError } from "./errors.js";
|
|
20
|
+
export { DatabaseHttpError };
|
|
21
|
+
/** The set of valid database lifetimes, in ascending order. */
|
|
22
|
+
export declare const DATABASE_DURATIONS: readonly ["15m", "1h", "4h", "24h", "7d"];
|
|
23
|
+
/** How long the database lives before it is automatically removed. */
|
|
24
|
+
export type DatabaseDuration = (typeof DATABASE_DURATIONS)[number];
|
|
25
|
+
/** Lifecycle state of a database. */
|
|
26
|
+
export type DatabaseStatus = "provisioning" | "active" | "expired" | "deleting" | "deleted";
|
|
27
|
+
export interface CreateDatabaseInput {
|
|
28
|
+
/** How long the database lives before it is automatically removed (required). */
|
|
29
|
+
duration: DatabaseDuration;
|
|
30
|
+
/**
|
|
31
|
+
* Optional stable, human-friendly key you can use to look the database up later
|
|
32
|
+
* (`get(handle)` / `delete(handle)`). 3–63 chars, `^[a-z0-9][a-z0-9-]*[a-z0-9]$`.
|
|
33
|
+
* Unique within your tenant.
|
|
34
|
+
*/
|
|
35
|
+
handle?: string;
|
|
36
|
+
/** Optional display name. */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** Optional description (up to 500 chars). */
|
|
39
|
+
description?: string;
|
|
40
|
+
/** Optional region to provision in. Defaults to a US region. */
|
|
41
|
+
region?: string;
|
|
42
|
+
/** Optional Postgres major version. Defaults to the latest supported. */
|
|
43
|
+
pgVersion?: 15 | 16 | 17;
|
|
44
|
+
}
|
|
45
|
+
export interface DatabaseConnection {
|
|
46
|
+
/**
|
|
47
|
+
* The full Postgres connection URI — pass this to any Postgres client. This is
|
|
48
|
+
* the canonical value and is always present; the component fields below are
|
|
49
|
+
* parsed from it on a best-effort basis and may be absent if it can't be parsed.
|
|
50
|
+
*/
|
|
51
|
+
connectionString: string;
|
|
52
|
+
/** Database host. */
|
|
53
|
+
host?: string;
|
|
54
|
+
/** Database port. */
|
|
55
|
+
port?: number;
|
|
56
|
+
/** Database user. */
|
|
57
|
+
username?: string;
|
|
58
|
+
/** Database password. */
|
|
59
|
+
password?: string;
|
|
60
|
+
/** Name of the database to connect to. */
|
|
61
|
+
databaseName?: string;
|
|
62
|
+
/** SSL mode from the connection URI, when present (e.g. "require"). */
|
|
63
|
+
sslmode?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface Database {
|
|
66
|
+
/** Unique database identifier. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** The handle you set at creation, or `null` if none was given. */
|
|
69
|
+
handle: string | null;
|
|
70
|
+
/** Display name, or `null`. */
|
|
71
|
+
name: string | null;
|
|
72
|
+
/** Description, or `null`. */
|
|
73
|
+
description: string | null;
|
|
74
|
+
/** Lifecycle state. */
|
|
75
|
+
status: DatabaseStatus;
|
|
76
|
+
/** Region the database is provisioned in. */
|
|
77
|
+
region: string;
|
|
78
|
+
/** Postgres major version. */
|
|
79
|
+
pgVersion: number;
|
|
80
|
+
/** The lifetime the database was created with. */
|
|
81
|
+
duration: DatabaseDuration | string;
|
|
82
|
+
/** Connection credentials — `null` while the database is still being provisioned. */
|
|
83
|
+
connection: DatabaseConnection | null;
|
|
84
|
+
/** ISO-8601 timestamp when the database expires, or `null`. */
|
|
85
|
+
expiresAt: string | null;
|
|
86
|
+
/** ISO-8601 timestamp when the database was created. */
|
|
87
|
+
createdAt: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Provision a new Postgres database. `duration` is required. Returns the database
|
|
91
|
+
* with connection credentials in `connection`. Failed requests throw
|
|
92
|
+
* {@link DatabaseHttpError}.
|
|
93
|
+
*/
|
|
94
|
+
export declare function create(input: CreateDatabaseInput, transport?: Transport, baseUrl?: string): Promise<Database>;
|
|
95
|
+
/** Retrieve a database by its id or handle. */
|
|
96
|
+
export declare function get(idOrHandle: string, transport?: Transport, baseUrl?: string): Promise<Database>;
|
|
97
|
+
/**
|
|
98
|
+
* Delete a database by its id or handle. Exported as `delete`:
|
|
99
|
+
* `import { database } from "@sapiom/tools"; await database.delete(id)`.
|
|
100
|
+
*/
|
|
101
|
+
declare function deleteDatabase(idOrHandle: string, transport?: Transport, baseUrl?: string): Promise<void>;
|
|
102
|
+
export { deleteDatabase as delete };
|
|
103
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/database/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAY,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAO7B,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,2CAA4C,CAAC;AAE5E,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,qCAAqC;AACrC,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,YAA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exports, "__esModule", { value: true });
|
|
3
|
+
exports.DATABASE_DURATIONS = exports.DatabaseHttpError = void 0;
|
|
4
|
+
exports.create = create;
|
|
5
|
+
exports.get = get;
|
|
6
|
+
exports.delete = deleteDatabase;
|
|
7
|
+
/**
|
|
8
|
+
* `database` capability — provision an on-demand Postgres database, retrieve it,
|
|
9
|
+
* and delete it. You get back direct connection credentials, so you can connect
|
|
10
|
+
* with any standard Postgres client or driver.
|
|
11
|
+
*
|
|
12
|
+
* import { database } from "@sapiom/tools"; // ambient auth
|
|
13
|
+
* const db = await database.create({ duration: "1h", handle: "analytics" });
|
|
14
|
+
* db.connection?.connectionString; // a ready-to-use Postgres URI
|
|
15
|
+
*
|
|
16
|
+
* const again = await database.get(db.id); // or get("analytics") by handle
|
|
17
|
+
* await database.delete(db.id); // or delete("analytics")
|
|
18
|
+
*
|
|
19
|
+
* Or via an explicit client: `createClient({ apiKey }).database.create(...)`.
|
|
20
|
+
*
|
|
21
|
+
* This is a provisioning surface, not a query layer: it hands you connection
|
|
22
|
+
* credentials and you run your own SQL with the client of your choice.
|
|
23
|
+
*/
|
|
24
|
+
const index_js_1 = require("../_client/index.js");
|
|
25
|
+
const errors_js_1 = require("./errors.js");
|
|
26
|
+
Object.defineProperty(exports, "DatabaseHttpError", { enumerable: true, get: function () { return errors_js_1.DatabaseHttpError; } });
|
|
27
|
+
const DEFAULT_BASE_URL = process.env.SAPIOM_DATABASE_URL || "https://neon.services.sapiom.ai";
|
|
28
|
+
// ----- Types -----
|
|
29
|
+
/** The set of valid database lifetimes, in ascending order. */
|
|
30
|
+
exports.DATABASE_DURATIONS = ["15m", "1h", "4h", "24h", "7d"];
|
|
31
|
+
/**
|
|
32
|
+
* Break a Postgres connection URI into its parts. `connectionString` is always
|
|
33
|
+
* preserved (it is the value you pass to a client); the parsed components are a
|
|
34
|
+
* convenience. If the URI can't be parsed, only `connectionString` is returned.
|
|
35
|
+
*/
|
|
36
|
+
function parseConnectionUri(uri) {
|
|
37
|
+
try {
|
|
38
|
+
const u = new URL(uri);
|
|
39
|
+
return {
|
|
40
|
+
connectionString: uri,
|
|
41
|
+
host: u.hostname,
|
|
42
|
+
port: u.port ? Number(u.port) : 5432,
|
|
43
|
+
username: decodeURIComponent(u.username),
|
|
44
|
+
password: decodeURIComponent(u.password),
|
|
45
|
+
databaseName: u.pathname.replace(/^\//, ""),
|
|
46
|
+
sslmode: u.searchParams.get("sslmode") ?? undefined,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return { connectionString: uri };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function mapDatabase(raw) {
|
|
54
|
+
return {
|
|
55
|
+
id: raw.id,
|
|
56
|
+
handle: raw.handle,
|
|
57
|
+
name: raw.name,
|
|
58
|
+
description: raw.description,
|
|
59
|
+
status: raw.status,
|
|
60
|
+
region: raw.region,
|
|
61
|
+
pgVersion: raw.pgVersion,
|
|
62
|
+
duration: raw.duration,
|
|
63
|
+
connection: raw.connectionUri == null ? null : parseConnectionUri(raw.connectionUri),
|
|
64
|
+
expiresAt: raw.expiresAt,
|
|
65
|
+
createdAt: raw.createdAt,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// ----- Capability operations -----
|
|
69
|
+
/**
|
|
70
|
+
* Provision a new Postgres database. `duration` is required. Returns the database
|
|
71
|
+
* with connection credentials in `connection`. Failed requests throw
|
|
72
|
+
* {@link DatabaseHttpError}.
|
|
73
|
+
*/
|
|
74
|
+
async function create(input, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
75
|
+
if (!input?.duration ||
|
|
76
|
+
!exports.DATABASE_DURATIONS.includes(input.duration)) {
|
|
77
|
+
throw new errors_js_1.DatabaseHttpError("duration must be one of: 15m, 1h, 4h, 24h, 7d", 400, { duration: input?.duration });
|
|
78
|
+
}
|
|
79
|
+
const body = { duration: input.duration };
|
|
80
|
+
if (input.handle !== undefined)
|
|
81
|
+
body.handle = input.handle;
|
|
82
|
+
if (input.name !== undefined)
|
|
83
|
+
body.name = input.name;
|
|
84
|
+
if (input.description !== undefined)
|
|
85
|
+
body.description = input.description;
|
|
86
|
+
if (input.region !== undefined)
|
|
87
|
+
body.region = input.region;
|
|
88
|
+
if (input.pgVersion !== undefined)
|
|
89
|
+
body.pgVersion = input.pgVersion;
|
|
90
|
+
const res = await (0, errors_js_1.ensureOk)(await transport.fetch(`${baseUrl}/v1/databases`, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers: { "content-type": "application/json" },
|
|
93
|
+
body: JSON.stringify(body),
|
|
94
|
+
}), "Failed to create database");
|
|
95
|
+
return mapDatabase((await res.json()));
|
|
96
|
+
}
|
|
97
|
+
/** Retrieve a database by its id or handle. */
|
|
98
|
+
async function get(idOrHandle, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
99
|
+
const res = await (0, errors_js_1.ensureOk)(await transport.fetch(`${baseUrl}/v1/databases/${encodeURIComponent(idOrHandle)}`), `Failed to get database '${idOrHandle}'`);
|
|
100
|
+
return mapDatabase((await res.json()));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Delete a database by its id or handle. Exported as `delete`:
|
|
104
|
+
* `import { database } from "@sapiom/tools"; await database.delete(id)`.
|
|
105
|
+
*/
|
|
106
|
+
async function deleteDatabase(idOrHandle, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
107
|
+
const res = await transport.fetch(`${baseUrl}/v1/databases/${encodeURIComponent(idOrHandle)}`, { method: "DELETE" });
|
|
108
|
+
if (!res.ok) {
|
|
109
|
+
const text = await res.text().catch(() => "");
|
|
110
|
+
let parsed;
|
|
111
|
+
try {
|
|
112
|
+
parsed = JSON.parse(text);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
parsed = text;
|
|
116
|
+
}
|
|
117
|
+
throw new errors_js_1.DatabaseHttpError(`Failed to delete database '${idOrHandle}': ${res.status} ${text}`, res.status, parsed);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/index.ts"],"names":[],"mappings":";;;AAiLA,wBAgCC;AAGD,kBAYC;AA+B0B,gCAAM;AA/PjC;;;;;;;;;;;;;;;;GAgBG;AACH,kDAAkE;AAClE,2CAA0D;AAEjD,kGAFU,6BAAiB,OAEV;AAE1B,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,iCAAiC,CAAC;AAEvE,oBAAoB;AAEpB,+DAA+D;AAClD,QAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAU,CAAC;AAuG5E;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,GAAW;IACrC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO;YACL,gBAAgB,EAAE,GAAG;YACrB,IAAI,EAAE,CAAC,CAAC,QAAQ;YAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;YACpC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC;YACxC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC;YACxC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAC3C,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS;SACpD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC;IACnC,CAAC;AACH,C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D,EAAE,MAAM,EAAE,QAAQ,EAAE,CACrB,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,6BAAiB,CACzB,8BAA8B,UAAU,MAAM,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,EAClE,GAAG,CAAC,MAAM,EACV,MAAM,CACP,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export * as fileStorage from "./file-storage/index.js";
|
|
|
31
31
|
export { FileStorageHttpError } from "./file-storage/index.js";
|
|
32
32
|
export * as contentGeneration from "./content-generation/index.js";
|
|
33
33
|
export { ContentGenerationHttpError } from "./content-generation/index.js";
|
|
34
|
+
export { VIDEO_RESULT_SIGNAL } from "./content-generation/index.js";
|
|
35
|
+
export type { VideoResultPayload } from "./content-generation/index.js";
|
|
36
|
+
export { toVideoResumePayload } from "./content-generation/index.js";
|
|
34
37
|
export * as search from "./search/index.js";
|
|
35
38
|
export { SearchHttpError } from "./search/index.js";
|
|
39
|
+
export * as database from "./database/index.js";
|
|
40
|
+
export { DatabaseHttpError } from "./database/index.js";
|
|
36
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAA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OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SearchHttpError = exports.search = exports.ContentGenerationHttpError = exports.contentGeneration = exports.FileStorageHttpError = exports.fileStorage = exports.OrchestrationResultSchemaError = exports.orchestrationResultSchema = exports.ORCHESTRATIONS_RESULT_SIGNAL = exports.orchestrations = exports.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX = exports.toResumePayload = exports.CodingResultSchemaError = exports.codingResultSchema = exports.CODING_RESULT_SIGNAL = exports.agent = exports.Repository = exports.repositories = exports.Sandbox = exports.sandboxes = exports.createClientFromEnv = exports.createClient = void 0;
|
|
36
|
+
exports.DatabaseHttpError = exports.database = exports.SearchHttpError = exports.search = exports.toVideoResumePayload = exports.VIDEO_RESULT_SIGNAL = exports.ContentGenerationHttpError = exports.contentGeneration = exports.FileStorageHttpError = exports.fileStorage = exports.OrchestrationResultSchemaError = exports.orchestrationResultSchema = exports.ORCHESTRATIONS_RESULT_SIGNAL = exports.orchestrations = exports.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX = exports.toResumePayload = exports.CodingResultSchemaError = exports.codingResultSchema = exports.CODING_RESULT_SIGNAL = exports.agent = exports.Repository = exports.repositories = exports.Sandbox = exports.sandboxes = exports.createClientFromEnv = exports.createClient = void 0;
|
|
37
37
|
/**
|
|
38
38
|
* `@sapiom/tools` — the typed Sapiom capability client.
|
|
39
39
|
*
|
|
@@ -81,7 +81,16 @@ Object.defineProperty(exports, "FileStorageHttpError", { enumerable: true, get:
|
|
|
81
81
|
exports.contentGeneration = __importStar(require("./content-generation/index.js"));
|
|
82
82
|
var index_js_8 = require("./content-generation/index.js");
|
|
83
83
|
Object.defineProperty(exports, "ContentGenerationHttpError", { enumerable: true, get: function () { return index_js_8.ContentGenerationHttpError; } });
|
|
84
|
+
// Surfaced top-level for the static `pause: { signal }` decl on a workflow step.
|
|
85
|
+
var index_js_9 = require("./content-generation/index.js");
|
|
86
|
+
Object.defineProperty(exports, "VIDEO_RESULT_SIGNAL", { enumerable: true, get: function () { return index_js_9.VIDEO_RESULT_SIGNAL; } });
|
|
87
|
+
// Map a live VideoGenerationResult to the wire shape the resumed step receives.
|
|
88
|
+
var index_js_10 = require("./content-generation/index.js");
|
|
89
|
+
Object.defineProperty(exports, "toVideoResumePayload", { enumerable: true, get: function () { return index_js_10.toVideoResumePayload; } });
|
|
84
90
|
exports.search = __importStar(require("./search/index.js"));
|
|
85
|
-
var
|
|
86
|
-
Object.defineProperty(exports, "SearchHttpError", { enumerable: true, get: function () { return
|
|
91
|
+
var index_js_11 = require("./search/index.js");
|
|
92
|
+
Object.defineProperty(exports, "SearchHttpError", { enumerable: true, get: function () { return index_js_11.SearchHttpError; } });
|
|
93
|
+
exports.database = __importStar(require("./database/index.js"));
|
|
94
|
+
var index_js_12 = require("./database/index.js");
|
|
95
|
+
Object.defineProperty(exports, "DatabaseHttpError", { enumerable: true, get: function () { return index_js_12.DatabaseHttpError; } });
|
|
87
96
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,yCAAgE;AAAvD,yGAAA,YAAY,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAQ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A4B,OAAA;AAIrC,oEAAoE;AACpE,sDAGmC;AAFjC,qHAAA,yBAAyB,OAAA;AACzB,0HAAA,8BAA8B,OAAA;AAGhC,uEAAuD;AACvD,oDAA+D;AAAtD,gHAAA,oBAAoB,OAAA;AAE7B,mFAAmE;AACnE,0DAA2E;AAAlE,sHAAA,0BAA0B,OAAA;AACnC,iFAAiF;AACjF,0DAAoE;AAA3D,+GAAA,mBAAmB,OAAA;AAI5B,gFAAgF;AAChF,2DAAqE;AAA5D,iHAAA,oBAAoB,OAAA;AAE7B,4DAA4C;AAC5C,+CAAoD;AAA3C,4GAAA,eAAe,OAAA;AAExB,gEAAgD;AAChD,iDAAwD;AAA/C,8GAAA,iBAAiB,OAAA"}
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
* `search` capability — find information across the web and beyond.
|
|
3
3
|
*
|
|
4
4
|
* This is the home for Sapiom's search primitives: searching the web, reading the
|
|
5
|
-
* contents of a page, and looking up professional email addresses.
|
|
6
|
-
*
|
|
7
|
-
* follow.
|
|
5
|
+
* contents of a page, and looking up professional email addresses. It offers
|
|
6
|
+
* `webSearch` (search the web), `scrape` (read a page), and `emailSearch` (find,
|
|
7
|
+
* verify, and discover professional email addresses); more operations follow.
|
|
8
8
|
*
|
|
9
9
|
* import { search } from "@sapiom/tools"; // ambient auth
|
|
10
10
|
* const hits = await search.webSearch({ query: "what is an LLM agent?" });
|
|
11
11
|
* hits.answer; // a synthesized answer
|
|
12
12
|
* const page = await search.scrape({ url: "https://example.com" });
|
|
13
13
|
* page.markdown; // the page content as markdown
|
|
14
|
+
* const found = await search.emailSearch.findEmail({
|
|
15
|
+
* domain: "example.com", fullName: "Ada Lovelace",
|
|
16
|
+
* });
|
|
17
|
+
* found.email; // the discovered email, or null when not found
|
|
14
18
|
*
|
|
15
19
|
* Or via an explicit client: `createClient({ apiKey }).search.webSearch(...)`.
|
|
16
20
|
*
|
|
@@ -102,4 +106,129 @@ export interface WebSearchResponse {
|
|
|
102
106
|
* Failed requests throw {@link SearchHttpError}.
|
|
103
107
|
*/
|
|
104
108
|
export declare function webSearch(input: WebSearchInput, transport?: Transport, baseUrl?: string): Promise<WebSearchResponse>;
|
|
109
|
+
export interface FindEmailInput {
|
|
110
|
+
/** Company domain to search at, e.g. `"example.com"`. Provide this or `company`. */
|
|
111
|
+
domain?: string;
|
|
112
|
+
/** Company name, as an alternative to `domain`. Provide this or `domain`. */
|
|
113
|
+
company?: string;
|
|
114
|
+
/** Person's first name. Provide with `lastName`, or use `fullName`. */
|
|
115
|
+
firstName?: string;
|
|
116
|
+
/** Person's last name. Provide with `firstName`, or use `fullName`. */
|
|
117
|
+
lastName?: string;
|
|
118
|
+
/** Person's full name, as an alternative to `firstName` + `lastName`. */
|
|
119
|
+
fullName?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface FindEmailResult {
|
|
122
|
+
/** The discovered email address, or `null` when none was found. */
|
|
123
|
+
email: string | null;
|
|
124
|
+
/** Confidence score (0–100) that the email is correct. */
|
|
125
|
+
score?: number;
|
|
126
|
+
/** First name associated with the result. */
|
|
127
|
+
firstName?: string;
|
|
128
|
+
/** Last name associated with the result. */
|
|
129
|
+
lastName?: string;
|
|
130
|
+
/** Job title / position associated with the result. */
|
|
131
|
+
position?: string;
|
|
132
|
+
/** Company associated with the result. */
|
|
133
|
+
company?: string;
|
|
134
|
+
/** LinkedIn profile URL associated with the result. */
|
|
135
|
+
linkedinUrl?: string;
|
|
136
|
+
/** Deliverability verification for the discovered email, when available. */
|
|
137
|
+
verification?: {
|
|
138
|
+
status?: string;
|
|
139
|
+
date?: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Find a person's professional email address.
|
|
144
|
+
*
|
|
145
|
+
* You must provide enough to identify both the person and where they work:
|
|
146
|
+
* a `domain` OR `company`, AND either a `fullName` OR both `firstName` and
|
|
147
|
+
* `lastName`. Calling without a valid combination throws {@link SearchHttpError}
|
|
148
|
+
* before any request is made.
|
|
149
|
+
*
|
|
150
|
+
* Returns the best match, with `email` set to `null` when none was found. Failed
|
|
151
|
+
* requests throw {@link SearchHttpError}.
|
|
152
|
+
*/
|
|
153
|
+
export declare function findEmail(input: FindEmailInput, transport?: Transport, baseUrl?: string): Promise<FindEmailResult>;
|
|
154
|
+
export interface VerifyEmailInput {
|
|
155
|
+
/** The email address to verify. */
|
|
156
|
+
email: string;
|
|
157
|
+
}
|
|
158
|
+
export interface VerifyEmailResult {
|
|
159
|
+
/** The email address that was verified (echoes the input). */
|
|
160
|
+
email: string;
|
|
161
|
+
/** Overall deliverability status. */
|
|
162
|
+
status?: string;
|
|
163
|
+
/** Verification result classification. */
|
|
164
|
+
result?: string;
|
|
165
|
+
/** Confidence score (0–100) in the verification. */
|
|
166
|
+
score?: number;
|
|
167
|
+
/** Whether the mail server accepted the address at the SMTP level. */
|
|
168
|
+
smtpCheck?: boolean;
|
|
169
|
+
/** Whether the domain accepts mail for any address (so a positive is weak). */
|
|
170
|
+
acceptAll?: boolean;
|
|
171
|
+
/** Whether the address belongs to a disposable email provider. */
|
|
172
|
+
disposable?: boolean;
|
|
173
|
+
/** Whether the address belongs to a public webmail provider. */
|
|
174
|
+
webmail?: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Verify that an email address is deliverable — returns a status, confidence
|
|
178
|
+
* score, SMTP/accept-all checks, and disposable/webmail flags. Use it before
|
|
179
|
+
* sending to avoid bounces.
|
|
180
|
+
*
|
|
181
|
+
* Failed requests throw {@link SearchHttpError}.
|
|
182
|
+
*/
|
|
183
|
+
export declare function verifyEmail(input: VerifyEmailInput, transport?: Transport, baseUrl?: string): Promise<VerifyEmailResult>;
|
|
184
|
+
export interface DomainSearchInput {
|
|
185
|
+
/** Company domain to search, e.g. `"example.com"`. */
|
|
186
|
+
domain: string;
|
|
187
|
+
/** Maximum number of emails to return (max 100, default 10). */
|
|
188
|
+
limit?: number;
|
|
189
|
+
/** Filter by email type. */
|
|
190
|
+
type?: "personal" | "generic";
|
|
191
|
+
/** Filter to one or more seniority levels. */
|
|
192
|
+
seniority?: ("junior" | "senior" | "executive")[];
|
|
193
|
+
/** Filter to one or more departments (e.g. `"engineering"`, `"sales"`). */
|
|
194
|
+
department?: string[];
|
|
195
|
+
}
|
|
196
|
+
export interface DomainEmail {
|
|
197
|
+
/** The email address. */
|
|
198
|
+
email: string;
|
|
199
|
+
/** Email type (e.g. `"personal"` or `"generic"`). */
|
|
200
|
+
type?: string;
|
|
201
|
+
/** Confidence score (0–100) that the address is valid. */
|
|
202
|
+
confidence?: number;
|
|
203
|
+
/** First name associated with the address. */
|
|
204
|
+
firstName?: string;
|
|
205
|
+
/** Last name associated with the address. */
|
|
206
|
+
lastName?: string;
|
|
207
|
+
/** Job title / position associated with the address. */
|
|
208
|
+
position?: string;
|
|
209
|
+
/** Department associated with the address. */
|
|
210
|
+
department?: string;
|
|
211
|
+
/** Seniority level associated with the address. */
|
|
212
|
+
seniority?: string;
|
|
213
|
+
}
|
|
214
|
+
export interface DomainSearchResult {
|
|
215
|
+
/** The domain that was searched (echoes the input). */
|
|
216
|
+
domain: string;
|
|
217
|
+
/** The organization name for the domain, when known. */
|
|
218
|
+
organization?: string;
|
|
219
|
+
/** The detected email pattern for the domain (e.g. `"{first}.{last}"`). */
|
|
220
|
+
pattern?: string;
|
|
221
|
+
/** Whether the domain accepts mail for any address. */
|
|
222
|
+
acceptAll?: boolean;
|
|
223
|
+
/** The emails discovered at the domain. */
|
|
224
|
+
emails: DomainEmail[];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Discover the professional emails published at a company domain. Filter the
|
|
228
|
+
* results by `type`, `seniority`, and `department` to home in on the people you
|
|
229
|
+
* care about.
|
|
230
|
+
*
|
|
231
|
+
* Failed requests throw {@link SearchHttpError}.
|
|
232
|
+
*/
|
|
233
|
+
export declare function domainSearch(input: DomainSearchInput, transport?: Transport, baseUrl?: string): Promise<DomainSearchResult>;
|
|
105
234
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,CAAC;AAa3B,sEAAsE;AACtE,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,MAAM,GACN,SAAS,GACT,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,WAAW;IAC1B,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,oEAAoE;IACpE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,UAAU,CA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