@arbidocs/sdk 0.4.58 → 0.4.59

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.
@@ -856,8 +856,16 @@ interface UploadOptions {
856
856
  * ``wp_type='skill'`` AND in a ``skills/<slug>`` folder so the
857
857
  * backend's ``SkillManager`` recognises them. */
858
858
  wpType?: 'source' | 'skill' | 'memory' | 'artifact' | 'webpage';
859
- /** Save the upload as a new immutable version of this document (`parent_ext_id` lineage). */
860
- parentExtId?: string;
859
+ /**
860
+ * Save the upload (a single file) as the next version of this document — any of its versions'
861
+ * ids. It becomes the current version and takes the document's sharing, folder and labels.
862
+ */
863
+ versionOf?: string;
864
+ /** Record that the upload is a NEW document made from this one (provenance only), e.g. a crop. */
865
+ derivedFrom?: {
866
+ docId: string;
867
+ role: 'crop' | 'redline_base' | 'redline_revised';
868
+ };
861
869
  }
862
870
  interface SkippedFile {
863
871
  file_name: string;
@@ -896,6 +904,14 @@ declare function listDocuments(arbi: ArbiClient): Promise<{
896
904
  re_ocred?: boolean | null | undefined;
897
905
  config_ext_id?: string | null | undefined;
898
906
  parent_ext_id?: string | null | undefined;
907
+ lineage_id?: string | null | undefined;
908
+ version_number: number;
909
+ is_current: boolean;
910
+ thread_id?: string | null | undefined;
911
+ derived_from: {
912
+ doc_ext_id: string;
913
+ role: components["schemas"]["DocRelationRole"];
914
+ }[];
899
915
  source_message_ext_id?: string | null | undefined;
900
916
  conversation_ext_id?: string | null | undefined;
901
917
  created_by_ext_id: string;
@@ -996,6 +1012,79 @@ declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<
996
1012
  re_ocred?: boolean | null | undefined;
997
1013
  config_ext_id?: string | null | undefined;
998
1014
  parent_ext_id?: string | null | undefined;
1015
+ lineage_id?: string | null | undefined;
1016
+ version_number: number;
1017
+ is_current: boolean;
1018
+ thread_id?: string | null | undefined;
1019
+ derived_from: {
1020
+ doc_ext_id: string;
1021
+ role: components["schemas"]["DocRelationRole"];
1022
+ }[];
1023
+ source_message_ext_id?: string | null | undefined;
1024
+ conversation_ext_id?: string | null | undefined;
1025
+ created_by_ext_id: string;
1026
+ updated_by_ext_id?: string | null | undefined;
1027
+ created_at: string;
1028
+ updated_at: string;
1029
+ wp_type?: string | null | undefined;
1030
+ folder?: string | null | undefined;
1031
+ sender?: string | null | undefined;
1032
+ doctags: {
1033
+ note?: string | null | undefined;
1034
+ citations?: {
1035
+ doc_ext_id: string;
1036
+ chunks?: {
1037
+ chunk_id: string;
1038
+ page?: number | null | undefined;
1039
+ }[] | undefined;
1040
+ }[] | null | undefined;
1041
+ external_id: string;
1042
+ doc_ext_id: string;
1043
+ tag_ext_id: string;
1044
+ created_by_ext_id: string;
1045
+ updated_by_ext_id?: string | null | undefined;
1046
+ created_at: string;
1047
+ updated_at: string;
1048
+ }[];
1049
+ doc_metadata?: {
1050
+ doc_nature?: string | null | undefined;
1051
+ doc_author?: string | null | undefined;
1052
+ doc_subject?: string | null | undefined;
1053
+ doc_date?: string | null | undefined;
1054
+ title?: string | null | undefined;
1055
+ } | null | undefined;
1056
+ }[]>;
1057
+ /**
1058
+ * Every version of the document `docId` belongs to (any version's id), oldest first; `is_current`
1059
+ * marks the current one. Lists and search only show current versions.
1060
+ */
1061
+ declare function listVersions(arbi: ArbiClient, docId: string): Promise<{
1062
+ external_id: string;
1063
+ workspace_ext_id: string;
1064
+ file_name?: string | null | undefined;
1065
+ status?: string | null | undefined;
1066
+ error_message?: string | null | undefined;
1067
+ failed_stage?: string | null | undefined;
1068
+ n_pages?: number | null | undefined;
1069
+ n_chunks?: number | null | undefined;
1070
+ tokens?: number | null | undefined;
1071
+ file_type?: string | null | undefined;
1072
+ file_size?: number | null | undefined;
1073
+ storage_type?: string | null | undefined;
1074
+ storage_uri?: string | null | undefined;
1075
+ content_hash?: string | null | undefined;
1076
+ shared?: boolean | null | undefined;
1077
+ re_ocred?: boolean | null | undefined;
1078
+ config_ext_id?: string | null | undefined;
1079
+ parent_ext_id?: string | null | undefined;
1080
+ lineage_id?: string | null | undefined;
1081
+ version_number: number;
1082
+ is_current: boolean;
1083
+ thread_id?: string | null | undefined;
1084
+ derived_from: {
1085
+ doc_ext_id: string;
1086
+ role: components["schemas"]["DocRelationRole"];
1087
+ }[];
999
1088
  source_message_ext_id?: string | null | undefined;
1000
1089
  conversation_ext_id?: string | null | undefined;
1001
1090
  created_by_ext_id: string;
@@ -1030,6 +1119,7 @@ declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<
1030
1119
  title?: string | null | undefined;
1031
1120
  } | null | undefined;
1032
1121
  }[]>;
