@jrmc/adonis-attachment 5.0.0-beta.2 → 5.0.0-beta.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.
Files changed (36) hide show
  1. package/build/index.d.ts +0 -1
  2. package/build/index.d.ts.map +1 -1
  3. package/build/index.js +0 -1
  4. package/build/providers/attachment_provider.d.ts.map +1 -1
  5. package/build/providers/attachment_provider.js +2 -1
  6. package/build/src/attachment_manager.d.ts +4 -2
  7. package/build/src/attachment_manager.d.ts.map +1 -1
  8. package/build/src/attachment_manager.js +3 -1
  9. package/build/src/attachments/attachment.d.ts +1 -1
  10. package/build/src/attachments/attachment.js +1 -1
  11. package/build/src/controllers/attachments_controller.d.ts.map +1 -1
  12. package/build/src/controllers/attachments_controller.js +74 -74
  13. package/build/src/decorators/attachment.d.ts +3 -3
  14. package/build/src/decorators/attachment.d.ts.map +1 -1
  15. package/build/src/services/record_with_attachment.d.ts.map +1 -1
  16. package/build/src/services/record_with_attachment.js +22 -9
  17. package/build/src/services/variant/variant_generator.d.ts +18 -0
  18. package/build/src/services/variant/variant_generator.d.ts.map +1 -0
  19. package/build/src/services/variant/variant_generator.js +91 -0
  20. package/build/src/services/variant/variant_persister.d.ts +17 -0
  21. package/build/src/services/variant/variant_persister.d.ts.map +1 -0
  22. package/build/src/services/variant/variant_persister.js +54 -0
  23. package/build/src/services/variant/variant_purger.d.ts +9 -0
  24. package/build/src/services/variant/variant_purger.d.ts.map +1 -0
  25. package/build/src/services/variant/variant_purger.js +42 -0
  26. package/build/src/services/variant_service.d.ts +7 -0
  27. package/build/src/services/variant_service.d.ts.map +1 -0
  28. package/build/src/services/variant_service.js +52 -0
  29. package/build/src/types/attachment.d.ts +3 -3
  30. package/build/src/types/attachment.d.ts.map +1 -1
  31. package/build/stubs/config.stub +102 -4
  32. package/build/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +4 -8
  34. package/build/src/converter_manager.d.ts +0 -13
  35. package/build/src/converter_manager.d.ts.map +0 -1
  36. package/build/src/converter_manager.js +0 -121
