-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchedPryv.ts
More file actions
44 lines (40 loc) · 1.92 KB
/
patchedPryv.ts
File metadata and controls
44 lines (40 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* CJS→ESM interop for the pryv package with plugin patching.
*
* Default import gives the module.exports object directly (Connection, Auth, etc.).
* We re-export both the runtime value AND a merged type namespace so that consumers
* can use `pryv.Connection` as both a constructor and a type annotation.
*/
import _pryv from 'pryv';
import type * as _PryvTypes from 'pryv';
import monitor from '@pryv/monitor';
import socketIo from '@pryv/socket.io';
import * as _cmc from '@pryv/cmc';
// @ts-expect-error CJS plugin pattern: module.exports = function(pryv) { ... }
monitor(_pryv);
// @ts-expect-error CJS plugin pattern: module.exports = function(pryv) { ... }
socketIo(_pryv);
// Declaration merging: the exported `pryv` const provides the runtime value,
// and the namespace augments it with all the types from pryv's .d.ts.
// This lets consumers write both `new pryv.Connection(...)` and `x: pryv.Connection`.
// eslint-disable-next-line import-x/export -- declaration merging: value + type namespace
export const pryv = _pryv as unknown as typeof _PryvTypes;
// eslint-disable-next-line @typescript-eslint/no-namespace, import-x/export -- declaration merging
export namespace pryv {
export type Connection = _PryvTypes.Connection;
export type Service = _PryvTypes.Service;
export type Stream = _PryvTypes.Stream;
export type Event = _PryvTypes.Event;
export type APICall = _PryvTypes.APICall;
export type AccessInfo = _PryvTypes.AccessInfo;
export type Access = _PryvTypes.Access;
export type Permission = _PryvTypes.Permission;
export type ServiceInfo = _PryvTypes.ServiceInfo;
export type ServiceAssets = _PryvTypes.ServiceAssets;
export type AuthController = _PryvTypes.AuthController;
export type AuthSettings = _PryvTypes.AuthSettings;
export type ItemDeletion = _PryvTypes.ItemDeletion;
export type PryvError = _PryvTypes.PryvError;
export type KeyValue = _PryvTypes.KeyValue;
}
export const cmc = _cmc;