@vacantthinker/firefox-addon-framework-easy 2026.610.749 → 2026.611.751

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/README.md CHANGED
@@ -92,9 +92,9 @@ export class DomainORM extends BaseORM { }
92
92
 
93
93
  ### 📄 File: `src/generate.js`
94
94
  ```javascript
95
- export function generateMkvScriptForSystemWindows({ }
95
+ export function generateMkvScriptForSystemWindows(videoInfo) { }
96
96
 
97
- export function generateMkvScriptForSystemFedora({ }
97
+ export function generateMkvScriptForSystemFedora(videoInfo) { }
98
98
 
99
99
  ```
100
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0610.0749",
3
+ "version": "2026.0611.0751",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
package/src/BaseORM.js CHANGED
@@ -1,21 +1,14 @@
1
1
  import {stoOpCheck, stoOpGet, stoOpRem, stoOpSet} from './opStorage.js';
2
2
 
3
3
  /**
4
- * Abstract base class BaseORM (similar to Java's Abstract Class).
5
- * Provides encapsulated CRUD operations for specific Key-Value pairs bound at instantiation.
4
+ * Abstract base class BaseORM.
5
+ * Provides encapsulated CRUD operations for JSON-serializable Key-Value pairs.
6
6
  */
7
7
  export class BaseORM {
8
- // Private fields for data encapsulation
9
- #id; // Added to store the raw unique identifier
8
+ #id;
10
9
  #fullStorageKey;
11
10
  #defaultValue;
12
11
 
13
- /**
14
- * Constructor
15
- * @param {string} prefix The prefix for the keys (e.g., 'magnetKey')
16
- * @param {string} id The unique identifier for this instance
17
- * @param {object} [defaultValue={}] Custom initial value
18
- */
19
12
  constructor(prefix, id, defaultValue = {}) {
20
13
  if (new.target === BaseORM) {
21
14
  throw new TypeError(
@@ -25,47 +18,28 @@ export class BaseORM {
25
18
  throw new Error('Both prefix and id must be specified.');
26
19
  }
27
20
 
28
- // Save the raw id to the private field
29
21
  this.#id = id;
30
-
31
22
  const formattedPrefix = prefix.endsWith(' ') ? prefix : `${prefix} `;
32
23
  this.#fullStorageKey = `${formattedPrefix}${id}`;
33
24
  this.#defaultValue = JSON.parse(JSON.stringify(defaultValue));
34
25
  }
35
26
 
36
- /**
37
- * Public Getter to retrieve the bound unique identifier (id).
38
- * Can be accessed as `this.id` inside subclasses or `instance.id` externally.
39
- * @return {string} The raw id
40
- */
41
27
  get id() {
42
28
  return this.#id;
43
29
  }
44
30
 
45
- /**
46
- * Protected Getter for subclasses to safely access the complete key.
47
- * Can be used in subclasses as `this.storageKey`.
48
- * @protected
49
- * @return {string} The full storage key
50
- */
51
31
  get storageKey() {
52
32
  return this.#fullStorageKey;
53
33
  }
54
34
 
55
- // Private helper method
56
35
  async #exists() {
57
36
  return await stoOpCheck(this.#fullStorageKey);
58
37
  }
59
38
 
60
- // Private helper method
61
39
  async #initDefaultObject() {
62
40
  await stoOpSet(this.#fullStorageKey, this.#defaultValue);
63
41
  }
64
42
 
65
- /**
66
- * [Read] Retrieve the value associated with the bound key.
67
- * @return {Promise<object>}
68
- */
69
43
  async get() {
70
44
  if (!(await this.#exists())) {
71
45
  await this.#initDefaultObject();
@@ -73,31 +47,16 @@ export class BaseORM {
73
47
  return await stoOpGet(this.#fullStorageKey);
74
48
  }
75
49
 
76
- /**
77
- * [Create/Update] Overwrite the value of the bound key completely.
78
- * @param {object} value The new Object data to store
79
- * @return {Promise<void>}
80
- */
81
50
  async set(value) {
82
51
  await stoOpSet(this.#fullStorageKey, value || this.#defaultValue);
83
52
  }
84
53
 
85
- /**
86
- * [Delete] Wipe the bound key from storage.
87
- * @return {Promise<object>}
88
- */
89
54
  async delete() {
90
55
  const previousValue = await this.get();
91
56
  await stoOpRem(this.#fullStorageKey);
92
57
  return previousValue;
93
58
  }
94
59
 
95
- /**
96
- * [Partial Update] Modify a single targeted key-value pair nested deep within the stored object.
97
- * @param {string} objectKey The internal key path inside the main value object
98
- * @param {*} objectValue The new value to map to that key
99
- * @return {Promise<object>} Returns the fully updated object structure
100
- */
101
60
  async updateValueKeyValue(objectKey, objectValue) {
102
61
  const currentData = await this.get();
103
62
  currentData[objectKey] = objectValue;
package/src/generate.js CHANGED
@@ -1,6 +1,11 @@
1
- export function generateMkvScriptForSystemWindows({vid, title}) {
2
- let args = {vid, title};
3
-
1
+ /**
2
+ *
3
+ * @param videoInfo
4
+ * @param videoInfo.vid{string}
5
+ * @param videoInfo.videoTitle{string}
6
+ * @return {string}
7
+ */
8
+ export function generateMkvScriptForSystemWindows(videoInfo) {
4
9
  return `if (true) {
5
10
  const path = require('path');
6
11
  const fs = require('fs');
@@ -9,11 +14,11 @@ export function generateMkvScriptForSystemWindows({vid, title}) {
9
14
  let dot = '.';
10
15
  let extMKV = 'mkv';
11
16
 
12
- let {vid, title} = ${JSON.stringify(args)};
17
+ let {vid, videoTitle} = ${JSON.stringify(videoInfo)};
13
18
  let playVideoAfterMerged = true;
14
19
  let pathToMkvmerge = 'C:\\\\Program Files\\\\MKVToolNix\\\\mkvmerge.exe';
15
20
 
16
- let pathMKVOutput = path.join(pathDownload, title.concat(dot, extMKV));
21
+ let pathMKVOutput = path.join(pathDownload, videoTitle.concat(dot, extMKV));
17
22
  let pathOutput = path.join(pathDownload, vid.concat(dot, extMKV));
18
23
  let pathInputAudio = path.join(pathDownload, vid.concat(dot, "mp3"));
19
24
  let pathInputVideo = path.join(pathDownload, vid.concat(dot, "mp4"));
@@ -24,7 +29,7 @@ export function generateMkvScriptForSystemWindows({vid, title}) {
24
29
  ) {
25
30
 
26
31
  console.log('');
27
- console.log(['file check ok!', title].join(' '));
32
+ console.log(['file check ok!', videoTitle].join(' '));
28
33
 
29
34
  let cmd_merge = [
30
35
  [pathToMkvmerge].map(v => '"' + v + '"').join(''),
@@ -56,7 +61,7 @@ export function generateMkvScriptForSystemWindows({vid, title}) {
56
61
  console.log('error', data);
57
62
  });
58
63
  exec_merge.stdout.on('close', (data) => {
59
- console.log(['merge finish!', title].join(' '));
64
+ console.log(['merge finish!', videoTitle].join(' '));
60
65
 
61
66
  if (true) {
62
67
  console.log('remove inputFile');
@@ -86,9 +91,14 @@ export function generateMkvScriptForSystemWindows({vid, title}) {
86
91
  `;
87
92
  }
88
93
 
89
- export function generateMkvScriptForSystemFedora({vid, title}) {
90
- let args = {vid, title};
91
-
94
+ /**
95
+ *
96
+ * @param videoInfo
97
+ * @param videoInfo.vid{string}
98
+ * @param videoInfo.videoTitle{string}
99
+ * @return {string}
100
+ */
101
+ export function generateMkvScriptForSystemFedora(videoInfo) {
92
102
  // We wrap the Node.js script inside a Linux Shell script block
93
103
  return `#!/usr/bin/env bash
94
104
  # This header tells Fedora to treat this file as a runnable bash script
@@ -110,17 +120,17 @@ let pathDownload = path.join(__dirname);
110
120
  let dot = '.';
111
121
  let extMKV = 'mkv';
112
122
 
113
- let {vid, title} = ${JSON.stringify(args)};
123
+ let {vid, videoTitle} = ${JSON.stringify(videoInfo)};
114
124
  let playVideoAfterMerged = true;
115
125
  let pathToMkvmerge = '/usr/bin/mkvmerge';
116
126
 
117
- let pathMKVOutput = path.join(pathDownload, title.concat(dot, extMKV));
127
+ let pathMKVOutput = path.join(pathDownload, videoTitle.concat(dot, extMKV));
118
128
  let pathOutput = path.join(pathDownload, vid.concat(dot, extMKV));
119
129
  let pathInputAudio = path.join(pathDownload, vid.concat(dot, "mp3"));
120
130
  let pathInputVideo = path.join(pathDownload, vid.concat(dot, "mp4"));
121
131
 
122
132
  if (fs.existsSync(pathToMkvmerge)) {
123
- console.log('\\nfile check ok! ' + title);
133
+ console.log('\\nfile check ok! ' + videoTitle);
124
134
 
125
135
  let cmd_merge = [
126
136
  '"' + pathToMkvmerge + '"',
@@ -134,7 +144,7 @@ if (fs.existsSync(pathToMkvmerge)) {
134
144
  try {
135
145
  // Run merge synchronously so stdout pipes directly to the terminal
136
146
  execSync(cmd_merge, { stdio: 'inherit' });
137
- console.log('merge finish! ' + title);
147
+ console.log('merge finish! ' + videoTitle);
138
148
 
139
149
  console.log('remove inputFile');
140
150
  if (fs.existsSync(pathInputVideo)) fs.unlinkSync(pathInputVideo);
@@ -164,4 +174,4 @@ read unused_input
164
174
  # Deletes the shell script file itself after completion
165
175
  rm -- "$0"
166
176
  `;
167
- }
177
+ }