@irpclib/irpc 1.0.0-beta.22 → 1.0.0-beta.24
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/dist/call.d.ts +7 -4
- package/dist/call.js +25 -7
- package/dist/context.d.ts +6 -16
- package/dist/context.js +12 -23
- package/dist/credential.d.ts +9 -0
- package/dist/credential.js +16 -0
- package/dist/enum.d.ts +20 -12
- package/dist/enum.js +21 -13
- package/dist/error.d.ts +6 -0
- package/dist/error.js +6 -0
- package/dist/file.d.ts +37 -0
- package/dist/file.js +86 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.js +12 -6
- package/dist/module.d.ts +41 -9
- package/dist/module.js +183 -12
- package/dist/packet.d.ts +32 -0
- package/dist/packet.js +100 -0
- package/dist/reader.d.ts +17 -3
- package/dist/reader.js +23 -4
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +25 -2
- package/dist/router.d.ts +53 -0
- package/dist/router.js +81 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +15 -0
- package/dist/state.d.ts +18 -17
- package/dist/state.js +96 -23
- package/dist/store.d.ts +44 -0
- package/dist/store.js +76 -0
- package/dist/stream.d.ts +13 -2
- package/dist/stream.js +77 -17
- package/dist/transport.d.ts +18 -2
- package/dist/transport.js +46 -5
- package/dist/types.d.ts +103 -17
- package/package.json +9 -7
- package/readme.md +8 -3
- package/dist/uuid.d.ts +0 -21
- package/dist/uuid.js +0 -45
package/dist/uuid.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region src/uuid.ts
|
|
2
|
-
/**
|
|
3
|
-
* Generates a random UUID v4 string using a simple algorithm.
|
|
4
|
-
*
|
|
5
|
-
* @returns A UUID v4 string in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
6
|
-
*/
|
|
7
|
-
function simpleId() {
|
|
8
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
9
|
-
const r = Math.random() * 16 | 0;
|
|
10
|
-
return (c === "x" ? r : r & 3 | 8).toString(16);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Default UUID provider that attempts to use the crypto API if available,
|
|
15
|
-
* otherwise falls back to a simpler implementation.
|
|
16
|
-
*
|
|
17
|
-
* @returns A UUID v4 string
|
|
18
|
-
*/
|
|
19
|
-
function defaultUUIDProvider() {
|
|
20
|
-
if (typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
|
21
|
-
return simpleId();
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The currently active UUID provider function.
|
|
25
|
-
*/
|
|
26
|
-
let uuidProvider = defaultUUIDProvider;
|
|
27
|
-
/**
|
|
28
|
-
* Generates a new UUID using the currently configured provider.
|
|
29
|
-
*
|
|
30
|
-
* @returns A UUID string generated by the current provider
|
|
31
|
-
*/
|
|
32
|
-
function uuid() {
|
|
33
|
-
return (uuidProvider ?? defaultUUIDProvider)();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Sets a custom UUID provider function to be used by the uuid() function.
|
|
37
|
-
*
|
|
38
|
-
* @param provider - A function that returns a UUID string when called
|
|
39
|
-
*/
|
|
40
|
-
function setUUIDProvider(provider) {
|
|
41
|
-
uuidProvider = provider;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { setUUIDProvider, uuid };
|