@signageos/front-applet 7.0.0 → 7.1.0
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/CHANGELOG.md +11 -0
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/docs/management/js-management-management.md +37 -11
- package/docs/management/js-management-native-commands-mdc.md +15 -0
- package/es6/FrontApplet/Iframe/Iframe.d.ts +1 -1
- package/es6/FrontApplet/Management/Management.d.ts +2 -0
- package/es6/FrontApplet/Management/Management.js +17 -0
- package/es6/FrontApplet/Management/Management.js.map +1 -1
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.d.ts +1 -0
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js +12 -0
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js.map +1 -1
- package/es6/bundle.d.ts +1 -0
- package/es6/bundle.js +21 -1
- package/es6/bundle.js.map +1 -1
- package/es6/fpath.d.ts +89 -0
- package/es6/fpath.js +132 -0
- package/es6/fpath.js.map +1 -0
- package/package.json +3 -1
|
@@ -17,17 +17,19 @@ To make the management of devices more viable and open there is a management API
|
|
|
17
17
|
|
|
18
18
|
## All methods
|
|
19
19
|
|
|
20
|
-
| Method
|
|
21
|
-
|
|
22
|
-
| `supports()`
|
|
23
|
-
| `getModel()`
|
|
24
|
-
| `getSerialNumber()`
|
|
25
|
-
| `getBatteryStatus()`
|
|
26
|
-
| `getNetworkInfo()`
|
|
27
|
-
| `getTemperature()`
|
|
28
|
-
| `resetSettings()`
|
|
29
|
-
| `factoryReset()`
|
|
30
|
-
| `getBrand()`
|
|
20
|
+
| Method | Description | Supported since |
|
|
21
|
+
|-----------------------------------|-----------------------------------------------------------------|:---------------:|
|
|
22
|
+
| `supports()` | Enum of supported features | 2.0.0 |
|
|
23
|
+
| `getModel()` | Information about device model | 2.0.0 |
|
|
24
|
+
| `getSerialNumber()` | Information about device serial number | 2.1.0 |
|
|
25
|
+
| `getBatteryStatus()` | Information about the battery level and battery charging status | 2.1.0 |
|
|
26
|
+
| `getNetworkInfo()` | Information about network connections, IPs and DNS | 4.0.0 |
|
|
27
|
+
| `getTemperature()` | Current device temperature | 3.0.0 |
|
|
28
|
+
| `resetSettings()` | Clear all settings on device | 4.0.0 |
|
|
29
|
+
| `factoryReset()` | Do a device factory reset | 4.0.0 |
|
|
30
|
+
| `getBrand()` | Information about device brand | 5.7.0 |
|
|
31
|
+
| `setHardwareAcceleration()` | Enable or disable hardware acceleration | 7.1.0 |
|
|
32
|
+
| `isHardwareAccelerationEnabled()` | Check if hardware acceleration is enabled | 7.1.0 |
|
|
31
33
|
|
|
32
34
|
## Examples
|
|
33
35
|
:::note[GitHub Example]
|
|
@@ -150,3 +152,27 @@ Method `getBrand()` will display the manufacturer brand of your device.
|
|
|
150
152
|
```typescript
|
|
151
153
|
await sos.management.getBrand(); // Returns string ex. Google, Samsung, signageOS for emulators
|
|
152
154
|
```
|
|
155
|
+
|
|
156
|
+
## setHardwareAcceleration()
|
|
157
|
+
Method `setHardwareAcceleration()` will enable or disable hardware acceleration.
|
|
158
|
+
|
|
159
|
+
:::note
|
|
160
|
+
- Check if device supports hardware acceleration changing by calling `sos.management.supports("HARDWARE_ACCELERATION")`.
|
|
161
|
+
- By default, hardware acceleration is always enabled.
|
|
162
|
+
:::
|
|
163
|
+
|
|
164
|
+
| Param | Type | Required | Description |
|
|
165
|
+
|-----------|---------|:--------------------------:|-----------------------------------------|
|
|
166
|
+
| `enabled` | boolean | <div class="red">Yes</div> | Enable or disable hardware acceleration |
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
await sos.management.setHardwareAcceleration(true); // Promise<void>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## isHardwareAccelerationEnabled()
|
|
173
|
+
Method `isHardwareAccelerationEnabled()` will return if hardware acceleration is enabled.
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
await sos.management.isHardwareAccelerationEnabled(); // Promise<boolean>
|
|
177
|
+
```
|
|
178
|
+
|
|
@@ -25,6 +25,8 @@ Native Commands API allows you to control the device using native commands.
|
|
|
25
25
|
| Method | Description | Supported since |
|
|
26
26
|
| ------ | ------ |-----------------|
|
|
27
27
|
| `sendOne()` | Send MDC command on one IP address (or localhost) | 6.5.1 |
|
|
28
|
+
| `sendOneRaw()` | Send MDC command on one IP address (or localhost) with subcommands | 6.7.1 |
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
## sendOne()
|
|
30
32
|
Method `sendOne()` will send MDC command on one IP address (or localhost).
|
|
@@ -45,6 +47,19 @@ await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x
|
|
|
45
47
|
await sos.native.mdc.sendOne('192.168.0.10', 0x01, []); // Promise<IMDCResponse>
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
## sendOneRaw()
|
|
51
|
+
Method `sendOneRaw()` will send MDC command on one IP address (or localhost) with subcommands .
|
|
52
|
+
|
|
53
|
+
| Param | Type | Required | Description |
|
|
54
|
+
| -------------- | ----------------------| :-------: | -------------------- |
|
|
55
|
+
| `ipAddress` | string | <div class="red">Yes</div> | IP address or `localhost` |
|
|
56
|
+
| `data` | number | <div class="red">Yes</div> | Data for command/subcommands |
|
|
57
|
+
|
|
58
|
+
### Javascript example
|
|
59
|
+
```javascript
|
|
60
|
+
await sos.native.mdc.sendOneRaw('localhost', [0x1B, 0x00, 0x01, 0x74]); // Promise<IMDCResponse>
|
|
61
|
+
```
|
|
62
|
+
|
|
48
63
|
### Example of returned object
|
|
49
64
|
```javascript
|
|
50
65
|
{
|
|
@@ -12,7 +12,7 @@ export default class Iframe {
|
|
|
12
12
|
private frontAppletWindows;
|
|
13
13
|
constructor(window: Window, messagePrefix: string, base: {
|
|
14
14
|
apiJsUri: string;
|
|
15
|
-
config:
|
|
15
|
+
config: Record<string, string | number>;
|
|
16
16
|
authHash: string | null;
|
|
17
17
|
display: Display;
|
|
18
18
|
}, transformers: Transformer[]);
|
|
@@ -51,6 +51,8 @@ export default class Management implements IManagement {
|
|
|
51
51
|
factoryReset(): Promise<void>;
|
|
52
52
|
getExtendedManagementUrl(): Promise<string | null>;
|
|
53
53
|
setExtendedManagementUrl(url: string | null): Promise<void>;
|
|
54
|
+
setHardwareAcceleration(enabled: boolean): Promise<void>;
|
|
55
|
+
isHardwareAccelerationEnabled(): Promise<boolean>;
|
|
54
56
|
private getMessage;
|
|
55
57
|
private getMessagePrefix;
|
|
56
58
|
}
|
|
@@ -134,6 +134,23 @@ class Management {
|
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
+
setHardwareAcceleration(enabled) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
Validate_1.default({ enabled }).required().boolean();
|
|
140
|
+
yield this.postMessage({
|
|
141
|
+
type: this.getMessage('set_hardware_acceleration'),
|
|
142
|
+
enabled,
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
isHardwareAccelerationEnabled() {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const { enabled } = yield this.postMessage({
|
|
149
|
+
type: this.getMessage('is_hardware_acceleration_enabled'),
|
|
150
|
+
});
|
|
151
|
+
return enabled;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
137
154
|
getMessage(name) {
|
|
138
155
|
return this.getMessagePrefix() + '.' + name;
|
|
139
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Management.js","sourceRoot":"","sources":["../../../src/FrontApplet/Management/Management.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,kDAA2C;AAC3C,yCAAkC;AAClC,4CAAqC;AACrC,iEAA0D;AAC1D,sCAA+B;AAC/B,mCAA4B;AAC5B,gCAAyB;AACzB,yCAAkC;AAClC,+CAAwC;AACxC,yCAAkC;AAClC,+CAAwC;AACxC,sCAA+B;AAC/B,kDAA2C;AAC3C,mDAA4C;AAC5C,yCAA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I,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC;gBACnD,GAAG;aACH,CAAC,CAAC;QACJ,CAAC;KAAA;IAEY,uBAAuB,CAAC,OAAgB;;YACpD,kBAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC;gBAClD,OAAO;aACP,CAAC,CAAC;QACJ,CAAC;KAAA;IAEY,6BAA6B;;YACzC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC1C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,kCAAkC,CAAC;aACzD,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QAChB,CAAC;KAAA;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC;IAC7C,CAAC;IAEO,gBAAgB;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC;IAC7D,CAAC;;AAjJF,6BAkJC;AAjJc,yBAAc,GAAW,YAAY,CAAC"}
|
|
@@ -16,6 +16,7 @@ export default class Mdc implements INativeMdcCommands {
|
|
|
16
16
|
static MESSAGE_PREFIX: string;
|
|
17
17
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
18
18
|
sendOne(ipAddress: IpAddressType, command: CodesMDC, data?: number[] | []): Promise<IMDCResponse>;
|
|
19
|
+
sendOneRaw(ipAddress: IpAddressType, data: number[] | []): Promise<IMDCResponse>;
|
|
19
20
|
private getMessage;
|
|
20
21
|
private getMessagePrefix;
|
|
21
22
|
}
|
|
@@ -37,6 +37,18 @@ class Mdc {
|
|
|
37
37
|
return commandResponse;
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
+
sendOneRaw(ipAddress, data) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
Validate_1.default({ ipAddress }).required().string();
|
|
43
|
+
Validate_1.default({ data }).required().array('number');
|
|
44
|
+
const { commandResponse } = yield this.postMessage({
|
|
45
|
+
type: this.getMessage('send_one_raw'),
|
|
46
|
+
ipAddress,
|
|
47
|
+
data,
|
|
48
|
+
});
|
|
49
|
+
return commandResponse;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
40
52
|
getMessage(name) {
|
|
41
53
|
return this.getMessagePrefix() + '.' + name;
|
|
42
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mdc.js","sourceRoot":"","sources":["../../../../src/FrontApplet/NativeCommands/MDC/Mdc.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,sDAA+C;AAW/C;;GAEG;AACH,MAAqB,GAAG;IAGvB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAES,OAAO,CAAC,SAAwB,EAAE,OAAiB,EAAE,IAAoB;;YACrF,kBAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAC5C,kBAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAC1C,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;gBAChC,kBAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;aAC9C;YACD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;gBAChC,IAAI,GAAG,EAAE,CAAC;aACV;YAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAClD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,IAAI;aACJ,CAAC,CAAC;YACH,OAAO,eAAe,CAAC;QACxB,CAAC;KAAA;IAEY,UAAU,CAAC,SAAwB,EAAE,IAAmB;;YACpE,kBAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAC5C,kBAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAE9C,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;gBAClD,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC;gBACrC,SAAS;gBACT,IAAI;aACJ,CAAC,CAAC;YACH,OAAO,eAAe,CAAC;QACxB,CAAC;KAAA;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC;IAC7C,CAAC;IAEO,gBAAgB;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC;IACtD,CAAC;;AA7CF,sBA8CC;AA7Cc,kBAAc,GAAW,KAAK,CAAC"}
|
package/es6/bundle.d.ts
CHANGED
package/es6/bundle.js
CHANGED
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
13
|
exports.monitoring = exports.sos = exports.frontApplet = void 0;
|
|
4
14
|
const createFrontApplet_1 = require("./FrontApplet/createFrontApplet");
|
|
5
15
|
const Montoring_1 = require("./Monitoring/Montoring");
|
|
16
|
+
__exportStar(require("./fpath"), exports);
|
|
17
|
+
// fake exports for generating declarations which are overwritten by module.exports
|
|
6
18
|
exports.frontApplet = createFrontApplet_1.default(window, 'hug');
|
|
7
19
|
exports.sos = exports.frontApplet;
|
|
8
20
|
exports.monitoring = new Montoring_1.default(exports.frontApplet);
|
|
21
|
+
// add exports to the frontApplet, which is assigned to module.exports
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
exports.frontApplet.sos = exports.frontApplet;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
exports.frontApplet.frontApplet = exports.frontApplet;
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
exports.frontApplet.monitoring = exports.monitoring;
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
exports.frontApplet.default = exports.frontApplet;
|
|
9
30
|
window.sos = exports.frontApplet;
|
|
10
31
|
window.sosMonitoring = exports.monitoring;
|
|
11
32
|
exports.default = exports.frontApplet;
|
|
12
33
|
module.exports = exports.frontApplet;
|
|
13
|
-
module.exports.default = exports.frontApplet;
|
|
14
34
|
//# sourceMappingURL=bundle.js.map
|
package/es6/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,uEAAgE;AAEhE,sDAAgD;AAChD,0CAAwB;AAExB,mFAAmF;AACtE,QAAA,WAAW,GAAG,2BAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC/C,QAAA,GAAG,GAAG,mBAAW,CAAC;AAClB,QAAA,UAAU,GAAG,IAAI,mBAAU,CAAC,mBAAW,CAAC,CAAC;AAEtD,sEAAsE;AACtE,aAAa;AACb,mBAAW,CAAC,GAAG,GAAG,mBAAW,CAAC;AAC9B,aAAa;AACb,mBAAW,CAAC,WAAW,GAAG,mBAAW,CAAC;AACtC,aAAa;AACb,mBAAW,CAAC,UAAU,GAAG,kBAAU,CAAC;AACpC,aAAa;AACb,mBAAW,CAAC,OAAO,GAAG,mBAAW,CAAC;AASlC,MAAM,CAAC,GAAG,GAAG,mBAAW,CAAC;AACzB,MAAM,CAAC,aAAa,GAAG,kBAAU,CAAC;AAElC,kBAAe,mBAAW,CAAC;AAC3B,MAAM,CAAC,OAAO,GAAG,mBAAW,CAAC"}
|
package/es6/fpath.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as path from 'path-browserify';
|
|
2
|
+
import { IFilePath } from './FrontApplet/FileSystem/types';
|
|
3
|
+
/**
|
|
4
|
+
* fpath utility mirrors node path module, but accepts IFilePath type instead of strings.
|
|
5
|
+
*
|
|
6
|
+
* Not implemented functions:
|
|
7
|
+
* - format
|
|
8
|
+
* - matchesGlob
|
|
9
|
+
* - parse
|
|
10
|
+
* - relative
|
|
11
|
+
*/
|
|
12
|
+
export declare const fpath: {
|
|
13
|
+
/**
|
|
14
|
+
* Return the last portion of path, since it is not a valid path, a string is returned.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
18
|
+
* fpath.basename(path); // "picture.png"
|
|
19
|
+
*/
|
|
20
|
+
basename(filePath: IFilePath, suffix?: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
26
|
+
* fpath.dirname(path); // { filePath: "images", storageUnit: ... }
|
|
27
|
+
*/
|
|
28
|
+
dirname(filePath: IFilePath): IFilePath;
|
|
29
|
+
/**
|
|
30
|
+
* Returns extension of the path, from the last period, including the period.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
34
|
+
* fpath.dirname(path); // .png
|
|
35
|
+
*/
|
|
36
|
+
extname(filePath: IFilePath): string;
|
|
37
|
+
/**
|
|
38
|
+
* Always returns true, because all file paths are absolute
|
|
39
|
+
*/
|
|
40
|
+
isAbsolute(_: IFilePath): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Returns new filePath with paths appended to it and normalized (resolved . and ..)
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const path = { filePath: "images", storageUnit: ... };
|
|
46
|
+
* fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
|
|
47
|
+
*/
|
|
48
|
+
join(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
49
|
+
/**
|
|
50
|
+
* Similar to fpath.join, but resulting path will always be subdirectory of base
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const path = { filePath: "uploads/userA", storageUnit: ... };
|
|
54
|
+
* fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
|
|
55
|
+
*/
|
|
56
|
+
safeJoin(base: IFilePath, ...paths: string[]): IFilePath;
|
|
57
|
+
/**
|
|
58
|
+
* Resolves . and .. in the path and removes multiple slashes
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const path = { filePath: "images//test/../test2/./", storageUnit: ... };
|
|
62
|
+
* fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
|
|
63
|
+
*/
|
|
64
|
+
normalize(filePath: IFilePath): IFilePath;
|
|
65
|
+
/**
|
|
66
|
+
* Same as fpath.join()
|
|
67
|
+
*/
|
|
68
|
+
resolve(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
69
|
+
/**
|
|
70
|
+
* Separator used for joining path segments
|
|
71
|
+
*/
|
|
72
|
+
sep: string;
|
|
73
|
+
/**
|
|
74
|
+
* Concatenate fp with paths without adding separator
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* const path = { filePath: "uploads/archive.tar", storageUnit: ... };
|
|
78
|
+
* fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
|
|
79
|
+
*/
|
|
80
|
+
concat(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
81
|
+
/**
|
|
82
|
+
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
|
|
83
|
+
*/
|
|
84
|
+
stringify(filePath: IFilePath): string;
|
|
85
|
+
/**
|
|
86
|
+
* Underlying path polyfill
|
|
87
|
+
*/
|
|
88
|
+
path: path.Path;
|
|
89
|
+
};
|
package/es6/fpath.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fpath = void 0;
|
|
4
|
+
const path = require("path-browserify");
|
|
5
|
+
/**
|
|
6
|
+
* fpath utility mirrors node path module, but accepts IFilePath type instead of strings.
|
|
7
|
+
*
|
|
8
|
+
* Not implemented functions:
|
|
9
|
+
* - format
|
|
10
|
+
* - matchesGlob
|
|
11
|
+
* - parse
|
|
12
|
+
* - relative
|
|
13
|
+
*/
|
|
14
|
+
exports.fpath = {
|
|
15
|
+
/**
|
|
16
|
+
* Return the last portion of path, since it is not a valid path, a string is returned.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
20
|
+
* fpath.basename(path); // "picture.png"
|
|
21
|
+
*/
|
|
22
|
+
basename(filePath, suffix) {
|
|
23
|
+
return path.basename(filePath.filePath, suffix);
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
30
|
+
* fpath.dirname(path); // { filePath: "images", storageUnit: ... }
|
|
31
|
+
*/
|
|
32
|
+
dirname(filePath) {
|
|
33
|
+
let parentPath = path.dirname(filePath.filePath);
|
|
34
|
+
if (parentPath === '.') {
|
|
35
|
+
// The top level file dirname is ".", but sos accepts empty string "" for root
|
|
36
|
+
parentPath = '';
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
filePath: parentPath,
|
|
40
|
+
storageUnit: filePath.storageUnit,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Returns extension of the path, from the last period, including the period.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
48
|
+
* fpath.dirname(path); // .png
|
|
49
|
+
*/
|
|
50
|
+
extname(filePath) {
|
|
51
|
+
return path.extname(filePath.filePath);
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Always returns true, because all file paths are absolute
|
|
55
|
+
*/
|
|
56
|
+
isAbsolute(_) {
|
|
57
|
+
return true;
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Returns new filePath with paths appended to it and normalized (resolved . and ..)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const path = { filePath: "images", storageUnit: ... };
|
|
64
|
+
* fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
|
|
65
|
+
*/
|
|
66
|
+
join(filePath, ...paths) {
|
|
67
|
+
return {
|
|
68
|
+
filePath: path.join(filePath.filePath, ...paths),
|
|
69
|
+
storageUnit: filePath.storageUnit,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Similar to fpath.join, but resulting path will always be subdirectory of base
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* const path = { filePath: "uploads/userA", storageUnit: ... };
|
|
77
|
+
* fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
|
|
78
|
+
*/
|
|
79
|
+
safeJoin(base, ...paths) {
|
|
80
|
+
return {
|
|
81
|
+
filePath: base.filePath + path.resolve('/', ...paths),
|
|
82
|
+
storageUnit: base.storageUnit,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Resolves . and .. in the path and removes multiple slashes
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* const path = { filePath: "images//test/../test2/./", storageUnit: ... };
|
|
90
|
+
* fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
|
|
91
|
+
*/
|
|
92
|
+
normalize(filePath) {
|
|
93
|
+
return {
|
|
94
|
+
filePath: path.normalize(filePath.filePath),
|
|
95
|
+
storageUnit: filePath.storageUnit,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Same as fpath.join()
|
|
100
|
+
*/
|
|
101
|
+
resolve(filePath, ...paths) {
|
|
102
|
+
return exports.fpath.join(filePath, ...paths);
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* Separator used for joining path segments
|
|
106
|
+
*/
|
|
107
|
+
sep: path.sep,
|
|
108
|
+
/**
|
|
109
|
+
* Concatenate fp with paths without adding separator
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* const path = { filePath: "uploads/archive.tar", storageUnit: ... };
|
|
113
|
+
* fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
|
|
114
|
+
*/
|
|
115
|
+
concat(filePath, ...paths) {
|
|
116
|
+
return {
|
|
117
|
+
filePath: filePath.filePath.concat(...paths),
|
|
118
|
+
storageUnit: filePath.storageUnit,
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
|
|
123
|
+
*/
|
|
124
|
+
stringify(filePath) {
|
|
125
|
+
return path.join(`[${filePath.storageUnit.type}]`, filePath.filePath);
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Underlying path polyfill
|
|
129
|
+
*/
|
|
130
|
+
path,
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=fpath.js.map
|
package/es6/fpath.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fpath.js","sourceRoot":"","sources":["../src/fpath.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AAGxC;;;;;;;;GAQG;AACU,QAAA,KAAK,GAAG;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAmB,EAAE,MAAe;QAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAmB;QAC1B,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,UAAU,KAAK,GAAG,EAAE;YACvB,8EAA8E;YAC9E,UAAU,GAAG,EAAE,CAAC;SAChB;QACD,OAAO;YACN,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,QAAQ,CAAC,WAAW;SACjC,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAmB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,CAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,QAAmB,EAAE,GAAG,KAAe;QAC3C,OAAO;YACN,QAAQ,EAAE,IAAI,CAAC,IA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7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"main": "dist/bundle.js",
|
|
5
5
|
"types": "es6/bundle.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@types/lodash": "4.14.137",
|
|
45
45
|
"@types/mocha": "5.2.7",
|
|
46
46
|
"@types/node": "12.7.2",
|
|
47
|
+
"@types/path-browserify": "1.0.3",
|
|
47
48
|
"@types/should": "13.0.0",
|
|
48
49
|
"@types/sinon": "7.0.13",
|
|
49
50
|
"babel-loader": "8.0.6",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"lint-staged": "12.5.0",
|
|
57
58
|
"lodash": "4.17.21",
|
|
58
59
|
"mocha": "6.2.3",
|
|
60
|
+
"path-browserify": "1.0.1",
|
|
59
61
|
"should": "13.2.3",
|
|
60
62
|
"should-sinon": "0.0.6",
|
|
61
63
|
"sinon": "7.4.1",
|