@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 CHANGED
@@ -579,6 +579,79 @@ await ci.workflows.invoke({
579
579
  - It needs the `ai:attachments` scope. Only service credentials may call it: a
580
580
  delegated user token or an anonymous visitor gets `operation_not_allowed`.
581
581
 
582
+ ### Entity File fields
583
+
584
+ A File field of an entity schema takes a different flow: the file becomes a
585
+ File value of the entity, not a stored file a workflow reads.
586
+ `resources.createUpload` asks CI for a single-use upload slot, the server PUTs
587
+ the bytes straight to storage, and the entity write through CI's resources API
588
+ names the slot's `uploadId` as `{ upload }` for that File field key:
589
+
590
+ ```ts
591
+ const slot = await ci.resources.createUpload({
592
+ field: "memberLogo",
593
+ filename: "logo.png",
594
+ mimeType: "image/png",
595
+ organizationId,
596
+ schemaId: "apito.vetrina.schemas.member-company"
597
+ })
598
+ if (slot.ok) {
599
+ const { headers, method, uploadId, url } = slot.value.result
600
+ await fetch(url, { body: logo, headers, method })
601
+ // The entity write then sends { memberLogo: { upload: uploadId } }.
602
+ }
603
+ ```
604
+
605
+ - Two credentials can ask for a slot, as for entity writes: the member's
606
+ delegated token (`exchangeMemberSession`), writing as that member; or the
607
+ application's service credential, for schemas declared by the application's
608
+ own package only, writing as the Organization default service principal.
609
+ `schemaId` is the schema id or FQN.
610
+ - A refusal resolves `{ ok: false, error }` with CI's `correlationId` and a
611
+ `code`; `upload_not_supported` means the Organization storage cannot presign
612
+ uploads. Only `retryable` failures are retried.
613
+ - Each attempt, request and response body, is bounded by `timeoutMs`
614
+ (10 seconds by default); a CI that stops answering ends in a retryable
615
+ `unavailable`. `signal` cancels: a cancelled request rejects with the
616
+ signal's reason.
617
+ - The PUT is the caller's: send exactly `headers` to `url` with `method`. No
618
+ file bytes pass through CI's API. A slot is single use: the first successful
619
+ write consumes it; request a new one to retry.
620
+ - The write form of a File field key is `{ upload }` to add the uploaded file,
621
+ `{ id }` (or a File value read before) to keep a file, an ordered array for a
622
+ multiple field, or `null` to remove every file. Omit the key to keep its
623
+ files.
624
+ - `/runtime/effect` exports the Effect schemas `EntityFileValue` (a File value
625
+ as CI reads return it), `EntityFileWrite` (one file of a write) and
626
+ `EntityFileFieldWrite` (the write form of a File field key). Their types
627
+ equal the client SDK types of the same name. They validate CI entity
628
+ values; a portable resource form has no File field, so
629
+ `projectResourceSchema` refuses them.
630
+
631
+ ## Runtime origin
632
+
633
+ The browser origins of an Organization are the `allowedOrigins` that its
634
+ installed applications declare, plus one runtime origin per application. A
635
+ confidential application sets its runtime origin, for example the URL of each
636
+ new deployment; CI keeps storage CORS in line with the Organization origins, so
637
+ a browser on that origin can upload to a presigned storage URL.
638
+
639
+ ```ts
640
+ await ci.origins.setRuntime({
641
+ organizationId,
642
+ origin: `https://${process.env.VERCEL_URL}`
643
+ })
644
+ // value.result: { origin }
645
+ ```
646
+
647
+ - Each call replaces the application's previous runtime origin, so the list
648
+ does not grow; declare stable origins, such as the production site, in
649
+ `allowedOrigins`.
650
+ - `origin` is an exact HTTPS origin (`https://host[:port]`, no path), or a
651
+ loopback HTTP origin with a port; other values get `invalid_request`.
652
+ - It needs the `origins:write` scope. Only service credentials may call it: a
653
+ delegated user token or an anonymous visitor gets `operation_not_allowed`.
654
+
582
655
  ## Member company links
