@jrmc/adonis-attachment 2.4.1 → 2.4.3

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.
@@ -9,17 +9,16 @@ import type { MultipartFile } from '@adonisjs/core/bodyparser';
9
9
  import type { AttachmentBase, Attachment as AttachmentType } from './types/attachment.js';
10
10
  import type { ResolvedAttachmentConfig } from './types/config.js';
11
11
  import { DeferQueue } from '@poppinss/defer';
12
- import { Attachment } from './attachments/attachment.js';
13
12
  import Converter from './converters/converter.js';
14
13
  export declare class AttachmentManager {
15
14
  #private;
16
15
  queue: DeferQueue;
17
16
  constructor(config: ResolvedAttachmentConfig, drive: DriveService);
18
17
  getConfig(): ResolvedAttachmentConfig;
19
- createFromDbResponse(response: any): Attachment | null;
20
- createFromFile(file: MultipartFile): Promise<Attachment>;
21
- createFromBuffer(buffer: Buffer, name?: string): Promise<Attachment>;
22
- createFromBase64(data: string, name?: string): Promise<Attachment>;
18
+ createFromDbResponse(response: any): AttachmentType | null;
19
+ createFromFile(file: MultipartFile): Promise<AttachmentType>;
20
+ createFromBuffer(buffer: Buffer, name?: string): Promise<AttachmentType>;
21
+ createFromBase64(data: string, name?: string): Promise<AttachmentType>;
23
22
  getConverter(key: string): Promise<void | Converter>;
24
23
  computeUrl(attachment: AttachmentType | AttachmentBase, signedUrlOptions?: SignedURLOptions): Promise<void>;
25
24
  preComputeUrl(attachment: AttachmentType): Promise<void>;
@@ -33,7 +33,8 @@ export class AttachmentManager {
33
33
  throw new errors.E_CANNOT_CREATE_ATTACHMENT([attribute]);
34
34
  }
35
35
  });
