@proveanything/smartlinks 2.0.56 → 2.0.57

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/dist/openapi.yaml CHANGED
@@ -19652,6 +19652,8 @@ components:
19652
19652
  $ref: "#/components/schemas/AppDataDeclaration"
19653
19653
  headless:
19654
19654
  $ref: "#/components/schemas/AppHeadlessDeclaration"
19655
+ connector:
19656
+ $ref: "#/components/schemas/AppConnectorDeclaration"
19655
19657
  required:
19656
19658
  - name
19657
19659
  - version
@@ -19659,6 +19661,268 @@ components:
19659
19661
  - function
19660
19662
  - files
19661
19663
  - components
19664
+ ConnectorConnectionField:
19665
+ type: object
19666
+ properties:
19667
+ name:
19668
+ type: string
19669
+ label:
19670
+ type: string
19671
+ description:
19672
+ type: string
19673
+ secret:
19674
+ type: string
19675
+ required:
19676
+ type: boolean
19677
+ type:
19678
+ type: string
19679
+ enum:
19680
+ - text
19681
+ - url
19682
+ - select
19683
+ - number
19684
+ - boolean
19685
+ options:
19686
+ type: array
19687
+ items:
19688
+ type: object
19689
+ additionalProperties: true
19690
+ placeholder:
19691
+ type: string
19692
+ required:
19693
+ - name
19694
+ - label
19695
+ ConnectorPreset:
19696
+ type: object
19697
+ properties:
19698
+ id:
19699
+ type: string
19700
+ title:
19701
+ type: string
19702
+ description:
19703
+ type: string
19704
+ direction:
19705
+ type: string
19706
+ enum:
19707
+ - inbound
19708
+ - outbound
19709
+ entity:
19710
+ type: string
19711
+ flow:
19712
+ type: object
19713
+ additionalProperties: true
19714
+ required:
19715
+ - id
19716
+ - title
19717
+ - direction
19718
+ - entity
19719
+ ConnectorPanel:
19720
+ type: object
19721
+ properties:
19722
+ id:
19723
+ type: string
19724
+ title:
19725
+ type: string
19726
+ component:
19727
+ type: string
19728
+ required:
19729
+ - id
19730
+ - title
19731
+ - component
19732
+ AppConnectorDeclaration:
19733
+ type: object
19734
+ properties:
19735
+ provider:
19736
+ type: string
19737
+ title:
19738
+ type: string
19739
+ directions:
19740
+ type: array
19741
+ items:
19742
+ type: string
19743
+ enum:
19744
+ - inbound
19745
+ - outbound
19746
+ entities:
19747
+ type: array
19748
+ items:
19749
+ type: string
19750
+ connection:
19751
+ type: object
19752
+ additionalProperties: true
19753
+ settings:
19754
+ type: object
19755
+ additionalProperties: true
19756
+ presets:
19757
+ type: array
19758
+ items:
19759
+ $ref: "#/components/schemas/ConnectorPreset"
19760
+ functions:
19761
+ type: object
19762
+ additionalProperties: true
19763
+ testConnection:
19764
+ type: string
19765
+ describeTarget:
19766
+ type: string
19767
+ sample:
19768
+ type: string
19769
+ transform:
19770
+ type: string
19771
+ send:
19772
+ type: string
19773
+ fetch:
19774
+ type: string
19775
+ panels:
19776
+ type: array
19777
+ items:
19778
+ $ref: "#/components/schemas/ConnectorPanel"
19779
+ aiGuide:
19780
+ type: string
19781
+ required:
19782
+ - provider
19783
+ - directions
19784
+ - entities
19785
+ - functions
19786
+ ConnectorInstallation:
19787
+ type: object
19788
+ properties:
19789
+ collectionId:
19790
+ type: string
19791
+ appId:
19792
+ type: string
19793
+ flowId:
19794
+ type: string
19795
+ connection:
19796
+ type: object
19797
+ additionalProperties: true
19798
+ settings:
19799
+ type: object
19800
+ additionalProperties: true
19801
+ required:
19802
+ - collectionId
19803
+ - appId
19804
+ - connection
19805
+ - settings
19806
+ ConnectorTestResult:
19807
+ type: object
19808
+ properties:
19809
+ ok:
19810
+ type: boolean
19811
+ message:
19812
+ type: string
19813
+ required:
19814
+ - ok
19815
+ - message
19816
+ ConnectorTargetField:
19817
+ type: object
19818
+ properties:
19819
+ path:
19820
+ type: string
19821
+ label:
19822
+ type: string
19823
+ type:
19824
+ type: string
19825
+ enum:
19826
+ - string
19827
+ - number
19828
+ - boolean
19829
+ - date
19830
+ - object
19831
+ - array
19832
+ required:
19833
+ type: boolean
19834
+ description:
19835
+ type: string
19836
+ enum:
19837
+ type: array
19838
+ items:
19839
+ type: string
19840
+ required:
19841
+ - path
19842
+ ConnectorTargetSchema:
19843
+ type: object
19844
+ properties:
19845
+ fields:
19846
+ type: array
19847
+ items:
19848
+ $ref: "#/components/schemas/ConnectorTargetField"
19849
+ required:
19850
+ - fields
19851
+ ConnectorRecords:
19852
+ type: object
19853
+ properties:
19854
+ records:
19855
+ type: array
19856
+ items:
19857
+ type: object
19858
+ additionalProperties: true
19859
+ nextCursor:
19860
+ type: string
19861
+ required:
19862
+ - records
19863
+ ConnectorTransformInput:
19864
+ type: object
19865
+ properties:
19866
+ installation:
19867
+ $ref: "#/components/schemas/ConnectorInstallation"
19868
+ records:
19869
+ type: array
19870
+ items:
19871
+ type: object
19872
+ additionalProperties: true
19873
+ mapping:
19874
+ type: array
19875
+ items:
19876
+ $ref: "#/components/schemas/FieldMapping"
19877
+ required:
19878
+ - installation
19879
+ - records
19880
+ - mapping
19881
+ ConnectorTransformResult:
19882
+ type: object
19883
+ properties:
19884
+ payloads:
19885
+ type: array
19886
+ items: {}
19887
+ skipped:
19888
+ type: array
19889
+ items:
19890
+ type: object
19891
+ additionalProperties: true
19892
+ required:
19893
+ - payloads
19894
+ ConnectorSendInput:
19895
+ type: object
19896
+ properties:
19897
+ installation:
19898
+ $ref: "#/components/schemas/ConnectorInstallation"
19899
+ payloads:
19900
+ type: array
19901
+ items: {}
19902
+ required:
19903
+ - installation
19904
+ - payloads
19905
+ ConnectorSendResult:
19906
+ type: object
19907
+ properties:
19908
+ results:
19909
+ type: array
19910
+ items:
19911
+ type: object
19912
+ additionalProperties: true
19913
+ required:
19914
+ - results
19915
+ ConnectorFetchInput:
19916
+ type: object
19917
+ properties:
19918
+ installation:
19919
+ $ref: "#/components/schemas/ConnectorInstallation"
19920
+ cursor:
19921
+ type: string
19922
+ limit:
19923
+ type: number
19924
+ required:
19925
+ - installation
19662
19926
  CollectionAppWidget:
