@collective-intelligence/external-apps-server-sdk 0.1.8 → 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.
@@ -26,6 +26,8 @@ export type ResourceCapabilities = Readonly<{
26
26
  search: true;
27
27
  softDelete?: boolean;
28
28
  update?: boolean;
29
+ /** File uploads for the File fields of a common entity resource. */
30
+ upload?: boolean;
29
31
  }>;
30
32
  export type ResourcePaginationMode = "cursor" | "page";
31
33
  export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
@@ -63,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
63
65
  }>;
64
66
  }>;
65
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
+ */
66
76
  export type ResourceFilter = Readonly<{
67
77
  field: string;
68
- 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";
69
79
  value: FilterValue;
70
80
  }> | Readonly<{
71
81
  field: string;
72
- operator: "is_not_null" | "is_null";
82
+ operator: "is_empty" | "is_not_null" | "is_null";
73
83
  }> | Readonly<{
74
84
  filters: readonly ResourceFilter[];
75
85
  operator: "and" | "or";
@@ -92,6 +102,11 @@ export type ResourcePagination = Readonly<{
92
102
  }>;
93
103
  export type ResourceListQuery = Readonly<{
94
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[];
95
110
  includeDeleted?: boolean;
96
111
  pagination: ResourcePagination;
97
112
  sort?: readonly ResourceSort[];
@@ -100,10 +115,20 @@ export type ResourceListQuery = Readonly<{
100
115
  export type ResourceRecord<Entity> = Readonly<{
101
116
  deletedAt?: string;
102
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>>;
103
124
  revision: ResourceRevision;
125
+ /** The keys whose included records were cut to the first 100. */
126
+ truncated?: readonly string[];
104
127
  value: Entity;
105
128
  }>;
106
- export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
129
+ export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable" |
130
+ /** The CI Organization storage can not take a presigned File upload. */
131
+ "upload_not_supported";
107
132
  export type ResourceError = Readonly<{
108
133
  code: ResourceErrorCode;
109
134
  /** Client-observed dispatch outcome; uncertainty never proves rollback. */
@@ -26,6 +26,8 @@ export type ResourceCapabilities = Readonly<{
26
26
  search: true;
27
27
  softDelete?: boolean;
28
28
  update?: boolean;
29
+ /** File uploads for the File fields of a common entity resource. */
30
+ upload?: boolean;
29
31
  }>;
30
32
  export type ResourcePaginationMode = "cursor" | "page";
31
33
  export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
@@ -63,13 +65,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
63
65
  }>;
64
66
  }>;
65
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
+ */
66
76
  export type ResourceFilter = Readonly<{
67
77
  field: string;
68
- 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";
69
79
  value: FilterValue;
70
80
  }> | Readonly<{
71
81
  field: string;
72
- operator: "is_not_null" | "is_null";
82
+ operator: "is_empty" | "is_not_null" | "is_null";
73
83
  }> | Readonly<{
74
84
  filters: readonly ResourceFilter[];
75
85
  operator: "and" | "or";
@@ -92,6 +102,11 @@ export type ResourcePagination = Readonly<{
92
102
  }>;
93
103
  export type ResourceListQuery = Readonly<{
94
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[];
95
110
  includeDeleted?: boolean;
96
111
  pagination: ResourcePagination;
97
112
  sort?: readonly ResourceSort[];
@@ -100,10 +115,20 @@ export type ResourceListQuery = Readonly<{
100
115
  export type ResourceRecord<Entity> = Readonly<{
101
116
  deletedAt?: string;
102
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>>;
103
124
  revision: ResourceRevision;
125
+ /** The keys whose included records were cut to the first 100. */
126
+ truncated?: readonly string[];
104
127
  value: Entity;
105
128
  }>;
106
- export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable";
129
+ export type ResourceErrorCode = "capability_not_supported" | "conflict" | "forbidden" | "internal" | "invalid_request" | "not_found" | "rate_limited" | "transport_error" | "unauthenticated" | "unavailable" |
130
+ /** The CI Organization storage can not take a presigned File upload. */
131
+ "upload_not_supported";
107
132
  export type ResourceError = Readonly<{
108
133
  code: ResourceErrorCode;
109
134
  /** Client-observed dispatch outcome; uncertainty never proves rollback. */
@@ -63,6 +63,8 @@ export type ResourceCapabilities = Readonly<{
63
63
  search: true;
64
64
  softDelete?: boolean;
65
65
  update?: boolean;
66
+ /** File uploads for the File fields of a common entity resource. */
67
+ upload?: boolean;
66
68
  }>;
67
69
  export type ResourcePaginationMode = "cursor" | "page";
68
70
  export type PortableResourceSchema = Readonly<Record<string, ResourceJsonValue>>;
@@ -100,13 +102,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
100
102
  }>;
101
103
  }>;
102
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
+ */
103
113
  export type ResourceFilter = Readonly<{
104
114
  field: string;
105
- 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";
106
116
  value: FilterValue;
107
117
  }> | Readonly<{
108
118
  field: string;
109
- operator: "is_not_null" | "is_null";
119
+ operator: "is_empty" | "is_not_null" | "is_null";
110
120
  }> | Readonly<{
111
121
  filters: readonly ResourceFilter[];
112
122
  operator: "and" | "or";
@@ -129,6 +139,11 @@ export type ResourcePagination = Readonly<{
129
139
  }>;
130
140
  export type ResourceListQuery = Readonly<{
131
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[];
132
147
  includeDeleted?: boolean;
133
148
  pagination: ResourcePagination;
134
149
  sort?: readonly ResourceSort[];
@@ -137,7 +152,15 @@ export type ResourceListQuery = Readonly<{
137
152
  export type ResourceRecord<Entity> = Readonly<{
138
153
  deletedAt?: string;
139
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>>;
140
161
  revision: ResourceRevision;
162
+ /** The keys whose included records were cut to the first 100. */
163
+ truncated?: readonly string[];
141
164
  value: Entity;
142
165
  }>;
143
166
  export type ResourceListResult<Entity> = Readonly<{
@@ -168,7 +191,7 @@ export type ResourceCreateInput<Value> = Readonly<{
168
191
  value: Value;
169
192
  }>;
170
193
  /** Common entity operations. Generic resource lifecycle/cursor APIs remain separate. */
171
- export type EntityOperation = "list" | "get" | "create" | "update" | "delete";
194
+ export type EntityOperation = "list" | "get" | "create" | "update" | "delete" | "upload";
172
195
  export type EntityListQuery = Omit<ResourceListQuery, "pagination" | "includeDeleted"> & Readonly<{
173
196
  pagination: Extract<ResourcePagination, {
174
197
  mode: "page";
@@ -651,7 +674,9 @@ declare const definePlatformTables: (options?: PlatformTablesOptions) => {
651
674
  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<{
652
675
  deletedAt?: string;
653
676
  id: ResourceRecordId;
677
+ included?: Readonly<Record<string, ResourceJsonValue>>;
654
678
  revision: ResourceRevision;
679
+ truncated?: readonly string[];
655
680
  value: unknown;
656
681
  }>>>, {
657
682
  name: string;
@@ -660,7 +685,9 @@ declare const definePlatformTables: (options?: PlatformTablesOptions) => {
660
685
  data: Readonly<{
661
686
  deletedAt?: string;
662
687
  id: ResourceRecordId;
688
+ included?: Readonly<Record<string, ResourceJsonValue>>;
663
689
  revision: ResourceRevision;
690
+ truncated?: readonly string[];
664
691
  value: unknown;
665
692
  }>;
666
693
  driverParam: unknown;
@@ -891,7 +918,9 @@ declare const makePlatformPersistence: (options: PlatformPersistenceOptions) =>
891
918
  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<{
892
919
  deletedAt?: string;
893
920
  id: ResourceRecordId;
921
+ included?: Readonly<Record<string, ResourceJsonValue>>;
894
922
  revision: ResourceRevision;
923
+ truncated?: readonly string[];
895
924
  value: unknown;
896
925
  }>>>, {
897
926
  name: string;
@@ -900,7 +929,9 @@ declare const makePlatformPersistence: (options: PlatformPersistenceOptions) =>
900
929
  data: Readonly<{
901
930
  deletedAt?: string;
902
931
  id: ResourceRecordId;
932
+ included?: Readonly<Record<string, ResourceJsonValue>>;
903
933
  revision: ResourceRevision;
934
+ truncated?: readonly string[];
904
935
  value: unknown;
905
936
  }>;
906
937
  driverParam: unknown;
@@ -1318,7 +1349,9 @@ declare const definePlatformTables$1: (options?: PlatformTablesOptions) => {
1318
1349
  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<{
1319
1350
  deletedAt?: string;
1320
1351
  id: ResourceRecordId;
1352
+ included?: Readonly<Record<string, ResourceJsonValue>>;
1321
1353
  revision: ResourceRevision;
1354
+ truncated?: readonly string[];
1322
1355
  value: unknown;
1323
1356
  }>>>, {
1324
1357
  name: string;
@@ -1327,7 +1360,9 @@ declare const definePlatformTables$1: (options?: PlatformTablesOptions) => {
1327
1360
  data: Readonly<{
1328
1361
  deletedAt?: string;
1329
1362
  id: ResourceRecordId;
1363
+ included?: Readonly<Record<string, ResourceJsonValue>>;
1330
1364
  revision: ResourceRevision;
1365
+ truncated?: readonly string[];
1331
1366
  value: unknown;
1332
1367
  }>;
1333
1368
  driverParam: unknown;
@@ -1480,7 +1515,9 @@ declare const makePlatformPersistence$1: (options: PlatformPersistenceOptions) =
1480
1515
  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<{
1481
1516
  deletedAt?: string;
1482
1517
  id: ResourceRecordId;
1518
+ included?: Readonly<Record<string, ResourceJsonValue>>;
1483
1519
  revision: ResourceRevision;
1520
+ truncated?: readonly string[];
1484
1521
  value: unknown;
1485
1522
  }>>>, {
1486
1523
  name: string;
@@ -1489,7 +1526,9 @@ declare const makePlatformPersistence$1: (options: PlatformPersistenceOptions) =
1489
1526
  data: Readonly<{
1490
1527
  deletedAt?: string;
1491
1528
  id: ResourceRecordId;
1529
+ included?: Readonly<Record<string, ResourceJsonValue>>;
1492
1530
  revision: ResourceRevision;
1531
+ truncated?: readonly string[];
1493
1532
  value: unknown;
1494
1533
  }>;
1495
1534
  driverParam: unknown;