@session.js/types 1.0.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/README.md +74 -0
- package/dist/disappearing-message.d.ts +2 -0
- package/dist/disappearing-message.js +1 -0
- package/dist/enums.d.ts +3 -0
- package/dist/enums.js +1 -0
- package/dist/envelope.d.ts +6 -0
- package/dist/envelope.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/namespaces.d.ts +42 -0
- package/dist/namespaces.js +99 -0
- package/dist/network/index.d.ts +4 -0
- package/dist/network/index.js +1 -0
- package/dist/network/request.d.ts +29 -0
- package/dist/network/request.js +8 -0
- package/dist/network/response.d.ts +23 -0
- package/dist/network/response.js +1 -0
- package/dist/pubkey.d.ts +22 -0
- package/dist/pubkey.js +23 -0
- package/dist/signal-bindings/compiled.d.ts +3233 -0
- package/dist/signal-bindings/compiled.js +8770 -0
- package/dist/signal-bindings/index.d.ts +3 -0
- package/dist/signal-bindings/index.js +3 -0
- package/dist/signal-bindings/utils.d.ts +13 -0
- package/dist/signal-bindings/utils.js +15 -0
- package/dist/snode-retrieve.d.ts +30 -0
- package/dist/snode-retrieve.js +1 -0
- package/dist/snode-signature-result.d.ts +5 -0
- package/dist/snode-signature-result.js +1 -0
- package/dist/snode.d.ts +6 -0
- package/dist/snode.js +1 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.js +4 -0
- package/dist/swarm.d.ts +6 -0
- package/dist/swarm.js +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function is used to check that an optional property on a Protobuf object is not undefined or using a type-specific default value.
|
|
3
|
+
* https://protobuf.dev/programming-guides/proto/#optional
|
|
4
|
+
*
|
|
5
|
+
* @param object - A Protobuf/JavaScript object
|
|
6
|
+
* @param property - The property you want make sure is not undefined
|
|
7
|
+
* @returns true if the property is defined or false if undefined or using a type-specific default value
|
|
8
|
+
*/
|
|
9
|
+
declare function hasDefinedProperty<A extends object, B extends PropertyKey & keyof A>(object: A, property: B): boolean;
|
|
10
|
+
export declare const ProtobufUtils: {
|
|
11
|
+
hasDefinedProperty: typeof hasDefinedProperty;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* This function is used to check that an optional property on a Protobuf object is not undefined or using a type-specific default value.
|
|
4
|
+
* https://protobuf.dev/programming-guides/proto/#optional
|
|
5
|
+
*
|
|
6
|
+
* @param object - A Protobuf/JavaScript object
|
|
7
|
+
* @param property - The property you want make sure is not undefined
|
|
8
|
+
* @returns true if the property is defined or false if undefined or using a type-specific default value
|
|
9
|
+
*/
|
|
10
|
+
function hasDefinedProperty(object, property) {
|
|
11
|
+
return !_.isNil(object) && Object.prototype.hasOwnProperty.call(object, property) !== false;
|
|
12
|
+
}
|
|
13
|
+
export const ProtobufUtils = {
|
|
14
|
+
hasDefinedProperty,
|
|
15
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SnodeNamespaces } from './namespaces.js';
|
|
2
|
+
export type RetrieveMessageItem = {
|
|
3
|
+
hash: string;
|
|
4
|
+
expiration: number;
|
|
5
|
+
data: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
};
|
|
8
|
+
export type RetrieveMessagesResultsContent = {
|
|
9
|
+
hf?: Array<number>;
|
|
10
|
+
messages?: Array<RetrieveMessageItem>;
|
|
11
|
+
more: boolean;
|
|
12
|
+
t: number;
|
|
13
|
+
};
|
|
14
|
+
export type RetrieveRequestResult = {
|
|
15
|
+
code: number;
|
|
16
|
+
messages: RetrieveMessagesResultsContent;
|
|
17
|
+
namespace: SnodeNamespaces;
|
|
18
|
+
};
|
|
19
|
+
export type RetrieveMessagesResultsBatched = Array<RetrieveRequestResult>;
|
|
20
|
+
export type RequestNamespace = {
|
|
21
|
+
namespace: SnodeNamespaces | 'all';
|
|
22
|
+
pubkey: string;
|
|
23
|
+
isOurPubkey: boolean;
|
|
24
|
+
signature: {
|
|
25
|
+
timestamp: number;
|
|
26
|
+
pubkeyEd25519: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
};
|
|
29
|
+
lastHash: string | undefined;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/snode.d.ts
ADDED
package/dist/snode.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Storage {
|
|
2
|
+
get(key: string): string | null | Promise<string | null>;
|
|
3
|
+
set(key: string, value: string): void | Promise<void>;
|
|
4
|
+
delete(key: string): void | Promise<void>;
|
|
5
|
+
has(key: string): boolean | Promise<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export declare enum StorageKeys {
|
|
8
|
+
LastHashes = "last_hashes"
|
|
9
|
+
}
|
package/dist/swarm.d.ts
ADDED
package/dist/swarm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@session.js/types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"module": "src/index.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"author": "Viktor Shchelochkov <hi@hloth.dev> (https://hloth.dev)",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sessionjs/types.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/sessionjs/types/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/sessionjs/types#readme",
|
|
16
|
+
"description": "A special package that holds TypeScript definitions and enums shared internally and for developing your own @session.js/client modular parts.",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**/*.js",
|
|
20
|
+
"dist/**/*.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && cp src/signal-bindings/compiled.js dist/signal-bindings/compiled.js && cp src/signal-bindings/compiled.d.ts dist/signal-bindings/compiled.d.ts",
|
|
24
|
+
"protobuf": "pbjs --target static-module --wrap es6 --out src/signal-bindings/compiled.js src/signal-bindings/signalservice.proto && pbts --out src/signal-bindings/compiled.d.ts src/signal-bindings/compiled.js --force-long"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"typescript": "^5.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"lodash": "^4.17.21",
|
|
31
|
+
"protobufjs": "^7.3.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/lodash": "^4.17.7",
|
|
35
|
+
"protobufjs-cli": "^1.1.2",
|
|
36
|
+
"tsc-alias": "^1.8.10"
|
|
37
|
+
}
|
|
38
|
+
}
|