@sapiom/tools 0.4.0 → 0.5.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/CHANGELOG.md +7 -1
- package/README.md +13 -2
- package/dist/cjs/client.d.ts +10 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +6 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/content-generation/errors.d.ts +16 -0
- package/dist/cjs/content-generation/errors.d.ts.map +1 -0
- package/dist/cjs/content-generation/errors.js +36 -0
- package/dist/cjs/content-generation/errors.js.map +1 -0
- package/dist/cjs/content-generation/index.d.ts +87 -0
- package/dist/cjs/content-generation/index.d.ts.map +1 -0
- package/dist/cjs/content-generation/index.js +77 -0
- package/dist/cjs/content-generation/index.js.map +1 -0
- package/dist/cjs/file-storage/errors.d.ts +2 -2
- package/dist/cjs/file-storage/errors.js +2 -2
- package/dist/cjs/file-storage/index.d.ts +14 -18
- package/dist/cjs/file-storage/index.d.ts.map +1 -1
- package/dist/cjs/file-storage/index.js +9 -11
- package/dist/cjs/file-storage/index.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +16 -0
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/esm/client.d.ts +10 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +6 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/content-generation/errors.d.ts +16 -0
- package/dist/esm/content-generation/errors.d.ts.map +1 -0
- package/dist/esm/content-generation/errors.js +31 -0
- package/dist/esm/content-generation/errors.js.map +1 -0
- package/dist/esm/content-generation/index.d.ts +87 -0
- package/dist/esm/content-generation/index.d.ts.map +1 -0
- package/dist/esm/content-generation/index.js +73 -0
- package/dist/esm/content-generation/index.js.map +1 -0
- package/dist/esm/file-storage/errors.d.ts +2 -2
- package/dist/esm/file-storage/errors.js +2 -2
- package/dist/esm/file-storage/index.d.ts +14 -18
- package/dist/esm/file-storage/index.d.ts.map +1 -1
- package/dist/esm/file-storage/index.js +9 -11
- package/dist/esm/file-storage/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +16 -0
- 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 +61 -0
- package/src/file-storage/README.md +12 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sapiom/tools
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c974b1: Add the `contentGeneration` capability — media generation (images today; video and audio to come) with an optional `storage` param that persists each output to Sapiom file storage (each generated image comes back annotated with its own `fileId`, or `storageError`). Exposes `contentGeneration.images.create({ prompt, numImages?, storage? })` via `createClient()`, the ambient `contentGeneration` namespace, or the `@sapiom/tools/content-generation` subpath. Failed requests throw `ContentGenerationHttpError`. Pairs with `fileStorage` — pass `storage` to persist outputs with no extra plumbing.
|
|
8
|
+
|
|
3
9
|
## 0.4.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -28,7 +34,7 @@
|
|
|
28
34
|
|
|
29
35
|
### Minor Changes
|
|
30
36
|
|
|
31
|
-
- 7f6859e: Add the `fileStorage` capability — tenant-scoped object storage
|
|
37
|
+
- 7f6859e: Add the `fileStorage` capability — tenant-scoped object storage with presigned URLs. Exposes `upload`, `getDownloadUrl`, `list`, `setVisibility`, and `delete` via `createClient().fileStorage`, the ambient `fileStorage` namespace, or the `@sapiom/tools/file-storage` subpath. Failed requests throw `FileStorageHttpError`. You transfer the bytes yourself via the presigned URLs.
|
|
32
38
|
|
|
33
39
|
## 0.1.3
|
|
34
40
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @sapiom/tools
|
|
2
2
|
|
|
3
|
-
A typed TypeScript client for Sapiom capabilities — sandboxes, git repositories, coding agents,
|
|
3
|
+
A typed TypeScript client for Sapiom capabilities — sandboxes, git repositories, coding agents, file storage, and content generation — authenticated to your tenant.
|
|
4
4
|
|
|
5
5
|
These are the same capabilities your Sapiom agents call as tools; this package makes them callable directly from your own code.
|
|
6
6
|
|
|
@@ -70,7 +70,8 @@ Each capability is a namespace, importable from the barrel or its own subpath (e
|
|
|
70
70
|
| `sandboxes` | Isolated, ephemeral compute | [src/sandboxes](./src/sandboxes/README.md) |
|
|
71
71
|
| `repositories` | Private, in-network git repos | [src/repositories](./src/repositories/README.md) |
|
|
72
72
|
| `agent` | Coding agents (LLM execution) | [src/agent](./src/agent/README.md) |
|
|
73
|
-
| `fileStorage` | Tenant-scoped object storage (presigned
|
|
73
|
+
| `fileStorage` | Tenant-scoped object storage (presigned URLs) | [src/file-storage](./src/file-storage/README.md) |
|
|
74
|
+
| `contentGeneration` | Media generation (images; video/audio soon), with optional `storage` | [src/content-generation](./src/content-generation/README.md) |
|
|
74
75
|
|
|
75
76
|
## Composing capabilities
|
|
76
77
|
|
|
@@ -83,6 +84,16 @@ await repo.pushFromSandbox(run.sandbox);
|
|
|
83
84
|
|
|
84
85
|
A useful pattern: let the agent do the open-ended work (writing files) and perform exact, repeatable actions — committing, pushing, deploying — in your own code rather than in the agent's prompt. The agent produces the changes; `pushFromSandbox` publishes them deterministically.
|
|
85
86
|
|
|
87
|
+
Some compositions need nothing but a param. `contentGeneration.images.create` takes an optional `storage`, and each generated image is persisted into `fileStorage` as it returns — handing you a durable `fileId` with no extra call:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const out = await contentGeneration.images.create({
|
|
91
|
+
prompt: "a logo",
|
|
92
|
+
storage: { visibility: "private" },
|
|
93
|
+
});
|
|
94
|
+
const { downloadUrl } = await fileStorage.getDownloadUrl(out.images![0].fileId!);
|
|
95
|
+
```
|
|
96
|
+
|
|
86
97
|
## License
|
|
87
98
|
|
|
88
99
|
MIT
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { SandboxCreateOptions } from "./sandboxes/index.js";
|
|
|
20
20
|
import { Repository } from "./repositories/index.js";
|
|
21
21
|
import type { CodingRunSpec, CodingRunResult, RunHandle } from "./agent/index.js";
|
|
22
22
|
import type { UploadInput, UploadResponse, DownloadUrlResponse, ListOptions, ListResponse, FileMetadata } from "./file-storage/index.js";
|
|
23
|
+
import type { ImageCreateInput, ImageGenerationResult } from "./content-generation/index.js";
|
|
23
24
|
export interface Sapiom {
|
|
24
25
|
readonly sandboxes: {
|
|
25
26
|
create(opts: SandboxCreateOptions): Promise<Sandbox>;
|
|
@@ -48,6 +49,15 @@ export interface Sapiom {
|
|
|
48
49
|
delete(fileId: string): Promise<void>;
|
|
49
50
|
setVisibility(fileId: string, visibility: "private" | "public"): Promise<FileMetadata>;
|
|
50
51
|
};
|
|
52
|
+
readonly contentGeneration: {
|
|
53
|
+
images: {
|
|
54
|
+
/**
|
|
55
|
+
* Generate image(s) from a prompt. Pass `storage` to persist each output into
|
|
56
|
+
* file-storage (the returned images then carry `file_id`).
|
|
57
|
+
*/
|
|
58
|
+
create(input: ImageCreateInput): Promise<ImageGenerationResult>;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
51
61
|
/**
|
|
52
62
|
* Derive a client that attributes its calls to a different agent/trace. For the
|
|
53
63
|
* router case (one process acting for many agents); step-authoring code doesn't
|
package/dist/cjs/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,aAAa,CACX,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,SAAS,GAAG,QAAQ,GAC/B,OAAO,CAAC,YAAY,CAAC,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,iBAAiB,EAAE;QAC1B,MAAM,EAAE;YACN;;;eAGG;YACH,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;SACjE,CAAC;KACH,CAAC;IACF;;;;OAIG;IACH,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;CAEnD;AAwCD,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -56,6 +56,7 @@ const index_js_2 = require("./sandboxes/index.js");
|
|
|
56
56
|
const index_js_3 = require("./repositories/index.js");
|
|
57
57
|
const index_js_4 = require("./agent/index.js");
|
|
58
58
|
const fileStorage = __importStar(require("./file-storage/index.js"));
|
|
59
|
+
const contentGeneration = __importStar(require("./content-generation/index.js"));
|
|
59
60
|
/** Bind every capability namespace to a transport. `withAttribution` rebinds to a derived one. */
|
|
60
61
|
function bind(transport) {
|
|
61
62
|
return {
|
|
@@ -83,6 +84,11 @@ function bind(transport) {
|
|
|
83
84
|
delete: (fileId) => fileStorage.delete(fileId, transport),
|
|
84
85
|
setVisibility: (fileId, visibility) => fileStorage.setVisibility(fileId, visibility, transport),
|
|
85
86
|
},
|
|
87
|
+
contentGeneration: {
|
|
88
|
+
images: {
|
|
89
|
+
create: (input) => contentGeneration.createImage(input, transport),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
86
92
|
withAttribution: (attribution) => bind(transport.withAttribution(attribution)),
|
|
87
93
|
};
|
|
88
94
|
}
|
package/dist/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqIA,oCAEC;AAWD,kDAEC;AApJD;;;;;;;;;;;;;;;GAeG;AACH,iDAK4B;AAC5B,mDAA+C;AAE/C,sDAAqD;AACrD,+CAA4E;AAM5E,qEAAuD;AASvD,iFAAmE;AAuDnE,kGAAkG;AAClG,SAAS,IAAI,CAAC,SAAoB;IAChC,OAAO;QACL,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACjD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,kBAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC;SAC9D;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACpD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;YAC9C,IAAI,EAAE,GAAG,EAAE,CAAC,qBAAU,CAAC,IAAI,CAAC,SAAS,CAAC;YACtC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACpD,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,qBAAU,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC;SACzE;QACD,KAAK,EAAE;YACL,MAAM,E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,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown by the `contentGeneration` capability when a request fails
|
|
3
|
+
* (non-2xx response). Exposes `status` (HTTP status code) and `body` (parsed JSON
|
|
4
|
+
* body, or raw text when the body isn't JSON) for programmatic inspection.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ContentGenerationHttpError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly body: unknown;
|
|
9
|
+
constructor(message: string, status: number, body: unknown);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Return the response when 2xx, otherwise throw a {@link ContentGenerationHttpError}.
|
|
13
|
+
* Parses the error body as JSON when possible; falls back to raw text.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureOk(response: Response, errorPrefix: string): Promise<Response>;
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/content-generation/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CAcnB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentGenerationHttpError = void 0;
|
|
4
|
+
exports.ensureOk = ensureOk;
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown by the `contentGeneration` capability when a request fails
|
|
7
|
+
* (non-2xx response). Exposes `status` (HTTP status code) and `body` (parsed JSON
|
|
8
|
+
* body, or raw text when the body isn't JSON) for programmatic inspection.
|
|
9
|
+
*/
|
|
10
|
+
class ContentGenerationHttpError extends Error {
|
|
11
|
+
constructor(message, status, body) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "ContentGenerationHttpError";
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.body = body;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ContentGenerationHttpError = ContentGenerationHttpError;
|
|
19
|
+
/**
|
|
20
|
+
* Return the response when 2xx, otherwise throw a {@link ContentGenerationHttpError}.
|
|
21
|
+
* Parses the error body as JSON when possible; falls back to raw text.
|
|
22
|
+
*/
|
|
23
|
+
async function ensureOk(response, errorPrefix) {
|
|
24
|
+
if (response.ok)
|
|
25
|
+
return response;
|
|
26
|
+
let body;
|
|
27
|
+
const text = await response.text().catch(() => "");
|
|
28
|
+
try {
|
|
29
|
+
body = JSON.parse(text);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
body = text;
|
|
33
|
+
}
|
|
34
|
+
throw new ContentGenerationHttpError(`${errorPrefix}: ${response.status} ${text}`, response.status, body);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/content-generation/errors.ts"],"names":[],"mappings":";;;AAqBA,4BAiBC;AAtCD;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,KAAK;IAInD,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAVD,gEAUC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ,CAC5B,QAAkB,EAClB,WAAmB;IAEnB,IAAI,QAAQ,CAAC,EAAE;QAAE,OAAO,QAAQ,CAAC;IACjC,IAAI,IAAa,CAAC;IAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,0BAA0B,CAClC,GAAG,WAAW,KAAK,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE,EAC5C,QAAQ,CAAC,MAAM,EACf,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `contentGeneration` capability — generate media (images today; video and audio
|
|
3
|
+
* to come), with an optional `storage` param that persists each output to Sapiom
|
|
4
|
+
* file storage so you get a durable `fileId` back inline.
|
|
5
|
+
*
|
|
6
|
+
* import { contentGeneration } from "@sapiom/tools"; // ambient auth
|
|
7
|
+
* const out = await contentGeneration.images.create({
|
|
8
|
+
* prompt: "a red bicycle",
|
|
9
|
+
* storage: { visibility: "private" }, // optional — persist outputs
|
|
10
|
+
* });
|
|
11
|
+
* out.images[0].url; // hosted URL of the generated image
|
|
12
|
+
* out.images[0].fileId; // present when `storage` was passed → use with fileStorage
|
|
13
|
+
*
|
|
14
|
+
* Or via an explicit client: `createClient({ apiKey }).contentGeneration.images.create(...)`.
|
|
15
|
+
*/
|
|
16
|
+
import { Transport } from "../_client/index.js";
|
|
17
|
+
import { ContentGenerationHttpError } from "./errors.js";
|
|
18
|
+
export { ContentGenerationHttpError };
|
|
19
|
+
export interface StorageOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Visibility of the persisted output.
|
|
22
|
+
* - "private" — download requires the owning tenant (default).
|
|
23
|
+
* - "public" — download URL is reachable by any tenant.
|
|
24
|
+
*/
|
|
25
|
+
visibility?: "private" | "public";
|
|
26
|
+
}
|
|
27
|
+
export interface ImageCreateInput {
|
|
28
|
+
/** Text prompt describing the image to generate. */
|
|
29
|
+
prompt: string;
|
|
30
|
+
/** Number of images to generate. */
|
|
31
|
+
numImages?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional model selector. Defaults to a fast image model; most callers omit it.
|
|
34
|
+
* (Model identifiers are an advanced, evolving surface.)
|
|
35
|
+
*/
|
|
36
|
+
model?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional: persist each generated output to Sapiom file storage. When set, every
|
|
39
|
+
* item in `images` comes back annotated with `fileId` (or `storageError` if
|
|
40
|
+
* persisting that one failed).
|
|
41
|
+
*/
|
|
42
|
+
storage?: StorageOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Advanced: extra model-specific parameters, forwarded verbatim
|
|
45
|
+
* (e.g. `image_size`, `seed`, `guidance_scale`).
|
|
46
|
+
*/
|
|
47
|
+
params?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export interface GeneratedImage {
|
|
50
|
+
/** Hosted URL of the generated image. */
|
|
51
|
+
url: string;
|
|
52
|
+
/** MIME type, when reported. */
|
|
53
|
+
contentType?: string;
|
|
54
|
+
width?: number;
|
|
55
|
+
height?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Present when `storage` was requested and this output was persisted — pass to
|
|
58
|
+
* `fileStorage.getDownloadUrl(fileId)` to retrieve it.
|
|
59
|
+
*/
|
|
60
|
+
fileId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Present when `storage` was requested but persisting THIS output failed
|
|
63
|
+
* (best-effort: other images in the same response may still carry `fileId`).
|
|
64
|
+
*/
|
|
65
|
+
storageError?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ImageGenerationResult {
|
|
68
|
+
/** Generated images. */
|
|
69
|
+
images?: GeneratedImage[];
|
|
70
|
+
/** Additional model-specific fields (e.g. `seed`, `timings`), returned as-is. */
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generate one or more images from a prompt. Pass `storage` to persist each output
|
|
75
|
+
* (the returned images then carry `fileId`). Failed requests throw
|
|
76
|
+
* {@link ContentGenerationHttpError}.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createImage(input: ImageCreateInput, transport?: Transport, baseUrl?: string): Promise<ImageGenerationResult>;
|
|
79
|
+
/**
|
|
80
|
+
* The `images` sub-namespace, so `contentGeneration.images.create(...)` reads the
|
|
81
|
+
* same whether imported from the barrel or used on a client. Video and audio will
|
|
82
|
+
* land here as sibling sub-namespaces.
|
|
83
|
+
*/
|
|
84
|
+
export declare const images: {
|
|
85
|
+
create: typeof createImage;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAY,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAUtC,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,iFAAiF;IACjF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA2CD;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,gBAAgB,EACvB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAqBhC;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM;;CAA0B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.images = exports.ContentGenerationHttpError = void 0;
|
|
4
|
+
exports.createImage = createImage;
|
|
5
|
+
/**
|
|
6
|
+
* `contentGeneration` capability — generate media (images today; video and audio
|
|
7
|
+
* to come), with an optional `storage` param that persists each output to Sapiom
|
|
8
|
+
* file storage so you get a durable `fileId` back inline.
|
|
9
|
+
*
|
|
10
|
+
* import { contentGeneration } from "@sapiom/tools"; // ambient auth
|
|
11
|
+
* const out = await contentGeneration.images.create({
|
|
12
|
+
* prompt: "a red bicycle",
|
|
13
|
+
* storage: { visibility: "private" }, // optional — persist outputs
|
|
14
|
+
* });
|
|
15
|
+
* out.images[0].url; // hosted URL of the generated image
|
|
16
|
+
* out.images[0].fileId; // present when `storage` was passed → use with fileStorage
|
|
17
|
+
*
|
|
18
|
+
* Or via an explicit client: `createClient({ apiKey }).contentGeneration.images.create(...)`.
|
|
19
|
+
*/
|
|
20
|
+
const index_js_1 = require("../_client/index.js");
|
|
21
|
+
const errors_js_1 = require("./errors.js");
|
|
22
|
+
Object.defineProperty(exports, "ContentGenerationHttpError", { enumerable: true, get: function () { return errors_js_1.ContentGenerationHttpError; } });
|
|
23
|
+
const DEFAULT_BASE_URL = process.env.SAPIOM_CONTENT_GENERATION_URL || "https://fal.services.sapiom.ai";
|
|
24
|
+
/** Default image model when the caller doesn't pick one — a fast, low-cost model. */
|
|
25
|
+
const DEFAULT_IMAGE_MODEL = "fal-ai/flux/schnell";
|
|
26
|
+
function mapImage(raw) {
|
|
27
|
+
return {
|
|
28
|
+
url: raw.url,
|
|
29
|
+
...(raw.content_type !== undefined && { contentType: raw.content_type }),
|
|
30
|
+
...(raw.width !== undefined && { width: raw.width }),
|
|
31
|
+
...(raw.height !== undefined && { height: raw.height }),
|
|
32
|
+
...(raw.file_id !== undefined && { fileId: raw.file_id }),
|
|
33
|
+
...(raw.storage_error !== undefined && { storageError: raw.storage_error }),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function mapResult(raw) {
|
|
37
|
+
const { images, ...rest } = raw;
|
|
38
|
+
return images === undefined
|
|
39
|
+
? { ...rest }
|
|
40
|
+
: { ...rest, images: images.map(mapImage) };
|
|
41
|
+
}
|
|
42
|
+
// ----- Capability operations -----
|
|
43
|
+
/** Encode a model id into a URL path, preserving its `/` separators. */
|
|
44
|
+
function modelToPath(model) {
|
|
45
|
+
return model.split("/").filter(Boolean).map(encodeURIComponent).join("/");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generate one or more images from a prompt. Pass `storage` to persist each output
|
|
49
|
+
* (the returned images then carry `fileId`). Failed requests throw
|
|
50
|
+
* {@link ContentGenerationHttpError}.
|
|
51
|
+
*/
|
|
52
|
+
async function createImage(input, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
53
|
+
const path = modelToPath(input.model || DEFAULT_IMAGE_MODEL);
|
|
54
|
+
const body = {
|
|
55
|
+
prompt: input.prompt,
|
|
56
|
+
...input.params,
|
|
57
|
+
};
|
|
58
|
+
if (input.numImages !== undefined)
|
|
59
|
+
body.num_images = input.numImages;
|
|
60
|
+
// Truthy check (not `!== undefined`) so a caller passing `storage: null` is
|
|
61
|
+
// treated as "no storage" rather than sending a null field.
|
|
62
|
+
if (input.storage)
|
|
63
|
+
body.storage = input.storage;
|
|
64
|
+
const res = await (0, errors_js_1.ensureOk)(await transport.fetch(`${baseUrl}/run/${path}`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: { "content-type": "application/json" },
|
|
67
|
+
body: JSON.stringify(body),
|
|
68
|
+
}), "Failed to generate image");
|
|
69
|
+
return mapResult((await res.json()));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The `images` sub-namespace, so `contentGeneration.images.create(...)` reads the
|
|
73
|
+
* same whether imported from the barrel or used on a client. Video and audio will
|
|
74
|
+
* land here as sibling sub-namespaces.
|
|
75
|
+
*/
|
|
76
|
+
exports.images = { create: createImage };
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":";;;AAoIA,kCAyBC;AA7JD;;;;;;;;;;;;;;GAcG;AACH,kDAAkE;AAClE,2CAAmE;AAE1D,2GAFU,sCAA0B,OAEV;AAEnC,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,gCAAgC,CAAC;AAEhF,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AA8ElD,SAAS,QAAQ,CAAC,GAAa;IAC7B,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,CAAC,GAAG,CAAC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pC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,KAAK,CAAC,MAAM;KAChB,CAAC;IACF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;IACrE,4EAA4E;IAC5E,4DAA4D;IAC5D,IAAI,KAAK,CAAC,OAAO;QAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAEhD,MAAM,GAAG,GAAG,MAAM,IAAA,oBAAQ,EACxB,MAAM,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,IAAI,EAAE,EAAE;QAC9C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,EACF,0BAA0B,CAC3B,CAAC;IACF,OAAO,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAmB,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACU,QAAA,MAAM,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Error thrown by the file-storage capability when
|
|
3
|
-
* response. Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
2
|
+
* Error thrown by the file-storage capability when a request fails (non-2xx
|
|
3
|
+
* response). Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
4
4
|
* raw text when the body isn't JSON) for programmatic inspection.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FileStorageHttpError extends Error {
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileStorageHttpError = void 0;
|
|
4
4
|
exports.ensureOk = ensureOk;
|
|
5
5
|
/**
|
|
6
|
-
* Error thrown by the file-storage capability when
|
|
7
|
-
* response. Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
6
|
+
* Error thrown by the file-storage capability when a request fails (non-2xx
|
|
7
|
+
* response). Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
8
8
|
* raw text when the body isn't JSON) for programmatic inspection.
|
|
9
9
|
*/
|
|
10
10
|
class FileStorageHttpError extends Error {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `fileStorage` capability — tenant-scoped object storage
|
|
2
|
+
* `fileStorage` capability — tenant-scoped object storage with presigned URLs.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* You transfer the bytes yourself: `upload` hands back a presigned URL you PUT the
|
|
5
|
+
* bytes to (so you own streaming / progress / resumable uploads), and
|
|
6
6
|
* `getDownloadUrl` hands back a presigned URL you GET. `list`, `setVisibility`, and
|
|
7
7
|
* `delete` round out the lifecycle.
|
|
8
8
|
*
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Or via an explicit client: `createClient({ apiKey }).fileStorage.upload(...)`.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* so `expectedFileSize` / `actualFileSize` on returned metadata are `string | null`.
|
|
18
|
+
* Byte-size fields (`expectedFileSize` / `actualFileSize` on returned metadata) are
|
|
19
|
+
* returned as `string | null` to stay precise for large files.
|
|
21
20
|
*/
|
|
22
21
|
import { Transport } from "../_client/index.js";
|
|
23
22
|
import { FileStorageHttpError } from "./errors.js";
|
|
@@ -33,13 +32,13 @@ export interface UploadInput {
|
|
|
33
32
|
* - "public" — download URL is unauthenticated.
|
|
34
33
|
*/
|
|
35
34
|
visibility?: "private" | "public";
|
|
36
|
-
/** Expected file size in bytes.
|
|
35
|
+
/** Expected file size in bytes. */
|
|
37
36
|
expectedFileSize?: number;
|
|
38
37
|
}
|
|
39
38
|
export interface UploadResponse {
|
|
40
39
|
/** Unique file identifier. Use this in subsequent calls. */
|
|
41
40
|
fileId: string;
|
|
42
|
-
/**
|
|
41
|
+
/** Presigned upload URL. PUT the file bytes here directly. Expires at `expiresAt`. */
|
|
43
42
|
uploadUrl: string;
|
|
44
43
|
/** ISO-8601 timestamp when the upload URL expires. */
|
|
45
44
|
expiresAt: string;
|
|
@@ -47,7 +46,7 @@ export interface UploadResponse {
|
|
|
47
46
|
requiredHeaders: Record<string, string>;
|
|
48
47
|
}
|
|
49
48
|
export interface DownloadUrlResponse {
|
|
50
|
-
/** Presigned
|
|
49
|
+
/** Presigned download URL. Expires at `expiresAt`. */
|
|
51
50
|
downloadUrl: string;
|
|
52
51
|
/** ISO-8601 timestamp when the download URL expires. */
|
|
53
52
|
expiresAt: string;
|
|
@@ -63,12 +62,9 @@ export interface FileMetadata {
|
|
|
63
62
|
visibility: "private" | "public";
|
|
64
63
|
/** Upload lifecycle status (e.g. "pending_upload", "uploaded", "deleted"). */
|
|
65
64
|
status: string;
|
|
66
|
-
/**
|
|
67
|
-
* Expected (client-declared) size in bytes — a string (int64, precision-safe),
|
|
68
|
-
* `null` when not declared.
|
|
69
|
-
*/
|
|
65
|
+
/** Expected (client-declared) size in bytes — a string, `null` when not declared. */
|
|
70
66
|
expectedFileSize?: string | null;
|
|
71
|
-
/** Actual size in bytes after upload (string; `null` until the
|
|
67
|
+
/** Actual size in bytes after upload (string; `null` until the upload is verified). */
|
|
72
68
|
actualFileSize?: string | null;
|
|
73
69
|
/** ISO-8601 timestamp when the record was created. */
|
|
74
70
|
createdAt: string;
|
|
@@ -96,8 +92,8 @@ export interface ListResponse {
|
|
|
96
92
|
hasMore: boolean;
|
|
97
93
|
}
|
|
98
94
|
/**
|
|
99
|
-
* Initiate an upload. Returns a presigned
|
|
100
|
-
*
|
|
95
|
+
* Initiate an upload. Returns a presigned URL; PUT the bytes to `uploadUrl` with
|
|
96
|
+
* `requiredHeaders` yourself.
|
|
101
97
|
*/
|
|
102
98
|
export declare function upload(input: UploadInput, transport?: Transport, baseUrl?: string): Promise<UploadResponse>;
|
|
103
99
|
/** Generate a presigned download URL for a file. */
|
|
@@ -107,8 +103,8 @@ export declare function list(opts?: ListOptions, transport?: Transport, baseUrl?
|
|
|
107
103
|
/** Update a file's visibility. */
|
|
108
104
|
export declare function setVisibility(fileId: string, visibility: "private" | "public", transport?: Transport, baseUrl?: string): Promise<FileMetadata>;
|
|
109
105
|
/**
|
|
110
|
-
* Delete a file. Idempotent
|
|
111
|
-
*
|
|
106
|
+
* Delete a file. Idempotent (deleting an already-deleted file is a no-op success).
|
|
107
|
+
* Exported as `delete`:
|
|
112
108
|
* `import { fileStorage } from "@sapiom/tools"; await fileStorage.delete(id)`.
|
|
113
109
|
*/
|
|
114
110
|
declare function deleteFile(fileId: string, transport?: Transport, baseUrl?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAY,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAQhC,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACt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,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,cAAc,CAAC,CAuBzB;AAED,oDAAoD;AACpD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAO9B;AAED,oDAAoD;AACpD,wBAAsB,IAAI,CACxB,IAAI,CAAC,EAAE,WAAW,EAClB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,YAAY,CAAC,CAmBvB;AAED,kCAAkC;AAClC,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,SAAS,GAAG,QAAQ,EAChC,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED;;;;GAIG;AACH,iBAAe,UAAU,CACvB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -7,10 +7,10 @@ exports.list = list;
|
|
|
7
7
|
exports.setVisibility = setVisibility;
|
|
8
8
|
exports.delete = deleteFile;
|
|
9
9
|
/**
|
|
10
|
-
* `fileStorage` capability — tenant-scoped object storage
|
|
10
|
+
* `fileStorage` capability — tenant-scoped object storage with presigned URLs.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* You transfer the bytes yourself: `upload` hands back a presigned URL you PUT the
|
|
13
|
+
* bytes to (so you own streaming / progress / resumable uploads), and
|
|
14
14
|
* `getDownloadUrl` hands back a presigned URL you GET. `list`, `setVisibility`, and
|
|
15
15
|
* `delete` round out the lifecycle.
|
|
16
16
|
*
|
|
@@ -23,14 +23,12 @@ exports.delete = deleteFile;
|
|
|
23
23
|
*
|
|
24
24
|
* Or via an explicit client: `createClient({ apiKey }).fileStorage.upload(...)`.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* so `expectedFileSize` / `actualFileSize` on returned metadata are `string | null`.
|
|
26
|
+
* Byte-size fields (`expectedFileSize` / `actualFileSize` on returned metadata) are
|
|
27
|
+
* returned as `string | null` to stay precise for large files.
|
|
29
28
|
*/
|
|
30
29
|
const index_js_1 = require("../_client/index.js");
|
|
31
30
|
const errors_js_1 = require("./errors.js");
|
|
32
31
|
Object.defineProperty(exports, "FileStorageHttpError", { enumerable: true, get: function () { return errors_js_1.FileStorageHttpError; } });
|
|
33
|
-
/** Object storage service. Host routing is an internal detail — override via SAPIOM_FILE_STORAGE_URL. */
|
|
34
32
|
const DEFAULT_BASE_URL = process.env.SAPIOM_FILE_STORAGE_URL ||
|
|
35
33
|
"https://file-storage.services.sapiom.ai";
|
|
36
34
|
function mapFileMetadata(raw) {
|
|
@@ -54,8 +52,8 @@ function mapFileMetadata(raw) {
|
|
|
54
52
|
}
|
|
55
53
|
// ----- capability operations -----
|
|
56
54
|
/**
|
|
57
|
-
* Initiate an upload. Returns a presigned
|
|
58
|
-
*
|
|
55
|
+
* Initiate an upload. Returns a presigned URL; PUT the bytes to `uploadUrl` with
|
|
56
|
+
* `requiredHeaders` yourself.
|
|
59
57
|
*/
|
|
60
58
|
async function upload(input, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
61
59
|
const body = { content_type: input.contentType };
|
|
@@ -114,8 +112,8 @@ async function setVisibility(fileId, visibility, transport = (0, index_js_1.defa
|
|
|
114
112
|
return mapFileMetadata(raw);
|
|
115
113
|
}
|
|
116
114
|
/**
|
|
117
|
-
* Delete a file. Idempotent
|
|
118
|
-
*
|
|
115
|
+
* Delete a file. Idempotent (deleting an already-deleted file is a no-op success).
|
|
116
|
+
* Exported as `delete`:
|
|
119
117
|
* `import { fileStorage } from "@sapiom/tools"; await fileStorage.delete(id)`.
|
|
120
118
|
*/
|
|
121
119
|
async function deleteFile(fileId, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":";;;AAyKA,wBA2BC;AAGD,wCAWC;AAGD,oBAuBC;AAGD,sCAgBC;AAiCsB,4BAAM;AAhS7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kDAAkE;AAClE,2CAA6D;AAEpD,qGAFU,gCAAoB,OAEV;AAE7B,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACnC,yCAAyC,CAAC;AAoH5C,SAAS,eAAe,CAAC,GAAoB;IAC3C,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QAC/D,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,GAAG,CAAC,GAAG,CAAC,kBAAkB,KAAK,SAAS,IAAI;YAC1C,gBAAgB,EAAE,GAAG,CAAC,kBAAkB;SACzC,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,gBAAgB,KAAK,SAAS,IAAI;YACxC,cAAc,EAAE,GAAG,CAAC,gBAAgB;SACrC,CAAC;QACF,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;QACrE,GAAG,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAA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AM,CAAC;YACP,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,gCAAoB,CAC5B,0BAA0B,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,EAC1D,GAAG,CAAC,MAAM,EACV,MAAM,CACP,CAAC;IACJ,CAAC;IACD,qCAAqC;AACvC,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ export type { CodingResultPayload, ExecutionEnvironmentRef, } from "./agent/inde
|
|
|
25
25
|
export { codingResultSchema, CodingResultSchemaError, toResumePayload, EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX, } from "./agent/index.js";
|
|
26
26
|
export * as fileStorage from "./file-storage/index.js";
|
|
27
27
|
export { FileStorageHttpError } from "./file-storage/index.js";
|
|
28
|
+
export * as contentGeneration from "./content-generation/index.js";
|
|
29
|
+
export { ContentGenerationHttpError } from "./content-generation/index.js";
|
|
28
30
|
//# 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,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIvE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1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nE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,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.FileStorageHttpError = exports.fileStorage = 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.ContentGenerationHttpError = exports.contentGeneration = exports.FileStorageHttpError = exports.fileStorage = 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
|
*
|
|
@@ -70,4 +70,7 @@ Object.defineProperty(exports, "EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX", { enumera
|
|
|
70
70
|
exports.fileStorage = __importStar(require("./file-storage/index.js"));
|
|
71
71
|
var index_js_5 = require("./file-storage/index.js");
|
|
72
72
|
Object.defineProperty(exports, "FileStorageHttpError", { enumerable: true, get: function () { return index_js_5.FileStorageHttpError; } });
|
|
73
|
+
exports.contentGeneration = __importStar(require("./content-generation/index.js"));
|
|
74
|
+
var index_js_6 = require("./content-generation/index.js");
|
|
75
|
+
Object.defineProperty(exports, "ContentGenerationHttpError", { enumerable: true, get: function () { return index_js_6.ContentGenerationHttpError; } });
|
|
73
76
|
//# 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;AAQ1C,kEAAkD;AAClD,iDAA+C;AAAtC,mGAAA,OAAO,OAAA;AAEhB,wEAAwD;AACxD,oDAAqD;AAA5C,sGAAA,UAAU,OAAA;AAEnB,0DAA0C;AAC1C,iFAAiF;AACjF,6CAAwD;AAA/C,gHAAA,oBAAoB,OAAA;AAO7B,+EAA+E;AAC/E,2CAA2C;AAC3C,6CAK0B;AAJxB,8GAAA,kBAAkB,OAAA;AAClB,mHAAA,uBAAuB,OAAA;AACvB,2GAAA,eAAe,OAAA;AACf,gIAAA,oCAAoC,OAAA;AAGtC,uEAAuD;AACvD,oDAA+D;AAAtD,gHAAA,oBAAoB,OAAA"}
|
|
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;AAQ1C,kEAAkD;AAClD,iDAA+C;AAAtC,mGAAA,OAAO,OAAA;AAEhB,wEAAwD;AACxD,oDAAqD;AAA5C,sGAAA,UAAU,OAAA;AAEnB,0DAA0C;AAC1C,iFAAiF;AACjF,6CAAwD;AAA/C,gHAAA,oBAAoB,OAAA;AAO7B,+EAA+E;AAC/E,2CAA2C;AAC3C,6CAK0B;AAJxB,8GAAA,kBAAkB,OAAA;AAClB,mHAAA,uBAAuB,OAAA;AACvB,2GAAA,eAAe,OAAA;AACf,gIAAA,oCAAoC,OAAA;AAGtC,uEAAuD;AACvD,oDAA+D;AAAtD,gHAAA,oBAAoB,OAAA;AAE7B,mFAAmE;AACnE,0DAA2E;AAAlE,sHAAA,0BAA0B,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAW3C,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAC5C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AA0TD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,iBAAsB,GAAG,MAAM,CAsKrE"}
|