36
- return new Attachment(this.#drive, attributes);
36
+ const attachment = new Attachment(this.#drive, attributes);
37
+ return this.#configureAttachment(attachment);
37
38
  }
38
39
  async createFromFile(file) {
39
40
  const attributes = {
@@ -45,14 +46,16 @@ export class AttachmentManager {
45
46
  if (!file.tmpPath) {
46
47
  throw new errors.ENOENT();
47
48
  }
48
- return new Attachment(this.#drive, attributes, file.tmpPath);
49
+ const attachment = new Attachment(this.#drive, attributes, file.tmpPath);
50
+ return this.#configureAttachment(attachment);
49
51
  }
50
52
  async createFromBuffer(buffer, name) {
51
53
  if (!Buffer.isBuffer(buffer)) {
52
54
  throw new errors.E_ISNOT_BUFFER();
53
55
  }
54
56
  const attributes = await createAttachmentAttributes(buffer, name);
55
- return new Attachment(this.#drive, attributes, buffer);
57
+ const attachment = new Attachment(this.#drive, attributes, buffer);
58
+ return this.#configureAttachment(attachment);
56
59
  }
57
60
  async createFromBase64(data, name) {
58
61
  const base64Data = data.replace(/^data:([A-Za-z-+\/]+);base64,/, '');
@@ -111,8 +114,7 @@ export class AttachmentManager {
111
114
  }
112
115
  async delete(attachment) {
113
116
  if (attachment.path) {
114
- const filePath = attachment.path;
115
- await attachment.getDisk().delete(filePath);
117
+ await attachment.getDisk().delete(attachment.path);
116
118
  if (attachment instanceof Attachment) {
117
119
  if (attachment.variants) {
118
120
  const variantPath = attachment.variants[0].folder;
@@ -120,5 +122,21 @@ export class AttachmentManager {
120
122
  }
121
123
  }
122
124
  }
125
+ if (attachment.originalPath) {
126
+ await attachment.getDisk().delete(attachment.originalPath);
127
+ }
128
+ }
129
+ // private methods
130
+ #configureAttachment(attachment) {
131
+ if (this.#config.meta !== undefined) {
132
+ attachment.setOptions({ meta: this.#config.meta });
133
+ }
134
+ if (this.#config.rename !== undefined) {
135
+ attachment.setOptions({ rename: this.#config.rename });
136
+ }
137
+ if (this.#config.preComputeUrl !== undefined) {
138
+ attachment.setOptions({ preComputeUrl: this.#config.preComputeUrl });
139
+ }
140
+ return attachment;
123
141
  }
124
142
  }
@@ -13,11 +13,21 @@ export declare class Attachment extends AttachmentBase implements AttachmentInte
13
13
  originalName: string;
14
14
  variants?: Variant[];
15
15
  constructor(drive: DriveService, attributes: AttachmentAttributes, input?: Input);
16
+ /**
17
+ * Getters
18
+ */
19
+ get name(): string;
20
+ /**
21
+ * Methods
22
+ */
16
23
  createVariant(key: string, input: Input): Promise<Variant>;
17
24
  getVariant(variantName: string): Variant | undefined;
18
25
  getUrl(variantName?: string): Promise<string>;
19
26
  getSignedUrl(variantNameOrOptions?: string | SignedURLOptions, signedUrlOptions?: SignedURLOptions): Promise<string>;
20
27
  setOptions(options: LucidOptions): this;
28
+ /**
29
+ *
30
+ */
21
31
  toObject(): AttachmentAttributes;
22
32
  toJSON(): Object;
23
33
  }
@@ -22,6 +22,18 @@ export class Attachment extends AttachmentBase {
22
22
  });
23
23
  }
24
24
  }
25
+ /**
26
+ * Getters
27
+ */
28
+ get name() {
29
+ if (this.options && this.options.rename === false) {
30
+ return this.originalName;
31
+ }
32
+ return super.name;
33
+ }
34
+ /**
35
+ * Methods
36
+ */
25
37
  async createVariant(key, input) {
26
38
  const attributes = {
27
39
  ...(await createAttachmentAttributes(input)),
@@ -72,13 +84,6 @@ export class Attachment extends AttachmentBase {
72
84
  ...this.options,
73
85
  ...options,
74
86
  };
75
- if (!this.path) {
76
- if (!this.options.rename) {
77
- this.name = this.originalName;
78
- }
79
- this.folder = this.options.folder;
80
- this.path = path.join(this.folder, this.name);
81
- }
82
87
  if (this.variants) {
83
88
  this.variants.forEach((v) => {
84
89
  v.setOptions({
@@ -89,6 +94,9 @@ export class Attachment extends AttachmentBase {
89
94
  }
90
95
  return this;
91
96
  }
97
+ /**
98
+ *
99
+ */
92
100
  toObject() {
93
101
  const variants = this.variants?.map((v) => v.toObject());
94
102
  return {
@@ -8,22 +8,33 @@ import type { DriveService, SignedURLOptions } from '@adonisjs/drive/types';
8
8
  import type { LucidOptions, AttachmentBaseAttributes, AttachmentBase as AttachmentBaseInterface } from '../types/attachment.js';
9
9
  import type { Exif, Input } from '../types/input.js';
10
10
  export declare class AttachmentBase implements AttachmentBaseInterface {
11
+ #private;
11
12
  drive: DriveService;
12
13
  input?: Input;
13
- name: string;
14
14
  size: number;
15
15
  extname: string;
16
16
  mimeType: string;
17
17
  meta?: Exif;
18
- folder?: string;
19
- path?: string;
18
+ originalPath?: string;
20
19
  url?: string;
21
20
  options?: LucidOptions;
22
21
  constructor(drive: DriveService, attributes: AttachmentBaseAttributes, input?: Input);
22
+ /**
23
+ * Getters
24
+ */
25
+ get name(): string;
26
+ get folder(): string | undefined;
27
+ get path(): string;
28
+ /**
29
+ * Methods
30
+ */
23
31
  getDisk(): import("flydrive").Disk;
24
32
  getUrl(): Promise<string>;
25
33
  getSignedUrl(signedUrlOptions?: SignedURLOptions): Promise<string>;
26
34
  setOptions(options: LucidOptions): this;
35
+ /**
36
+ *
37
+ */
27
38
  toObject(): AttachmentBaseAttributes;
28
39
  toJSON(): Object;
29
40
  }
@@ -4,18 +4,19 @@
4
4
  * @license MIT
5
5
  * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
6
  */
7
+ import path from 'node:path';
7
8
  import { cuid } from '@adonisjs/core/helpers';
8
9
  import { defaultOptionsDecorator } from '../utils/default_values.js';
9
10
  export class AttachmentBase {
10
11
  drive;
11
12
  input;
12
- name;
13
+ #name;
14
+ #folder;
13
15
  size;
14
16
  extname;
15
17
  mimeType;
16
18
  meta;
17
- folder;
18
- path;
19
+ originalPath;
19
20
  url;
20
21
  options;
21
22
  constructor(drive, attributes, input) {
@@ -24,17 +25,35 @@ export class AttachmentBase {
24
25
  this.meta = attributes.meta;
25
26
  this.extname = attributes.extname;
26
27
  this.mimeType = attributes.mimeType;
27
- this.folder = attributes.folder;
28
- this.path = attributes.path;
29
- this.options = defaultOptionsDecorator;
30
- this.drive = drive;
28
+ this.originalPath = attributes.path;
29
+ this.#folder = attributes.folder;
31
30
  if (attributes.name) {
32
- this.name = attributes.name;
31
+ this.#name = attributes.name;
33
32
  }
34
33
  else {
35
- this.name = `${cuid()}.${this.extname}`;
34
+ this.#name = `${cuid()}.${this.extname}`;
35
+ }
36
+ this.options = defaultOptionsDecorator;
37
+ this.drive = drive;
38
+ }
39
+ /**
40
+ * Getters
41
+ */
42
+ get name() {
43
+ return this.#name;
44
+ }
45
+ get folder() {
46
+ if (this.options) {
47
+ return this.options?.folder;
36
48
  }
49
+ return this.#folder;
50
+ }
51
+ get path() {
52
+ return path.join(this.folder, this.name);
37
53
  }
54
+ /**
55
+ * Methods
56
+ */
38
57
  getDisk() {
39
58
  return this.drive.use(this.options?.disk);
40
59
  }
@@ -51,6 +70,9 @@ export class AttachmentBase {
51
70
  };
52
71
  return this;
53
72
  }
73
+ /**
74
+ *
75
+ */
54
76
  toObject() {
55
77
  return {
56
78
  name: this.name,
@@ -9,8 +9,15 @@ import type { VariantAttributes, Variant as VariantInterface } from '../types/at
9
9
  import type { Input } from '../types/input.js';
10
10
  import { AttachmentBase } from './attachment_base.js';
11
11
  export declare class Variant extends AttachmentBase implements VariantInterface {
12
+ #private;
12
13
  key: string;
13
- folder: string;
14
14
  constructor(drive: DriveService, attributes: VariantAttributes, input?: Input);
15
+ /**
16
+ * Getters
17
+ */
18
+ get folder(): string;
19
+ /**
20
+ *
21
+ */
15
22
  toObject(): VariantAttributes;
16
23
  }
@@ -4,17 +4,24 @@
4
4
  * @license MIT
5
5
  * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
6
  */
7
- import path from 'node:path';
8
7
  import { AttachmentBase } from './attachment_base.js';
9
8
  export class Variant extends AttachmentBase {
10
9
  key;
11
- folder;
10
+ #folder;
12
11
  constructor(drive, attributes, input) {
13
12
  super(drive, attributes, input);
14
13
  this.key = attributes.key;
15
- this.folder = attributes.folder;
16
- this.path = path.join(this.folder, this.name);
14
+ this.#folder = attributes.folder;
17
15
  }
16
+ /**
17
+ * Getters
18
+ */
19
+ get folder() {
20
+ return this.#folder;
21
+ }
22
+ /**
23
+ *
24
+ */
18
25
  toObject() {
19
26
  return {
20
27
  key: this.key,
@@ -30,6 +30,10 @@ export default class PdfThumbnailConverter extends Converter {
30
30
  binPath = this.binPaths.pdftocairoBasePath;
31
31
  }
32
32
  const poppler = new Poppler(binPath);
33
+ const pdfInfo = await poppler.pdfInfo(input);
34
+ const pagesMatch = pdfInfo.match(/Pages:\s*(\d+)/);
35
+ const pageCount = pagesMatch ? parseInt(pagesMatch[1]) : 1;
36
+ const pageNumberFormat = '0'.repeat(String(pageCount).length - 1);
33
37
  const options = {
34
38
  // firstPageToConvert: 1,
35
39
  lastPageToConvert: 1,
@@ -37,6 +41,6 @@ export default class PdfThumbnailConverter extends Converter {
37
41
  };
38
42
  const filePath = path.join(os.tmpdir(), cuid());
39
43
  await poppler.pdfToCairo(input, filePath, options);
40
- return filePath + '-1.jpg';
44
+ return `${filePath}-${pageNumberFormat}1.jpg`;
41
45
  }
42
46
  }
@@ -12,23 +12,6 @@ export const attachment = (options) => {
12
12
  if (!target[optionsSym]) {
13
13
  target[optionsSym] = {};
14
14
  }
15
- const defaultConfig = attachmentManager.getConfig();
16
- const defaultOptions = {
17
- meta: defaultConfig.meta !== undefined ? defaultConfig.meta : defaultOptionsDecorator.meta,
18
- rename: defaultConfig.rename !== undefined ? defaultConfig.rename : defaultOptionsDecorator.rename,
19
- preComputeUrl: defaultConfig.preComputeUrl !== undefined
20
- ? defaultConfig.preComputeUrl
21
- : defaultOptionsDecorator.preComputeUrl,
22
- };
23
- if (!options || options?.meta === undefined) {
24
- options.meta = defaultOptions.meta;
25
- }
26
- if (!options || options?.rename === undefined) {
27
- options.rename = defaultOptions.rename;
28
- }
29
- if (!options || options?.preComputeUrl === undefined) {
30
- options.preComputeUrl = defaultOptions.preComputeUrl;
31
- }
32
15
  target[optionsSym][attributeName] = options;
33
16
  const Model = target.constructor;
34
17
  Model.boot();
@@ -40,7 +23,16 @@ export const attachment = (options) => {
40
23
  consume: (value) => {
41
24
  if (value) {
42
25
  const attachment = attachmentManager.createFromDbResponse(value);
43
- attachment?.setOptions({ disk, folder, variants, meta, rename });
26
+ attachment?.setOptions({ disk, folder, variants });
27
+ if (options && options?.meta !== undefined) {
28
+ attachment?.setOptions({ meta: options.meta });
29
+ }
30
+ if (options && options?.rename !== undefined) {
31
+ attachment?.setOptions({ rename: options.rename });
32
+ }
33
+ if (options && options?.preComputeUrl !== undefined) {
34
+ attachment?.setOptions({ preComputeUrl: options.preComputeUrl });
35
+ }
44
36
  return attachment;
45
37
  }
46
38
  else {
@@ -28,8 +28,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
28
28
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
29
29
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
30
30
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
31
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
32
- useConnection(connection: string): any;
31
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
32
+ useConnection(connection: string): /*elided*/ any;
33
33
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
34
34
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
35
35
  $setAttribute(key: string, value: any): void;
@@ -43,19 +43,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
43
43
  $hydrateOriginals(): void;
44
44
  fill(value: Partial<{
45
45
  $attachments: AttributeOfModelWithAttachment;
46
- }>, allowExtraProperties?: boolean): any;
46
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
47
47
  merge(value: Partial<{
48
48
  $attachments: AttributeOfModelWithAttachment;
49
- }>, allowExtraProperties?: boolean): any;
50
- enableForceUpdate(): any;
51
- save(): Promise<any>;
52
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
49
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
50
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
51
+ enableForceUpdate(): /*elided*/ any;
52
+ save(): Promise</*elided*/ any>;
53
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
53
54
  delete(): Promise<void>;
54
- refresh(): Promise<any>;
55
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
56
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
57
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
58
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
55
+ refresh(): Promise</*elided*/ any>;
56
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
57
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
58
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
59
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
60
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
59
61
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
60
62
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
61
63
  serializeRelations(fields: undefined, raw: true): {
@@ -66,7 +68,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
66
68
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
67
69
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
68
70
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
69
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
71
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
70
72
  };
71
73
  afterFindHook(modelInstance: {
72
74
  $attachments: AttributeOfModelWithAttachment;
@@ -88,8 +90,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
88
90
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
89
91
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
90
92
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
91
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
92
- useConnection(connection: string): any;
93
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
94
+ useConnection(connection: string): /*elided*/ any;
93
95
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
94
96
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
95
97
  $setAttribute(key: string, value: any): void;
@@ -103,19 +105,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
103
105
  $hydrateOriginals(): void;
104
106
  fill(value: Partial<{
105
107
  $attachments: AttributeOfModelWithAttachment;
106
- }>, allowExtraProperties?: boolean): any;
108
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
107
109
  merge(value: Partial<{
108
110
  $attachments: AttributeOfModelWithAttachment;
109
- }>, allowExtraProperties?: boolean): any;
110
- enableForceUpdate(): any;
111
- save(): Promise<any>;
112
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
111
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
112
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
113
+ enableForceUpdate(): /*elided*/ any;
114
+ save(): Promise</*elided*/ any>;
115
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
113
116
  delete(): Promise<void>;
114
- refresh(): Promise<any>;
115
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
116
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
117
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
118
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
117
+ refresh(): Promise</*elided*/ any>;
118
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
119
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
120
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
121
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
122
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
119
123
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
120
124
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
121
125
  serializeRelations(fields: undefined, raw: true): {
@@ -126,7 +130,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
126
130
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
127
131
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
128
132
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
129
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
133
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
130
134
  }): Promise<void>;
131
135
  afterFetchHook(modelInstances: {
132
136
  $attachments: AttributeOfModelWithAttachment;
@@ -148,8 +152,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
148
152
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
149
153
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
150
154
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
151
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
152
- useConnection(connection: string): any;
155
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
156
+ useConnection(connection: string): /*elided*/ any;
153
157
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
154
158
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
155
159
  $setAttribute(key: string, value: any): void;
@@ -163,19 +167,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
163
167
  $hydrateOriginals(): void;
164
168
  fill(value: Partial<{
165
169
  $attachments: AttributeOfModelWithAttachment;
166
- }>, allowExtraProperties?: boolean): any;
170
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
167
171
  merge(value: Partial<{
168
172
  $attachments: AttributeOfModelWithAttachment;
169
- }>, allowExtraProperties?: boolean): any;
170
- enableForceUpdate(): any;
171
- save(): Promise<any>;
172
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
173
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
174
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
175
+ enableForceUpdate(): /*elided*/ any;
176
+ save(): Promise</*elided*/ any>;
177
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
173
178
  delete(): Promise<void>;
174
- refresh(): Promise<any>;
175
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
176
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
177
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
178
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
179
+ refresh(): Promise</*elided*/ any>;
180
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
181
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
182
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
183
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
184
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
179
185
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
180
186
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
181
187
  serializeRelations(fields: undefined, raw: true): {
@@ -186,7 +192,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
186
192
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
187
193
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
188
194
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
189
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
195
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
190
196
  }[]): Promise<void>;
191
197
  beforeSaveHook(modelInstance: {
192
198
  $attachments: AttributeOfModelWithAttachment;
@@ -208,8 +214,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
208
214
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
209
215
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
210
216
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
211
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
212
- useConnection(connection: string): any;
217
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
218
+ useConnection(connection: string): /*elided*/ any;
213
219
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
214
220
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
215
221
  $setAttribute(key: string, value: any): void;
@@ -223,19 +229,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
223
229
  $hydrateOriginals(): void;
224
230
  fill(value: Partial<{
225
231
  $attachments: AttributeOfModelWithAttachment;
226
- }>, allowExtraProperties?: boolean): any;
232
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
227
233
  merge(value: Partial<{
228
234
  $attachments: AttributeOfModelWithAttachment;
229
- }>, allowExtraProperties?: boolean): any;
230
- enableForceUpdate(): any;
231
- save(): Promise<any>;
232
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
235
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
236
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
237
+ enableForceUpdate(): /*elided*/ any;
238
+ save(): Promise</*elided*/ any>;
239
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
233
240
  delete(): Promise<void>;
234
- refresh(): Promise<any>;
235
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
236
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
237
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
238
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
241
+ refresh(): Promise</*elided*/ any>;
242
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
243
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
244
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
245
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
246
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
239
247
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
240
248
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
241
249
  serializeRelations(fields: undefined, raw: true): {
@@ -246,7 +254,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
246
254
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
247
255
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
248
256
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
249
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
257
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
250
258
  }): Promise<void>;
251
259
  afterSaveHook(modelInstance: {
252
260
  $attachments: AttributeOfModelWithAttachment;
@@ -268,8 +276,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
268
276
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
269
277
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
270
278
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
271
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
272
- useConnection(connection: string): any;
279
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
280
+ useConnection(connection: string): /*elided*/ any;
273
281
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
274
282
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
275
283
  $setAttribute(key: string, value: any): void;
@@ -283,19 +291,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
283
291
  $hydrateOriginals(): void;
284
292
  fill(value: Partial<{
285
293
  $attachments: AttributeOfModelWithAttachment;
286
- }>, allowExtraProperties?: boolean): any;
294
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
287
295
  merge(value: Partial<{
288
296
  $attachments: AttributeOfModelWithAttachment;
289
- }>, allowExtraProperties?: boolean): any;
290
- enableForceUpdate(): any;
291
- save(): Promise<any>;
292
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
297
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
298
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
299
+ enableForceUpdate(): /*elided*/ any;
300
+ save(): Promise</*elided*/ any>;
301
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
293
302
  delete(): Promise<void>;
294
- refresh(): Promise<any>;
295
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
296
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
297
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
298
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
303
+ refresh(): Promise</*elided*/ any>;
304
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
305
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
306
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
307
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
308
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
299
309
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
300
310
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
301
311
  serializeRelations(fields: undefined, raw: true): {
@@ -306,7 +316,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
306
316
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
307
317
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
308
318
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
309
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
319
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
310
320
  }): Promise<void>;
311
321
  beforeDeleteHook(modelInstance: {
312
322
  $attachments: AttributeOfModelWithAttachment;
@@ -328,8 +338,8 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
328
338
  $options?: import("@adonisjs/lucid/types/model").ModelOptions;
329
339
  $trx?: import("@adonisjs/lucid/types/database").TransactionClientContract;
330
340
  $setOptionsAndTrx(options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions): void;
331
- useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): any;
332
- useConnection(connection: string): any;
341
+ useTransaction(trx: import("@adonisjs/lucid/types/database").TransactionClientContract): /*elided*/ any;
342
+ useConnection(connection: string): /*elided*/ any;
333
343
  $getQueryFor(action: "insert", client: import("@adonisjs/lucid/types/database").QueryClientContract): ReturnType<import("@adonisjs/lucid/types/database").QueryClientContract["insertQuery"]>;
334
344
  $getQueryFor(action: "update" | "delete" | "refresh", client: import("@adonisjs/lucid/types/database").QueryClientContract): import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<import("@adonisjs/lucid/types/model").LucidModel>;
335
345
  $setAttribute(key: string, value: any): void;
@@ -343,19 +353,21 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
343
353
  $hydrateOriginals(): void;
344
354
  fill(value: Partial<{
345
355
  $attachments: AttributeOfModelWithAttachment;
346
- }>, allowExtraProperties?: boolean): any;
356
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
347
357
  merge(value: Partial<{
348
358
  $attachments: AttributeOfModelWithAttachment;
349
- }>, allowExtraProperties?: boolean): any;
350
- enableForceUpdate(): any;
351
- save(): Promise<any>;
352
- lockForUpdate<T>(callback: (user: any) => T | Promise<T>): Promise<T>;
359
+ }>, allowExtraProperties?: boolean): /*elided*/ any;
360
+ isDirty(fields?: "$attachments" | ("$attachments" | undefined)[] | undefined): boolean;
361
+ enableForceUpdate(): /*elided*/ any;
362
+ save(): Promise</*elided*/ any>;
363
+ lockForUpdate<T>(callback: (user: /*elided*/ any) => T | Promise<T>): Promise<T>;
353
364
  delete(): Promise<void>;
354
- refresh(): Promise<any>;
355
- load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
356
- preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
357
- loadAggregate: <Self extends any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
358
- loadCount: <Self extends any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
365
+ refresh(): Promise</*elided*/ any>;
366
+ load: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
367
+ loadOnce: import("@adonisjs/lucid/types/model").LucidRowPreloadOnce</*elided*/ any>;
368
+ preload: import("@adonisjs/lucid/types/model").LucidRowPreload</*elided*/ any>;
369
+ loadAggregate: <Self extends /*elided*/ any, Name extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder = Self[Name] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name]["subQuery"] : never>(name: Name, callback: (builder: RelatedBuilder) => void) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
370
+ loadCount: <Self extends /*elided*/ any, Name_1 extends import("@adonisjs/lucid/types/relations").ExtractModelRelations<Self>, RelatedBuilder_1 = Self[Name_1] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? Self[Name_1]["subQuery"] : never>(name: Name_1, callback?: ((builder: RelatedBuilder_1) => void) | undefined) => import("@adonisjs/lucid/types/model").LazyLoadAggregatesContract<Self>;
359
371
  serializeAttributes(fields?: import("@adonisjs/lucid/types/model").CherryPickFields, raw?: boolean): import("@adonisjs/lucid/types/model").ModelObject;
360
372
  serializeComputed(fields?: import("@adonisjs/lucid/types/model").CherryPickFields): import("@adonisjs/lucid/types/model").ModelObject;
361
373
  serializeRelations(fields: undefined, raw: true): {
@@ -366,7 +378,7 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
366
378
  serialize(cherryPick?: import("@adonisjs/lucid/types/model").CherryPick): import("@adonisjs/lucid/types/model").ModelObject;
367
379
  toObject(): import("@adonisjs/lucid/types/model").ModelObject;
368
380
  toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
369
- related<Name_2 extends undefined>(relation: Name_2): any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? any[Name_2]["client"] : never;
381
+ related<Name_2 extends undefined>(relation: Name_2): /*elided*/ any[Name_2] extends import("@adonisjs/lucid/types/relations").ModelRelations<import("@adonisjs/lucid/types/model").LucidModel, import("@adonisjs/lucid/types/model").LucidModel> ? /*elided*/ any[Name_2]["client"] : never;
370
382
  }): Promise<void>;
371
383
  find: <T extends import("@adonisjs/lucid/types/model").LucidModel>(this: T, value: any, options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions) => Promise<null | InstanceType<T>>;
372
384
  readonly booted: boolean;
@@ -441,5 +453,6 @@ export declare const Attachmentable: <Model extends NormalizeConstructor<typeof
441
453
  updateOrCreateMany: <T extends import("@adonisjs/lucid/types/model").LucidModel>(this: T, predicate: keyof import("@adonisjs/lucid/types/model").ModelAttributes<InstanceType<T>> | (keyof import("@adonisjs/lucid/types/model").ModelAttributes<InstanceType<T>>)[], payload: Partial<import("@adonisjs/lucid/types/model").ModelAttributes<InstanceType<T>>>[], options?: import("@adonisjs/lucid/types/model").ModelAssignOptions) => Promise<InstanceType<T>[]>;
442
454
  all: <T extends import("@adonisjs/lucid/types/model").LucidModel>(this: T, options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions) => Promise<InstanceType<T>[]>;
443
455
  query: <Model_1 extends import("@adonisjs/lucid/types/model").LucidModel, Result = InstanceType<Model_1>>(this: Model_1, options?: import("@adonisjs/lucid/types/model").ModelAdapterOptions) => import("@adonisjs/lucid/types/model").ModelQueryBuilderContract<Model_1, Result>;
456
+ transaction: import("@adonisjs/lucid/types/database").TransactionFn;
444
457
  truncate: (cascade?: boolean) => Promise<void>;
445
458
  } & Model;
@@ -12,12 +12,13 @@ export type AttachmentBase = {
12
12
  drive: DriveService;
13
13
  input?: Input;
14
14
  name: string;
15
+ folder?: string;
16
+ path?: string;
15
17
  size: number;
16
18
  extname: string;
17
19
  mimeType: string;
18
20
  meta?: Exif;
19
- folder?: string;
20
- path?: string;
21
+ originalPath?: string;
21
22
  url?: string;
22
23
  options?: LucidOptions;
23
24
  getDisk(): Disk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrmc/adonis-attachment",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "type": "module",
5
5
  "description": "Turn any field on your Lucid model to an attachment data type",
6
6
  "engines": {