583
656
 
584
657
  An application links a member of its Organization to the Knowledge company
package/dist/admin.d.ts CHANGED
@@ -325,15 +325,33 @@ declare const FeatureFlagRolloutMode: {
325
325
  readonly DISABLED_FOR_ORGANIZATIONS: "disabled_for_organizations";
326
326
  };
327
327
  export type FeatureFlagRolloutMode = typeof FeatureFlagRolloutMode[keyof typeof FeatureFlagRolloutMode];
328
- export type EntityRelationField = {
329
- cardinality: "many" | "one";
330
- field: string;
331
- id: string;
332
- nullable: boolean;
333
- reference: "external_id";
334
- targetEntityId: string;
328
+ export type KnowledgeRelationFieldEntry = {
329
+ autocomplete?: {
330
+ baseFilters?: Array<{
331
+ caseSensitive?: boolean;
332
+ field: string;
333
+ operator: "eq" | "ne" | "in" | "nin" | "contains" | "not_contains" | "starts_with" | "ends_with" | "gt" | "gte" | "lt" | "lte" | "exists" | "is_empty" | "is_not_empty";
334
+ value: Suspend;
335
+ }>;
336
+ fields?: Array<{
337
+ field: string;
338
+ scope: "data" | "entity";
339
+ }>;
340
+ };
341
+ cardinality: "one" | "many";
342
+ display?: {
343
+ fields: Array<{
344
+ field: string;
345
+ scope: "data" | "entity";
346
+ }>;
347
+ };
348
+ maxItems?: number;
349
+ onDelete?: "clear" | "restrict";
335
350
  targetSchemaFqn: string;
336
351
  };
352
+ export type Suspend = null | boolean | number | string | Array<Suspend> | {
353
+ [key: string]: Suspend;
354
+ };
337
355
  declare const KnowledgeFileVisibility: {
338
356
  readonly PUBLIC: "public";
339
357
  readonly PROTECTED: "protected";
@@ -1917,6 +1935,7 @@ export type RelationSchemasUpdateData = {
1917
1935
  unique?: boolean;
1918
1936
  file?: unknown;
1919
1937
  mediaVisibility?: unknown;
1938
+ relation?: unknown;
1920
1939
  };
1921
1940
  };
1922
1941
  fqn?: string;
@@ -2030,6 +2049,7 @@ export type RelationSchemasCreateData = {
2030
2049
  unique?: boolean;
2031
2050
  file?: unknown;
2032
2051
  mediaVisibility?: unknown;
2052
+ relation?: unknown;
2033
2053
  };
2034
2054
  };
2035
2055
  fqn: string;
@@ -2280,6 +2300,7 @@ export type EntitySchemasUpdateData = {
2280
2300
  unique?: boolean;
2281
2301
  file?: KnowledgeFileFieldEntry;
2282
2302
  mediaVisibility?: KnowledgeFileVisibility;
2303
+ relation?: KnowledgeRelationFieldEntry;
2283
2304
  };
2284
2305
  };
2285
2306
  fqn?: string;
@@ -2302,7 +2323,6 @@ export type EntitySchemasUpdateData = {
2302
2323
  name?: string;
2303
2324
  overviewInputMaxChars?: number | null;
2304
2325
  persistFullFieldContributions?: boolean;
2305
- relationFields?: Array<EntityRelationField>;
2306
2326
  richEnrichment?: boolean | null;
2307
2327
  usableAsDocumentScope?: boolean;
2308
2328
  };
@@ -2421,6 +2441,7 @@ export type EntitySchemasCreateData = {
2421
2441
  unique?: boolean;
2422
2442
  file?: KnowledgeFileFieldEntry;
2423
2443
  mediaVisibility?: KnowledgeFileVisibility;
2444
+ relation?: KnowledgeRelationFieldEntry;
2424
2445
  };
2425
2446
  };
2426
2447
  fqn: string;
