@sparkvault/sdk-mobile 7.2.5 → 7.2.6

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.
@@ -10,9 +10,10 @@ export function hasControlOrBidiCharacter(text: string): boolean;
10
10
  /**
11
11
  * `name` without the trailing dots and white space a save drops: "page.html."
12
12
  * and "page.html " are "page.html", "notes. ." is "notes", and a name of only
13
- * dots and white space is ''. lastExtension reads the extension in front of
14
- * them, and Forge completes a saved name after them (./media-type-node.js
15
- * withMediaTypeExtension: "notes." under text/plain saves as "notes.txt").
13
+ * dots and white space is ''. shownExtension and lastExtension read the
14
+ * extension in front of them, and Forge completes a saved name after them
15
+ * (./media-type-node.js withMediaTypeExtension: "notes." under text/plain
16
+ * saves as "notes.txt").
16
17
  *
17
18
  * @param {string} name
18
19
  * @returns {string}
@@ -70,24 +71,37 @@ export function splitExtension(name: string): {
70
71
  extension: string;
71
72
  };
72
73
  /**
73
- * The extension `name` shows, lowercase and without its dot: what follows the
74
- * last dot of what the name shows once saved (nameAsShown: read past its
75
- * invisible characters, without the trailing dots and white space a save
76
- * drops). It is the extension a saved copy opens as wherever the name holds
77
- * no invisible character: "invoice.note.html" and
78
- * "page.html." open as 'html', "logs.tar.gz" as 'gz', ".html" as 'html'
79
- * (Windows reads a leading dot's extension), and a name with no dot as ''.
80
- * "Invoice.pdf<U+034F>" shows 'pdf', so no rule completes it with a second
81
- * extension a desktop that hides known extensions would not show. A character
82
- * that draws as blank space or as another letter yet is no invisible
83
- * character stays in the extension read ("Invoice.pdf<U+2800>", a braille
84
- * blank, reads 'pdf<U+2800>'; "Invoice.<U+0440>df", a Cyrillic er,
85
- * '<U+0440>df'), which no registry extension then is, and Forge completes no
86
- * such name (./media-type-node.js withMediaTypeExtension). Every rule
74
+ * The extension `name` shows, its spaces kept, lowercase and without its dot:
75
+ * what follows the last dot of what the name shows once saved (nameAsShown:
76
+ * read past its invisible characters, without the trailing dots and white
77
+ * space a save drops). "invoice.note.html" and "page.html." show 'html',
78
+ * "logs.tar.gz" 'gz', ".html" 'html' (Windows reads a leading dot's
79
+ * extension), "Invoice.pdf (1)" 'pdf (1)', and a name with no dot ''. It is
80
+ * what Chromium's copy shows, since Chromium saves a name as sent:
81
+ * "Invoice.pdf<U+034F>" shows 'pdf', and a character that draws as blank
82
+ * space or as another letter yet is no invisible character stays in it
83
+ * ("Invoice.pdf<U+2800>", a braille blank, shows 'pdf<U+2800>';
84
+ * "Invoice.<U+0440>df", a Cyrillic er, '<U+0440>df'). Only whether a saved
85
+ * name is completed reads it, by where its first word ends
86
+ * (./media-type-node.js withMediaTypeExtension), since completion ends a name
87
+ * in its type's own extension, which holds no space for Firefox to close up;
88
+ * every rule about what a name makes a file reads lastExtension.
89
+ *
90
+ * @param {string} name
91
+ * @returns {string}
92
+ */
93
+ export function shownExtension(name: string): string;
94
+ /**
95
+ * The extension a saved copy of `name` opens as, lowercase and without its
96
+ * dot: the one it shows (shownExtension) once its spaces are closed up as
97
+ * Firefox, the browser that changes a saved name most, closes them
98
+ * (closeUpSpaces). "evil.ex e", "evil.ex<U+00A0>e" and "evil. exe" open as
99
+ * 'exe', "Scan. pdf" as 'pdf', "Invoice.pdf (1)" as 'pdf(1)' and "Acme Inc.
100
+ * Contract" as 'contract', though Chromium saves each as sent. Every rule
87
101
  * about what a name makes a file (a refused extension, an inline
88
- * disposition, the type Core stores for an untyped upload, whether Forge
89
- * completes a saved name and the type it serves it under:
90
- * ./media-type-node.js) reads this, never splitExtension.
102
+ * disposition, the type Core stores for an untyped upload, the type Forge
103
+ * serves a download under: ./media-type-node.js) reads this, never
104
+ * splitExtension.
91
105
  *
92
106
  * @param {string} name
93
107
  * @returns {string}
@@ -142,6 +156,6 @@ export const WHITEBOARD_MARKER_EXTENSION: ".whiteboard.svg";
142
156
  * shortened copy keeps it ("Plan (2).note.html", never "Plan.note (2).html")
143
157
  * and its title is still the part in front of it. No rule about what a file
144
158
  * is reads a marker: those read the content type (a document's kind,
145
- * ./ingot-kind.js) or the lastExtension (the extension a name shows).
159
+ * ./ingot-kind.js) or the lastExtension (the extension a saved copy opens as).
146
160
  */
