@pushwoosh/session-store 2.4.1 → 2.5.1

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.
@@ -1,24 +1,27 @@
1
1
  import { type Subscription } from 'rxjs';
2
- import { type GrpcClient } from '@pushwoosh/http-client';
3
- import { type RpcServiceClientInstances } from '@pushwoosh/grpc-bridge';
2
+ import { type API } from '@pushwoosh/rpc-v2-http-api-data';
3
+ import { type Account as AuthInfoAccount, type User as AuthInfoUser } from '@pushwoosh/rpc-v2-http-api-data/accounts_get_auth_info';
4
4
  import type { Session } from './session-store.types';
5
- type AuthInfoAccountAsObject = ReturnType<RpcServiceClientInstances['accounts']['AuthInfoAccount']['toObject']>;
6
- type AuthInfoUserAsObject = ReturnType<RpcServiceClientInstances['accounts']['AuthInfoUser']['toObject']>;
7
5
  export declare class SessionStore {
8
6
  /**
9
- * Client for working with grpc
7
+ * rpc gateway
8
+ * @private
10
9
  */
11
- private readonly grpcClient;
10
+ private readonly rpcGateway;
12
11
  /**
13
12
  * "Observable object" of the session
14
13
  */
15
14
  private readonly subject;
15
+ /**
16
+ * The last session
17
+ */
18
+ private lastSession?;
16
19
  /**
17
20
  * Create an instance of the SessionStore class
18
21
  *
19
- * @param grpcClient - grpc client
22
+ * @param rpcGateway - rpc gateway
20
23
  */
21
- constructor(grpcClient: GrpcClient);
24
+ constructor(rpcGateway: API);
22
25
  /**
23
26
  * Update the "Observable object" of the current session
24
27
  */
@@ -26,7 +29,7 @@ export declare class SessionStore {
26
29
  /**
27
30
  * Load account and user data
28
31
  */
29
- load: () => Promise<[AuthInfoAccountAsObject, AuthInfoUserAsObject]>;
32
+ load: () => Promise<[AuthInfoAccount, AuthInfoUser]>;
30
33
  /**
31
34
  * Update the session
32
35
  */
@@ -37,6 +40,9 @@ export declare class SessionStore {
37
40
  * @param callback - callback that will be called when the session changes
38
41
  */
39
42
  subscribe: (callback: (session: Session) => any) => Subscription;
43
+ /**
44
+ * Get the last session
45
+ */
46
+ getLastSession: () => Session | undefined;
40
47
  }
41
- export {};
42
48
  //# sourceMappingURL=session-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,yBAAyB,EAAoB,MAAM,wBAAwB,CAAC;AAS1F,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,uBAAuB,CAAC;AAOvE,KAAK,uBAAuB,GAAG,UAAU,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAChH,KAAK,oBAAoB,GAAG,UAAU,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAE1G,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD;;;;OAIG;gBACS,UAAU,EAAE,UAAU;IAMlC;;OAEG;IACH,OAAO,CAAC,aAAa,CASnB;IAEF;;OAEG;IACI,IAAI,QAAa,QAAQ,CAAC,uBAAuB,EAAE,oBAAoB,CAAC,CAAC,CAO9E;IAEF;;OAEG;IACI,MAAM,QAAa,QAAQ,IAAI,CAAC,CAGrC;IAEF;;;;OAIG;IACI,SAAS,uBAAwB,OAAO,KAAK,GAAG,KAAG,YAAY,CAEpE;CACH"}
1
+ {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,IAAI,eAAe,EAC/B,KAAK,IAAI,IAAI,YAAY,EAC1B,MAAM,wDAAwD,CAAC;AAShE,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,uBAAuB,CAAC;AAEvE,qBAAa,YAAY;IACvB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAM;IAEjC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD;;OAEG;IACH,OAAO,CAAC,WAAW,CAAC,CAAU;IAE9B;;;;OAIG;gBACS,UAAU,EAAE,GAAG;IAM3B;;OAEG;IACH,OAAO,CAAC,aAAa,CAWnB;IAEF;;OAEG;IACI,IAAI,QAAa,QAAQ,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAO9D;IAEF;;OAEG;IACI,MAAM,QAAa,QAAQ,IAAI,CAAC,CAGrC;IAEF;;;;OAIG;IACI,SAAS,uBAAwB,OAAO,KAAK,GAAG,KAAG,YAAY,CAEpE;IAEF;;OAEG;IACI,cAAc,QAAO,OAAO,GAAG,SAAS,CAAqB;CACrE"}
@@ -1,4 +1,2 @@
1
- import type { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
2
- export declare function timestampToUtcDate(timestamp?: Timestamp.AsObject): string;
3
1
  export declare const formatEmailsList: (emails?: string[]) => string;
4
2
  //# sourceMappingURL=session-store.helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.helpers.d.ts","sourceRoot":"","sources":["../src/session-store.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAE9E,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,QAAQ,GAAG,MAAM,CAOzE;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,EAAE,KAAG,MAEpD,CAAC"}
1
+ {"version":3,"file":"session-store.helpers.d.ts","sourceRoot":"","sources":["../src/session-store.helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAa,MAAM,EAAE,KAAG,MAEpD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { RestrictionValue } from '@pushwoosh/rpc-service-client/pushwoosh/objects/restrictionValues/v1/model_pb';
1
+ import { type RestrictionValue } from '@pushwoosh/rpc-v2-http-api-data/pushwoosh_objects_restrictionValues_v1';
2
2
  import type { Account } from './entities/account';
3
3
  import type { Permissions } from './entities/permissions';
4
4
  import type { Platforms } from './entities/platforms';
@@ -14,6 +14,6 @@ export type Session = {
14
14
  readonly user: User;
15
15
  };
16
16
  export type RestrictionsData = {
17
- restrictions: RestrictionValue.AsObject;
17
+ restrictions: RestrictionValue;
18
18
  };
19
19
  //# sourceMappingURL=session-store.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.types.d.ts","sourceRoot":"","sources":["../src/session-store.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+EAA+E,CAAC;AAEtH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,gBAAgB,CAAC,QAAQ,CAAC;CACzC,CAAC"}
1
+ {"version":3,"file":"session-store.types.d.ts","sourceRoot":"","sources":["../src/session-store.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,wEAAwE,CAAC;AAE/G,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,gBAAgB,CAAC;CAChC,CAAC"}
package/package.json CHANGED
@@ -10,23 +10,20 @@
10
10
  "build": "npm run production",
11
11
  "development": "cross-env NODE_ENV=development webpack-dev-server --config webpack.development.config.js",
12
12
  "production": "cross-env NODE_ENV=production webpack --config webpack.production.config.js",
13
- "check": "npm run check:lint && npm run check:tests && npm run check:types",
13
+ "check": "npm run check:lint && npm run check:types",
14
14
  "check:lint": "echo \"Run check:lint\" && eslint .",
15
- "check:tests": "echo \"Run check:tests\" && jest --passWithNoTests",
16
- "check:types": "echo \"Run check:types\" && tsc --project tsconfig.json --noEmit"
15
+ "check:types": "echo \"Run check:types\" && tsc --project tsconfig.json --noEmit --skipLibCheck"
17
16
  },
18
17
  "pre-commit": "check",
19
18
  "dependencies": {
20
19
  "@babel/runtime-corejs3": "^7.17.2",
21
- "@pushwoosh/grpc-bridge": "^1.0.0",
20
+ "@pushwoosh/rpc-v2-http-api-data": "^0.1.398",
22
21
  "core-js": "^3.21.0"
23
22
  },
24
23
  "devDependencies": {
25
24
  "@babel/core": "^7.18.6",
26
25
  "@babel/plugin-transform-runtime": "^7.17.0",
27
26
  "@babel/preset-env": "^7.16.11",
28
- "@types/google-protobuf": "^3.15.12",
29
- "@types/jest": "^27.4.0",
30
27
  "@types/webpack-env": "^1.16.3",
31
28
  "@typescript-eslint/eslint-plugin": "^7.11.0",
32
29
  "@typescript-eslint/parser": "^7.11.0",
@@ -42,10 +39,8 @@
42
39
  "eslint-plugin-jsx-a11y": "^6.5.1",
43
40
  "eslint-plugin-react": "^7.28.0",
44
41
  "eslint-plugin-react-hooks": "^4.3.0",
45
- "jest": "^27.5.1",
46
42
  "pre-commit": "^1.2.2",
47
43
  "terser-webpack-plugin": "^5.3.1",
48
- "ts-jest": "^27.1.3",
49
44
  "ts-loader": "^9.2.6",
50
45
  "typescript": "^4.5.5",
51
46
  "webpack": "^5.91.0",
@@ -54,8 +49,8 @@
54
49
  "webpack-merge": "^5.8.0"
55
50
  },
56
51
  "peerDependencies": {
57
- "@pushwoosh/grpc-bridge": "^1.0.0",
58
52
  "@pushwoosh/http-client": "^2.4.8",
53
+ "@pushwoosh/rpc-v2-http-api-data": "^0.1.398",
59
54
  "rxjs": "^7.5.2",
60
55
  "tslib": "^2.3.1"
61
56
  },
@@ -63,5 +58,5 @@
63
58
  "node": ">=16.0.0",
64
59
  "npm": ">=7.0.0"
65
60
  },
66
- "version": "2.4.1"
61
+ "version": "2.5.1"
67
62
  }