@nx.js/runtime 0.0.58 → 0.0.60

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 (2) hide show
  1. package/dist/index.d.ts +249 -20
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1763,6 +1763,125 @@ interface GamepadEffectParameters {
1763
1763
  strongMagnitude?: number;
1764
1764
  weakMagnitude?: number;
1765
1765
  }
1766
+ interface AesCbcParams {
1767
+ name: "AES-CBC";
1768
+ iv: BufferSource;
1769
+ }
1770
+ interface AesCtrParams extends Algorithm {
1771
+ counter: BufferSource;
1772
+ length: number;
1773
+ }
1774
+ interface AesXtsParams {
1775
+ name: "AES-XTS";
1776
+ sectorSize: number;
1777
+ sector?: number;
1778
+ isNintendo?: boolean;
1779
+ }
1780
+ interface AesDerivedKeyParams extends Algorithm {
1781
+ length: number;
1782
+ }
1783
+ interface AesGcmParams extends Algorithm {
1784
+ additionalData?: BufferSource;
1785
+ iv: BufferSource;
1786
+ tagLength?: number;
1787
+ }
1788
+ interface AesKeyAlgorithm extends KeyAlgorithm {
1789
+ length: number;
1790
+ }
1791
+ interface AesKeyGenParams extends Algorithm {
1792
+ length: number;
1793
+ }
1794
+ interface Algorithm {
1795
+ name: string;
1796
+ }
1797
+ interface EcKeyAlgorithm extends KeyAlgorithm {
1798
+ namedCurve: NamedCurve;
1799
+ }
1800
+ interface EcKeyGenParams extends Algorithm {
1801
+ namedCurve: NamedCurve;
1802
+ }
1803
+ interface EcKeyImportParams extends Algorithm {
1804
+ namedCurve: NamedCurve;
1805
+ }
1806
+ interface EcdhKeyDeriveParams extends Algorithm {
1807
+ public: CryptoKey;
1808
+ }
1809
+ interface EcdsaParams extends Algorithm {
1810
+ hash: HashAlgorithmIdentifier;
1811
+ }
1812
+ interface HkdfParams extends Algorithm {
1813
+ hash: HashAlgorithmIdentifier;
1814
+ info: BufferSource;
1815
+ salt: BufferSource;
1816
+ }
1817
+ interface HmacImportParams extends Algorithm {
1818
+ hash: HashAlgorithmIdentifier;
1819
+ length?: number;
1820
+ }
1821
+ interface HmacKeyAlgorithm extends KeyAlgorithm {
1822
+ hash: KeyAlgorithm;
1823
+ length: number;
1824
+ }
1825
+ interface HmacKeyGenParams extends Algorithm {
1826
+ hash: HashAlgorithmIdentifier;
1827
+ length?: number;
1828
+ }
1829
+ interface JsonWebKey {
1830
+ alg?: string;
1831
+ crv?: string;
1832
+ d?: string;
1833
+ dp?: string;
1834
+ dq?: string;
1835
+ e?: string;
1836
+ ext?: boolean;
1837
+ k?: string;
1838
+ key_ops?: string[];
1839
+ kty?: string;
1840
+ n?: string;
1841
+ oth?: RsaOtherPrimesInfo[];
1842
+ p?: string;
1843
+ q?: string;
1844
+ qi?: string;
1845
+ use?: string;
1846
+ x?: string;
1847
+ y?: string;
1848
+ }
1849
+ interface KeyAlgorithm {
1850
+ name: string;
1851
+ }
1852
+ type NamedCurve = string;
1853
+ type AlgorithmIdentifier = Algorithm | string;
1854
+ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
1855
+ type KeyType = "private" | "public" | "secret";
1856
+ type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
1857
+ interface RsaHashedImportParams extends Algorithm {
1858
+ hash: HashAlgorithmIdentifier;
1859
+ }
1860
+ interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
1861
+ hash: KeyAlgorithm;
1862
+ }
1863
+ interface RsaHashedKeyGenParams extends RsaKeyGenParams {
1864
+ hash: HashAlgorithmIdentifier;
1865
+ }
1866
+ interface RsaKeyAlgorithm extends KeyAlgorithm {
1867
+ modulusLength: number;
1868
+ publicExponent: BigInteger;
1869
+ }
1870
+ interface RsaKeyGenParams extends Algorithm {
1871
+ modulusLength: number;
1872
+ publicExponent: BigInteger;
1873
+ }
1874
+ interface RsaOaepParams extends Algorithm {
1875
+ label?: BufferSource;
1876
+ }
1877
+ interface RsaOtherPrimesInfo {
1878
+ d?: string;
1879
+ r?: string;
1880
+ t?: string;
1881
+ }
1882
+ interface RsaPssParams extends Algorithm {
1883
+ saltLength: number;
1884
+ }
1766
1885
  type BlobPart = string | Blob | BufferSource;
