@n8n_io/license-sdk 2.18.0 → 2.19.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.
- package/dist/LicenseManager.d.mts +12 -12
- package/dist/LicenseManager.d.ts +12 -12
- package/dist/LicenseManager.js +3 -3
- package/dist/LicenseManager.js.map +1 -1
- package/dist/LicenseManager.mjs +3 -3
- package/dist/LicenseManager.mjs.map +1 -1
- package/dist/_tsup-dts-rollup.d.mts +227 -216
- package/dist/_tsup-dts-rollup.d.ts +227 -216
- package/dist/httpRequest.d.mts +2 -2
- package/dist/httpRequest.d.ts +2 -2
- package/dist/httpRequest.js +1 -1
- package/dist/httpRequest.js.map +1 -1
- package/dist/httpRequest.mjs +1 -1
- package/dist/httpRequest.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,216 +1,227 @@
|
|
|
1
|
-
import { X509Certificate } from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
/** How often
|
|
4
|
-
export declare const AUTORENEWAL_INTERVAL: number;
|
|
5
|
-
|
|
6
|
-
export declare function computeDeviceFingerprint(): Promise<string>;
|
|
7
|
-
|
|
8
|
-
export declare const default_alias: {
|
|
9
|
-
postRequest: typeof postRequest;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export declare function generateCertContainerStr(options?: {}): Promise<string>;
|
|
13
|
-
|
|
14
|
-
export declare function generateTamperedCert(options?: Object): Promise<string>;
|
|
15
|
-
|
|
16
|
-
export declare class LicenseManager {
|
|
17
|
-
config: TLicenseManagerConfig;
|
|
18
|
-
private initializationPromise?;
|
|
19
|
-
private key?;
|
|
20
|
-
private logger;
|
|
21
|
-
protected licenseCert?: TLicenseCertObj;
|
|
22
|
-
private x509Cert?;
|
|
23
|
-
private x509IssuerCert;
|
|
24
|
-
private deviceFingerprint?;
|
|
25
|
-
private renewalTimer?;
|
|
26
|
-
private upcomingEntitlementChangesCheckTimer?;
|
|
27
|
-
private entitlementChangeTimer?;
|
|
28
|
-
private currentFeatures?;
|
|
29
|
-
private isShuttingDown;
|
|
30
|
-
get isInitialized(): boolean;
|
|
31
|
-
constructor(config: TLicenseManagerConfig);
|
|
32
|
-
log(msg: string, logLevel: LogLevel): void;
|
|
33
|
-
initialize(): Promise<void>;
|
|
34
|
-
/** Initializes the license manager */
|
|
35
|
-
private _doInitialization;
|
|
36
|
-
private setupSingleTimer;
|
|
37
|
-
clearSingleTimer(timer: SingleTimer | undefined): void;
|
|
38
|
-
setupRepeatingTimer(callback: () => void, interval: number): RepeatingTimer;
|
|
39
|
-
clearRepeatingTimer(timer: RepeatingTimer | undefined): void;
|
|
40
|
-
private isOlderThan;
|
|
41
|
-
reload(): Promise<void>;
|
|
42
|
-
reset(): Promise<void>;
|
|
43
|
-
computeDeviceFingerprint(): Promise<string>;
|
|
44
|
-
activate(reservationId: string): Promise<void>;
|
|
45
|
-
renew(): Promise<void>;
|
|
46
|
-
_renew({ detachFloatingEntitlements, cause, }?: {
|
|
47
|
-
detachFloatingEntitlements?: Boolean;
|
|
48
|
-
cause?: 'startup' | 'shutdown' | 'request' | 'auto' | 'unknown';
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
private hasCert;
|
|
51
|
-
isTerminated(): boolean;
|
|
52
|
-
getExpiryDate(): Date;
|
|
53
|
-
getTerminationDate(): Date;
|
|
54
|
-
isValid(useLogger?: boolean): boolean;
|
|
55
|
-
hasFeatureEnabled(feature: string, requireValidCert?: boolean): boolean;
|
|
56
|
-
hasFeatureDefined(feature: string, requireValidCert?: boolean): boolean;
|
|
57
|
-
hasQuotaLeft(quotaFeatureName: string, currentConsumption: number): boolean;
|
|
58
|
-
getFeatureValue(feature: string, requireValidCert?: boolean): undefined | boolean | number | string;
|
|
59
|
-
private updateCurrentFeatures;
|
|
60
|
-
getFeatures(): TFeatures;
|
|
61
|
-
getCurrentEntitlements(): TEntitlement[];
|
|
62
|
-
getManagementJwt(): string;
|
|
63
|
-
getCertStr(): Promise<TLicenseBlock>;
|
|
64
|
-
getConsumerId(): string | undefined;
|
|
65
|
-
isRenewalDue(): boolean;
|
|
66
|
-
private formatDuration;
|
|
67
|
-
toString(): string;
|
|
68
|
-
private triggerOnFeatureChangeCallback;
|
|
69
|
-
private setTimerForNextEntitlementChange;
|
|
70
|
-
private renewalCron;
|
|
71
|
-
private initCert;
|
|
72
|
-
private stringifyCertContainer;
|
|
73
|
-
private parseLicenseCertContainerStr;
|
|
74
|
-
private parseLicenseKeyStr;
|
|
75
|
-
private validateLicenseKey;
|
|
76
|
-
getIssuerCert(): X509Certificate;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
*
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export declare type
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export declare type
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export {
|
|
1
|
+
import { X509Certificate } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
/** How often to consider periodic license renewal (in ms) */
|
|
4
|
+
export declare const AUTORENEWAL_INTERVAL: number;
|
|
5
|
+
|
|
6
|
+
export declare function computeDeviceFingerprint(): Promise<string>;
|
|
7
|
+
|
|
8
|
+
export declare const default_alias: {
|
|
9
|
+
postRequest: typeof postRequest;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export declare function generateCertContainerStr(options?: {}): Promise<string>;
|
|
13
|
+
|
|
14
|
+
export declare function generateTamperedCert(options?: Object): Promise<string>;
|
|
15
|
+
|
|
16
|
+
export declare class LicenseManager {
|
|
17
|
+
config: TLicenseManagerConfig;
|
|
18
|
+
private initializationPromise?;
|
|
19
|
+
private key?;
|
|
20
|
+
private logger;
|
|
21
|
+
protected licenseCert?: TLicenseCertObj;
|
|
22
|
+
private x509Cert?;
|
|
23
|
+
private x509IssuerCert;
|
|
24
|
+
private deviceFingerprint?;
|
|
25
|
+
private renewalTimer?;
|
|
26
|
+
private upcomingEntitlementChangesCheckTimer?;
|
|
27
|
+
private entitlementChangeTimer?;
|
|
28
|
+
private currentFeatures?;
|
|
29
|
+
private isShuttingDown;
|
|
30
|
+
get isInitialized(): boolean;
|
|
31
|
+
constructor(config: TLicenseManagerConfig);
|
|
32
|
+
log(msg: string, logLevel: LogLevel): void;
|
|
33
|
+
initialize(): Promise<void>;
|
|
34
|
+
/** Initializes the license manager */
|
|
35
|
+
private _doInitialization;
|
|
36
|
+
private setupSingleTimer;
|
|
37
|
+
clearSingleTimer(timer: SingleTimer | undefined): void;
|
|
38
|
+
setupRepeatingTimer(callback: () => void, interval: number): RepeatingTimer;
|
|
39
|
+
clearRepeatingTimer(timer: RepeatingTimer | undefined): void;
|
|
40
|
+
private isOlderThan;
|
|
41
|
+
reload(): Promise<void>;
|
|
42
|
+
reset(): Promise<void>;
|
|
43
|
+
computeDeviceFingerprint(): Promise<string>;
|
|
44
|
+
activate(reservationId: string): Promise<void>;
|
|
45
|
+
renew(): Promise<void>;
|
|
46
|
+
_renew({ detachFloatingEntitlements, cause, }?: {
|
|
47
|
+
detachFloatingEntitlements?: Boolean;
|
|
48
|
+
cause?: 'startup' | 'shutdown' | 'request' | 'auto' | 'unknown';
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
private hasCert;
|
|
51
|
+
isTerminated(): boolean;
|
|
52
|
+
getExpiryDate(): Date;
|
|
53
|
+
getTerminationDate(): Date;
|
|
54
|
+
isValid(useLogger?: boolean): boolean;
|
|
55
|
+
hasFeatureEnabled(feature: string, requireValidCert?: boolean): boolean;
|
|
56
|
+
hasFeatureDefined(feature: string, requireValidCert?: boolean): boolean;
|
|
57
|
+
hasQuotaLeft(quotaFeatureName: string, currentConsumption: number): boolean;
|
|
58
|
+
getFeatureValue(feature: string, requireValidCert?: boolean): undefined | boolean | number | string;
|
|
59
|
+
private updateCurrentFeatures;
|
|
60
|
+
getFeatures(): TFeatures;
|
|
61
|
+
getCurrentEntitlements(): TEntitlement[];
|
|
62
|
+
getManagementJwt(): string;
|
|
63
|
+
getCertStr(): Promise<TLicenseBlock>;
|
|
64
|
+
getConsumerId(): string | undefined;
|
|
65
|
+
isRenewalDue(): boolean;
|
|
66
|
+
private formatDuration;
|
|
67
|
+
toString(): string;
|
|
68
|
+
private triggerOnFeatureChangeCallback;
|
|
69
|
+
private setTimerForNextEntitlementChange;
|
|
70
|
+
private renewalCron;
|
|
71
|
+
private initCert;
|
|
72
|
+
private stringifyCertContainer;
|
|
73
|
+
private parseLicenseCertContainerStr;
|
|
74
|
+
private parseLicenseKeyStr;
|
|
75
|
+
private validateLicenseKey;
|
|
76
|
+
getIssuerCert(): X509Certificate;
|
|
77
|
+
/**
|
|
78
|
+
* Detaches any floating entitlements and clears the local license cert.
|
|
79
|
+
*/
|
|
80
|
+
clear(): Promise<void>;
|
|
81
|
+
shutdown(): Promise<void>;
|
|
82
|
+
private detachFloatingEntitlements;
|
|
83
|
+
/** Enable renewing the license periodically. */
|
|
84
|
+
enableAutoRenewals(): void;
|
|
85
|
+
/** Disable renewing the license periodically. */
|
|
86
|
+
disableAutoRenewals(): void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare function licenseManagerFactory(config?: {}): LicenseManager;
|
|
90
|
+
|
|
91
|
+
declare const enum LogLevel {
|
|
92
|
+
ERROR = "error",
|
|
93
|
+
WARN = "warn",
|
|
94
|
+
INFO = "info",
|
|
95
|
+
DEBUG = "debug"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare function makeEntitlement({ validFrom, validTo, features, featureOverrides, productId, isFloatable, }: {
|
|
99
|
+
validFrom?: Date;
|
|
100
|
+
validTo?: Date;
|
|
101
|
+
features?: TFeatures;
|
|
102
|
+
featureOverrides?: TFeatures;
|
|
103
|
+
productId?: string;
|
|
104
|
+
isFloatable?: boolean;
|
|
105
|
+
}): {
|
|
106
|
+
id: string;
|
|
107
|
+
productId: string;
|
|
108
|
+
productMetadata: {
|
|
109
|
+
metadataKey1: string;
|
|
110
|
+
};
|
|
111
|
+
features: TFeatures;
|
|
112
|
+
featureOverrides: TFeatures;
|
|
113
|
+
validFrom: Date;
|
|
114
|
+
validTo: Date;
|
|
115
|
+
isFloatable: boolean;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export declare function makeRelativeDate(offsetInMinutes: number): Date;
|
|
119
|
+
|
|
120
|
+
export declare function postRequest<T>(url: string, data: Record<string, unknown>, options?: {
|
|
121
|
+
timeoutInMs?: number;
|
|
122
|
+
productIdentifier?: string;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
status: number;
|
|
125
|
+
data: T;
|
|
126
|
+
}>;
|
|
127
|
+
|
|
128
|
+
declare type RepeatingTimer = NodeJS.Timeout;
|
|
129
|
+
|
|
130
|
+
export declare const SDK_VERSION = "2.19.1";
|
|
131
|
+
|
|
132
|
+
declare type SingleTimer = NodeJS.Timeout;
|
|
133
|
+
|
|
134
|
+
export declare type TEntitlement = {
|
|
135
|
+
id: string;
|
|
136
|
+
productId: string;
|
|
137
|
+
productMetadata: TMetadata;
|
|
138
|
+
features: TFeatures;
|
|
139
|
+
featureOverrides: TFeatures;
|
|
140
|
+
validFrom: Date;
|
|
141
|
+
validTo: Date;
|
|
142
|
+
isFloatable: boolean;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export declare type TFeatures = {
|
|
146
|
+
[key: string]: boolean | number | string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export declare type TLicenseBlock = string;
|
|
150
|
+
|
|
151
|
+
export declare type TLicenseCertObj = {
|
|
152
|
+
consumerId: string;
|
|
153
|
+
consumerRef?: string;
|
|
154
|
+
version: number;
|
|
155
|
+
tenantId: number;
|
|
156
|
+
renewalToken: string;
|
|
157
|
+
deviceLock: boolean;
|
|
158
|
+
deviceFingerprint: string;
|
|
159
|
+
createdAt: Date;
|
|
160
|
+
issuedAt: Date;
|
|
161
|
+
expiresAt: Date;
|
|
162
|
+
terminatesAt: Date;
|
|
163
|
+
entitlements: TEntitlement[];
|
|
164
|
+
/**
|
|
165
|
+
* Indicates the number of floating entitlements that are not attached to the consumer
|
|
166
|
+
* because they are in use elsewhere at the time of renewal.
|
|
167
|
+
*/
|
|
168
|
+
detachedEntitlementsCount: number;
|
|
169
|
+
managementJwt: string;
|
|
170
|
+
/**
|
|
171
|
+
* Specifies whether the license is ephemeral and therefore does not have corresponding entries in the license server DB.
|
|
172
|
+
*/
|
|
173
|
+
isEphemeral: boolean;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export declare type TLicenseContainer = {
|
|
177
|
+
licenseKey: string;
|
|
178
|
+
x509: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export declare type TLicenseManagerConfig = {
|
|
182
|
+
server?: string;
|
|
183
|
+
tenantId: number;
|
|
184
|
+
productIdentifier: string;
|
|
185
|
+
/**
|
|
186
|
+
* Whether to renew the license periodically.
|
|
187
|
+
*
|
|
188
|
+
* @default true
|
|
189
|
+
*/
|
|
190
|
+
autoRenewEnabled?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Whether to return any floatable entitlements to the pool on SDK shutdown.
|
|
193
|
+
*
|
|
194
|
+
* @default true
|
|
195
|
+
*/
|
|
196
|
+
detachFloatingOnShutdown?: boolean;
|
|
197
|
+
offlineMode?: boolean;
|
|
198
|
+
renewOnInit?: boolean;
|
|
199
|
+
autoRenewOffset?: number;
|
|
200
|
+
loadCertStr: () => Promise<TLicenseBlock>;
|
|
201
|
+
saveCertStr: (cert: TLicenseBlock) => Promise<void>;
|
|
202
|
+
collectUsageMetrics?: () => Promise<Array<TUsageMetric>>;
|
|
203
|
+
collectPassthroughData?: () => Promise<TPassthroughData>;
|
|
204
|
+
deviceFingerprint?: () => string | Promise<string>;
|
|
205
|
+
onFeatureChange?: (features: TFeatures) => any;
|
|
206
|
+
logger?: TLogger;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export declare type TLogger = {
|
|
210
|
+
error: Function;
|
|
211
|
+
warn: Function;
|
|
212
|
+
info: Function;
|
|
213
|
+
debug: Function;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export declare type TMetadata = {
|
|
217
|
+
[key: string]: boolean | number | string | Array<any> | {};
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export declare type TPassthroughData = Record<string, unknown>;
|
|
221
|
+
|
|
222
|
+
export declare type TUsageMetric = {
|
|
223
|
+
name: string;
|
|
224
|
+
value: number;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export { }
|