@collective-intelligence/external-apps-server-sdk 0.1.9 → 0.1.11
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 +131 -39
- package/dist/admin.d.ts +537 -319
- package/dist/admin.js +1 -1
- package/dist/auth/better-auth.d.ts +4 -2
- package/dist/auth/federated.d.ts +17 -7
- package/dist/auth/federated.js +1 -1
- package/dist/auth.d.ts +3 -1
- 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 +232 -73
- 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 +43 -4
- package/dist/persistence/drizzle.js +4 -4
- package/dist/resources.d.ts +39 -5
- package/dist/resources.js +3 -3
- package/dist/runtime/effect.d.ts +93 -5
- package/dist/runtime/effect.js +4 -4
- package/dist/runtime/express.d.ts +15 -2
- package/dist/runtime/nestjs.d.ts +36 -5
- package/dist/runtime/nestjs.js +2 -2
- package/dist/runtime/next.d.ts +37 -6
- package/dist/runtime/next.js +2 -2
- package/dist/runtime/web.d.ts +19 -4
- package/dist/runtime/web.js +2 -2
- package/dist/tools/ai-sdk.js +2 -2
- package/package.json +3 -3
|
@@ -65,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
65
65
|
}>;
|
|
66
66
|
}>;
|
|
67
67
|
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
68
|
+
/**
|
|
69
|
+
* A filter predicate. `field` names a declared filterable field, or a path
|
|
70
|
+
* through at most three fields that hold Entity References to a field of
|
|
71
|
+
* the last target, such as `company.industry` or
|
|
72
|
+
* `contacts.company.parent.industry`. On a field that holds Entity
|
|
73
|
+
* References, `is_empty` means no reference, and `contains_any` and
|
|
74
|
+
* `contains_all` compare the ids of a field that holds many.
|
|
75
|
+
*/
|
|
68
76
|
export type ResourceFilter = Readonly<{
|
|
69
77
|
field: string;
|
|
70
|
-
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
78
|
+
operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
71
79
|
value: FilterValue;
|
|
72
80
|
}> | Readonly<{
|
|
73
81
|
field: string;
|
|
74
|
-
operator: "is_not_null" | "is_null";
|
|
82
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
75
83
|
}> | Readonly<{
|
|
76
84
|
filters: readonly ResourceFilter[];
|
|
77
85
|
operator: "and" | "or";
|
|
@@ -94,6 +102,11 @@ export type ResourcePagination = Readonly<{
|
|
|
94
102
|
}>;
|
|
95
103
|
export type ResourceListQuery = Readonly<{
|
|
96
104
|
filter?: ResourceFilter;
|
|
105
|
+
/**
|
|
106
|
+
* Include Paths, such as `["company", "contacts.company"]`: relation
|
|
107
|
+
* fields whose records each item carries in `included`.
|
|
108
|
+
*/
|
|
109
|
+
include?: readonly string[];
|
|
97
110
|
includeDeleted?: boolean;
|
|
98
111
|
pagination: ResourcePagination;
|
|
99
112
|
sort?: readonly ResourceSort[];
|
|
@@ -102,7 +115,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
102
115
|
export type ResourceRecord<Entity> = Readonly<{
|
|
103
116
|
deletedAt?: string;
|
|
104
117
|
id: ResourceRecordId;
|
|
118
|
+
/**
|
|
119
|
+
* The records of the read's Include Paths by relation field key: one
|
|
120
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
121
|
+
* the target schemas are CI's.
|
|
122
|
+
*/
|
|
123
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
105
124
|
revision: ResourceRevision;
|
|
125
|
+
/** The keys whose included records were cut to the first 100. */
|
|
126
|
+
truncated?: readonly string[];
|
|
106
127
|
value: Entity;
|
|
107
128
|
}>;
|
|
108
129
|
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable" |
|
|
@@ -65,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
65
65
|
}>;
|
|
66
66
|
}>;
|
|
67
67
|
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
68
|
+
/**
|
|
69
|
+
* A filter predicate. `field` names a declared filterable field, or a path
|
|
70
|
+
* through at most three fields that hold Entity References to a field of
|
|
71
|
+
* the last target, such as `company.industry` or
|
|
72
|
+
* `contacts.company.parent.industry`. On a field that holds Entity
|
|
73
|
+
* References, `is_empty` means no reference, and `contains_any` and
|
|
74
|
+
* `contains_all` compare the ids of a field that holds many.
|
|
75
|
+
*/
|
|
68
76
|
export type ResourceFilter = Readonly<{
|
|
69
77
|
field: string;
|
|
70
|
-
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
78
|
+
operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
71
79
|
value: FilterValue;
|
|
72
80
|
}> | Readonly<{
|
|
73
81
|
field: string;
|
|
74
|
-
operator: "is_not_null" | "is_null";
|
|
82
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
75
83
|
}> | Readonly<{
|
|
76
84
|
filters: readonly ResourceFilter[];
|
|
77
85
|
operator: "and" | "or";
|
|
@@ -94,6 +102,11 @@ export type ResourcePagination = Readonly<{
|
|
|
94
102
|
}>;
|
|
95
103
|
export type ResourceListQuery = Readonly<{
|
|
96
104
|
filter?: ResourceFilter;
|
|
105
|
+
/**
|
|
106
|
+
* Include Paths, such as `["company", "contacts.company"]`: relation
|
|
107
|
+
* fields whose records each item carries in `included`.
|
|
108
|
+
*/
|
|
109
|
+
include?: readonly string[];
|
|
97
110
|
includeDeleted?: boolean;
|
|
98
111
|
pagination: ResourcePagination;
|
|
99
112
|
sort?: readonly ResourceSort[];
|
|
@@ -102,7 +115,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
102
115
|
export type ResourceRecord<Entity> = Readonly<{
|
|
103
116
|
deletedAt?: string;
|
|
104
117
|
id: ResourceRecordId;
|
|
118
|
+
/**
|
|
119
|
+
* The records of the read's Include Paths by relation field key: one
|
|
120
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
121
|
+
* the target schemas are CI's.
|
|
122
|
+
*/
|
|
123
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
105
124
|
revision: ResourceRevision;
|
|
125
|
+
/** The keys whose included records were cut to the first 100. */
|
|
126
|
+
truncated?: readonly string[];
|
|
106
127
|
value: Entity;
|
|
107
128
|
}>;
|
|
108
129
|
export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable" |
|
|
@@ -102,13 +102,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
|
|
|
102
102
|
}>;
|
|
103
103
|
}>;
|
|
104
104
|
export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
|
|
105
|
+
/**
|
|
106
|
+
* A filter predicate. `field` names a declared filterable field, or a path
|
|
107
|
+
* through at most three fields that hold Entity References to a field of
|
|
108
|
+
* the last target, such as `company.industry` or
|
|
109
|
+
* `contacts.company.parent.industry`. On a field that holds Entity
|
|
110
|
+
* References, `is_empty` means no reference, and `contains_any` and
|
|
111
|
+
* `contains_all` compare the ids of a field that holds many.
|
|
112
|
+
*/
|
|
105
113
|
export type ResourceFilter = Readonly<{
|
|
106
114
|
field: string;
|
|
107
|
-
operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
115
|
+
operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
|
|
108
116
|
value: FilterValue;
|
|
109
117
|
}> | Readonly<{
|
|
110
118
|
field: string;
|
|
111
|
-
operator: "is_not_null" | "is_null";
|
|
119
|
+
operator: "is_empty" | "is_not_null" | "is_null";
|
|
112
120
|
}> | Readonly<{
|
|
113
121
|
filters: readonly ResourceFilter[];
|
|
114
122
|
operator: "and" | "or";
|
|
@@ -131,6 +139,11 @@ export type ResourcePagination = Readonly<{
|
|
|
131
139
|
}>;
|
|
132
140
|
export type ResourceListQuery = Readonly<{
|
|
133
141
|
filter?: ResourceFilter;
|
|
142
|
+
/**
|
|
143
|
+
* Include Paths, such as `["company", "contacts.company"]`: relation
|
|
144
|
+
* fields whose records each item carries in `included`.
|
|
145
|
+
*/
|
|
146
|
+
include?: readonly string[];
|
|
134
147
|
includeDeleted?: boolean;
|
|
135
148
|
pagination: ResourcePagination;
|
|
136
149
|
sort?: readonly ResourceSort[];
|
|
@@ -139,7 +152,15 @@ export type ResourceListQuery = Readonly<{
|
|
|
139
152
|
export type ResourceRecord<Entity> = Readonly<{
|
|
140
153
|
deletedAt?: string;
|
|
141
154
|
id: ResourceRecordId;
|
|
155
|
+
/**
|
|
156
|
+
* The records of the read's Include Paths by relation field key: one
|
|
157
|
+
* record, or the records of a `many` field in reference order. Untyped:
|
|
158
|
+
* the target schemas are CI's.
|
|
159
|
+
*/
|
|
160
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
142
161
|
revision: ResourceRevision;
|
|
162
|
+
/** The keys whose included records were cut to the first 100. */
|
|
163
|
+
truncated?: readonly string[];
|
|
143
164
|
value: Entity;
|
|
144
165
|
}>;
|
|
145
166
|
export type ResourceListResult<Entity> = Readonly<{
|
|
@@ -170,7 +191,7 @@ export type ResourceCreateInput<Value> = Readonly<{
|
|
|
170
191
|
value: Value;
|
|
171
192
|
}>;
|
|
172
193
|
/** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
|
|
173
|
-
export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
194
|
+
export type EntityOperation = "list_members" | "list" | "get" | "create" | "update" | "delete" | "upload";
|
|
174
195
|
export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
|
|
175
196
|
pagination: Extract<ResourcePagination, {
|
|
176
197
|
mode: "page";
|
|
@@ -205,13 +226,15 @@ export type ApplicationUserIdentity = Readonly<{
|
|
|
205
226
|
* and request/correlation IDs are deliberately not part of that logical identity.
|
|
206
227
|
*/
|
|
207
228
|
export type EntityInvocationContext = Readonly<{
|
|
229
|
+
/** The App Permissions of the user's effective roles on the app. */
|
|
230
|
+
appPermissions: readonly string[];
|
|
208
231
|
applicationId: string;
|
|
209
232
|
issuer: string;
|
|
210
233
|
organizationId: string;
|
|
211
234
|
resourceId: string;
|
|
235
|
+
/** The user's effective roles on the app, read from CI at this lookup. */
|
|
212
236
|
roles: readonly string[];
|
|
213
237
|
scopes: readonly string[];
|
|
214
|
-
groupIds: readonly string[];
|
|
215
238
|
user: ApplicationUserIdentity;
|
|
216
239
|
}>;
|
|
217
240
|
/** Common CRUD port. Implementations own atomic revisions, receipts and soft deletion. */
|
|
@@ -653,7 +676,9 @@ declare const definePlatformTables: (options?: PlatformTablesOptions) => {
|
|
|
653
676
|
result: import("drizzle-orm/pg-core").PgBuildColumn<"resource_idempotency", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Readonly<{
|
|
654
677
|
deletedAt?: string;
|
|
655
678
|
id: ResourceRecordId;
|
|
679
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
656
680
|
revision: ResourceRevision;
|
|
681
|
+
truncated?: readonly string[];
|
|
657
682
|
value: unknown;
|
|
658
683
|
}>>>, {
|
|
659
684
|
name: string;
|
|
@@ -662,7 +687,9 @@ declare const definePlatformTables: (options?: PlatformTablesOptions) => {
|
|
|
662
687
|
data: Readonly<{
|
|
663
688
|
deletedAt?: string;
|
|
664
689
|
id: ResourceRecordId;
|
|
690
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
665
691
|
revision: ResourceRevision;
|
|
692
|
+
truncated?: readonly string[];
|
|
666
693
|
value: unknown;
|
|
667
694
|
}>;
|
|
668
695
|
driverParam: unknown;
|
|
@@ -893,7 +920,9 @@ declare const makePlatformPersistence: (options: PlatformPersistenceOptions) =>
|
|
|
893
920
|
result: import("drizzle-orm/pg-core").PgBuildColumn<"resource_idempotency", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Readonly<{
|
|
894
921
|
deletedAt?: string;
|
|
895
922
|
id: ResourceRecordId;
|
|
923
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
896
924
|
revision: ResourceRevision;
|
|
925
|
+
truncated?: readonly string[];
|
|
897
926
|
value: unknown;
|
|
898
927
|
}>>>, {
|
|
899
928
|
name: string;
|
|
@@ -902,7 +931,9 @@ declare const makePlatformPersistence: (options: PlatformPersistenceOptions) =>
|
|
|
902
931
|
data: Readonly<{
|
|
903
932
|
deletedAt?: string;
|
|
904
933
|
id: ResourceRecordId;
|
|
934
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
905
935
|
revision: ResourceRevision;
|
|
936
|
+
truncated?: readonly string[];
|
|
906
937
|
value: unknown;
|
|
907
938
|
}>;
|
|
908
939
|
driverParam: unknown;
|
|
@@ -1320,7 +1351,9 @@ declare const definePlatformTables$1: (options?: PlatformTablesOptions) => {
|
|
|
1320
1351
|
result: import("drizzle-orm/pg-core").PgBuildColumn<"resource_idempotency", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Readonly<{
|
|
1321
1352
|
deletedAt?: string;
|
|
1322
1353
|
id: ResourceRecordId;
|
|
1354
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
1323
1355
|
revision: ResourceRevision;
|
|
1356
|
+
truncated?: readonly string[];
|
|
1324
1357
|
value: unknown;
|
|
1325
1358
|
}>>>, {
|
|
1326
1359
|
name: string;
|
|
@@ -1329,7 +1362,9 @@ declare const definePlatformTables$1: (options?: PlatformTablesOptions) => {
|
|
|
1329
1362
|
data: Readonly<{
|
|
1330
1363
|
deletedAt?: string;
|
|
1331
1364
|
id: ResourceRecordId;
|
|
1365
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
1332
1366
|
revision: ResourceRevision;
|
|
1367
|
+
truncated?: readonly string[];
|
|
1333
1368
|
value: unknown;
|
|
1334
1369
|
}>;
|
|
1335
1370
|
driverParam: unknown;
|
|
@@ -1482,7 +1517,9 @@ declare const makePlatformPersistence$1: (options: PlatformPersistenceOptions) =
|
|
|
1482
1517
|
result: import("drizzle-orm/pg-core").PgBuildColumn<"resource_idempotency", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Readonly<{
|
|
1483
1518
|
deletedAt?: string;
|
|
1484
1519
|
id: ResourceRecordId;
|
|
1520
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
1485
1521
|
revision: ResourceRevision;
|
|
1522
|
+
truncated?: readonly string[];
|
|
1486
1523
|
value: unknown;
|
|
1487
1524
|
}>>>, {
|
|
1488
1525
|
name: string;
|
|
@@ -1491,7 +1528,9 @@ declare const makePlatformPersistence$1: (options: PlatformPersistenceOptions) =
|
|
|
1491
1528
|
data: Readonly<{
|
|
1492
1529
|
deletedAt?: string;
|
|
1493
1530
|
id: ResourceRecordId;
|
|
1531
|
+
included?: Readonly<Record<string, ResourceJsonValue>>;
|
|
1494
1532
|
revision: ResourceRevision;
|
|
1533
|
+
truncated?: readonly string[];
|
|
1495
1534
|
value: unknown;
|
|
1496
1535
|
}>;
|
|
1497
1536
|
driverParam: unknown;
|