@@ -2437,7 +2458,6 @@ export type EntitySchemasCreateData = {
2437
2458
  name: string;
2438
2459
  overviewInputMaxChars?: number | null;
2439
2460
  persistFullFieldContributions?: boolean;
2440
- relationFields?: Array<EntityRelationField>;
2441
2461
  richEnrichment?: boolean | null;
2442
2462
  usableAsDocumentScope?: boolean;
2443
2463
  };
@@ -5302,6 +5322,85 @@ declare const createAdministrationApi: (client: Client$1) => {
5302
5322
  op: "transform";
5303
5323
  remote: string;
5304
5324
  transformerId: string;
5325
+ } | {
5326
+ direction: "both" | "inbound" | "outbound";
5327
+ local: string;
5328
+ skipIfNull: boolean;
5329
+ op: "reference";
5330
+ remote: string;
5331
+ target?: string;
5332
+ } | {
5333
+ direction: "both" | "inbound" | "outbound";
5334
+ local: string;
5335
+ skipIfNull: boolean;
5336
+ fieldMap: Array<{
5337
+ direction: "both" | "inbound" | "outbound";
5338
+ local: string;
5339
+ skipIfNull: boolean;
5340
+ op: "path";
5341
+ remote: string;
5342
+ } | {
5343
+ direction: "both" | "inbound" | "outbound";
5344
+ local: string;
5345
+ skipIfNull: boolean;
5346
+ falseValues?: Array<string>;
5347
+ op: "cast";
5348
+ remote: string;
5349
+ trueValues?: Array<string>;
5350
+ } | {
5351
+ direction: "both" | "inbound" | "outbound";
5352
+ local: string;
5353
+ skipIfNull: boolean;
5354
+ op: "default";
5355
+ remote?: string;
5356
+ value: unknown;
5357
+ } | {
5358
+ direction: "both" | "inbound" | "outbound";
5359
+ local: string;
5360
+ skipIfNull: boolean;
5361
+ op: "concat";
5362
+ remote: Array<string>;
5363
+ separator?: string;
5364
+ } | {
5365
+ direction: "both" | "inbound" | "outbound";
5366
+ local: string;
5367
+ skipIfNull: boolean;
5368
+ discardEmpty?: boolean;
5369
+ op: "split";
5370
+ remote: string;
5371
+ separators?: Array<string>;
5372
+ trimItems?: boolean;
5373
+ uniqueItems?: boolean;
5374
+ } | {
5375
+ direction: "both" | "inbound" | "outbound";
5376
+ local: string;
5377
+ skipIfNull: boolean;
5378
+ latitudeKey?: string;
5379
+ longitudeKey?: string;
5380
+ op: "coordinates";
5381
+ remote: [
5382
+ string,
5383
+ string
5384
+ ];
5385
+ } | {
5386
+ direction: "both" | "inbound" | "outbound";
5387
+ local: string;
5388
+ skipIfNull: boolean;
5389
+ op: "transform";
5390
+ remote: string;
5391
+ transformerId: string;
5392
+ } | {
5393
+ direction: "both" | "inbound" | "outbound";
5394
+ local: string;
5395
+ skipIfNull: boolean;
5396
+ op: "reference";
5397
+ remote: string;
5398
+ target?: string;
5399
+ }>;
5400
+ op: "embedded";
5401
+ remote: string;
5402
+ remoteId: string;
5403
+ target?: string;
5305
5404
  }>;
5306
5405
  fqn: string;
5307
5406
  outboundStrategy?: "local_first" | "remote_first";