19663
19927
  type: object
19664
19928
  properties:
@@ -25913,6 +26177,18 @@ components:
25913
26177
  type: string
25914
26178
  auth:
25915
26179
  $ref: "#/components/schemas/FlowConnectionAuth"
26180
+ FlowConnectorRef:
26181
+ type: object
26182
+ properties:
26183
+ appId:
26184
+ type: string
26185
+ preset:
26186
+ type: string
26187
+ settings:
26188
+ type: object
26189
+ additionalProperties: true
26190
+ required:
26191
+ - appId
25916
26192
  IntegrationFlowConfig:
25917
26193
  type: object
25918
26194
  properties:
@@ -25922,6 +26198,8 @@ components:
25922
26198
  type: array
25923
26199
  items:
25924
26200
  $ref: "#/components/schemas/FieldMapping"
26201
+ connector:
26202
+ $ref: "#/components/schemas/FlowConnectorRef"
25925
26203
  IntegrationFlow:
25926
26204
  type: object
25927
26205
  properties:
@@ -26054,6 +26332,12 @@ components:
26054
26332
  type: number
26055
26333
  failed:
26056
26334
  type: number
26335
+ created:
26336
+ type: number
26337
+ updated:
26338
+ type: number
26339
+ skipped:
26340
+ type: number
26057
26341
  status:
