tnp-core 16.0.15 → 16.0.18

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 (100) hide show
  1. package/README.md +20 -20
  2. package/assets/shared/shared_folder_info.txt +1 -1
  3. package/browser/README.md +24 -24
  4. package/browser/esm2022/lib/core-config.mjs +1 -1
  5. package/browser/esm2022/lib/core-imports.mjs +10 -5
  6. package/browser/esm2022/lib/core-models.mjs +87 -2
  7. package/browser/esm2022/lib/framework-name.mjs +1 -1
  8. package/browser/esm2022/lib/helpers-isomorphic.mjs +1 -1
  9. package/browser/esm2022/lib/helpers-messages.mjs +12 -1
  10. package/browser/esm2022/lib/helpers.mjs +100 -27
  11. package/browser/esm2022/lib/index.mjs +2 -1
  12. package/browser/esm2022/lib/node-chalk-mock.mjs +3 -3
  13. package/browser/esm2022/lib/node-path-mock.mjs +1 -1
  14. package/browser/esm2022/lib/progress-data.mjs +1 -1
  15. package/browser/esm2022/lib/utils.mjs +274 -0
  16. package/browser/fesm2022/tnp-core.mjs +476 -32
  17. package/browser/fesm2022/tnp-core.mjs.map +1 -1
  18. package/browser/lib/core-imports.d.ts +4 -1
  19. package/browser/lib/core-models.d.ts +170 -1
  20. package/browser/lib/helpers-messages.d.ts +1 -0
  21. package/browser/lib/helpers.d.ts +24 -4
  22. package/browser/lib/index.d.ts +1 -0
  23. package/browser/lib/utils.d.ts +70 -0
  24. package/cli.backend.js +3 -3
  25. package/cli.backend.js.map +1 -1
  26. package/client/README.md +24 -24
  27. package/client/esm2022/lib/core-config.mjs +1 -1
  28. package/client/esm2022/lib/core-imports.mjs +10 -5
  29. package/client/esm2022/lib/core-models.mjs +87 -2
  30. package/client/esm2022/lib/framework-name.mjs +1 -1
  31. package/client/esm2022/lib/helpers-isomorphic.mjs +1 -1
  32. package/client/esm2022/lib/helpers-messages.mjs +12 -1
  33. package/client/esm2022/lib/helpers.mjs +100 -27
  34. package/client/esm2022/lib/index.mjs +2 -1
  35. package/client/esm2022/lib/node-chalk-mock.mjs +3 -3
  36. package/client/esm2022/lib/node-path-mock.mjs +1 -1
  37. package/client/esm2022/lib/progress-data.mjs +1 -1
  38. package/client/esm2022/lib/utils.mjs +274 -0
  39. package/client/fesm2022/tnp-core.mjs +476 -32
  40. package/client/fesm2022/tnp-core.mjs.map +1 -1
  41. package/client/lib/core-imports.d.ts +4 -1
  42. package/client/lib/core-models.d.ts +170 -1
  43. package/client/lib/helpers-messages.d.ts +1 -0
  44. package/client/lib/helpers.d.ts +24 -4
  45. package/client/lib/index.d.ts +1 -0
  46. package/client/lib/utils.d.ts +70 -0
  47. package/client/package.json +15 -8
  48. package/index.js.map +1 -1
  49. package/lib/core-config.js.map +1 -1
  50. package/lib/core-imports.d.ts +6 -2
  51. package/lib/core-imports.js +12 -6
  52. package/lib/core-imports.js.map +1 -1
  53. package/lib/core-models.d.ts +169 -0
  54. package/lib/core-models.js +88 -0
  55. package/lib/core-models.js.map +1 -1
  56. package/lib/framework-name.js.map +1 -1
  57. package/lib/helpers-isomorphic.js.map +1 -1
  58. package/lib/helpers-messages.d.ts +1 -0
  59. package/lib/helpers-messages.js +11 -0
  60. package/lib/helpers-messages.js.map +1 -1
  61. package/lib/helpers.d.ts +56 -17
  62. package/lib/helpers.js +228 -38
  63. package/lib/helpers.js.map +1 -1
  64. package/lib/index.d.ts +1 -0
  65. package/lib/index.js +1 -0
  66. package/lib/index.js.map +1 -1
  67. package/lib/node-chalk-mock.js +3 -3
  68. package/lib/node-chalk-mock.js.map +1 -1
  69. package/lib/node-path-mock.js +3 -3
  70. package/lib/node-path-mock.js.map +1 -1
  71. package/lib/progress-data.js.map +1 -1
  72. package/lib/public-api.js.map +1 -1
  73. package/lib/utils.d.ts +79 -0
  74. package/lib/utils.js +562 -0
  75. package/lib/utils.js.map +1 -0
  76. package/package.json +2 -2
  77. package/package.json_devDependencies.json +202 -202
  78. package/package.json_tnp.json5 +69 -69
  79. package/tmp-environment.json +19 -12
  80. package/websql/README.md +24 -24
  81. package/websql/esm2022/lib/core-config.mjs +1 -1
  82. package/websql/esm2022/lib/core-imports.mjs +10 -5
  83. package/websql/esm2022/lib/core-models.mjs +87 -2
  84. package/websql/esm2022/lib/framework-name.mjs +1 -1
  85. package/websql/esm2022/lib/helpers-isomorphic.mjs +1 -1
  86. package/websql/esm2022/lib/helpers-messages.mjs +12 -1
  87. package/websql/esm2022/lib/helpers.mjs +100 -27
  88. package/websql/esm2022/lib/index.mjs +2 -1
  89. package/websql/esm2022/lib/node-chalk-mock.mjs +3 -3
  90. package/websql/esm2022/lib/node-path-mock.mjs +1 -1
  91. package/websql/esm2022/lib/progress-data.mjs +1 -1
  92. package/websql/esm2022/lib/utils.mjs +274 -0
  93. package/websql/fesm2022/tnp-core.mjs +476 -32
  94. package/websql/fesm2022/tnp-core.mjs.map +1 -1
  95. package/websql/lib/core-imports.d.ts +4 -1
  96. package/websql/lib/core-models.d.ts +170 -1
  97. package/websql/lib/helpers-messages.d.ts +1 -0
  98. package/websql/lib/helpers.d.ts +24 -4
  99. package/websql/lib/index.d.ts +1 -0
  100. package/websql/lib/utils.d.ts +70 -0