@@ -5403,6 +5502,85 @@ declare const createAdministrationApi: (client: Client$1) => {
5403
5502
  op: "transform";
5404
5503
  remote: string;
5405
5504
  transformerId: string;
5505
+ } | {
5506
+ direction: "both" | "inbound" | "outbound";
5507
+ local: string;
5508
+ skipIfNull: boolean;
5509
+ op: "reference";
5510
+ remote: string;
5511
+ target?: string;
5512
+ } | {
5513
+ direction: "both" | "inbound" | "outbound";
5514
+ local: string;
5515
+ skipIfNull: boolean;
5516
+ fieldMap: Array<{
5517
+ direction: "both" | "inbound" | "outbound";
5518
+ local: string;
5519
+ skipIfNull: boolean;
5520
+ op: "path";
5521
+ remote: string;
5522
+ } | {
5523
+ direction: "both" | "inbound" | "outbound";
5524
+ local: string;
5525
+ skipIfNull: boolean;
5526
+ falseValues?: Array<string>;
5527
+ op: "cast";
5528
+ remote: string;
5529
+ trueValues?: Array<string>;
5530
+ } | {
5531
+ direction: "both" | "inbound" | "outbound";
5532
+ local: string;
5533
+ skipIfNull: boolean;
5534
+ op: "default";
5535
+ remote?: string;
5536
+ value: unknown;
5537
+ } | {
5538
+ direction: "both" | "inbound" | "outbound";
5539
+ local: string;
5540
+ skipIfNull: boolean;
5541
+ op: "concat";
5542
+ remote: Array<string>;
5543
+ separator?: string;
5544
+ } | {
5545
+ direction: "both" | "inbound" | "outbound";
5546
+ local: string;
5547
+ skipIfNull: boolean;
5548
+ discardEmpty?: boolean;
5549
+ op: "split";
5550
+ remote: string;
5551
+ separators?: Array<string>;
5552
+ trimItems?: boolean;
5553
+ uniqueItems?: boolean;
5554
+ } | {
5555
+ direction: "both" | "inbound" | "outbound";
5556
+ local: string;
5557
+ skipIfNull: boolean;
5558
+ latitudeKey?: string;
5559
+ longitudeKey?: string;
5560
+ op: "coordinates";
5561
+ remote: [
5562
+ string,
5563
+ string
5564
+ ];
5565
+ } | {
5566
+ direction: "both" | "inbound" | "outbound";
5567
+ local: string;
5568
+ skipIfNull: boolean;
5569
+ op: "transform";
5570
+ remote: string;
5571
+ transformerId: string;
5572
+ } | {
5573
+ direction: "both" | "inbound" | "outbound";
5574
+ local: string;
5575
+ skipIfNull: boolean;
5576
+ op: "reference";
5577
+ remote: string;
5578
+ target?: string;
5579
+ }>;
5580
+ op: "embedded";
5581
+ remote: string;
5582
+ remoteId: string;
5583
+ target?: string;
5406
5584
  }>;
5407
5585
  fqn: string;
5408
5586
  outboundStrategy?: "local_first" | "remote_first";
@@ -5771,6 +5949,85 @@ declare const createAdministrationApi: (client: Client$1) => {
5771
5949
  op: "transform";
5772
5950
  remote: string;
5773
5951
  transformerId: string;
5952
+ } | {
5953
+ direction: "both" | "inbound" | "outbound";
5954
+ local: string;
5955
+ skipIfNull: boolean;
5956
+ op: "reference";
5957
+ remote: string;
5958
+ target?: string;
5959
+ } | {
5960
+ direction: "both" | "inbound" | "outbound";
5961
+ local: string;
5962
+ skipIfNull: boolean;
5963
+ fieldMap: Array<{
5964
+ direction: "both" | "inbound" | "outbound";
5965
+ local: string;
5966
+ skipIfNull: boolean;
5967
+ op: "path";
5968
+ remote: string;
5969
+ } | {
5970
+ direction: "both" | "inbound" | "outbound";
5971
+ local: string;
5972
+ skipIfNull: boolean;
5973
+ falseValues?: Array<string>;
5974
+ op: "cast";
5975
+ remote: string;
5976
+ trueValues?: Array<string>;
5977
+ } | {
5978
+ direction: "both" | "inbound" | "outbound";
5979
+ local: string;
5980
+ skipIfNull: boolean;
5981
+ op: "default";
5982
+ remote?: string;
5983
+ value: unknown;
5984
+ } | {
5985
+ direction: "both" | "inbound" | "outbound";
5986
+ local: string;
5987
+ skipIfNull: boolean;
5988
+ op: "concat";
5989
+ remote: Array<string>;
5990
+ separator?: string;
5991
+ } | {
5992
+ direction: "both" | "inbound" | "outbound";
5993
+ local: string;
5994
+ skipIfNull: boolean;
5995
+ discardEmpty?: boolean;
5996
+ op: "split";
5997
+ remote: string;
5998
+ separators?: Array<string>;
5999
+ trimItems?: boolean;
6000
+ uniqueItems?: boolean;
6001
+ } | {
6002
+ direction: "both" | "inbound" | "outbound";
6003
+ local: string;
6004
+ skipIfNull: boolean;
6005
+ latitudeKey?: string;
6006
+ longitudeKey?: string;
6007
+ op: "coordinates";
6008
+ remote: [
6009
+ string,
6010
+ string
6011
+ ];
6012
+ } | {
6013
+ direction: "both" | "inbound" | "outbound";
6014
+ local: string;
6015
+ skipIfNull: boolean;
6016
+ op: "transform";
6017
+ remote: string;
6018
+ transformerId: string;
6019
+ } | {
6020
+ direction: "both" | "inbound" | "outbound";
6021
+ local: string;
6022
+ skipIfNull: boolean;
6023
+ op: "reference";
6024
+ remote: string;
6025
+ target?: string;
6026
+ }>;
6027
+ op: "embedded";
6028
+ remote: string;
6029
+ remoteId: string;
6030
+ target?: string;
5774
6031
  }>;
