@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.
@@ -96,13 +96,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
96
96
  }>;
97
97
  }>;
98
98
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
99
+ /**
100
+ * A filter predicate. `field` names a declared filterable field, or a path
101
+ * through at most three fields that hold Entity References to a field of
102
+ * the last target, such as `company.industry` or
103
+ * `contacts.company.parent.industry`. On a field that holds Entity
104
+ * References, `is_empty` means no reference, and `contains_any` and
105
+ * `contains_all` compare the ids of a field that holds many.
106
+ */
99
107
  export type ResourceFilter = Readonly<{
100
108
  field: string;
101
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
109
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
102
110
  value: FilterValue;
103
111
  }> | Readonly<{
104
112
  field: string;
105
- operator: "is_not_null" | "is_null";
113
+ operator: "is_empty" | "is_not_null" | "is_null";
106
114
  }> | Readonly<{
107
115
  filters: readonly ResourceFilter[];
108
116
  operator: "and" | "or";
@@ -125,6 +133,11 @@ export type ResourcePagination = Readonly<{
125
133
  }>;
126
134
  export type ResourceListQuery = Readonly<{
127
135
  filter?: ResourceFilter;
136
+ /**
137
+ * Include Paths, such as `["company", "contacts.company"]`: relation
138
+ * fields whose records each item carries in `included`.
139
+ */
140
+ include?: readonly string[];
128
141
  includeDeleted?: boolean;
129
142
  pagination: ResourcePagination;
130
143
  sort?: readonly ResourceSort[];
@@ -133,7 +146,15 @@ export type ResourceListQuery = Readonly<{
133
146
  export type ResourceRecord<Entity> = Readonly<{
134
147
  deletedAt?: string;
135
148
  id: ResourceRecordId;
149
+ /**
150
+ * The records of the read's Include Paths by relation field key: one
151
+ * record, or the records of a `many` field in reference order. Untyped:
152
+ * the target schemas are CI's.
153
+ */
154
+ included?: Readonly<Record<string, ResourceJsonValue>>;
136
155
  revision: ResourceRevision;
156
+ /** The keys whose included records were cut to the first 100. */
157
+ truncated?: readonly string[];
137
158
  value: Entity;
138
159
  }>;
139
160
  export type ResourceListResult<Entity> = Readonly<{
@@ -261,6 +282,7 @@ export type EntityRequest<Create = unknown, Patch = unknown> = EntityRequestIden
261
282
  }> | Readonly<{
262
283
  operation: "get";
263
284
  id: ResourceRecordId;
285
+ include?: readonly string[];
264
286
  }> | (Readonly<{
265
287
  operation: "create";
266
288
  }> & EntityCreateInput<Create>) | (Readonly<{
@@ -1013,6 +1035,63 @@ export type GatewayEffectHandler = (request: Request) => Effect.Effect<Response,
1013
1035
  export type ResourceEffectHandlerOptions<E = never, R = never, Value = unknown, Create = Value, Patch = Partial<Value>> = Omit<ResourceHttpHandlerOptions<Value, Create, Patch>, "authorize"> & Readonly<{
1014
1036
  authorize: (request: Request, operation: Parameters<ResourceHttpHandlerOptions["authorize"]>[1]) => Effect.Effect<EntityInvocationContext | Response, E, R>;
1015
1037
  }>;
1038
+ /** One file of a File field, as every CI read surface returns it. */
1039
+ export declare const EntityFileValue: Schema.Struct<{
1040
+ readonly filename: Schema.String;
1041
+ readonly id: Schema.String;
1042
+ readonly mimeType: Schema.NullOr<Schema.String>;
1043
+ readonly size: Schema.NullOr<Schema.Int>;
1044
+ readonly source: Schema.Literals<readonly [
1045
+ "managed",
1046
+ "external_url"
1047
+ ]>;
1048
+ readonly url: Schema.String;
1049
+ }>;
1050
+ export type EntityFileValue = typeof EntityFileValue.Type;
1051
+ /**
1052
+ * One file of a File field write: `{ upload }` adds the File upload of an
1053
+ * upload slot's `uploadId`; `{ id }` keeps a file, so a File value read before
1054
+ * decodes as the file it names.
1055
+ */
1056
+ export declare const EntityFileWrite: Schema.Union<readonly [
1057
+ Schema.Struct<{
1058
+ readonly id: Schema.optionalKey<Schema.Never>;
1059
+ readonly upload: Schema.String;
1060
+ }>,
1061
+ Schema.Struct<{
1062
+ readonly id: Schema.String;
1063
+ readonly upload: Schema.optionalKey<Schema.Never>;
1064
+ }>
1065
+ ]>;
1066
+ export type EntityFileWrite = typeof EntityFileWrite.Type;
1067
+ /**
1068
+ * The write form of a File field key: one file or `null` for a single field,
1069
+ * an ordered array for a multiple field; `null` removes every file. Omit the
1070
+ * key to keep its files unchanged.
1071
+ */
1072
+ export declare const EntityFileFieldWrite: Schema.NullOr<Schema.Union<readonly [
1073
+ Schema.Union<readonly [
1074
+ Schema.Struct<{
1075
+ readonly id: Schema.optionalKey<Schema.Never>;
1076
+ readonly upload: Schema.String;
1077
+ }>,
1078
+ Schema.Struct<{
1079
+ readonly id: Schema.String;
1080
+ readonly upload: Schema.optionalKey<Schema.Never>;
1081
+ }>
1082
+ ]>,
1083
+ Schema.$Array<Schema.Union<readonly [
1084
+ Schema.Struct<{
1085
+ readonly id: Schema.optionalKey<Schema.Never>;
1086
+ readonly upload: Schema.String;
1087
+ }>,
1088
+ Schema.Struct<{
1089
+ readonly id: Schema.String;
1090
+ readonly upload: Schema.optionalKey<Schema.Never>;
1091
+ }>
1092
+ ]>>
1093
+ ]>>;
1094
+ export type EntityFileFieldWrite = typeof EntityFileFieldWrite.Type;
1016
1095
  export declare const createGatewayEffectHandler: (kernel: GatewayRuntimeKernel) => GatewayEffectHandler;
1017
1096
  export declare const createResourceEffectHandler: <E, R, Value = unknown, Create = Value, Patch = Partial<Value>>(options: ResourceEffectHandlerOptions<E, R, Value, Create, Patch>) => (request: Request) => import("effect/Effect").Effect<Response, E | GatewayEffectRuntimeError, R>;
1018
1097
  export declare const DateTimeString: import("effect/Schema").String;