1767
1886
  interface BlobPropertyBag {
1768
1887
  endings?: "native" | "transparent";
@@ -2570,10 +2689,16 @@ declare class Response extends Body {
2570
2689
  * @see https://developer.mozilla.org/docs/Web/API/fetch
2571
2690
  */
2572
2691
  declare function fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
2573
- interface Algorithm {
2574
- name: string;
2692
+ declare class CryptoKey {
2693
+ readonly algorithm: KeyAlgorithm;
2694
+ readonly extractable: boolean;
2695
+ readonly type: KeyType;
2696
+ readonly usages: KeyUsage[];
2697
+ /**
2698
+ * @private
2699
+ */
2700
+ constructor();
2575
2701
  }
2576
- type AlgorithmIdentifier = Algorithm | string;
2577
2702
  /**
2578
2703
  * Basic cryptography features available in the current context.
2579
2704
  * It allows access to a cryptographically strong random number
@@ -2641,10 +2766,17 @@ declare class SubtleCrypto {
2641
2766
  * @ignore
2642
2767
  */
2643
2768
  constructor();
2644
- decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
2769
+ /**
2770
+ * Decrypts some encrypted data.
2771
+ *
2772
+ * It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext").
2773
+ *
2774
+ * @returns A Promise which will be fulfilled with the decrypted data (also known as "plaintext") as an `ArrayBuffer`.
2775
+ * @see https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt
2776
+ */
2777
+ decrypt(algorithm: AesCbcParams | AesXtsParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
2645
2778
  deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
2646
2779
  deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
2647
- deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
2648
2780
  /**
2649
2781
  * Generates a digest of the given data. A digest is a short fixed-length value
2650
2782
  * derived from some variable-length input. Cryptographic digests should exhibit
@@ -2668,24 +2800,25 @@ declare class SubtleCrypto {
2668
2800
  * @see https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest
2669
2801
  */
2670
2802
  digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
2671
- encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
2803
+ encrypt(algorithm: AesCbcParams | AesXtsParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
2672
2804
  exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
2673
2805
  exportKey(format: "pkcs8" | "raw" | "spki", key: CryptoKey): Promise<ArrayBuffer>;
2674
- exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
2675
2806
  generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: readonly ("sign" | "verify")[]): Promise<CryptoKeyPair>;
2676
2807
  generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair>;
2677
2808
  generateKey(algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
2678
2809
  generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey | CryptoKeyPair>;
2679
2810
  generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair>;
2680
2811
  generateKey(algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
2681
- generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey | CryptoKeyPair>;
2682
- importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
2812
+ /**
2813
+ * Takes as input a key in an external, portable format and gives you a
2814
+ * {@link CryptoKey} object that you can use in the Web Crypto API.
2815
+ *
2816
+ * @see https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey
2817
+ */
2818
+ importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
2683
2819
  importKey(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
2684
- importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
2685
- importKey(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
2686
2820
  sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
2687
2821
  unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
2688
- unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
2689
2822
  verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
2690
2823
  wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
2691
2824
  }
@@ -3376,6 +3509,60 @@ declare class AmbientLightSensor extends Sensor {
3376
3509
  start(): void;
3377
3510
  stop(): void;
3378
3511
  }
3512
+ declare class DOMException extends Error {
3513
+ INDEX_SIZE_ERR: 1;
3514
+ DOMSTRING_SIZE_ERR: 2;
3515
+ HIERARCHY_REQUEST_ERR: 3;
3516
+ WRONG_DOCUMENT_ERR: 4;
3517
+ INVALID_CHARACTER_ERR: 5;
3518
+ NO_DATA_ALLOWED_ERR: 6;
3519
+ NO_MODIFICATION_ALLOWED_ERR: 7;
3520
+ NOT_FOUND_ERR: 8;
3521
+ NOT_SUPPORTED_ERR: 9;
3522
+ INUSE_ATTRIBUTE_ERR: 10;
3523
+ INVALID_STATE_ERR: 11;
3524
+ SYNTAX_ERR: 12;
3525
+ INVALID_MODIFICATION_ERR: 13;
3526
+ NAMESPACE_ERR: 14;
3527
+ INVALID_ACCESS_ERR: 15;
3528
+ VALIDATION_ERR: 16;
3529
+ TYPE_MISMATCH_ERR: 17;
3530
+ SECURITY_ERR: 18;
3531
+ NETWORK_ERR: 19;
3532
+ ABORT_ERR: 20;
3533
+ URL_MISMATCH_ERR: 21;
3534
+ QUOTA_EXCEEDED_ERR: 22;
3535
+ TIMEOUT_ERR: 23;
3536
+ INVALID_NODE_TYPE_ERR: 24;
3537
+ DATA_CLONE_ERR: 25;
3538
+ static INDEX_SIZE_ERR: 1;
3539
+ static DOMSTRING_SIZE_ERR: 2;
3540
+ static HIERARCHY_REQUEST_ERR: 3;
3541
+ static WRONG_DOCUMENT_ERR: 4;
3542
+ static INVALID_CHARACTER_ERR: 5;
3543
+ static NO_DATA_ALLOWED_ERR: 6;
3544
+ static NO_MODIFICATION_ALLOWED_ERR: 7;
3545
+ static NOT_FOUND_ERR: 8;
3546
+ static NOT_SUPPORTED_ERR: 9;
3547
+ static INUSE_ATTRIBUTE_ERR: 10;
3548
+ static INVALID_STATE_ERR: 11;
3549
+ static SYNTAX_ERR: 12;
3550
+ static INVALID_MODIFICATION_ERR: 13;
3551
+ static NAMESPACE_ERR: 14;
3552
+ static INVALID_ACCESS_ERR: 15;
3553
+ static VALIDATION_ERR: 16;
3554
+ static TYPE_MISMATCH_ERR: 17;
3555
+ static SECURITY_ERR: 18;
3556
+ static NETWORK_ERR: 19;
3557
+ static ABORT_ERR: 20;
3558
+ static URL_MISMATCH_ERR: 21;
3559
+ static QUOTA_EXCEEDED_ERR: 22;
3560
+ static TIMEOUT_ERR: 23;
3561
+ static INVALID_NODE_TYPE_ERR: 24;
3562
+ static DATA_CLONE_ERR: 25;
3563
+ code: number;
3564
+ constructor(message?: string, name?: string);
3565
+ }
3379
3566
  /**
3380
3567
  * The `import.meta` meta-property exposes context-specific metadata to a JavaScript module.
3381
3568
  * It contains information about the module, such as the module's URL.
@@ -3479,6 +3666,20 @@ declare namespace Switch {
3479
3666
  * ```
3480
3667
  */
3481
3668
  declare function resolveDns(hostname: string): Promise<string[]>;
3669
+ interface ReadFileOptions {
3670
+ /**
3671
+ * Byte offset to start reading the file from.
3672
+ *
3673
+ * @default 0
3674
+ */
3675
+ start?: number;
3676
+ /**
3677
+ * Byte offset to stop reading the file at (inclusive).
3678
+ *
3679
+ * @default Infinity
3680
+ */
3681
+ end?: number;
3682
+ }
3482
3683
  /**
3483
3684
  * Creates the directory at the provided `path`, as well as any necessary parent directories.
3484
3685
  *
@@ -3506,7 +3707,7 @@ declare namespace Switch {
3506
3707
  * const gameState = JSON.parse(new TextDecoder().decode(buffer));
3507
3708
  * ```
3508
3709
  */
3509
- declare function readFile(path: PathLike): Promise<ArrayBuffer | null>;
3710
+ declare function readFile(path: PathLike, opts?: ReadFileOptions): Promise<ArrayBuffer | null>;
3510
3711
  /**
3511
3712
  * Synchronously returns an array of the file names within `path`.
3512
3713
  *
@@ -3530,7 +3731,7 @@ declare namespace Switch {
3530
3731
  * const appState = JSON.parse(new TextDecoder().decode(buffer));
3531
3732
  * ```
3532
3733
  */
3533
- declare function readFileSync(path: PathLike): ArrayBuffer | null;
3734
+ declare function readFileSync(path: PathLike, opts?: ReadFileOptions): ArrayBuffer | null;
3534
3735
  /**
3535
3736
  * Synchronously writes the contents of `data` to the file at `path`.
3536
3737
  *
@@ -3584,7 +3785,7 @@ declare namespace Switch {
3584
3785
  /**
3585
3786
  * Options object for the {@link file | `Switch.file()`} function.
3586
3787
  */
3587
- interface FsFileOptions {
3788
+ interface FsFileOptions extends ReadFileOptions {
3588
3789
  type?: string;
3589
3790
  /**
3590
3791
  * Create a "big file", which is a directory with the "archive" bit set.
@@ -3603,7 +3804,7 @@ declare namespace Switch {
3603
3804
  *
3604
3805
  * @default 65536
3605
3806
  */
3606
- chunkSize: number;
3807
+ chunkSize?: number;
3607
3808
  }
3608
3809
  /**
3609
3810
  * Returns a {@link FsFile | `Switch.FsFile`} instance for the given `path`.
@@ -3620,9 +3821,12 @@ declare namespace Switch {
3620
3821
  * also for writing files.
3621
3822
  */
3622
3823
  declare class FsFile extends File {
3824
+ start?: number;
3825
+ end?: number;
3623
3826
  constructor(path: PathLike, opts?: FsFileOptions);
3624
3827
  get size(): number;
3625
3828
  stat(): Promise<Stats | null>;
3829
+ slice(start?: number, end?: number, type?: string): FsFile;
3626
3830
  arrayBuffer(): Promise<ArrayBuffer>;
3627
3831
  text(): Promise<string>;
3628
3832
  json(): Promise<any>;
@@ -4147,12 +4351,37 @@ declare namespace Switch {
4147
4351
  * ```
4148
4352
  */
4149
4353
  static openSdmc(): FileSystem;
4354
+ /**
4355
+ * Opens a file system partition for the application with the specified title ID.
4356
+ * The file system type is specified by the `FsFileSystemType` parameter.
4357
+ *
4358
+ * @example
4359
+ *
4360
+ * ```typescript
4361
+ * import { FsFileSystemType } from '@nx.js/constants';
4362
+ *
4363
+ * // Open and mount the "User" partition
4364
+ * const fs = Switch.FileSystem.openWithId(
4365
+ * 0x0100000000001000n,
4366
+ * FsFileSystemType.ContentMeta,
4367
+ * );
4368
+ * const url = fs.mount();
4369
+ *
4370
+ * // Read the file entries at the root of the file system
4371
+ * console.log(Switch.readDirSync(url));
4372
+ * ```
4373
+ *
4374
+ * @param titleId The title ID of the file system to open.
4375
+ * @param type The `FsFileSystemType` of the file system to open.
4376
+ * @param path The base path of the file system to open. Defaults to `/`.
4377
+ */
4378
+ static openWithId(titleId: bigint, type: number, path?: string): FileSystem;
4150
4379
  }
4151
4380
  interface ServiceDispatchParams {
4152
4381
  targetSession?: number;
4153
4382
  context?: number;
4154
4383
  bufferAttrs?: number[];
4155
- buffers?: ArrayBuffer[];
4384
+ buffers?: (ArrayBuffer | ArrayBufferView)[];
4156
4385
  inSendPid?: boolean;
4157
4386
  inObjects?: Service[];
4158
4387
  inHandles?: number[];
@@ -4166,9 +4395,9 @@ declare namespace Switch {
4166
4395
  isDomain(): void;
4167
4396
  isOverride(): void;
4168
4397
  dispatch(rid: number, params?: ServiceDispatchParams): void;
4169
- dispatchIn(rid: number, inData: ArrayBuffer, parmas?: ServiceDispatchParams): void;
4170
- dispatchOut(rid: number, outData: ArrayBuffer, params?: ServiceDispatchParams): void;
4171
- dispatchInOut(rid: number, inData?: ArrayBuffer, outData?: ArrayBuffer, params?: ServiceDispatchParams): void;
4398
+ dispatchIn(rid: number, inData: ArrayBuffer | ArrayBufferView, parmas?: ServiceDispatchParams): void;
4399
+ dispatchOut(rid: number, outData: ArrayBuffer | ArrayBufferView, params?: ServiceDispatchParams): void;
4400
+ dispatchInOut(rid: number, inData?: ArrayBuffer | ArrayBufferView, outData?: ArrayBuffer | ArrayBufferView, params?: ServiceDispatchParams): void;
4172
4401
  }
4173
4402
  type PathLike = string | URL;
4174
4403
  interface Versions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx.js/runtime",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "description": "nx.js runtime",
5
5
  "repository": {
6
6
  "type": "git",