5775
6032
  fqn: string;
5776
6033
  outboundStrategy?: "local_first" | "remote_first";
@@ -5872,6 +6129,85 @@ declare const createAdministrationApi: (client: Client$1) => {
5872
6129
  op: "transform";
5873
6130
  remote: string;
5874
6131
  transformerId: string;
6132
+ } | {
6133
+ direction: "both" | "inbound" | "outbound";
6134
+ local: string;
6135
+ skipIfNull: boolean;
6136
+ op: "reference";
6137
+ remote: string;
6138
+ target?: string;
6139
+ } | {
6140
+ direction: "both" | "inbound" | "outbound";
6141
+ local: string;
6142
+ skipIfNull: boolean;
6143
+ fieldMap: Array<{
6144
+ direction: "both" | "inbound" | "outbound";
6145
+ local: string;
6146
+ skipIfNull: boolean;
6147
+ op: "path";
6148
+ remote: string;
6149
+ } | {
6150
+ direction: "both" | "inbound" | "outbound";
6151
+ local: string;
6152
+ skipIfNull: boolean;
6153
+ falseValues?: Array<string>;
6154
+ op: "cast";
6155
+ remote: string;
6156
+ trueValues?: Array<string>;
6157
+ } | {
6158
+ direction: "both" | "inbound" | "outbound";
6159
+ local: string;
6160
+ skipIfNull: boolean;
6161
+ op: "default";
6162
+ remote?: string;
6163
+ value: unknown;
6164
+ } | {
6165
+ direction: "both" | "inbound" | "outbound";
6166
+ local: string;
6167
+ skipIfNull: boolean;
6168
+ op: "concat";
6169
+ remote: Array<string>;
6170
+ separator?: string;
6171
+ } | {
6172
+ direction: "both" | "inbound" | "outbound";
6173
+ local: string;
6174
+ skipIfNull: boolean;
6175
+ discardEmpty?: boolean;
6176
+ op: "split";
6177
+ remote: string;
6178
+ separators?: Array<string>;
6179
+ trimItems?: boolean;
6180
+ uniqueItems?: boolean;
6181
+ } | {
6182
+ direction: "both" | "inbound" | "outbound";
6183
+ local: string;
6184
+ skipIfNull: boolean;
6185
+ latitudeKey?: string;
6186
+ longitudeKey?: string;
6187
+ op: "coordinates";
6188
+ remote: [
6189
+ string,
6190
+ string
6191
+ ];
6192
+ } | {
6193
+ direction: "both" | "inbound" | "outbound";
6194
+ local: string;
6195
+ skipIfNull: boolean;
6196
+ op: "transform";
6197
+ remote: string;
6198
+ transformerId: string;
6199
+ } | {
6200
+ direction: "both" | "inbound" | "outbound";
6201
+ local: string;
6202
+ skipIfNull: boolean;
6203
+ op: "reference";
6204
+ remote: string;
6205
+ target?: string;
6206
+ }>;
6207
+ op: "embedded";
6208
+ remote: string;
6209
+ remoteId: string;
6210
+ target?: string;
5875
6211
  }>;