147
161
  export const DOCUMENT_MARKER_EXTENSIONS: readonly string[];
@@ -54,9 +54,10 @@ const DROPPED_TRAILING_CHARACTER = /[\s.]/u;
54
54
  /**
55
55
  * `name` without the trailing dots and white space a save drops: "page.html."
56
56
  * and "page.html " are "page.html", "notes. ." is "notes", and a name of only
57
- * dots and white space is ''. lastExtension reads the extension in front of
58
- * them, and Forge completes a saved name after them (./media-type-node.js
59
- * withMediaTypeExtension: "notes." under text/plain saves as "notes.txt").
57
+ * dots and white space is ''. shownExtension and lastExtension read the
58
+ * extension in front of them, and Forge completes a saved name after them
59
+ * (./media-type-node.js withMediaTypeExtension: "notes." under text/plain
60
+ * saves as "notes.txt").
60
61
  *
61
62
  * @param {string} name
62
63
  * @returns {string}
@@ -79,7 +80,7 @@ const INVISIBLE_CHARACTERS = /\p{Default_Ignorable_Code_Point}/gu;
79
80
  * What `name` shows once saved: the name read past its invisible characters
80
81
  * (INVISIBLE_CHARACTERS), without the trailing dots and white space a save
81
82
  * drops (trimDroppedTrailing). The extension a name shows is read in it
82
- * (lastExtension), and a name it leaves nothing of is one of only dots or
83
+ * (shownExtension), and a name it leaves nothing of is one of only dots or
83
84
  * spaces (isOnlyDotsOrSpaces).
84
85
  *
85
86
  * @param {string} name
@@ -197,7 +198,7 @@ export const WHITEBOARD_MARKER_EXTENSION = '.whiteboard.svg';
197
198
  * shortened copy keeps it ("Plan (2).note.html", never "Plan.note (2).html")
198
199
  * and its title is still the part in front of it. No rule about what a file
199
200
  * is reads a marker: those read the content type (a document's kind,
200
- * ./ingot-kind.js) or the lastExtension (the extension a name shows).
201
+ * ./ingot-kind.js) or the lastExtension (the extension a saved copy opens as).
201
202
  */
202
203
  export const DOCUMENT_MARKER_EXTENSIONS = Object.freeze([WHITEBOARD_MARKER_EXTENSION, NOTE_MARKER_EXTENSION]);
203
204
  /**
@@ -217,33 +218,76 @@ export function splitExtension(name) {
217
218
  : { stem: name, extension: '' };
218
219
  }
219
220
  /**
220
- * The extension `name` shows, lowercase and without its dot: what follows the
221
- * last dot of what the name shows once saved (nameAsShown: read past its
222
- * invisible characters, without the trailing dots and white space a save
223
- * drops). It is the extension a saved copy opens as wherever the name holds
224
- * no invisible character: "invoice.note.html" and
225
- * "page.html." open as 'html', "logs.tar.gz" as 'gz', ".html" as 'html'
226
- * (Windows reads a leading dot's extension), and a name with no dot as ''.
227
- * "Invoice.pdf<U+034F>" shows 'pdf', so no rule completes it with a second
228
- * extension a desktop that hides known extensions would not show. A character
229
- * that draws as blank space or as another letter yet is no invisible
230
- * character stays in the extension read ("Invoice.pdf<U+2800>", a braille
231
- * blank, reads 'pdf<U+2800>'; "Invoice.<U+0440>df", a Cyrillic er,
232
- * '<U+0440>df'), which no registry extension then is, and Forge completes no
233
- * such name (./media-type-node.js withMediaTypeExtension). Every rule
234
- * about what a name makes a file (a refused extension, an inline
235
- * disposition, the type Core stores for an untyped upload, whether Forge
236
- * completes a saved name and the type it serves it under:
237
- * ./media-type-node.js) reads this, never splitExtension.
221
+ * A run of the white space Firefox reads in a name it saves: the space
222
+ * separators and U+FEFF, and the line and paragraph separators, which it
223
+ * drops wherever they stand and which end no run.
224
+ */
225
+ const WHITE_SPACE_RUN = /[\p{Zs}\uFEFF\u2028\u2029]+/gu;
226
+ /** A run whose first space is an ideographic space (U+3000), the one space Firefox keeps. */
227
+ const RUN_FIREFOX_KEEPS = /^[\u2028\u2029]*\u3000/;
228
+ /**
229
+ * `name` with its white space closed up as Firefox closes it in what follows
230
+ * its last dot, under any type it is handed and in a blob's name alike
231
+ * (nsExternalHelperAppService::SanitizeFileName): it collapses a run of white
232
+ * space into the run's first character, an ideographic space kept as it is
233
+ * and any other made an ASCII space, then strips the ASCII spaces from what
234
+ * follows the last dot. So a run there is dropped whole unless it starts with
235
+ * an ideographic space: `evil.ex e` saves as `evil.exe`, `evil.ex<U+3000>e`
236
+ * as itself, `evil.ex <U+3000>e` as `evil.exe`. Closing up the whole name
237
+ * moves no dot, so what follows its last dot is what Firefox saves there.
238
238
  *
239
239
  * @param {string} name
240
240
  * @returns {string}
241
241
  */