@@ -0,0 +1,42 @@
1
+ import attachmentManager from '../../../services/main.js';
2
+ export default class VariantPurger {
3
+ #filters;
4
+ constructor(filters) {
5
+ this.#filters = filters;
6
+ }
7
+ async purge(attachments) {
8
+ const variantsToRemove = this.#getVariantsToRemove(attachments);
9
+ await Promise.all(variantsToRemove.map(variant => attachmentManager.remove(variant)));
10
+ this.#updateAttachmentVariants(attachments);
11
+ }
12
+ #getVariantsToRemove(attachments) {
13
+ const variants = [];
14
+ attachments.forEach(attachment => {
15
+ if (attachment.variants) {
16
+ attachment.variants.forEach(variant => {
17
+ if (this.#shouldRemoveVariant(variant)) {
18
+ variants.push(variant);
19
+ }
20
+ });
21
+ }
22
+ });
23
+ return variants;
24
+ }
25
+ #updateAttachmentVariants(attachments) {
26
+ attachments.forEach(attachment => {
27
+ if (attachment.variants) {
28
+ attachment.variants = this.#filterVariants(attachment.variants);
29
+ }
30
+ });
31
+ }
32
+ #shouldRemoveVariant(variant) {
33
+ return this.#filters?.variants === undefined ||
34
+ this.#filters.variants.includes(variant.key);
35
+ }
36
+ #filterVariants(variants) {
37
+ if (this.#filters?.variants === undefined) {
38
+ return [];
39
+ }
40
+ return variants.filter(variant => !this.#filters.variants.includes(variant.key));
41
+ }
42
+ }
@@ -0,0 +1,7 @@
1
+ import type { ConverterInitializeAttributes } from '../types/converter.js';
2
+ export default class VariantService {
3
+ #private;
4
+ constructor({ record, attributeName, options, filters }: ConverterInitializeAttributes);
5
+ run(): Promise<import("../types/attachment.js").Variant[] | undefined>;
6
+ }
7
+ //# sourceMappingURL=variant_service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variant_service.d.ts","sourceRoot":"","sources":["../../../src/services/variant_service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAO1E,MAAM,CAAC,OAAO,OAAO,cAAc;;gBASrB,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,6BAA6B;IAgBhF,GAAG;CA6BV"}
@@ -0,0 +1,52 @@
1
+ import logger from '@adonisjs/core/services/logger';
2
+ import VariantGenerator from './variant/variant_generator.js';
3
+ import VariantPurger from './variant/variant_purger.js';
4
+ import VariantPersister from './variant/variant_persister.js';
5
+ export default class VariantService {
6
+ #record;
7
+ #attributeName;
8
+ #options;
9
+ #filters;
10
+ #variantGenerator;
11
+ #variantPurger;
12
+ #variantPersister;
13
+ constructor({ record, attributeName, options, filters }) {
14
+ this.#record = record;
15
+ this.#attributeName = attributeName;
16
+ this.#options = options;
17
+ this.#filters = filters;
18
+ this.#variantGenerator = new VariantGenerator();
19
+ this.#variantPurger = new VariantPurger(filters);
20
+ this.#variantPersister = new VariantPersister({
21
+ id: record.row.$attributes['id'],
22
+ modelTable: record.row.constructor.table,
23
+ attributeName,
24
+ multiple: Array.isArray(record.row.$original[attributeName])
25
+ });
26
+ }
27
+ async run() {
28
+ try {
29
+ const attachments = await this.#getAttachments();
30
+ if (!this.#shouldProcess(attachments)) {
31
+ return;
32
+ }
33
+ await this.#variantPurger.purge(attachments);
34
+ const variants = await this.#variantGenerator.generate({ attachments, options: this.#options, filters: this.#filters });
35
+ await this.#variantPersister.persist({ attachments, variants });
36
+ return variants;
37
+ }
38
+ catch (error) {
39
+ logger.error(`VariantService.run failed: ${error.message}`);
40
+ throw error;
41
+ }
42
+ }
43
+ async #getAttachments() {
44
+ await this.#record.row.refresh();
45
+ return this.#record.getAttachments({
46
+ attributeName: this.#attributeName,
47
+ });
48
+ }
49
+ #shouldProcess(attachments) {
50
+ return !!(attachments?.length && this.#options?.variants?.length);
51
+ }
52
+ }
@@ -40,7 +40,7 @@ export type Attachment = AttachmentBase & {
40
40
  originalName: string;
41
41
  variants?: Variant[];
42
42
  createVariant(key: string, input: Input): Promise<Variant>;
43
- getVariant(variantName: string): Variant | undefined;
43
+ getVariant(variantName: string): Variant | null;
44
44
  getUrl(variantName?: string): Promise<string>;
45
45
  getSignedUrl(variantNameOrOptions?: string | SignedURLOptions, signedUrlOptions?: SignedURLOptions): Promise<string>;
46
46
  toObject(): AttachmentAttributes;
@@ -52,9 +52,9 @@ export type Variant = AttachmentBase & {
52
52
  generateBlurhash(options?: BlurhashOptions): void;
53
53
  toObject(): VariantAttributes;
54
54
  };
55
- export type LucidOptions = {
55
+ export type LucidOptions<T = LucidRow> = {
56
56
  disk?: string;
57
- folder?: string | ((record?: LucidRow) => string);
57
+ folder?: string | ((record: T) => string);
58
58
  preComputeUrl?: boolean;
59
59
  variants?: (keyof AttachmentVariants)[];
60
60
  rename?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/types/attachment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,YAAY,CAAA;IAEnB,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,E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MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IACzC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,kBAAkB,CAAC,EAAE,CAAA;IACvC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,KAAK,OAAO,CAAA;IAC3C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG;IAC5D,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,GAAG;IACzD,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA"}
@@ -1,16 +1,114 @@
1
1
  {{{
2
2
  exports({ to: app.configPath('attachment.ts') })
3
3
  }}}
4
+ // import sharp from 'sharp'
4
5
  import { defineConfig } from '@jrmc/adonis-attachment'
5
6
  import { InferConverters } from '@jrmc/adonis-attachment/types/config'
6
7
 
8
+ /**
9
+ * Documentation: https://adonis-attachment.jrmc.dev/guide/essentials/configuration
10
+ */
11
+
7
12
  const attachmentConfig = defineConfig({
13
+ /**
14
+ * Enable the preComputeUrl flag to pre compute the URLs after SELECT queries. (default: false)
15
+ */
16
+ // preComputeUrl: true,
17
+
18
+ /**
19
+ * Enable the meta informations after upload. (default: false)
20
+ */
21
+ // meta: true,
22
+
23
+ /**
24
+ * Enable file rename after upload. (default: true)
25
+ */
26
+ // rename: false,
27
+
28
+ /**
29
+ * Specify binary path
30
+ */
31
+ // bin: { // [!code focus:8]
32
+ // ffmpegPath: 'ffmpeg_path', // the full path of the binary
33
+ // ffprobePath: 'ffprobe_path', // the full path of the binary
34
+ // pdftoppmPath: 'pdftoppm_path' // the full path of the binary
35
+ // pdfinfoPath: 'pdfinfo_path' // the full path of the binary
36
+ // sofficePath: 'soffice_path', // the full path of the binary (libreoffice/openoffice)
37
+ // },
38
+
39
+ /**
40
+ * Queue configuration for file processing.
41
+ * By default, 1 task is processed concurrently. A task corresponds to a model attribute.
42
+ * For example, if a model has a logo attribute and an avatar attribute,
43
+ * this represents 2 tasks, regardless of the number of concerts per attribute.
44
+ *
45
+ * Increasing concurrency can improve performance but consumes more resources.
46
+ * A value too high may lead to memory or CPU issues.
47
+ *
48
+ */
49
+ // queue: {
50
+ // concurrency: 2
51
+ // },
52
+
53
+ /**
54
+ * Maximum duration (in milliseconds) that an operation can take before being interrupted.
55
+ * Default: 30_000 (30 seconds)
56
+ *
57
+ * This timeout applies to each individual operation conversion.
58
+ * If an operation exceeds this time limit, it will be interrupted and an error will be thrown.
59
+ *
60
+ * Increase this value if you're processing large files or if your operations
61
+ * require more time (e.g., long video conversion).
62
+ *
63
+ */
64
+ // timeout: 40_000,
65
+
66
+ /**
67
+ *
68
+ */
8
69
  converters: {
9
70
  thumbnail: {
10
- converter: () => import('@jrmc/adonis-attachment/converters/image_converter'),
11
- options: {
12
- resize: 300,
13
- }
71
+ /**
72
+ * optional converter
73
+ * default : @jrmc/adonis-attachment/converters/autodetect_converter
74
+ * image : @jrmc/adonis-attachment/converters/image_converter
75
+ * pdf : @jrmc/adonis-attachment/converters/pdf_thumbnail_converter
76
+ * document : @jrmc/adonis-attachment/converters/document_thumbnail_converter
77
+ * video : @jrmc/adonis-attachment/converters/video_thumbnail_converter
78
+ * create your custom converter : https://adonis-attachment.jrmc.dev/guide/advanced_usage/custom-converter
79
+ */
80
+ // converter: () => import('@jrmc/adonis-attachment/converters/autodetect_converter'),
81
+
82
+ /**
83
+ *
84
+ * https://sharp.pixelplumbing.com/api-resize/
85
+ */
86
+ resize: 300,
87
+
88
+ // resize: { // https://sharp.pixelplumbing.com/api-resize
89
+ // width: 400,
90
+ // height: 400,
91
+ // fit: sharp.fit.cover,
92
+ // position: 'top'
93
+ // },
94
+
95
+ /**
96
+ *
97
+ * https://sharp.pixelplumbing.com/api-output/#toformat
98
+ */
99
+ // format: 'jpeg',
100
+ // format: {
101
+ // format: 'jpeg',
102
+ // options: {
103
+ // quality: 80
104
+ // }
105
+ // }
106
+
107
+ /**
108
+ * generation of blurhashes (default: true)
109
+ * https://blurha.sh/
110
+ */
111
+ // blurhash: true
14
112
  }
15
113
  }
16
114
  })