26058
26342
  $ref: "#/components/schemas/RunStatus"
26059
26343
  runId:
@@ -26062,9 +26346,47 @@ components:
26062
26346
  - flowId
26063
26347
  - direction
26064
26348
  - records
26065
- - sent
26066
26349
  - failed
26067
26350
  - status
26351
+ InstalledConnector:
26352
+ type: object
26353
+ properties:
26354
+ appId:
26355
+ type: string
26356
+ name:
26357
+ type: string
26358
+ channel:
26359
+ type: string
26360
+ version:
26361
+ type: string
26362
+ connector:
26363
+ type: object
26364
+ additionalProperties: true
26365
+ installation:
26366
+ type: object
26367
+ additionalProperties: true
26368
+ secrets:
26369
+ type: object
26370
+ additionalProperties:
26371
+ type: object
26372
+ additionalProperties: true
26373
+ required:
26374
+ - appId
26375
+ - name
26376
+ - channel
26377
+ - version
26378
+ - connector
26379
+ - installation
26380
+ - secrets
26381
+ SaveConnectorInstallationInput:
26382
+ type: object
26383
+ properties:
26384
+ connection:
26385
+ type: object
26386
+ additionalProperties: true
26387
+ settings:
26388
+ type: object
26389
+ additionalProperties: true
26068
26390
  CapturedRequest:
26069
26391
  type: object
26070
26392
  properties:
@@ -26406,6 +26728,13 @@ components:
26406
26728
  - none
26407
26729
  UpdateFlowInput:
26408
26730
  $ref: "#/components/schemas/CreateFlowInput"
26731
+ ConnectorConsoleStep:
26732
+ type: string
26733
+ enum:
26734
+ - testConnection
26735
+ - describeTarget
26736
+ - sample
26737
+ - transform
26409
26738
  RunTrigger:
26410
26739
  type: string
26411
26740
  enum:
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import type { AppDataDeclaration, AppHeadlessDeclaration } from './headless.js';
4
4
  import type { RealtimeChannelDeclaration } from './realtime.js';
5
+ import type { FieldMapping } from './integrations.js';
5
6
  /**
6
7
  * A bundle (widget or container) as returned by the collection widgets endpoint.
7
8
  *
@@ -827,8 +828,162 @@ export interface AppManifest {
827
828
  * provider). Validated by `smartlinks-headless`. @see AppHeadlessDeclaration
828
829
  */
829
830
  headless?: AppHeadlessDeclaration;
831
+ /**
832
+ * This app is an integration CONNECTOR for one external provider (Syndigo, OneWorldSync, …): the
833
+ * integrations console lists it, draws its connect form and settings, and the integration engine
834
+ * calls its server functions to test, describe, sample, transform, send and fetch.
835
+ * @see AppConnectorDeclaration · docs/connectors.md
836
+ */
837
+ connector?: AppConnectorDeclaration;
830
838
  [key: string]: any;
831
839
  }