242
- export function lastExtension(name) {
242
+ function closeUpSpaces(name) {
243
+ return name.replace(WHITE_SPACE_RUN, (run) => (RUN_FIREFOX_KEEPS.test(run) ? '\u3000' : ''));
244
+ }
245
+ /**
246
+ * The extension `name` shows, its spaces kept, lowercase and without its dot:
247
+ * what follows the last dot of what the name shows once saved (nameAsShown:
248
+ * read past its invisible characters, without the trailing dots and white
249
+ * space a save drops). "invoice.note.html" and "page.html." show 'html',
250
+ * "logs.tar.gz" 'gz', ".html" 'html' (Windows reads a leading dot's
251
+ * extension), "Invoice.pdf (1)" 'pdf (1)', and a name with no dot ''. It is
252
+ * what Chromium's copy shows, since Chromium saves a name as sent:
253
+ * "Invoice.pdf<U+034F>" shows 'pdf', and a character that draws as blank
254
+ * space or as another letter yet is no invisible character stays in it
255
+ * ("Invoice.pdf<U+2800>", a braille blank, shows 'pdf<U+2800>';
256
+ * "Invoice.<U+0440>df", a Cyrillic er, '<U+0440>df'). Only whether a saved
257
+ * name is completed reads it, by where its first word ends
258
+ * (./media-type-node.js withMediaTypeExtension), since completion ends a name
259
+ * in its type's own extension, which holds no space for Firefox to close up;
260
+ * every rule about what a name makes a file reads lastExtension.
261
+ *
262
+ * @param {string} name
263
+ * @returns {string}
264
+ */
265
+ export function shownExtension(name) {
243
266
  const shown = nameAsShown(name);
244
267
  const dot = shown.lastIndexOf('.');
245
268
  return dot === -1 ? '' : shown.slice(dot + 1).toLowerCase();
246
269
  }
270
+ /**
271
+ * The extension a saved copy of `name` opens as, lowercase and without its
272
+ * dot: the one it shows (shownExtension) once its spaces are closed up as
273
+ * Firefox, the browser that changes a saved name most, closes them
274
+ * (closeUpSpaces). "evil.ex e", "evil.ex<U+00A0>e" and "evil. exe" open as
275
+ * 'exe', "Scan. pdf" as 'pdf', "Invoice.pdf (1)" as 'pdf(1)' and "Acme Inc.
276
+ * Contract" as 'contract', though Chromium saves each as sent. Every rule
277
+ * about what a name makes a file (a refused extension, an inline
278
+ * disposition, the type Core stores for an untyped upload, the type Forge
279
+ * serves a download under: ./media-type-node.js) reads this, never
280
+ * splitExtension.
281
+ *
282
+ * @param {string} name
283
+ * @returns {string}
284
+ */
285
+ export function lastExtension(name) {
286
+ // Closed up before its invisible characters are read past: Firefox counts
287
+ // U+FEFF, one of them, as white space (`evil.ex<U+FEFF><U+3000>e` saves as
288
+ // `evil.exe`).
289
+ return shownExtension(closeUpSpaces(name));
290
+ }
247
291
  /**
248
292
  * The longest prefix of `text` within `maxLength` UTF-16 units that splits no
249
293
  * character.
@@ -1 +1 @@
1
- {"version":3,"file":"filename.js","sourceRoot":"","sources":["../../src/app-sdk/filename.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,oDAAoD;AACpD,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,oDAAoD,CAAC;AAEnG,2EAA2E;AAC3E,MAAM,0BAA0B,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,OAAO,2BAA2B,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpG,MAAM,yBAAyB,GAAG,IAAI,MAAM,CAAC,IAAI,2BAA2B,GAAG,EAAE,GAAG,CAAC,CAAC;AAEtF;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAI;IAC5C,OAAO,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,6DAA6D;AAC7D,MAAM,gCAAgC,GAAG,WAAW,CAAC;AAErD;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAI;IACtC,IAAI,GAAG,GAAG,IAAI,CAA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CAAC;AACxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-mobile",
3
- "version": "7.2.5",
3
+ "version": "7.2.6",
4
4
  "description": "Mobile SDK for SparkVault Identity, vault, folder, and ingot workflows",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -62,9 +62,10 @@ const DROPPED_TRAILING_CHARACTER = /[\s.]/u;
62
62
  /**
63
63
  * `name` without the trailing dots and white space a save drops: "page.html."
64
64
  * and "page.html " are "page.html", "notes. ." is "notes", and a name of only
65
- * dots and white space is ''. lastExtension reads the extension in front of
66
- * them, and Forge completes a saved name after them (./media-type-node.js
67
- * withMediaTypeExtension: "notes." under text/plain saves as "notes.txt").
65
+ * dots and white space is ''. shownExtension and lastExtension read the
66
+ * extension in front of them, and Forge completes a saved name after them
67
+ * (./media-type-node.js withMediaTypeExtension: "notes." under text/plain
68
+ * saves as "notes.txt").
68
69
  *
69
70
  * @param {string} name
70
71
  * @returns {string}
@@ -88,7 +89,7 @@ const INVISIBLE_CHARACTERS = /\p{Default_Ignorable_Code_Point}/gu;
88
89
  * What `name` shows once saved: the name read past its invisible characters
89
90
  * (INVISIBLE_CHARACTERS), without the trailing dots and white space a save
90
91
  * drops (trimDroppedTrailing). The extension a name shows is read in it
91
- * (lastExtension), and a name it leaves nothing of is one of only dots or
92
+ * (shownExtension), and a name it leaves nothing of is one of only dots or
92
93
  * spaces (isOnlyDotsOrSpaces).
93
94
  *
94
95
  * @param {string} name
@@ -215,7 +216,7 @@ export const WHITEBOARD_MARKER_EXTENSION = '.whiteboard.svg';
215
216
  * shortened copy keeps it ("Plan (2).note.html", never "Plan.note (2).html")
216
217
  * and its title is still the part in front of it. No rule about what a file
217
218
  * is reads a marker: those read the content type (a document's kind,
218
- * ./ingot-kind.js) or the lastExtension (the extension a name shows).
219
+ * ./ingot-kind.js) or the lastExtension (the extension a saved copy opens as).
219
220
  */
220
221
  export const DOCUMENT_MARKER_EXTENSIONS = Object.freeze([WHITEBOARD_MARKER_EXTENSION, NOTE_MARKER_EXTENSION]);
221
222
 
@@ -239,34 +240,81 @@ export function splitExtension(name) {
239
240
  }
240
241
 
241
242
  /**
242
- * The extension `name` shows, lowercase and without its dot: what follows the
243
- * last dot of what the name shows once saved (nameAsShown: read past its
244
- * invisible characters, without the trailing dots and white space a save
245
- * drops). It is the extension a saved copy opens as wherever the name holds
246
- * no invisible character: "invoice.note.html" and
247
- * "page.html." open as 'html', "logs.tar.gz" as 'gz', ".html" as 'html'
248
- * (Windows reads a leading dot's extension), and a name with no dot as ''.
249
- * "Invoice.pdf<U+034F>" shows 'pdf', so no rule completes it with a second
250
- * extension a desktop that hides known extensions would not show. A character
251
- * that draws as blank space or as another letter yet is no invisible
252
- * character stays in the extension read ("Invoice.pdf<U+2800>", a braille
253
- * blank, reads 'pdf<U+2800>'; "Invoice.<U+0440>df", a Cyrillic er,
254
- * '<U+0440>df'), which no registry extension then is, and Forge completes no
255
- * such name (./media-type-node.js withMediaTypeExtension). Every rule
256
- * about what a name makes a file (a refused extension, an inline
257
- * disposition, the type Core stores for an untyped upload, whether Forge
258
- * completes a saved name and the type it serves it under:
259
- * ./media-type-node.js) reads this, never splitExtension.
243
+ * A run of the white space Firefox reads in a name it saves: the space
244
+ * separators and U+FEFF, and the line and paragraph separators, which it
245
+ * drops wherever they stand and which end no run.
246
+ */
247
+ const WHITE_SPACE_RUN = /[\p{Zs}\uFEFF\u2028\u2029]+/gu;
248
+
249
+ /** A run whose first space is an ideographic space (U+3000), the one space Firefox keeps. */
250
+ const RUN_FIREFOX_KEEPS = /^[\u2028\u2029]*\u3000/;
251
+
252
+ /**
253
+ * `name` with its white space closed up as Firefox closes it in what follows
254
+ * its last dot, under any type it is handed and in a blob's name alike
255
+ * (nsExternalHelperAppService::SanitizeFileName): it collapses a run of white
256
+ * space into the run's first character, an ideographic space kept as it is
257
+ * and any other made an ASCII space, then strips the ASCII spaces from what
258
+ * follows the last dot. So a run there is dropped whole unless it starts with
259
+ * an ideographic space: `evil.ex e` saves as `evil.exe`, `evil.ex<U+3000>e`
260
+ * as itself, `evil.ex <U+3000>e` as `evil.exe`. Closing up the whole name
261
+ * moves no dot, so what follows its last dot is what Firefox saves there.
260
262
  *
261
263
  * @param {string} name
262
264
  * @returns {string}
263
265
  */
264
- export function lastExtension(name) {
266
+ function closeUpSpaces(name) {
267
+ return name.replace(WHITE_SPACE_RUN, (run) => (RUN_FIREFOX_KEEPS.test(run) ? '\u3000' : ''));
268
+ }
269
+
270
+ /**
271
+ * The extension `name` shows, its spaces kept, lowercase and without its dot:
272
+ * what follows the last dot of what the name shows once saved (nameAsShown:
273
+ * read past its invisible characters, without the trailing dots and white
274
+ * space a save drops). "invoice.note.html" and "page.html." show 'html',
275
+ * "logs.tar.gz" 'gz', ".html" 'html' (Windows reads a leading dot's
276
+ * extension), "Invoice.pdf (1)" 'pdf (1)', and a name with no dot ''. It is
277
+ * what Chromium's copy shows, since Chromium saves a name as sent:
278
+ * "Invoice.pdf<U+034F>" shows 'pdf', and a character that draws as blank
279
+ * space or as another letter yet is no invisible character stays in it
280
+ * ("Invoice.pdf<U+2800>", a braille blank, shows 'pdf<U+2800>';
281
+ * "Invoice.<U+0440>df", a Cyrillic er, '<U+0440>df'). Only whether a saved
282
+ * name is completed reads it, by where its first word ends
283
+ * (./media-type-node.js withMediaTypeExtension), since completion ends a name
284
+ * in its type's own extension, which holds no space for Firefox to close up;
285
+ * every rule about what a name makes a file reads lastExtension.
286
+ *
287
+ * @param {string} name
288
+ * @returns {string}
289
+ */
290
+ export function shownExtension(name) {
265
291
  const shown = nameAsShown(name);
266
292
  const dot = shown.lastIndexOf('.');
267
293
  return dot === -1 ? '' : shown.slice(dot + 1).toLowerCase();
268
294
  }
269
295
 
296
+ /**
297
+ * The extension a saved copy of `name` opens as, lowercase and without its
298
+ * dot: the one it shows (shownExtension) once its spaces are closed up as
299
+ * Firefox, the browser that changes a saved name most, closes them
300
+ * (closeUpSpaces). "evil.ex e", "evil.ex<U+00A0>e" and "evil. exe" open as
301
+ * 'exe', "Scan. pdf" as 'pdf', "Invoice.pdf (1)" as 'pdf(1)' and "Acme Inc.
302
+ * Contract" as 'contract', though Chromium saves each as sent. Every rule
303
+ * about what a name makes a file (a refused extension, an inline
304
+ * disposition, the type Core stores for an untyped upload, the type Forge
305
+ * serves a download under: ./media-type-node.js) reads this, never
306
+ * splitExtension.
307
+ *
308
+ * @param {string} name
309
+ * @returns {string}
310
+ */
311
+ export function lastExtension(name) {
312
+ // Closed up before its invisible characters are read past: Firefox counts
313
+ // U+FEFF, one of them, as white space (`evil.ex<U+FEFF><U+3000>e` saves as
314
+ // `evil.exe`).
315
+ return shownExtension(closeUpSpaces(name));
316
+ }
317
+
270
318
  /**
271
319
  * The longest prefix of `text` within `maxLength` UTF-16 units that splits no
272
320
  * character.