1122
+ /** Delete documents. A document goes with all its versions, and an email with its attachments. */
1033
1123
  declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise<void>;
1034
1124
  declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{
1035
1125
  external_id: string;
@@ -1050,6 +1140,14 @@ declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1
1050
1140
  re_ocred?: boolean | null | undefined;
1051
1141
  config_ext_id?: string | null | undefined;
1052
1142
  parent_ext_id?: string | null | undefined;
1143
+ lineage_id?: string | null | undefined;
1144
+ version_number: number;
1145
+ is_current: boolean;
1146
+ thread_id?: string | null | undefined;
1147
+ derived_from: {
1148
+ doc_ext_id: string;
1149
+ role: components["schemas"]["DocRelationRole"];
1150
+ }[];
1053
1151
  source_message_ext_id?: string | null | undefined;
1054
1152
  conversation_ext_id?: string | null | undefined;
1055
1153
  created_by_ext_id: string;
@@ -1143,7 +1241,8 @@ interface UploadDirectOptions {
1143
1241
  shared?: boolean;
1144
1242
  folder?: string;
1145
1243
  configExtId?: string;
1146
- parentExtId?: string;
1244
+ /** Upload a single file as the next version of this document. */
1245
+ versionOf?: string;
1147
1246
  wpType?: string;
1148
1247
  tagExtId?: string;
1149
1248
  /** Expiry for presigned PUT URLs, in seconds. Defaults to server default (1h). */
@@ -1238,6 +1337,7 @@ declare const documents_getThumbnails: typeof getThumbnails;
1238
1337
  declare const documents_listAll: typeof listAll;
1239
1338
  declare const documents_listDocuments: typeof listDocuments;
1240
1339
  declare const documents_listPaginated: typeof listPaginated;
1340
+ declare const documents_listVersions: typeof listVersions;
1241
1341
  declare const documents_mimeFromName: typeof mimeFromName;
1242
1342
  declare const documents_sanitizeFolderPath: typeof sanitizeFolderPath;
1243
1343
  declare const documents_updateDocuments: typeof updateDocuments;
@@ -1245,7 +1345,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1245
1345
  declare const documents_uploadFiles: typeof uploadFiles;
1246
1346
  declare const documents_uploadUrl: typeof uploadUrl;
1247
1347
  declare namespace documents {
1248
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1348
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1249
1349
  }
1250
1350
 
1251
1351
  /**
@@ -3894,6 +3994,14 @@ declare class Arbi {
3894
3994
  re_ocred?: boolean | null | undefined;
3895
3995
  config_ext_id?: string | null | undefined;
3896
3996
  parent_ext_id?: string | null | undefined;
3997
+ lineage_id?: string | null | undefined;
3998
+ version_number: number;
3999
+ is_current: boolean;
4000
+ thread_id?: string | null | undefined;
4001
+ derived_from: {
4002
+ doc_ext_id: string;
4003
+ role: components["schemas"]["DocRelationRole"];
4004
+ }[];
3897
4005
  source_message_ext_id?: string | null | undefined;
3898
4006
  conversation_ext_id?: string | null | undefined;
3899
4007
  created_by_ext_id: string;
@@ -3958,6 +4066,11 @@ declare class Arbi {
3958
4066
  re_ocred?: boolean | null;
3959
4067
  config_ext_id?: string | null;
3960
4068
  parent_ext_id?: string | null;
4069
+ lineage_id?: string | null;
4070
+ version_number: number;
4071
+ is_current: boolean;
4072
+ thread_id?: string | null;
4073
+ derived_from: components["schemas"]["DerivedFrom"][];
3961
4074
  source_message_ext_id?: string | null;
3962
4075
  conversation_ext_id?: string | null;
3963
4076
  created_by_ext_id: string;
@@ -3996,6 +4109,11 @@ declare class Arbi {
3996
4109
  re_ocred?: boolean | null;
3997
4110
  config_ext_id?: string | null;
3998
4111
  parent_ext_id?: string | null;
4112
+ lineage_id?: string | null;
4113
+ version_number: number;
4114
+ is_current: boolean;
4115
+ thread_id?: string | null;
4116
+ derived_from: components["schemas"]["DerivedFrom"][];
3999
4117
  source_message_ext_id?: string | null;
4000
4118
  conversation_ext_id?: string | null;
4001
4119
  created_by_ext_id: string;
@@ -4027,6 +4145,76 @@ declare class Arbi {
4027
4145
  re_ocred?: boolean | null | undefined;
4028
4146
  config_ext_id?: string | null | undefined;
4029
4147
  parent_ext_id?: string | null | undefined;
4148
+ lineage_id?: string | null | undefined;
4149
+ version_number: number;
4150
+ is_current: boolean;
4151
+ thread_id?: string | null | undefined;
4152
+ derived_from: {
4153
+ doc_ext_id: string;
4154
+ role: components["schemas"]["DocRelationRole"];
4155
+ }[];
4156
+ source_message_ext_id?: string | null | undefined;
4157
+ conversation_ext_id?: string | null | undefined;
4158
+ created_by_ext_id: string;
4159
+ updated_by_ext_id?: string | null | undefined;
4160
+ created_at: string;
4161
+ updated_at: string;
4162
+ wp_type?: string | null | undefined;
4163
+ folder?: string | null | undefined;
4164
+ sender?: string | null | undefined;
4165
+ doctags: {
4166
+ note?: string | null | undefined;
4167
+ citations?: {
4168
+ doc_ext_id: string;
4169
+ chunks?: {
4170
+ chunk_id: string;
4171
+ page?: number | null | undefined;
4172
+ }[] | undefined;
4173
+ }[] | null | undefined;
4174
+ external_id: string;
4175
+ doc_ext_id: string;
4176
+ tag_ext_id: string;
4177
+ created_by_ext_id: string;
4178
+ updated_by_ext_id?: string | null | undefined;
4179
+ created_at: string;
4180
+ updated_at: string;
4181
+ }[];
4182
+ doc_metadata?: {
4183
+ doc_nature?: string | null | undefined;
4184
+ doc_author?: string | null | undefined;
4185
+ doc_subject?: string | null | undefined;
4186
+ doc_date?: string | null | undefined;
4187
+ title?: string | null | undefined;
4188
+ } | null | undefined;
4189
+ }[]>;
4190
+ /** Every version of a document (any version's id), oldest first; `is_current` marks the current one. */
4191
+ versions: (docId: string) => Promise<{
4192
+ external_id: string;
4193
+ workspace_ext_id: string;
4194
+ file_name?: string | null | undefined;
4195
+ status?: string | null | undefined;
4196
+ error_message?: string | null | undefined;
4197
+ failed_stage?: string | null | undefined;
4198
+ n_pages?: number | null | undefined;
4199
+ n_chunks?: number | null | undefined;
4200
+ tokens?: number | null | undefined;
4201
+ file_type?: string | null | undefined;
4202
+ file_size?: number | null | undefined;
4203
+ storage_type?: string | null | undefined;
4204
+ storage_uri?: string | null | undefined;
4205
+ content_hash?: string | null | undefined;
4206
+ shared?: boolean | null | undefined;
4207
+ re_ocred?: boolean | null | undefined;
4208
+ config_ext_id?: string | null | undefined;
4209
+ parent_ext_id?: string | null | undefined;
4210
+ lineage_id?: string | null | undefined;
4211
+ version_number: number;
4212
+ is_current: boolean;
4213
+ thread_id?: string | null | undefined;
4214
+ derived_from: {
4215
+ doc_ext_id: string;
4216
+ role: components["schemas"]["DocRelationRole"];
4217
+ }[];
4030
4218
  source_message_ext_id?: string | null | undefined;
4031
4219
  conversation_ext_id?: string | null | undefined;
4032
4220
  created_by_ext_id: string;
@@ -4081,6 +4269,14 @@ declare class Arbi {
4081
4269
  re_ocred?: boolean | null | undefined;
4082
4270
  config_ext_id?: string | null | undefined;
4083
4271
  parent_ext_id?: string | null | undefined;
4272
+ lineage_id?: string | null | undefined;
4273
+ version_number: number;
4274
+ is_current: boolean;
4275
+ thread_id?: string | null | undefined;
4276
+ derived_from: {
4277
+ doc_ext_id: string;
4278
+ role: components["schemas"]["DocRelationRole"];
4279
+ }[];
4084
4280
  source_message_ext_id?: string | null | undefined;
4085
4281
  conversation_ext_id?: string | null | undefined;
4086
4282
  created_by_ext_id: string;
@@ -856,8 +856,16 @@ interface UploadOptions {
856
856
  * ``wp_type='skill'`` AND in a ``skills/<slug>`` folder so the
857
857
  * backend's ``SkillManager`` recognises them. */
858
858
  wpType?: 'source' | 'skill' | 'memory' | 'artifact' | 'webpage';
859
- /** Save the upload as a new immutable version of this document (`parent_ext_id` lineage). */
860
- parentExtId?: string;
859
+ /**
860
+ * Save the upload (a single file) as the next version of this document — any of its versions'
861
+ * ids. It becomes the current version and takes the document's sharing, folder and labels.
862
+ */
863
+ versionOf?: string;
864
+ /** Record that the upload is a NEW document made from this one (provenance only), e.g. a crop. */
865
+ derivedFrom?: {
866
+ docId: string;
867
+ role: 'crop' | 'redline_base' | 'redline_revised';
868
+ };
861
869
  }
862
870
  interface SkippedFile {
863
871
  file_name: string;
@@ -896,6 +904,14 @@ declare function listDocuments(arbi: ArbiClient): Promise<{
896
904
  re_ocred?: boolean | null | undefined;
897
905
  config_ext_id?: string | null | undefined;
898
906
  parent_ext_id?: string | null | undefined;
907
+ lineage_id?: string | null | undefined;
908
+ version_number: number;
909
+ is_current: boolean;
910
+ thread_id?: string | null | undefined;
911
+ derived_from: {
912
+ doc_ext_id: string;
913
+ role: components["schemas"]["DocRelationRole"];
914
+ }[];
899
915
  source_message_ext_id?: string | null | undefined;
900
916
  conversation_ext_id?: string | null | undefined;
901
917
  created_by_ext_id: string;
@@ -996,6 +1012,79 @@ declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<
996
1012
  re_ocred?: boolean | null | undefined;
997
1013
  config_ext_id?: string | null | undefined;
998
1014
  parent_ext_id?: string | null | undefined;
1015
+ lineage_id?: string | null | undefined;
1016
+ version_number: number;
1017
+ is_current: boolean;
1018
+ thread_id?: string | null | undefined;
1019
+ derived_from: {
1020
+ doc_ext_id: string;
1021
+ role: components["schemas"]["DocRelationRole"];
1022
+ }[];
1023
+ source_message_ext_id?: string | null | undefined;
1024
+ conversation_ext_id?: string | null | undefined;
1025
+ created_by_ext_id: string;
1026
+ updated_by_ext_id?: string | null | undefined;
1027
+ created_at: string;
1028
+ updated_at: string;
1029
+ wp_type?: string | null | undefined;
1030
+ folder?: string | null | undefined;
1031
+ sender?: string | null | undefined;
1032
+ doctags: {
1033
+ note?: string | null | undefined;
1034
+ citations?: {
1035
+ doc_ext_id: string;
1036
+ chunks?: {
1037
+ chunk_id: string;
1038
+ page?: number | null | undefined;
1039
+ }[] | undefined;
1040
+ }[] | null | undefined;
1041
+ external_id: string;
1042
+ doc_ext_id: string;
1043
+ tag_ext_id: string;
1044
+ created_by_ext_id: string;
1045
+ updated_by_ext_id?: string | null | undefined;
1046
+ created_at: string;
1047
+ updated_at: string;
1048
+ }[];
1049
+ doc_metadata?: {
1050
+ doc_nature?: string | null | undefined;
1051
+ doc_author?: string | null | undefined;
1052
+ doc_subject?: string | null | undefined;
1053
+ doc_date?: string | null | undefined;
1054
+ title?: string | null | undefined;
1055
+ } | null | undefined;
1056
+ }[]>;
1057
+ /**
1058
+ * Every version of the document `docId` belongs to (any version's id), oldest first; `is_current`
1059
+ * marks the current one. Lists and search only show current versions.
1060
+ */
1061
+ declare function listVersions(arbi: ArbiClient, docId: string): Promise<{
1062
+ external_id: string;
1063
+ workspace_ext_id: string;
1064
+ file_name?: string | null | undefined;
1065
+ status?: string | null | undefined;
1066
+ error_message?: string | null | undefined;
1067
+ failed_stage?: string | null | undefined;
1068
+ n_pages?: number | null | undefined;
1069
+ n_chunks?: number | null | undefined;
1070
+ tokens?: number | null | undefined;
1071
+ file_type?: string | null | undefined;
1072
+ file_size?: number | null | undefined;
1073
+ storage_type?: string | null | undefined;
1074
+ storage_uri?: string | null | undefined;
1075
+ content_hash?: string | null | undefined;
1076
+ shared?: boolean | null | undefined;
1077
+ re_ocred?: boolean | null | undefined;
1078
+ config_ext_id?: string | null | undefined;
1079
+ parent_ext_id?: string | null | undefined;
1080
+ lineage_id?: string | null | undefined;
1081
+ version_number: number;
1082
+ is_current: boolean;
1083
+ thread_id?: string | null | undefined;
1084
+ derived_from: {
1085
+ doc_ext_id: string;
1086
+ role: components["schemas"]["DocRelationRole"];
1087
+ }[];
999
1088
  source_message_ext_id?: string | null | undefined;
1000
1089
  conversation_ext_id?: string | null | undefined;
1001
1090
  created_by_ext_id: string;
@@ -1030,6 +1119,7 @@ declare function getDocuments(arbi: ArbiClient, externalIds: string[]): Promise<
1030
1119
  title?: string | null | undefined;
1031
1120
  } | null | undefined;
1032
1121
  }[]>;
1122
+ /** Delete documents. A document goes with all its versions, and an email with its attachments. */
1033
1123
  declare function deleteDocuments(arbi: ArbiClient, externalIds: string[]): Promise<void>;
1034
1124
  declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1[]): Promise<{
1035
1125
  external_id: string;
@@ -1050,6 +1140,14 @@ declare function updateDocuments(arbi: ArbiClient, documents: DocUpdateRequest$1
1050
1140
  re_ocred?: boolean | null | undefined;
1051
1141
  config_ext_id?: string | null | undefined;
1052
1142
  parent_ext_id?: string | null | undefined;
1143
+ lineage_id?: string | null | undefined;
1144
+ version_number: number;
1145
+ is_current: boolean;
1146
+ thread_id?: string | null | undefined;
1147
+ derived_from: {
1148
+ doc_ext_id: string;
1149
+ role: components["schemas"]["DocRelationRole"];
1150
+ }[];
1053
1151
  source_message_ext_id?: string | null | undefined;
1054
1152
  conversation_ext_id?: string | null | undefined;
1055
1153
  created_by_ext_id: string;
@@ -1143,7 +1241,8 @@ interface UploadDirectOptions {
1143
1241
  shared?: boolean;
1144
1242
  folder?: string;
1145
1243
  configExtId?: string;
1146
- parentExtId?: string;
1244
+ /** Upload a single file as the next version of this document. */
1245
+ versionOf?: string;
1147
1246
  wpType?: string;
1148
1247
  tagExtId?: string;
1149
1248
  /** Expiry for presigned PUT URLs, in seconds. Defaults to server default (1h). */
@@ -1238,6 +1337,7 @@ declare const documents_getThumbnails: typeof getThumbnails;
1238
1337
  declare const documents_listAll: typeof listAll;
1239
1338
  declare const documents_listDocuments: typeof listDocuments;
1240
1339
  declare const documents_listPaginated: typeof listPaginated;
1340
+ declare const documents_listVersions: typeof listVersions;
1241
1341
  declare const documents_mimeFromName: typeof mimeFromName;
1242
1342
  declare const documents_sanitizeFolderPath: typeof sanitizeFolderPath;
1243
1343
  declare const documents_updateDocuments: typeof updateDocuments;
@@ -1245,7 +1345,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1245
1345
  declare const documents_uploadFiles: typeof uploadFiles;
1246
1346
  declare const documents_uploadUrl: typeof uploadUrl;
1247
1347
  declare namespace documents {
1248
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1348
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_listVersions as listVersions, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1249
1349
  }
1250
1350
 
1251
1351
  /**
@@ -3894,6 +3994,14 @@ declare class Arbi {
3894
3994
  re_ocred?: boolean | null | undefined;
3895
3995
  config_ext_id?: string | null | undefined;
3896
3996
  parent_ext_id?: string | null | undefined;
3997
+ lineage_id?: string | null | undefined;
3998
+ version_number: number;
3999
+ is_current: boolean;
4000
+ thread_id?: string | null | undefined;
4001
+ derived_from: {
4002
+ doc_ext_id: string;
4003
+ role: components["schemas"]["DocRelationRole"];
4004
+ }[];
3897
4005
  source_message_ext_id?: string | null | undefined;
3898
4006
  conversation_ext_id?: string | null | undefined;
3899
4007
  created_by_ext_id: string;
@@ -3958,6 +4066,11 @@ declare class Arbi {
3958
4066
  re_ocred?: boolean | null;
3959
4067
  config_ext_id?: string | null;
3960
4068
  parent_ext_id?: string | null;
4069
+ lineage_id?: string | null;
4070
+ version_number: number;
4071
+ is_current: boolean;
4072
+ thread_id?: string | null;
4073
+ derived_from: components["schemas"]["DerivedFrom"][];
3961
4074
  source_message_ext_id?: string | null;
3962
4075
  conversation_ext_id?: string | null;
3963
4076
  created_by_ext_id: string;
@@ -3996,6 +4109,11 @@ declare class Arbi {
3996
4109
  re_ocred?: boolean | null;
3997
4110
  config_ext_id?: string | null;
3998
4111
  parent_ext_id?: string | null;
4112
+ lineage_id?: string | null;
4113
+ version_number: number;
4114
+ is_current: boolean;
4115
+ thread_id?: string | null;
4116
+ derived_from: components["schemas"]["DerivedFrom"][];
3999
4117
  source_message_ext_id?: string | null;
4000
4118
  conversation_ext_id?: string | null;
4001
4119
  created_by_ext_id: string;
@@ -4027,6 +4145,76 @@ declare class Arbi {
4027
4145
  re_ocred?: boolean | null | undefined;
4028
4146
  config_ext_id?: string | null | undefined;
4029
4147
  parent_ext_id?: string | null | undefined;
4148
+ lineage_id?: string | null | undefined;
4149
+ version_number: number;
4150
+ is_current: boolean;
4151
+ thread_id?: string | null | undefined;
4152
+ derived_from: {
4153
+ doc_ext_id: string;
4154
+ role: components["schemas"]["DocRelationRole"];
4155
+ }[];
4156
+ source_message_ext_id?: string | null | undefined;
4157
+ conversation_ext_id?: string | null | undefined;
4158
+ created_by_ext_id: string;
4159
+ updated_by_ext_id?: string | null | undefined;
4160
+ created_at: string;
4161
+ updated_at: string;
4162
+ wp_type?: string | null | undefined;
4163
+ folder?: string | null | undefined;
4164
+ sender?: string | null | undefined;
4165
+ doctags: {
4166
+ note?: string | null | undefined;
4167
+ citations?: {
4168
+ doc_ext_id: string;
4169
+ chunks?: {
4170
+ chunk_id: string;
4171
+ page?: number | null | undefined;
4172
+ }[] | undefined;
4173
+ }[] | null | undefined;
4174
+ external_id: string;
4175
+ doc_ext_id: string;
4176
+ tag_ext_id: string;
4177
+ created_by_ext_id: string;
4178
+ updated_by_ext_id?: string | null | undefined;
4179
+ created_at: string;
4180
+ updated_at: string;
4181
+ }[];
4182
+ doc_metadata?: {
4183
+ doc_nature?: string | null | undefined;
4184
+ doc_author?: string | null | undefined;
4185
+ doc_subject?: string | null | undefined;
4186
+ doc_date?: string | null | undefined;
4187
+ title?: string | null | undefined;
4188
+ } | null | undefined;
4189
+ }[]>;
4190
+ /** Every version of a document (any version's id), oldest first; `is_current` marks the current one. */
4191
+ versions: (docId: string) => Promise<{
4192
+ external_id: string;
4193
+ workspace_ext_id: string;
4194
+ file_name?: string | null | undefined;
4195
+ status?: string | null | undefined;
4196
+ error_message?: string | null | undefined;
4197
+ failed_stage?: string | null | undefined;
4198
+ n_pages?: number | null | undefined;
4199
+ n_chunks?: number | null | undefined;
4200
+ tokens?: number | null | undefined;
4201
+ file_type?: string | null | undefined;
4202
+ file_size?: number | null | undefined;
4203
+ storage_type?: string | null | undefined;
4204
+ storage_uri?: string | null | undefined;
4205
+ content_hash?: string | null | undefined;
4206
+ shared?: boolean | null | undefined;
4207
+ re_ocred?: boolean | null | undefined;
4208
+ config_ext_id?: string | null | undefined;
4209
+ parent_ext_id?: string | null | undefined;
4210
+ lineage_id?: string | null | undefined;
4211
+ version_number: number;
4212
+ is_current: boolean;
4213
+ thread_id?: string | null | undefined;
4214
+ derived_from: {
4215
+ doc_ext_id: string;
4216
+ role: components["schemas"]["DocRelationRole"];
4217
+ }[];
4030
4218
  source_message_ext_id?: string | null | undefined;
4031
4219
  conversation_ext_id?: string | null | undefined;
4032
4220
  created_by_ext_id: string;
@@ -4081,6 +4269,14 @@ declare class Arbi {
4081
4269
  re_ocred?: boolean | null | undefined;
4082
4270
  config_ext_id?: string | null | undefined;
4083
4271
  parent_ext_id?: string | null | undefined;
4272
+ lineage_id?: string | null | undefined;
4273
+ version_number: number;
4274
+ is_current: boolean;
4275
+ thread_id?: string | null | undefined;
4276
+ derived_from: {
4277
+ doc_ext_id: string;
4278
+ role: components["schemas"]["DocRelationRole"];
4279
+ }[];
4084
4280
  source_message_ext_id?: string | null | undefined;
4085
4281
  conversation_ext_id?: string | null | undefined;
4086
4282
  created_by_ext_id: string;
package/dist/browser.cjs CHANGED
@@ -4309,6 +4309,7 @@ __export(documents_exports, {
4309
4309
  listAll: () => listAll,
4310
4310
  listDocuments: () => listDocuments,
4311
4311
  listPaginated: () => listPaginated,
4312
+ listVersions: () => listVersions,
4312
4313
  mimeFromName: () => mimeFromName,
4313
4314
  sanitizeFolderPath: () => sanitizeFolderPath,
4314
4315
  updateDocuments: () => updateDocuments,
@@ -4451,6 +4452,14 @@ async function getDocuments(arbi, externalIds) {
4451
4452
  "Failed to fetch documents"
4452
4453
  );
4453
4454
  }
4455
+ async function listVersions(arbi, docId) {
4456
+ return requireData(
4457
+ await arbi.fetch.GET("/v1/document/{document_ext_id}/versions", {
4458
+ params: { path: { document_ext_id: docId } }
4459
+ }),
4460
+ "Failed to fetch document versions"
4461
+ );
4462
+ }
4454
4463
  async function deleteDocuments(arbi, externalIds) {
4455
4464
  requireOk(
4456
4465
  await arbi.fetch.DELETE("/v1/document/", { body: { external_ids: externalIds } }),
@@ -4499,7 +4508,11 @@ async function uploadFile(auth, fileData, fileName, options) {
4499
4508
  if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
4500
4509
  if (options?.configExtId) params.set("config_ext_id", options.configExtId);
4501
4510
  if (options?.wpType) params.set("wp_type", options.wpType);
4502
- if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
4511
+ if (options?.versionOf) params.set("version_of", options.versionOf);
4512
+ if (options?.derivedFrom) {
4513
+ params.set("derived_from", options.derivedFrom.docId);
4514
+ params.set("derived_role", options.derivedFrom.role);
4515
+ }
4503
4516
  const qs = params.toString();
4504
4517
  const res = await authenticatedFetch({
4505
4518
  ...auth,
@@ -4516,7 +4529,11 @@ async function uploadFiles(auth, files, options) {
4516
4529
  if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
4517
4530
  if (options?.configExtId) params.set("config_ext_id", options.configExtId);
4518
4531
  if (options?.wpType) params.set("wp_type", options.wpType);
4519
- if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
4532
+ if (options?.versionOf) params.set("version_of", options.versionOf);
4533
+ if (options?.derivedFrom) {
4534
+ params.set("derived_from", options.derivedFrom.docId);
4535
+ params.set("derived_role", options.derivedFrom.role);
4536
+ }
4520
4537
  const qs = params.toString();
4521
4538
  const res = await authenticatedFetch({
4522
4539
  ...auth,
@@ -4611,7 +4628,8 @@ async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
4611
4628
  files: declared,
4612
4629
  shared: options?.shared !== false,
4613
4630
  config_ext_id: options?.configExtId ?? null,
4614
- parent_ext_id: options?.parentExtId ?? null,
4631
+ // Only sent when set, so a plain upload is accepted by any server version.
4632
+ ...options?.versionOf ? { version_of: options.versionOf } : {},
4615
4633
  wp_type: options?.wpType ?? null,
4616
4634
  tag_ext_id: options?.tagExtId ?? null,
4617
4635
  folder: options?.folder ? sanitizeFolderPath(options.folder) : null,
@@ -6567,6 +6585,8 @@ var Arbi = class {
6567
6585
  */
6568
6586
  listAll: (options) => listAll(this.requireClient(), options),
6569
6587
  get: (externalIds) => getDocuments(this.requireClient(), externalIds),
6588
+ /** Every version of a document (any version's id), oldest first; `is_current` marks the current one. */
6589
+ versions: (docId) => listVersions(this.requireClient(), docId),
6570
6590
  delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
6571
6591
  update: (documents) => updateDocuments(this.requireClient(), documents),
6572
6592
  uploadUrl: (urls, shared) => {