5876
6212
  fqn: string;
5877
6213
  outboundStrategy?: "local_first" | "remote_first";
@@ -6413,6 +6749,7 @@ declare const createAdministrationApi: (client: Client$1) => {
6413
6749
  unique?: boolean;
6414
6750
  file?: KnowledgeFileFieldEntry;
6415
6751
  mediaVisibility?: KnowledgeFileVisibility;
6752
+ relation?: KnowledgeRelationFieldEntry;
6416
6753
  };
6417
6754
  };
6418
6755
  fqn: string;
@@ -6431,7 +6768,6 @@ declare const createAdministrationApi: (client: Client$1) => {
6431
6768
  name: string;
6432
6769
  overviewInputMaxChars: number | null;
6433
6770
  persistFullFieldContributions: boolean;
6434
- relationFields: Array<EntityRelationField>;
6435
6771
  removedFields: Array<unknown>;
6436
6772
  richEnrichment: boolean | null;
6437
6773
  updatedAt: string | null;
@@ -6654,6 +6990,7 @@ declare const createAdministrationApi: (client: Client$1) => {
6654
6990
  unique?: boolean;
6655
6991
  file?: KnowledgeFileFieldEntry;
6656
6992
  mediaVisibility?: KnowledgeFileVisibility;
6993
+ relation?: KnowledgeRelationFieldEntry;
6657
6994
  };
6658
6995
  };
6659
6996
  fqn: string;
@@ -6672,7 +7009,6 @@ declare const createAdministrationApi: (client: Client$1) => {
6672
7009
  name: string;
6673
7010
  overviewInputMaxChars: number | null;
6674
7011
  persistFullFieldContributions: boolean;
6675
- relationFields: Array<EntityRelationField>;
6676
7012
  removedFields: Array<unknown>;
6677
7013
  richEnrichment: boolean | null;
6678
7014
  updatedAt: string | null;
@@ -6890,6 +7226,7 @@ declare const createAdministrationApi: (client: Client$1) => {
6890
7226
  unique?: boolean;
6891
7227
  file?: KnowledgeFileFieldEntry;
6892
7228
  mediaVisibility?: KnowledgeFileVisibility;
7229
+ relation?: KnowledgeRelationFieldEntry;
6893
7230
  };
6894
7231
  };
6895
7232
  fqn: string;
@@ -6908,7 +7245,6 @@ declare const createAdministrationApi: (client: Client$1) => {
6908
7245
  name: string;
6909
7246
  overviewInputMaxChars: number | null;
6910
7247
  persistFullFieldContributions: boolean;
6911
- relationFields: Array<EntityRelationField>;
6912
7248
  removedFields: Array<unknown>;
6913
7249
  richEnrichment: boolean | null;
6914
7250
  updatedAt: string | null;
package/dist/express.d.ts CHANGED
@@ -426,13 +426,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
426
426
  }>;
427
427
  }>;
428
428
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
429
+ /**
430
+ * A filter predicate. `field` names a declared filterable field, or a path
431
+ * through at most three fields that hold Entity References to a field of
432
+ * the last target, such as `company.industry` or
433
+ * `contacts.company.parent.industry`. On a field that holds Entity
434
+ * References, `is_empty` means no reference, and `contains_any` and
435
+ * `contains_all` compare the ids of a field that holds many.
436
+ */
429
437
  export type ResourceFilter = Readonly<{
430
438
  field: string;
431
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
439
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
432
440
  value: FilterValue;
433
441
  }> | Readonly<{
434
442
  field: string;
435
- operator: "is_not_null" | "is_null";
443
+ operator: "is_empty" | "is_not_null" | "is_null";
436
444
  }> | Readonly<{
437
445
  filters: readonly ResourceFilter[];
438
446
  operator: "and" | "or";
@@ -455,6 +463,11 @@ export type ResourcePagination = Readonly<{
455
463
  }>;
456
464
  export type ResourceListQuery = Readonly<{
457
465
  filter?: ResourceFilter;
466
+ /**
467
+ * Include Paths, such as `["company", "contacts.company"]`: relation
468
+ * fields whose records each item carries in `included`.
469
+ */
470
+ include?: readonly string[];
458
471
  includeDeleted?: boolean;
459
472
  pagination: ResourcePagination;
460
473
  sort?: readonly ResourceSort[];
@@ -393,13 +393,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
393
393
  }>;
394
394
  }>;