@@ -40,4 +40,173 @@ export interface RunOptions extends ExecuteOptions {
40
40
  stdio?: any;
41
41
  cwd?: string;
42
42
  }
43
- export type PROGRESS_DATA_TYPE = 'info' | 'error' | 'warning' | 'event';
43
+ export type PROGRESS_DATA_TYPE = 'info' | 'error' | 'warning' | 'event';
44
+ export declare const mimeTypes: {
45
+ readonly ".aac": "audio/aac";
46
+ readonly ".abw": "application/x-abiword";
47
+ readonly ".arc": "application/x-freearc";
48
+ readonly ".avi": "video/x-msvideo";
49
+ readonly ".azw": "application/vnd.amazon.ebook";
50
+ readonly ".bin": "application/octet-stream";
51
+ readonly ".bmp": "image/bmp";
52
+ readonly ".bz": "application/x-bzip";
53
+ readonly ".bz2": "application/x-bzip2";
54
+ readonly ".csh": "application/x-csh";
55
+ readonly ".css": "text/css";
56
+ readonly ".csv": "text/csv";
57
+ readonly ".doc": "application/msword";
58
+ readonly ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
59
+ readonly ".eot": "application/vnd.ms-fontobject";
60
+ readonly ".epub": "application/epub+zip";
61
+ readonly ".gz": "application/gzip";
62
+ readonly ".gif": "image/gif";
63
+ readonly ".htm": "text/html";
64
+ readonly ".html": "text/html";
65
+ readonly ".ico": "image/vnd.microsoft.icon";
66
+ readonly ".ics": "text/calendar";
67
+ readonly ".jar": "application/java-archive";
68
+ readonly ".jpeg": "image/jpeg";
69
+ readonly ".jpg": "image/jpeg";
70
+ readonly ".js": "text/javascript";
71
+ readonly ".json": "application/json";
72
+ readonly ".jsonld": "application/ld+json";
73
+ readonly ".mid": "application/midi";
74
+ readonly ".midi": "application/midi";
75
+ readonly ".mjs": "text/javascript";
76
+ readonly ".mp3": "audio/mpeg";
77
+ readonly ".mp4": "video/mp4";
78
+ readonly ".mpeg": "video/mpeg";
79
+ readonly ".mpkg": "application/vnd.apple.installer+xml";
80
+ readonly ".odp": "application/vnd.oasis.opendocument.presentation";
81
+ readonly ".ods": "application/vnd.oasis.opendocument.spreadsheet";
82
+ readonly ".odt": "application/vnd.oasis.opendocument.text";
83
+ readonly ".oga": "audio/ogg";
84
+ readonly ".ogg": "audio/ogg";
85
+ readonly ".ogv": "video/ogg";
86
+ readonly ".ogx": "application/ogg";
87
+ readonly ".opus": "audio/opus";
88
+ readonly ".otf": "font/otf";
89
+ readonly ".png": "image/png";
90
+ readonly ".pdf": "application/pdf";
91
+ readonly ".php": "application/php";
92
+ readonly ".ppt": "application/vnd.ms-powerpoint";
93
+ readonly ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation";
94
+ readonly ".rar": "application/vnd.rar";
95
+ readonly ".rtf": "application/rtf";
96
+ readonly ".sh": "application/x-sh";
97
+ readonly ".svg": "image/svg+xml";
98
+ readonly ".swf": "application/x-shockwave-flash";
99
+ readonly ".tar": "application/x-tar";
100
+ readonly ".tif": "image/tiff";
101
+ readonly ".tiff": "image/tiff";
102
+ readonly ".ts": "video/mp2t";
103
+ readonly ".ttf": "font/ttf";
104
+ readonly ".txt": "text/plain";
105
+ readonly ".vsd": "application/vnd.visio";
106
+ readonly ".wav": "audio/wav";
107
+ readonly ".weba": "audio/webm";
108
+ readonly ".webm": "video/webm";
109
+ readonly ".webp": "image/webp";
110
+ readonly ".woff": "font/woff";
111
+ readonly ".woff2": "font/woff2";
112
+ readonly ".xhtml": "application/xhtml+xml";
113
+ readonly ".xls": "application/vnd.ms-excel";
114
+ readonly ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
115
+ readonly ".xml": "application/xml";
116
+ readonly ".xul": "application/vnd.mozilla.xul+xml";
117
+ readonly ".zip": "application/zip";
118
+ readonly ".3gp": "video/3gpp";
119
+ readonly ".3g2": "video/3gpp2";
120
+ readonly ".7z": "application/x-7z-compressed";
121
+ };
122
+ export type ContentTypeKeys = keyof typeof mimeTypes;
123
+ export type ContentType = typeof mimeTypes[ContentTypeKeys] | 'multipart/form-data';
124
+ /**
125
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
126
+ */
127
+ export type MediaType = 'text' | 'image' | 'audio' | 'font' | 'video' | 'application' | 'multipart' | 'message' | 'model';
128
+ export declare const MediaTypeAllArr: MediaType[];
129
+ type ContentType_ = ContentType;
130
+ export declare namespace Files {
131
+ type MimeType = keyof typeof mimeTypes;
132
+ const MimeTypesObj: {
133
+ readonly ".aac": "audio/aac";
134
+ readonly ".abw": "application/x-abiword";
135
+ readonly ".arc": "application/x-freearc";
136
+ readonly ".avi": "video/x-msvideo";
137
+ readonly ".azw": "application/vnd.amazon.ebook";
138
+ readonly ".bin": "application/octet-stream";
139
+ readonly ".bmp": "image/bmp";
140
+ readonly ".bz": "application/x-bzip";
141
+ readonly ".bz2": "application/x-bzip2";
142
+ readonly ".csh": "application/x-csh";
143
+ readonly ".css": "text/css";
144
+ readonly ".csv": "text/csv";
145
+ readonly ".doc": "application/msword";
146
+ readonly ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
147
+ readonly ".eot": "application/vnd.ms-fontobject";
148
+ readonly ".epub": "application/epub+zip";
149
+ readonly ".gz": "application/gzip";
150
+ readonly ".gif": "image/gif";
151
+ readonly ".htm": "text/html";
152
+ readonly ".html": "text/html";
153
+ readonly ".ico": "image/vnd.microsoft.icon";
154
+ readonly ".ics": "text/calendar";
155
+ readonly ".jar": "application/java-archive";
156
+ readonly ".jpeg": "image/jpeg";
157
+ readonly ".jpg": "image/jpeg";
158
+ readonly ".js": "text/javascript";
159
+ readonly ".json": "application/json";
160
+ readonly ".jsonld": "application/ld+json";
161
+ readonly ".mid": "application/midi";
162
+ readonly ".midi": "application/midi";
163
+ readonly ".mjs": "text/javascript";
164
+ readonly ".mp3": "audio/mpeg";
165
+ readonly ".mp4": "video/mp4";
166
+ readonly ".mpeg": "video/mpeg";
167
+ readonly ".mpkg": "application/vnd.apple.installer+xml";
168
+ readonly ".odp": "application/vnd.oasis.opendocument.presentation";
169
+ readonly ".ods": "application/vnd.oasis.opendocument.spreadsheet";
170
+ readonly ".odt": "application/vnd.oasis.opendocument.text";
171
+ readonly ".oga": "audio/ogg";
172
+ readonly ".ogg": "audio/ogg";
173
+ readonly ".ogv": "video/ogg";
174
+ readonly ".ogx": "application/ogg";
175
+ readonly ".opus": "audio/opus";
176
+ readonly ".otf": "font/otf";
177
+ readonly ".png": "image/png";
178
+ readonly ".pdf": "application/pdf";
179
+ readonly ".php": "application/php";
180
+ readonly ".ppt": "application/vnd.ms-powerpoint";
181
+ readonly ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation";
182
+ readonly ".rar": "application/vnd.rar";
183
+ readonly ".rtf": "application/rtf";
184
+ readonly ".sh": "application/x-sh";
185
+ readonly ".svg": "image/svg+xml";
186
+ readonly ".swf": "application/x-shockwave-flash";
187
+ readonly ".tar": "application/x-tar";
188
+ readonly ".tif": "image/tiff";
189
+ readonly ".tiff": "image/tiff";
190
+ readonly ".ts": "video/mp2t";
191
+ readonly ".ttf": "font/ttf";
192
+ readonly ".txt": "text/plain";
193
+ readonly ".vsd": "application/vnd.visio";
194
+ readonly ".wav": "audio/wav";
195
+ readonly ".weba": "audio/webm";
196
+ readonly ".webm": "video/webm";
197
+ readonly ".webp": "image/webp";
198
+ readonly ".woff": "font/woff";
199
+ readonly ".woff2": "font/woff2";
200
+ readonly ".xhtml": "application/xhtml+xml";
201
+ readonly ".xls": "application/vnd.ms-excel";
202
+ readonly ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
203
+ readonly ".xml": "application/xml";
204
+ readonly ".xul": "application/vnd.mozilla.xul+xml";
205
+ readonly ".zip": "application/zip";
206
+ readonly ".3gp": "video/3gpp";
207
+ readonly ".3g2": "video/3gpp2";
208
+ readonly ".7z": "application/x-7z-compressed";
209
+ };
210
+ type ContentType = ContentType_;
211
+ }
212
+ export {};
@@ -2,6 +2,7 @@
2
2
  import { HelpersIsomorphic } from './helpers-isomorphic';