840
+ /** One field of a connector's "Connect" form. */
841
+ export interface ConnectorConnectionField {
842
+ /** Key in the installation's connection settings (non-secret fields) — `name` for a secret too. */
843
+ name: string;
844
+ label: string;
845
+ description?: string;
846
+ /** Store the value as this app's SECRET of this name (sealed, write-only; the function reads it with
847
+ * `ctx.secrets.get(secret)`), never in the settings. Declare `secrets:<name>` on the functions. */
848
+ secret?: string;
849
+ required?: boolean;
850
+ /** Input hint for the form. Default 'text'. */
851
+ type?: 'text' | 'url' | 'select' | 'number' | 'boolean';
852
+ options?: Array<{
853
+ value: string;
854
+ label: string;
855
+ }>;
856
+ placeholder?: string;
857
+ }
858
+ /** A ready-made flow a connector offers ("Products → Syndigo"). */
859
+ export interface ConnectorPreset {
860
+ id: string;
861
+ title: string;
862
+ description?: string;
863
+ direction: 'inbound' | 'outbound';
864
+ /** SmartLinks entity: outbound source / inbound target. */
865
+ entity: string;
866
+ /** Defaults for the flow (event types, schedule, mapping, settings…). */
867
+ flow?: Record<string, unknown>;
868
+ }
869
+ /** A panel the connector contributes to the integrations console (e.g. an API explorer). */
870
+ export interface ConnectorPanel {
871
+ id: string;
872
+ title: string;
873
+ /** Exported component name in the app's widgets bundle (manifest `widgets.files`). */
874
+ component: string;
875
+ }
876
+ /**
877
+ * The connector contract. Every function named here is one of this app's server functions
878
+ * (manifest `functions.definitions`); the engine calls it with collection authority, capped by the
879
+ * capabilities the function declares. A connector fills in only what it needs.
880
+ */
881
+ export interface AppConnectorDeclaration {
882
+ /** Stable provider key, e.g. 'syndigo', 'oneworldsync'. */
883
+ provider: string;
884
+ /** Display name of the provider ("1WorldSync"). Defaults to the app name. */
885
+ title?: string;
886
+ directions: Array<'inbound' | 'outbound'>;
887
+ /** SmartLinks entities it maps, e.g. ['product']. */
888
+ entities: string[];
889
+ /** The console's "Connect" form. */
890
+ connection?: {
891
+ fields: ConnectorConnectionField[];
892
+ };
893
+ /** Per-installation settings: a JSON Schema the console renders as a form. */
894
+ settings?: Record<string, unknown>;
895
+ presets?: ConnectorPreset[];
896
+ /** Names of this app's server functions implementing each step. */
897
+ functions: {
898
+ /** → ConnectorTestResult. */
899
+ testConnection?: string;
900
+ /** → ConnectorTargetSchema: the provider's fields for THIS customer (the mapper's right-hand side). */
901
+ describeTarget?: string;
902
+ /** → ConnectorRecords: real records for the mapper, the AI assistant and dry runs (inbound). */
903
+ sample?: string;
904
+ /** (ConnectorTransformInput) → ConnectorTransformResult. Must be deterministic — no AI at run time. */
905
+ transform?: string;
906
+ /** (ConnectorSendInput) → ConnectorSendResult. Omit to use a generic transport (HTTP, Event Hub). */
907
+ send?: string;
908
+ /** (ConnectorFetchInput) → ConnectorRecords: inbound pull, one page per call. */
909
+ fetch?: string;
910
+ };
911
+ panels?: ConnectorPanel[];
912
+ /** Path (under the app's public files) of a guide the AI mapping assistant reads. */
913
+ aiGuide?: string;
914
+ }
915
+ /**
916
+ * What every connector function receives about the installation it serves. The engine assembles it
917
+ * from the connector app's config on the collection (`connector.connection` / `connector.settings`)
918
+ * with the flow's `config.connector.settings` layered on top.
919
+ */
920
+ export interface ConnectorInstallation {
921
+ collectionId: string;
922
+ /** The connector app. */
923
+ appId: string;
924
+ /** The flow being run / configured, when there is one. */
925
+ flowId?: string | null;
926
+ /** Non-secret connection fields (secrets are read with ctx.secrets.get). */
927
+ connection: Record<string, unknown>;
928
+ /** Installation settings, overridden per flow. */
929
+ settings: Record<string, unknown>;
930
+ }
931
+ export interface ConnectorTestResult {
932
+ ok: boolean;
933
+ /** Shown to the admin: "Connected as …" or what's wrong. */
934
+ message: string;
935
+ }
936
+ export interface ConnectorTargetField {
937
+ /** Path in the provider payload, e.g. 'attributes.brandName'. */
938
+ path: string;
939
+ label?: string;
940
+ type?: 'string' | 'number' | 'boolean' | 'date' | 'object' | 'array';
941
+ required?: boolean;
942
+ description?: string;
943
+ /** Allowed values, when the provider fixes them. */
944
+ enum?: string[];
945
+ }
946
+ export interface ConnectorTargetSchema {
947
+ fields: ConnectorTargetField[];
948
+ }
949
+ export interface ConnectorRecords {
950
+ records: Array<Record<string, unknown>>;
951
+ /** Inbound paging: pass back to the next fetch; absent when there's no more. */
952
+ nextCursor?: string | null;
953
+ }
954
+ export interface ConnectorTransformInput {
955
+ installation: ConnectorInstallation;
956
+ /** SmartLinks records (outbound) or provider records (inbound). */
957
+ records: Array<Record<string, unknown>>;
958
+ /** The flow's saved mapping (`config.fieldMappings`) — the same shape the engine's mapper runs. */
959
+ mapping: FieldMapping[];
960
+ }
961
+ export interface ConnectorTransformResult {
962
+ /** One payload per input record, in the same order (null = skip that record, with a reason). */
963
+ payloads: Array<unknown | null>;
964
+ skipped?: Array<{
965
+ index: number;
966
+ reason: string;
967
+ }>;
968
+ }
969
+ export interface ConnectorSendInput {
970
+ installation: ConnectorInstallation;
971
+ payloads: unknown[];
972
+ }
973
+ export interface ConnectorSendResult {
974
+ results: Array<{
975
+ index: number;
976
+ ok: boolean;
977
+ status?: number;
978
+ error?: string;
979
+ externalId?: string;
980
+ }>;
981
+ }
982
+ export interface ConnectorFetchInput {
983
+ installation: ConnectorInstallation;
984
+ cursor?: string | null;
985
+ limit?: number;
986
+ }
832
987
  /**
833
988
  * One app entry in the collection widgets response.
834
989
  */
