@collective-intelligence/external-apps-server-sdk 0.1.9 → 0.1.10
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 +73 -0
- package/dist/admin.d.ts +348 -12
- package/dist/express.d.ts +15 -2
- package/dist/gateway/contracts.d.ts +15 -2
- package/dist/gateway.d.ts +15 -2
- package/dist/gateway.js +2 -2
- package/dist/index.d.ts +79 -0
- package/dist/index.js +3 -3
- package/dist/knowledge-sources/payload.d.ts +23 -2
- package/dist/knowledge-sources/strapi.d.ts +23 -2
- package/dist/persistence/drizzle.d.ts +39 -2
- package/dist/persistence/drizzle.js +4 -4
- package/dist/resources.d.ts +24 -2
- package/dist/resources.js +3 -3
- package/dist/runtime/effect.d.ts +81 -2
- package/dist/runtime/effect.js +4 -4
- package/dist/runtime/express.d.ts +15 -2
- package/dist/runtime/nestjs.d.ts +24 -2
- package/dist/runtime/nestjs.js +1 -1
- package/dist/runtime/next.d.ts +24 -2
- package/dist/runtime/next.js +1 -1
- package/dist/runtime/web.d.ts +15 -2
- package/dist/runtime/web.js +1 -1
- package/dist/tools/ai-sdk.js +2 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
export type ResourceJsonValue = null | boolean | number | string | readonly ResourceJsonValue[] | Readonly<{
|
|
4
4
|
[key: string]: ResourceJsonValue;
|
|
5
5
|
}>;
|
|
6
|
+
/** A File upload request for one File field of the entity schema. */
|
|
7
|
+
export type EntityUploadInput = Readonly<{
|
|
8
|
+
field: string;
|
|
9
|
+
filename: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
}>;
|
|
12
|
+
/** PUT the file bytes to `url` with `headers`; then write `{ upload: uploadId }`. */
|
|
13
|
+
export type EntityUploadSlot = Readonly<{
|
|
14
|
+
headers: Readonly<Record<string, string>>;
|
|
15
|
+
method: "PUT";
|
|
16
|
+
uploadId: string;
|
|
17
|
+
url: string;
|
|
18
|
+
}>;
|
|
6
19
|
export type ExternalApplicationsGetContextErrors = {
|
|
7
20
|
/**
|
|
8
21
|
* Error
|
|
@@ -461,6 +474,11 @@ export type ExternalApplicationServiceOperationRequest = {
|
|
|
461
474
|
userId: string;
|
|
462
475
|
};
|
|
463
476
|
operationId: "members_remove";
|
|
477
|
+
} | {
|
|
478
|
+
input: {
|
|
479
|
+
origin: string;
|
|
480
|
+
};
|
|
481
|
+
operationId: "origins_set_runtime";
|
|
464
482
|
} | {
|
|
465
483
|
input: {
|
|
466
484
|
userId: string;
|
|
@@ -483,6 +501,8 @@ export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_
|
|
|
483
501
|
outcome: MemberUserResolution;
|
|
484
502
|
}> | EnvelopeSuccess<"members_get", MemberUser> | EnvelopeSuccess<"members_list", MemberUserPage> | EnvelopeSuccess<"members_update", MemberUser> | EnvelopeSuccess<"members_remove", {
|
|
485
503
|
userId: string;
|
|
504
|
+
}> | EnvelopeSuccess<"origins_set_runtime", {
|
|
505
|
+
origin: string;
|
|
486
506
|
}> | EnvelopeSuccess<"users_list_company_links", UserCompanyLinks> | EnvelopeSuccess<"users_link_companies", UserCompanyLinks>;
|
|
487
507
|
/** Every operation a confidential server client may invoke. */
|
|
488
508
|
export type ExternalApplicationServerOperationRequest = ExternalApplicationOperationRequest | ExternalApplicationServiceOperationRequest;
|
|
@@ -669,6 +689,45 @@ export type ServerMessageSendRequest = Omit<MessageSendInput, "idempotencyKey">
|
|
|
669
689
|
idempotencyKey?: string;
|
|
670
690
|
}> & ServerInvocationContext;
|
|
671
691
|
export type ServerMessageSendMethod = (request: ServerMessageSendRequest) => Promise<MessageSendResult>;
|
|
692
|
+
/** A File upload slot for one File field of an entity schema, named by id or FQN. */
|
|
693
|
+
export type ServerResourceUploadRequest = EntityUploadInput & Readonly<{
|
|
694
|
+
schemaId: string;
|
|
695
|
+
/** Bound on each attempt's request and response body. Defaults to 10 seconds. */
|
|
696
|
+
timeoutMs?: number;
|
|
697
|
+
}> & ServerInvocationContext;
|
|
698
|
+
declare const resourceFailureCodes: readonly [
|
|
699
|
+
"conflict",
|
|
700
|
+
"forbidden",
|
|
701
|
+
"internal",
|
|
702
|
+
"invalid_request",
|
|
703
|
+
"not_found",
|
|
704
|
+
"unauthenticated",
|
|
705
|
+
"unavailable",
|
|
706
|
+
"upload_not_supported"
|
|
707
|
+
];
|
|
708
|
+
/** Why CI's resources API refused the request. */
|
|
709
|
+
export type ServerResourceFailure = Readonly<{
|
|
710
|
+
correlationId: string;
|
|
711
|
+
error: Readonly<{
|
|
712
|
+
code: (typeof resourceFailureCodes)[number];
|
|
713
|
+
details?: Readonly<Record<string, ResourceJsonValue>>;
|
|
714
|
+
message: string;
|
|
715
|
+
retryable: boolean;
|
|
716
|
+
}>;
|
|
717
|
+
}>;
|
|
718
|
+
/** PUT the bytes to `result.url` with `result.headers`, then write `{ upload: uploadId }`. */
|
|
719
|
+
export type ServerResourceUploadResult = Readonly<{
|
|
720
|
+
error: ServerResourceFailure;
|
|
721
|
+
ok: false;
|
|
722
|
+
}> | Readonly<{
|
|
723
|
+
ok: true;
|
|
724
|
+
value: Readonly<{
|
|
725
|
+
correlationId: string;
|
|
726
|
+
operationId: "resources_create_upload";
|
|
727
|
+
result: EntityUploadSlot;
|
|
728
|
+
}>;
|
|
729
|
+
}>;
|
|
730
|
+
export type ServerResourceUploadMethod = (request: ServerResourceUploadRequest) => Promise<ServerResourceUploadResult>;
|
|
672
731
|
export type RunOperationId = "runs_cancel" | "runs_get" | "runs_stream";
|
|
673
732
|
export type ServerRunStatus = "accepted" | "cancelled" | "failed" | "running" | "succeeded";
|
|
674
733
|
/**
|
|
@@ -803,6 +862,26 @@ export interface ServerClient {
|
|
|
803
862
|
readonly messages: Readonly<{
|
|
804
863
|
send: ServerMessageSendMethod;
|
|
805
864
|
}>;
|
|
865
|
+
/**
|
|
866
|
+
* The application's browser origins in its Organization. `setRuntime({ origin })`
|
|
867
|
+
* replaces the application's one runtime origin, such as the URL of the
|
|
868
|
+
* current deployment, beside the `allowedOrigins` its package declares.
|
|
869
|
+
* Needs the `origins:write` scope and confidential credentials.
|
|
870
|
+
*/
|
|
871
|
+
readonly origins: Readonly<{
|
|
872
|
+
setRuntime: ServerOperationMethod<"origins_set_runtime">;
|
|
873
|
+
}>;
|
|
874
|
+
/**
|
|
875
|
+
* CI's resources API. `createUpload` asks a single-use File upload slot for
|
|
876
|
+
* one File field of an entity schema; the entity write then names its
|
|
877
|
+
* `uploadId` as `{ upload }`. Slots follow entity writes: the member's
|
|
878
|
+
* delegated token writes as that member; the service credential writes as
|
|
879
|
+
* the Organization default service principal, only on schemas its own
|
|
880
|
+
* package declares.
|
|
881
|
+
*/
|
|
882
|
+
readonly resources: Readonly<{
|
|
883
|
+
createUpload: ServerResourceUploadMethod;
|
|
884
|
+
}>;
|
|
806
885
|
readonly runs: Readonly<{
|
|
807
886
|
cancel: ServerRunOperationMethod<"runs_cancel", ServerRun>;
|
|
808
887
|
get: ServerRunOperationMethod<"runs_get", ServerRun>;
|