395
395
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
396
+ /**
397
+ * A filter predicate. `field` names a declared filterable field, or a path
398
+ * through at most three fields that hold Entity References to a field of
399
+ * the last target, such as `company.industry` or
400
+ * `contacts.company.parent.industry`. On a field that holds Entity
401
+ * References, `is_empty` means no reference, and `contains_any` and
402
+ * `contains_all` compare the ids of a field that holds many.
403
+ */
396
404
  export type ResourceFilter = Readonly<{
397
405
  field: string;
398
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
406
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
399
407
  value: FilterValue;
400
408
  }> | Readonly<{
401
409
  field: string;
402
- operator: "is_not_null" | "is_null";
410
+ operator: "is_empty" | "is_not_null" | "is_null";
403
411
  }> | Readonly<{
404
412
  filters: readonly ResourceFilter[];
405
413
  operator: "and" | "or";
@@ -422,6 +430,11 @@ export type ResourcePagination = Readonly<{
422
430
  }>;
423
431
  export type ResourceListQuery = Readonly<{
424
432
  filter?: ResourceFilter;
433
+ /**
434
+ * Include Paths, such as `["company", "contacts.company"]`: relation
435
+ * fields whose records each item carries in `included`.
436
+ */
437
+ include?: readonly string[];
425
438
  includeDeleted?: boolean;
426
439
  pagination: ResourcePagination;
427
440
  sort?: readonly ResourceSort[];
package/dist/gateway.d.ts CHANGED
@@ -434,13 +434,21 @@ export type ResourceDefinition<Entity, Create = Entity, Update = Partial<Entity>
434
434
  }>;
435
435
  }>;
436
436
  export type FilterValue = ResourceJsonValue | readonly ResourceJsonValue[];
437
+ /**
438
+ * A filter predicate. `field` names a declared filterable field, or a path
439
+ * through at most three fields that hold Entity References to a field of
440
+ * the last target, such as `company.industry` or
441
+ * `contacts.company.parent.industry`. On a field that holds Entity
442
+ * References, `is_empty` means no reference, and `contains_any` and
443
+ * `contains_all` compare the ids of a field that holds many.
444
+ */
437
445
  export type ResourceFilter = Readonly<{
438
446
  field: string;
439
- operator: "contains" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
447
+ operator: "contains" | "contains_all" | "contains_any" | "ends_with" | "eq" | "gt" | "gte" | "in" | "lt" | "lte" | "ne" | "not_in" | "starts_with";
440
448
  value: FilterValue;
441
449
  }> | Readonly<{
442
450
  field: string;
443
- operator: "is_not_null" | "is_null";
451
+ operator: "is_empty" | "is_not_null" | "is_null";
444
452
  }> | Readonly<{
445
453
  filters: readonly ResourceFilter[];
446
454
  operator: "and" | "or";
@@ -463,6 +471,11 @@ export type ResourcePagination = Readonly<{
463
471
  }>;
464
472
  export type ResourceListQuery = Readonly<{
465
473
  filter?: ResourceFilter;
474
+ /**
475
+ * Include Paths, such as `["company", "contacts.company"]`: relation
476
+ * fields whose records each item carries in `included`.
477
+ */
478
+ include?: readonly string[];
466
479
  includeDeleted?: boolean;
467
480
  pagination: ResourcePagination;
468
481
  sort?: readonly ResourceSort[];