abra-flexi 0.5.7 → 0.6.0

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/index.d.mts CHANGED
@@ -85,11 +85,26 @@ declare enum UpdateStrategy {
85
85
  Updated = 0,
86
86
  }
87
87
  type AFApiFetch = (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>;
88
+ type AFResponseFormat = 'json' | 'xml' | 'pdf' | 'html' | 'csv' | 'isdoc' | (string & {});
89
+ type AFFileResult = {
90
+ blob: Blob;
91
+ contentType: string;
92
+ filename?: string;
93
+ };
94
+ type AFLogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
95
+ interface AFLogger {
96
+ debug(...args: any[]): void;
97
+ info(...args: any[]): void;
98
+ warn(...args: any[]): void;
99
+ error(...args: any[]): void;
100
+ }
88
101
  type AFApiConfig = {
89
102
  url: string;
90
103
  company: string;
91
104
  fetch?: AFApiFetch;
92
105
  stitkyCacheStrategy?: StitkyCacheStrategy;
106
+ logger?: AFLogger;
107
+ logLevel?: AFLogLevel;
93
108
  };
94
109
  type NO_LIMIT_T = 0;
95
110
  declare const NO_LIMIT = 0;
@@ -113,14 +128,18 @@ type AFQueryOptions = {
113
128
  noSimpleMode?: boolean;
114
129
  noValidityCheck?: boolean;
115
130
  noUpdateStitkyCache?: boolean;
116
- entityPathPrefix?: string;
117
131
  ucetniObdobi?: string;
118
132
  koncovyMesicRok?: string;
119
133
  pocetMesicu?: number;
120
134
  date?: string;
121
135
  currency?: string;
136
+ adresarId?: number | string | AFFilter;
122
137
  abortController?: AbortController;
123
138
  };
139
+ type AFQueryFileOptions = AFQueryOptions & {
140
+ reportName?: string;
141
+ reportLang?: string;
142
+ };
124
143
  type AFURelOptions = {
125
144
  detail?: AFNestedDetail | AFQueryDetail;
126
145
  vazbaTyp?: string | string[];
@@ -153,6 +172,10 @@ type AFSaveOptions = {
153
172
  };
154
173
  type AFDeleteOptions = {
155
174
  abortController?: AbortController;
175
+ asUserRelation?: boolean;
176
+ };
177
+ type AFActionOptions = {
178
+ abortController?: AbortController;
156
179
  };
157
180
  type AFSessionConfig = {
158
181
  url: string;
@@ -303,6 +326,7 @@ declare class AFStitkyCache {
303
326
  private _stitky;
304
327
  private _stitekSkupiny;
305
328
  private _lastUpdate?;
329
+ private _inflight?;
306
330
  constructor(client: AFApiClient, strategy?: StitkyCacheStrategy);
307
331
  get strategy(): StitkyCacheStrategy;
308
332
  fetchTick(): Promise<void>;
@@ -320,6 +344,7 @@ declare class AFEntity {
320
344
  kod?: string | null;
321
345
  stitky?: string | null;
322
346
  _orig: Record<string, any>;
347
+ _isNew: boolean;
323
348
  constructor(stitkyCache: AFStitkyCache);
324
349
  getPropertyTypeAnnotation(key: string): TypeAnnotation | undefined;
325
350
  getStitky(): AFStitek[] | undefined;
@@ -339,23 +364,30 @@ declare class AFApiClient {
339
364
  private _fetch;
340
365
  private _company;
341
366
  private _stitkyCache;
367
+ private _logger;
342
368
  constructor(config: AFApiConfig);
343
369
  get url(): string;
344
370
  get company(): string;
345
371
  get stitkyCacheStrategy(): StitkyCacheStrategy;
346
- queryRaw(entityPath: string, options: AFQueryOptions): Promise<any>;
347
- query<T extends typeof AFEntity>(entity: T, options: AFQueryOptions): Promise<InstanceType<T>[]>;
372
+ private _buildQueryUrl;
373
+ queryRaw(entityPath: string, options?: AFQueryOptions): Promise<any>;
374
+ queryFileRaw(entityPath: string, format: AFResponseFormat, options?: AFQueryFileOptions): Promise<AFFileResult>;
375
+ queryFile<T extends typeof AFEntity>(entity: T, format: AFResponseFormat, options?: AFQueryFileOptions): Promise<AFFileResult>;
376
+ query<T extends typeof AFEntity>(entity: T, options?: AFQueryOptions): Promise<InstanceType<T>[]>;
348
377
  queryOne<T extends typeof AFEntity>(entity: T, options: AFQueryOptions): Promise<InstanceType<T>>;
349
378
  queryURels<T extends typeof AFEntity = typeof AFEntity>(relatedEntity: T, forObjects: AFURelMinimal | AFURelMinimal[], options?: AFURelOptions): Promise<AFURelResult<InstanceType<T>>[]>;
350
- populate<T extends typeof AFEntity = typeof AFEntity>(entities: InstanceType<T>[], options: AFPopulateOptions): Promise<InstanceType<T>[]>;
351
- populateOne<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, options: AFPopulateOptions): Promise<InstanceType<T>>;
379
+ populate<T extends typeof AFEntity = typeof AFEntity>(entities: InstanceType<T>[], options?: AFPopulateOptions): Promise<InstanceType<T>[]>;
380
+ populateOne<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, options?: AFPopulateOptions): Promise<InstanceType<T>>;
352
381
  create<T extends typeof AFEntity>(entity: T): Promise<InstanceType<T>>;
353
382
  createIdStub<T extends typeof AFEntity>(entity: T, id: IdStub): Promise<InstanceType<T>>;
354
383
  saveRaw(entityPath: string, data: any, options?: AFSaveOptions): Promise<any>;
355
384
  save<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, options?: AFSaveOptions): Promise<InstanceType<T>>;
356
- deleteRaw(entityPath: string, id: string | number | undefined | null, options: AFSaveOptions): Promise<any>;
357
- delete<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, options: AFDeleteOptions): Promise<boolean>;
358
- deleteUserRelation(entity: AFUzivatelskaVazba, options: AFSaveOptions): Promise<void>;
385
+ deleteRaw(entityPath: string, id: string | number | undefined | null, options?: AFDeleteOptions): Promise<any>;
386
+ delete<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, options?: AFDeleteOptions): Promise<boolean>;
387
+ callEntityActionRaw(entityPath: string, id: string | number, actionName: string, options?: AFActionOptions): Promise<boolean>;
388
+ callEntityAction<T extends typeof AFEntity = typeof AFEntity>(entity: InstanceType<T>, actionName: string, options?: AFActionOptions): Promise<boolean>;
389
+ private _applySaveResultToEntity;
390
+ private _extractAbraErrors;
359
391
  private _decodeEntityObj;
360
392
  private _encodeEntity;
361
393
  private _decodeProperty;