3
3
  export declare class HelpersMessages extends HelpersIsomorphic {
4
4
  msgCacheClear(): void;
5
+ renderError(err: Error): void;
5
6
  error(details: any, noExit?: boolean, noTrace?: boolean): void;
6
7
  info(details: string, repeatable?: boolean): void;
7
8
  success(details: any | string): void;
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { HelpersMessages } from './helpers-messages';
3
- import { RunOptions } from './core-models';
3
+ import { MediaType, RunOptions } from './core-models';
4
4
  export interface RunSyncOrAsyncOptions {
5
5
  functionFn: Function;
6
6
  context?: object;
@@ -18,11 +18,27 @@ export declare class HelpersCore extends HelpersMessages {
18
18
  static get InstanceCore(): HelpersCore;
19
19
  readonly bigMaxBuffer: number;
20
20
  constructor();
21
- isBlob(maybeBlob: any): boolean;
21
+ mediaTypeFromSrc(src: string): MediaType;
22
+ /**
23
+ * check if data is nodejs/browser blob
24
+ *
25
+ * @param maybeBlob
26
+ * @returns
27
+ */
28
+ isBlob(maybeBlob: any): maybeBlob is Blob;
29
+ /**
30
+ * Check if data is nodejs buffer
31
+ *
32
+ * @param maybeNodejsBuffer
33
+ * @returns
34
+ */
22
35
  removeSlashAtEnd(s: string): string;
23
36
  removeSlashAtBegin(s: string): string;
37
+ /**
38
+ * stringify to pretty json string
39
+ */
24
40
  stringify(inputObject: any): string;
25
- runSyncOrAsync(fnOrOptions: Function | [string, object] | RunSyncOrAsyncOptions, ...firstArg: any[]): Promise<any>;
41
+ runSyncOrAsync<FUNCTION_RETURN_TYPE = any>(fnOrOptions: Function | [string, object] | RunSyncOrAsyncOptions, ...firstArg: any[]): Promise<FUNCTION_RETURN_TYPE>;
26
42
  /**
27
43
  * symlink may have existed or unexisted destiantion url
28
44
  * @param destUrl M
@@ -38,15 +54,19 @@ export declare class HelpersCore extends HelpersMessages {
38
54
  */
39
55
  isExistedSymlink(filePath: string): boolean;
40
56
  exists(folderOrFilePath: string | string[]): any;
57
+ /**
58
+ * this is HACK for running procesess inside processes
59
+ */
41
60
  _fixCommand(command: string): string;
42
61
  command(command: string): {};
43
- wait(second: number): Promise<unknown>;
62
+ wait(second: number): Promise<void>;
44
63
  killProcess(byPid: number): void;
45
64
  run(command: string, options?: RunOptions): {
46
65
  async(detach?: boolean, mockFun?: (stdoutCallback: (dataForStdout: any) => any, stdErrcCallback: (dataForStder: any) => any, shouldProcesBeDead?: () => boolean) => Promise<number> | number): any;
47
66
  };
48
67
  /**
49
68
  * Quick fix for object values
69
+ * @deprecated
50
70
  */
51
71
  values(obj: any): any[];
52
72
  }
@@ -5,5 +5,6 @@ export * from './core-models';
5
5
  import { HelpersCore as Base } from './helpers';
6
6
  export * from './core-config';
7
7
  export * from './progress-data';
8
+ export * from './utils';
8
9
  export { HelpersCore as CoreHelpers, CommandOutputOptions } from './helpers';
9
10
  export declare let Helpers: Base;
@@ -0,0 +1,70 @@
1
+ // @ts-nocheck
2
+ import { ContentType } from "./core-models";
3
+ export declare namespace Utils {
4
+ enum DbBinaryFormatEnum {
5
+ Blob = "Blob",
6
+ File = "File",
7
+ string = "string"
8
+ }
9
+ type DbBinaryFormatForBrowser = Blob | File | string;
10
+ /**
11
+ * Binary format that can be stored in database
12
+ *
13
+ * for nodejs => Buffer
14
+ * for sql.js => string (shoulb be blob - but not supported)
15
+ *
16
+ */
17
+ type DbBinaryFormat = DbBinaryFormatForBrowser;
18
+ namespace binary {
19
+ /**
20
+ * This is for BROWSER ONLY
21
+ *
22
+ * @param buffer
23
+ * @param contentType
24
+ * @returns
25
+ */
26
+ function arrayBufferToBlob(buffer: ArrayBuffer, contentType: ContentType): Promise<Blob>;
27
+ /**
28
+ * This is for BROWSER ONLY
29
+ * @param blob
30
+ * @returns
31
+ */
32
+ function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
33
+ /**
34
+ * it is revers to base64toBlob
35
+ * @param blob
36
+ * @returns
37
+ */
38
+ function blobToBase64(blob: Blob): Promise<string>;
39
+ /**
40
+ * it is revers to blobToBase64()
41
+ * @param base64Data
42
+ * @returns
43
+ */
44
+ function base64toBlob(base64Data: string, contentTypeOverride?: ContentType): Promise<Blob>;
45
+ function base64toDbBinaryFormat(text: string): Promise<DbBinaryFormat>;
46
+ function dbBinaryFormatToBase64(binaryFormat: DbBinaryFormat): Promise<string>;
47
+ function textToDbBinaryFormat(text: string): Promise<DbBinaryFormat>;
48
+ function dbBinaryFormatToText(binaryFormat: DbBinaryFormat): Promise<string>;
49
+ function fileToBlob(file: File): Promise<Blob>;
50
+ function blobToFile(blob: Blob, nameForFile?: string): Promise<File>;
51
+ function textToBlob(text: string, type?: ContentType): Promise<Blob>;
52
+ function blobToText(blob: Blob): Promise<string>;
53
+ function textToFile(text: string, fileRelativePathOrName: string): Promise<File>;
54
+ function fileToText(file: File): Promise<string>;
55
+ function jsonToBlob(jsonObj: object): Promise<Blob>;
56
+ /**
57
+ * TODO NOT TESTED
58
+ */
59
+ function blobToJson(blob: Blob): Promise<string>;
60
+ function getBlobFrom(url: string): Promise<Blob>;
61
+ }
62
+ namespace css {
63
+ /**
64
+ *
65
+ * @param pixelsCss pixels ex. 100px
66
+ * @returns
67
+ */
68
+ function numValue(pixelsCss: string): number;
69
+ }
70
+ }