@@ -29,9 +29,20 @@ export interface FlowConnection {
29
29
  defaultHeaders?: Record<string, string>;
30
30
  auth?: FlowConnectionAuth;
31
31
  }
32
+ /** A flow driven by a connector app (docs/connectors.md). */
33
+ export interface FlowConnectorRef {
34
+ /** The connector app (manifest `connector` block), installed on the collection. */
35
+ appId: string;
36
+ /** The preset the flow was created from, if any. */
37
+ preset?: string;
38
+ /** Per-flow settings, layered over the installation's. */
39
+ settings?: Record<string, unknown>;
40
+ }
32
41
  export interface IntegrationFlowConfig {
33
42
  connection?: FlowConnection;
34
43
  fieldMappings?: FieldMapping[];
44
+ /** Run this flow through a connector app's functions instead of the built-in mapper/transport. */
45
+ connector?: FlowConnectorRef;
35
46
  [key: string]: any;
36
47
  }
37
48
  export interface IntegrationFlow {
@@ -95,12 +106,43 @@ export interface RunFlowSummary {
95
106
  flowId: string;
96
107
  direction: FlowDirection;
97
108
  records: number;
98
- sent: number;
109
+ /** Outbound: records delivered. */
110
+ sent?: number;
99
111
  failed: number;
112
+ /** Inbound: products created / updated, and records the connector skipped. */
113
+ created?: number;
114
+ updated?: number;
115
+ skipped?: number;
100
116
  status: RunStatus;
101
117
  /** Id of the persisted run row (deep-link into its detail). */
102
118
  runId?: string;
103
119
  }
120
+ /** One installed connector app, as the integrations console sees it. */
121
+ export interface InstalledConnector {
122
+ appId: string;
123
+ name: string;
124
+ /** The release channel installed on this collection. */
125
+ channel: string;
126
+ version: string | null;
127
+ connector: import('./appManifest.js').AppConnectorDeclaration;
128
+ /** Non-secret Connect-form values + installation settings. */
129
+ installation: {
130
+ connection: Record<string, unknown>;
131
+ settings: Record<string, unknown>;
132
+ };
133
+ /** Each secret the Connect form declares: whether it is set (+ masked hint). Never a value. */
134
+ secrets: Record<string, {
135
+ set: boolean;
136
+ hint?: string | null;
137
+ }>;
138
+ }
139
+ export interface SaveConnectorInstallationInput {
140
+ /** Non-secret fields only; secret fields are set with `secrets.put` for the connector's appId. */
141
+ connection?: Record<string, unknown>;
142
+ settings?: Record<string, unknown>;
143
+ }
144
+ /** Steps the console may run directly (send and fetch only run inside a flow). */
145
+ export type ConnectorConsoleStep = 'testConnection' | 'describeTarget' | 'sample' | 'transform';
104
146
  export type RunTrigger = 'manual' | 'event' | 'schedule' | 'test';
105
147
  export type FlowRunStatus = 'running' | 'success' | 'partial' | 'failed' | 'skipped';
106
148
  export type FlowRunItemStatus = 'sent' | 'failed' | 'skipped';