@sockethub/server 5.0.0-beta.1 → 5.0.0-beta.2
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/connection-scope.d.ts +1 -0
- package/dist/index.js +164 -57
- package/dist/platform-instance.d.ts +4 -1
- package/dist/platform.js +37 -7
- package/dist/process-manager.d.ts +11 -0
- package/package.json +19 -16
- package/res/sockethub-client.js +15 -15
|
@@ -58,6 +58,7 @@ export declare function beginCredentialScope(sessionId: string, platform: string
|
|
|
58
58
|
/** Drops a session's scopes. Called when the session ends. */
|
|
59
59
|
export declare function clearSessionScopes(sessionId: string): void;
|
|
60
60
|
export interface ScopeRequest {
|
|
61
|
+
shareConnections?: boolean;
|
|
61
62
|
/**
|
|
62
63
|
* Session the credentials were submitted under. Over a socket this is the
|
|
63
64
|
* socket id; over HTTP it is the request's single-use session, which is
|
package/dist/index.js
CHANGED
|
@@ -11057,7 +11057,7 @@ var init_package = __esm(() => {
|
|
|
11057
11057
|
package_default = {
|
|
11058
11058
|
name: "@sockethub/schemas",
|
|
11059
11059
|
description: "JSON schema files for validating Sockethub Activity Streams",
|
|
11060
|
-
version: "3.0.0-beta.
|
|
11060
|
+
version: "3.0.0-beta.2",
|
|
11061
11061
|
type: "module",
|
|
11062
11062
|
private: false,
|
|
11063
11063
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
@@ -11127,7 +11127,7 @@ var init_package = __esm(() => {
|
|
|
11127
11127
|
"ajv-formats": "^2.1.1",
|
|
11128
11128
|
"ajv-formats-draft2019": "^1.6.1"
|
|
11129
11129
|
},
|
|
11130
|
-
gitHead: "
|
|
11130
|
+
gitHead: "1f74d4e07311496f0acc021855137bc197d79eab",
|
|
11131
11131
|
types: "./dist/index.d.ts"
|
|
11132
11132
|
};
|
|
11133
11133
|
});
|
|
@@ -11236,8 +11236,11 @@ var init_sockethub_config = __esm(() => {
|
|
|
11236
11236
|
"@sockethub/platform-caldav",
|
|
11237
11237
|
"@sockethub/platform-dummy",
|
|
11238
11238
|
"@sockethub/platform-feeds",
|
|
11239
|
+
"@sockethub/platform-email",
|
|
11239
11240
|
"@sockethub/platform-irc",
|
|
11240
11241
|
"@sockethub/platform-metadata",
|
|
11242
|
+
"@sockethub/platform-messenger",
|
|
11243
|
+
"@sockethub/platform-instagram",
|
|
11241
11244
|
"@sockethub/platform-xmpp"
|
|
11242
11245
|
]
|
|
11243
11246
|
},
|
|
@@ -11253,7 +11256,8 @@ var init_sockethub_config = __esm(() => {
|
|
|
11253
11256
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
11254
11257
|
allowPrivateAddresses: { type: "boolean" },
|
|
11255
11258
|
allowInsecureHttp: { type: "boolean" },
|
|
11256
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
11259
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
11260
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
11257
11261
|
}
|
|
11258
11262
|
},
|
|
11259
11263
|
"@sockethub/platform-caldav": {
|
|
@@ -11263,7 +11267,20 @@ var init_sockethub_config = __esm(() => {
|
|
|
11263
11267
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
11264
11268
|
allowPrivateAddresses: { type: "boolean" },
|
|
11265
11269
|
allowInsecureHttp: { type: "boolean" },
|
|
11266
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
11270
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
11271
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
11272
|
+
}
|
|
11273
|
+
},
|
|
11274
|
+
"@sockethub/platform-email": {
|
|
11275
|
+
type: "object",
|
|
11276
|
+
additionalProperties: false,
|
|
11277
|
+
properties: {
|
|
11278
|
+
connectTimeoutMs: {
|
|
11279
|
+
type: "integer",
|
|
11280
|
+
minimum: 5000,
|
|
11281
|
+
maximum: 120000
|
|
11282
|
+
},
|
|
11283
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
11267
11284
|
}
|
|
11268
11285
|
},
|
|
11269
11286
|
"@sockethub/platform-dummy": {
|
|
@@ -11286,7 +11303,8 @@ var init_sockethub_config = __esm(() => {
|
|
|
11286
11303
|
type: "object",
|
|
11287
11304
|
additionalProperties: false,
|
|
11288
11305
|
properties: {
|
|
11289
|
-
connectTimeoutMs: { type: "number" }
|
|
11306
|
+
connectTimeoutMs: { type: "number" },
|
|
11307
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
11290
11308
|
}
|
|
11291
11309
|
},
|
|
11292
11310
|
"@sockethub/platform-xmpp": {
|
|
@@ -11396,6 +11414,12 @@ var init_sockethub_config = __esm(() => {
|
|
|
11396
11414
|
default: 20,
|
|
11397
11415
|
description: "Maximum persistent instances per client IP, including HTTP actions. 0 disables the cap."
|
|
11398
11416
|
},
|
|
11417
|
+
maxStartsPerIpPerMinute: {
|
|
11418
|
+
type: "integer",
|
|
11419
|
+
minimum: 0,
|
|
11420
|
+
default: 60,
|
|
11421
|
+
description: "Maximum new persistent instances a client IP may start per minute, " + "including HTTP actions. Bounds fork/teardown churn that the " + "concurrent caps allow. Reusing a running instance does not count. " + "0 disables the cap."
|
|
11422
|
+
},
|
|
11399
11423
|
maxPlatformInstances: {
|
|
11400
11424
|
type: "number",
|
|
11401
11425
|
minimum: 0,
|
|
@@ -27650,9 +27674,8 @@ function addPlatformSchema(schema, platform_type) {
|
|
|
27650
27674
|
return;
|
|
27651
27675
|
}
|
|
27652
27676
|
const schemaRef = `${schemaURL}/context/${platform_type}`;
|
|
27653
|
-
|
|
27654
|
-
|
|
27655
|
-
}
|
|
27677
|
+
instance.removeSchema(schemaRef);
|
|
27678
|
+
instance.addSchema(schema, schemaRef);
|
|
27656
27679
|
}
|
|
27657
27680
|
function addPlatformContext(platformId, platformContextUrl) {
|
|
27658
27681
|
registerPlatformContext(platformId, platformContextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
|
|
@@ -30000,6 +30023,7 @@ var init_config_schema = __esm(() => {
|
|
|
30000
30023
|
"rateLimiter.maxConnectionsPerIp": { format: "nat" },
|
|
30001
30024
|
"limits.maxInstancesPerSession": { format: "nat" },
|
|
30002
30025
|
"limits.maxInstancesPerIp": { format: "nat" },
|
|
30026
|
+
"limits.maxStartsPerIpPerMinute": { format: "nat" },
|
|
30003
30027
|
"limits.maxPlatformInstances": { format: "nat" },
|
|
30004
30028
|
"credentials.ttlMs": {
|
|
30005
30029
|
format: "nat",
|
|
@@ -99068,7 +99092,7 @@ var require_package2 = __commonJS(function(exports, module) {
|
|
|
99068
99092
|
module.exports = {
|
|
99069
99093
|
name: "@sockethub/server",
|
|
99070
99094
|
description: "A polyglot messaging service, server libraries",
|
|
99071
|
-
version: "5.0.0-beta.
|
|
99095
|
+
version: "5.0.0-beta.2",
|
|
99072
99096
|
type: "module",
|
|
99073
99097
|
private: false,
|
|
99074
99098
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
@@ -99093,7 +99117,7 @@ var require_package2 = __commonJS(function(exports, module) {
|
|
|
99093
99117
|
bin: "bin/sockethub",
|
|
99094
99118
|
preferGlobal: true,
|
|
99095
99119
|
engines: {
|
|
99096
|
-
node: ">=20"
|
|
99120
|
+
node: ">=20.19"
|
|
99097
99121
|
},
|
|
99098
99122
|
keywords: [
|
|
99099
99123
|
"sockethub",
|
|
@@ -99120,11 +99144,11 @@ var require_package2 = __commonJS(function(exports, module) {
|
|
|
99120
99144
|
dependencies: {
|
|
99121
99145
|
"@sentry/node": "^10.36.0",
|
|
99122
99146
|
"@sentry/profiling-node": "10.36.0",
|
|
99123
|
-
"@sockethub/client": "^5.0.0-beta.
|
|
99124
|
-
"@sockethub/data-layer": "^1.0.0-beta.
|
|
99125
|
-
"@sockethub/logger": "^1.0.0-beta.
|
|
99126
|
-
"@sockethub/schemas": "^3.0.0-beta.
|
|
99127
|
-
"@sockethub/util": "^1.0.0-beta.
|
|
99147
|
+
"@sockethub/client": "^5.0.0-beta.2",
|
|
99148
|
+
"@sockethub/data-layer": "^1.0.0-beta.2",
|
|
99149
|
+
"@sockethub/logger": "^1.0.0-beta.2",
|
|
99150
|
+
"@sockethub/schemas": "^3.0.0-beta.2",
|
|
99151
|
+
"@sockethub/util": "^1.0.0-beta.2",
|
|
99128
99152
|
chalk: "^5.6.2",
|
|
99129
99153
|
convict: "^6.2.5",
|
|
99130
99154
|
debug: "^4.4.3",
|
|
@@ -99158,16 +99182,19 @@ var require_package2 = __commonJS(function(exports, module) {
|
|
|
99158
99182
|
"web-streams-polyfill": "^3.3.3"
|
|
99159
99183
|
},
|
|
99160
99184
|
optionalDependencies: {
|
|
99161
|
-
"@sockethub/examples": "^1.0.0-beta.
|
|
99162
|
-
"@sockethub/platform-caldav": "^1.0.0-beta.
|
|
99163
|
-
"@sockethub/platform-carddav": "^1.0.0-beta.
|
|
99164
|
-
"@sockethub/platform-dummy": "^3.0.0-beta.
|
|
99165
|
-
"@sockethub/platform-
|
|
99166
|
-
"@sockethub/platform-
|
|
99167
|
-
"@sockethub/platform-
|
|
99168
|
-
"@sockethub/platform-
|
|
99169
|
-
|
|
99170
|
-
|
|
99185
|
+
"@sockethub/examples": "^1.0.0-beta.2",
|
|
99186
|
+
"@sockethub/platform-caldav": "^1.0.0-beta.2",
|
|
99187
|
+
"@sockethub/platform-carddav": "^1.0.0-beta.2",
|
|
99188
|
+
"@sockethub/platform-dummy": "^3.0.0-beta.2",
|
|
99189
|
+
"@sockethub/platform-email": "^1.0.0-beta.2",
|
|
99190
|
+
"@sockethub/platform-feeds": "^4.0.0-beta.2",
|
|
99191
|
+
"@sockethub/platform-instagram": "^1.0.0-beta.2",
|
|
99192
|
+
"@sockethub/platform-irc": "^4.0.0-beta.2",
|
|
99193
|
+
"@sockethub/platform-messenger": "^1.0.0-beta.2",
|
|
99194
|
+
"@sockethub/platform-metadata": "^1.0.1-beta.2",
|
|
99195
|
+
"@sockethub/platform-xmpp": "^5.0.0-beta.2"
|
|
99196
|
+
},
|
|
99197
|
+
gitHead: "1f74d4e07311496f0acc021855137bc197d79eab",
|
|
99171
99198
|
types: "./dist/index.d.ts"
|
|
99172
99199
|
};
|
|
99173
99200
|
});
|
|
@@ -100111,7 +100138,7 @@ var require_safer = __commonJS(function(exports, module) {
|
|
|
100111
100138
|
module.exports = safer;
|
|
100112
100139
|
});
|
|
100113
100140
|
|
|
100114
|
-
// ../../node_modules/iconv-lite/lib/bom-handling.js
|
|
100141
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/lib/bom-handling.js
|
|
100115
100142
|
var require_bom_handling = __commonJS(function(exports) {
|
|
100116
100143
|
var BOMChar = "\uFEFF";
|
|
100117
100144
|
exports.PrependBOM = PrependBOMWrapper;
|
|
@@ -100154,7 +100181,7 @@ var require_bom_handling = __commonJS(function(exports) {
|
|
|
100154
100181
|
};
|
|
100155
100182
|
});
|
|
100156
100183
|
|
|
100157
|
-
// ../../node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
100184
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
100158
100185
|
var require_merge_exports = __commonJS(function(exports, module) {
|
|
100159
100186
|
var hasOwn = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
100160
100187
|
function mergeModules(target, module2) {
|
|
@@ -100167,7 +100194,7 @@ var require_merge_exports = __commonJS(function(exports, module) {
|
|
|
100167
100194
|
module.exports = mergeModules;
|
|
100168
100195
|
});
|
|
100169
100196
|
|
|
100170
|
-
// ../../node_modules/iconv-lite/encodings/internal.js
|
|
100197
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/internal.js
|
|
100171
100198
|
var require_internal = __commonJS(function(exports, module) {
|
|
100172
100199
|
var Buffer2 = require_safer().Buffer;
|
|
100173
100200
|
module.exports = {
|
|
@@ -100340,7 +100367,7 @@ var require_internal = __commonJS(function(exports, module) {
|
|
|
100340
100367
|
};
|
|
100341
100368
|
});
|
|
100342
100369
|
|
|
100343
|
-
// ../../node_modules/iconv-lite/encodings/utf32.js
|
|
100370
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/utf32.js
|
|
100344
100371
|
var require_utf32 = __commonJS(function(exports) {
|
|
100345
100372
|
var Buffer2 = require_safer().Buffer;
|
|
100346
100373
|
exports._utf32 = Utf32Codec;
|
|
@@ -100574,7 +100601,7 @@ var require_utf32 = __commonJS(function(exports) {
|
|
|
100574
100601
|
}
|
|
100575
100602
|
});
|
|
100576
100603
|
|
|
100577
|
-
// ../../node_modules/iconv-lite/encodings/utf16.js
|
|
100604
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/utf16.js
|
|
100578
100605
|
var require_utf16 = __commonJS(function(exports) {
|
|
100579
100606
|
var Buffer2 = require_safer().Buffer;
|
|
100580
100607
|
exports.utf16be = Utf16BECodec;
|
|
@@ -100717,7 +100744,7 @@ var require_utf16 = __commonJS(function(exports) {
|
|
|
100717
100744
|
}
|
|
100718
100745
|
});
|
|
100719
100746
|
|
|
100720
|
-
// ../../node_modules/iconv-lite/encodings/utf7.js
|
|
100747
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/utf7.js
|
|
100721
100748
|
var require_utf7 = __commonJS(function(exports) {
|
|
100722
100749
|
var Buffer2 = require_safer().Buffer;
|
|
100723
100750
|
exports.utf7 = Utf7Codec;
|
|
@@ -100931,7 +100958,7 @@ var require_utf7 = __commonJS(function(exports) {
|
|
|
100931
100958
|
};
|
|
100932
100959
|
});
|
|
100933
100960
|
|
|
100934
|
-
// ../../node_modules/iconv-lite/encodings/sbcs-codec.js
|
|
100961
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-codec.js
|
|
100935
100962
|
var require_sbcs_codec = __commonJS(function(exports) {
|
|
100936
100963
|
var Buffer2 = require_safer().Buffer;
|
|
100937
100964
|
exports._sbcs = SBCSCodec;
|
|
@@ -100988,7 +101015,7 @@ var require_sbcs_codec = __commonJS(function(exports) {
|
|
|
100988
101015
|
SBCSDecoder.prototype.end = function() {};
|
|
100989
101016
|
});
|
|
100990
101017
|
|
|
100991
|
-
// ../../node_modules/iconv-lite/encodings/sbcs-data.js
|
|
101018
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data.js
|
|
100992
101019
|
var require_sbcs_data = __commonJS(function(exports, module) {
|
|
100993
101020
|
module.exports = {
|
|
100994
101021
|
10029: "maccenteuro",
|
|
@@ -101136,7 +101163,7 @@ var require_sbcs_data = __commonJS(function(exports, module) {
|
|
|
101136
101163
|
};
|
|
101137
101164
|
});
|
|
101138
101165
|
|
|
101139
|
-
// ../../node_modules/iconv-lite/encodings/sbcs-data-generated.js
|
|
101166
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data-generated.js
|
|
101140
101167
|
var require_sbcs_data_generated = __commonJS(function(exports, module) {
|
|
101141
101168
|
module.exports = {
|
|
101142
101169
|
"437": "cp437",
|
|
@@ -101593,7 +101620,7 @@ var require_sbcs_data_generated = __commonJS(function(exports, module) {
|
|
|
101593
101620
|
};
|
|
101594
101621
|
});
|
|
101595
101622
|
|
|
101596
|
-
// ../../node_modules/iconv-lite/encodings/dbcs-codec.js
|
|
101623
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-codec.js
|
|
101597
101624
|
var require_dbcs_codec = __commonJS(function(exports) {
|
|
101598
101625
|
var Buffer2 = require_safer().Buffer;
|
|
101599
101626
|
exports._dbcs = DBCSCodec;
|
|
@@ -102051,7 +102078,7 @@ var require_dbcs_codec = __commonJS(function(exports) {
|
|
|
102051
102078
|
}
|
|
102052
102079
|
});
|
|
102053
102080
|
|
|
102054
|
-
// ../../node_modules/iconv-lite/encodings/tables/shiftjis.json
|
|
102081
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/shiftjis.json
|
|
102055
102082
|
var require_shiftjis = __commonJS(function(exports, module) {
|
|
102056
102083
|
module.exports = [
|
|
102057
102084
|
["0", "\x00", 128],
|
|
@@ -102180,7 +102207,7 @@ var require_shiftjis = __commonJS(function(exports, module) {
|
|
|
102180
102207
|
];
|
|
102181
102208
|
});
|
|
102182
102209
|
|
|
102183
|
-
// ../../node_modules/iconv-lite/encodings/tables/eucjp.json
|
|
102210
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/eucjp.json
|
|
102184
102211
|
var require_eucjp = __commonJS(function(exports, module) {
|
|
102185
102212
|
module.exports = [
|
|
102186
102213
|
["0", "\x00", 127],
|
|
@@ -102366,7 +102393,7 @@ var require_eucjp = __commonJS(function(exports, module) {
|
|
|
102366
102393
|
];
|
|
102367
102394
|
});
|
|
102368
102395
|
|
|
102369
|
-
// ../../node_modules/iconv-lite/encodings/tables/cp936.json
|
|
102396
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp936.json
|
|
102370
102397
|
var require_cp936 = __commonJS(function(exports, module) {
|
|
102371
102398
|
module.exports = [
|
|
102372
102399
|
["0", "\x00", 127, "€"],
|
|
@@ -102634,7 +102661,7 @@ var require_cp936 = __commonJS(function(exports, module) {
|
|
|
102634
102661
|
];
|
|
102635
102662
|
});
|
|
102636
102663
|
|
|
102637
|
-
// ../../node_modules/iconv-lite/encodings/tables/gbk-added.json
|
|
102664
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gbk-added.json
|
|
102638
102665
|
var require_gbk_added = __commonJS(function(exports, module) {
|
|
102639
102666
|
module.exports = [
|
|
102640
102667
|
["a140", "", 62],
|
|
@@ -102694,12 +102721,12 @@ var require_gbk_added = __commonJS(function(exports, module) {
|
|
|
102694
102721
|
];
|
|
102695
102722
|
});
|
|
102696
102723
|
|
|
102697
|
-
// ../../node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
|
|
102724
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
|
|
102698
102725
|
var require_gb18030_ranges = __commonJS(function(exports, module) {
|
|
102699
102726
|
module.exports = { uChars: [128, 165, 169, 178, 184, 216, 226, 235, 238, 244, 248, 251, 253, 258, 276, 284, 300, 325, 329, 334, 364, 463, 465, 467, 469, 471, 473, 475, 477, 506, 594, 610, 712, 716, 730, 930, 938, 962, 970, 1026, 1104, 1106, 8209, 8215, 8218, 8222, 8231, 8241, 8244, 8246, 8252, 8365, 8452, 8454, 8458, 8471, 8482, 8556, 8570, 8596, 8602, 8713, 8720, 8722, 8726, 8731, 8737, 8740, 8742, 8748, 8751, 8760, 8766, 8777, 8781, 8787, 8802, 8808, 8816, 8854, 8858, 8870, 8896, 8979, 9322, 9372, 9548, 9588, 9616, 9622, 9634, 9652, 9662, 9672, 9676, 9680, 9702, 9735, 9738, 9793, 9795, 11906, 11909, 11913, 11917, 11928, 11944, 11947, 11951, 11956, 11960, 11964, 11979, 12284, 12292, 12312, 12319, 12330, 12351, 12436, 12447, 12535, 12543, 12586, 12842, 12850, 12964, 13200, 13215, 13218, 13253, 13263, 13267, 13270, 13384, 13428, 13727, 13839, 13851, 14617, 14703, 14801, 14816, 14964, 15183, 15471, 15585, 16471, 16736, 17208, 17325, 17330, 17374, 17623, 17997, 18018, 18212, 18218, 18301, 18318, 18760, 18811, 18814, 18820, 18823, 18844, 18848, 18872, 19576, 19620, 19738, 19887, 40870, 59244, 59336, 59367, 59413, 59417, 59423, 59431, 59437, 59443, 59452, 59460, 59478, 59493, 63789, 63866, 63894, 63976, 63986, 64016, 64018, 64021, 64025, 64034, 64037, 64042, 65074, 65093, 65107, 65112, 65127, 65132, 65375, 65510, 65536], gbChars: [0, 36, 38, 45, 50, 81, 89, 95, 96, 100, 103, 104, 105, 109, 126, 133, 148, 172, 175, 179, 208, 306, 307, 308, 309, 310, 311, 312, 313, 341, 428, 443, 544, 545, 558, 741, 742, 749, 750, 805, 819, 820, 7922, 7924, 7925, 7927, 7934, 7943, 7944, 7945, 7950, 8062, 8148, 8149, 8152, 8164, 8174, 8236, 8240, 8262, 8264, 8374, 8380, 8381, 8384, 8388, 8390, 8392, 8393, 8394, 8396, 8401, 8406, 8416, 8419, 8424, 8437, 8439, 8445, 8482, 8485, 8496, 8521, 8603, 8936, 8946, 9046, 9050, 9063, 9066, 9076, 9092, 9100, 9108, 9111, 9113, 9131, 9162, 9164, 9218, 9219, 11329, 11331, 11334, 11336, 11346, 11361, 11363, 11366, 11370, 11372, 11375, 11389, 11682, 11686, 11687, 11692, 11694, 11714, 11716, 11723, 11725, 11730, 11736, 11982, 11989, 12102, 12336, 12348, 12350, 12384, 12393, 12395, 12397, 12510, 12553, 12851, 12962, 12973, 13738, 13823, 13919, 13933, 14080, 14298, 14585, 14698, 15583, 15847, 16318, 16434, 16438, 16481, 16729, 17102, 17122, 17315, 17320, 17402, 17418, 17859, 17909, 17911, 17915, 17916, 17936, 17939, 17961, 18664, 18703, 18814, 18962, 19043, 33469, 33470, 33471, 33484, 33485, 33490, 33497, 33501, 33505, 33513, 33520, 33536, 33550, 37845, 37921, 37948, 38029, 38038, 38064, 38065, 38066, 38069, 38075, 38076, 38078, 39108, 39109, 39113, 39114, 39115, 39116, 39265, 39394, 189000] };
|
|
102700
102727
|
});
|
|
102701
102728
|
|
|
102702
|
-
// ../../node_modules/iconv-lite/encodings/tables/cp949.json
|
|
102729
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp949.json
|
|
102703
102730
|
var require_cp949 = __commonJS(function(exports, module) {
|
|
102704
102731
|
module.exports = [
|
|
102705
102732
|
["0", "\x00", 127],
|
|
@@ -102976,7 +103003,7 @@ var require_cp949 = __commonJS(function(exports, module) {
|
|
|
102976
103003
|
];
|
|
102977
103004
|
});
|
|
102978
103005
|
|
|
102979
|
-
// ../../node_modules/iconv-lite/encodings/tables/cp950.json
|
|
103006
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp950.json
|
|
102980
103007
|
var require_cp950 = __commonJS(function(exports, module) {
|
|
102981
103008
|
module.exports = [
|
|
102982
103009
|
["0", "\x00", 127],
|
|
@@ -103157,7 +103184,7 @@ var require_cp950 = __commonJS(function(exports, module) {
|
|
|
103157
103184
|
];
|
|
103158
103185
|
});
|
|
103159
103186
|
|
|
103160
|
-
// ../../node_modules/iconv-lite/encodings/tables/big5-added.json
|
|
103187
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/big5-added.json
|
|
103161
103188
|
var require_big5_added = __commonJS(function(exports, module) {
|
|
103162
103189
|
module.exports = [
|
|
103163
103190
|
["8740", "䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"],
|
|
@@ -103283,7 +103310,7 @@ var require_big5_added = __commonJS(function(exports, module) {
|
|
|
103283
103310
|
];
|
|
103284
103311
|
});
|
|
103285
103312
|
|
|
103286
|
-
// ../../node_modules/iconv-lite/encodings/dbcs-data.js
|
|
103313
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-data.js
|
|
103287
103314
|
var require_dbcs_data = __commonJS(function(exports, module) {
|
|
103288
103315
|
module.exports = {
|
|
103289
103316
|
shiftjis: {
|
|
@@ -103454,7 +103481,7 @@ var require_dbcs_data = __commonJS(function(exports, module) {
|
|
|
103454
103481
|
};
|
|
103455
103482
|
});
|
|
103456
103483
|
|
|
103457
|
-
// ../../node_modules/iconv-lite/encodings/index.js
|
|
103484
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/encodings/index.js
|
|
103458
103485
|
var require_encodings = __commonJS(function(exports, module) {
|
|
103459
103486
|
var mergeModules = require_merge_exports();
|
|
103460
103487
|
var modules = [
|
|
@@ -103476,7 +103503,7 @@ var require_encodings = __commonJS(function(exports, module) {
|
|
|
103476
103503
|
var i;
|
|
103477
103504
|
});
|
|
103478
103505
|
|
|
103479
|
-
// ../../node_modules/iconv-lite/lib/streams.js
|
|
103506
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/lib/streams.js
|
|
103480
103507
|
var require_streams = __commonJS(function(exports, module) {
|
|
103481
103508
|
var Buffer2 = require_safer().Buffer;
|
|
103482
103509
|
module.exports = function(streamModule) {
|
|
@@ -103574,7 +103601,7 @@ var require_streams = __commonJS(function(exports, module) {
|
|
|
103574
103601
|
};
|
|
103575
103602
|
});
|
|
103576
103603
|
|
|
103577
|
-
// ../../node_modules/iconv-lite/lib/index.js
|
|
103604
|
+
// ../../node_modules/express/node_modules/body-parser/node_modules/iconv-lite/lib/index.js
|
|
103578
103605
|
var require_lib6 = __commonJS(function(exports, module) {
|
|
103579
103606
|
var Buffer2 = require_safer().Buffer;
|
|
103580
103607
|
var bomHandling = require_bom_handling();
|
|
@@ -155687,9 +155714,12 @@ function fingerprint(credentials) {
|
|
|
155687
155714
|
if (!object) {
|
|
155688
155715
|
return null;
|
|
155689
155716
|
}
|
|
155690
|
-
const
|
|
155691
|
-
|
|
155692
|
-
|
|
155717
|
+
const hasSecret = [object, object.imap, object.smtp].some((candidate) => {
|
|
155718
|
+
if (!candidate || typeof candidate !== "object")
|
|
155719
|
+
return false;
|
|
155720
|
+
const { password, token } = candidate;
|
|
155721
|
+
return typeof password === "string" && password.length > 0 || typeof token === "string" && token.length > 0;
|
|
155722
|
+
});
|
|
155693
155723
|
if (!hasSecret) {
|
|
155694
155724
|
return null;
|
|
155695
155725
|
}
|
|
@@ -155737,10 +155767,21 @@ async function resolveConnectionScope(platform, actorId, request = {}) {
|
|
|
155737
155767
|
if (pending) {
|
|
155738
155768
|
const resolved = await pending;
|
|
155739
155769
|
if (resolved) {
|
|
155740
|
-
return {
|
|
155770
|
+
return {
|
|
155771
|
+
scope: request.shareConnections === false ? crypto.objectHash({
|
|
155772
|
+
credentials: resolved,
|
|
155773
|
+
session: socketSessionId ?? credentialSessionId
|
|
155774
|
+
}) : resolved
|
|
155775
|
+
};
|
|
155741
155776
|
}
|
|
155742
155777
|
}
|
|
155743
155778
|
}
|
|
155779
|
+
if (request.shareConnections === false) {
|
|
155780
|
+
const session = socketSessionId ?? credentialSessionId;
|
|
155781
|
+
if (!session)
|
|
155782
|
+
throw new Error("session required for private connection");
|
|
155783
|
+
return { scope: crypto.objectHash({ session }) };
|
|
155784
|
+
}
|
|
155744
155785
|
return anonymousScope(platform, actorId, {
|
|
155745
155786
|
credentialSessionId,
|
|
155746
155787
|
socketSessionId,
|
|
@@ -157016,7 +157057,11 @@ class PlatformInstance {
|
|
|
157016
157057
|
heartbeatFailureHandled = false;
|
|
157017
157058
|
replaced = false;
|
|
157018
157059
|
shutdownResult;
|
|
157060
|
+
retirementError;
|
|
157019
157061
|
actor;
|
|
157062
|
+
get actorId() {
|
|
157063
|
+
return this.actor;
|
|
157064
|
+
}
|
|
157020
157065
|
constructor(params) {
|
|
157021
157066
|
this.id = params.identifier;
|
|
157022
157067
|
this.queueId = params.queueId ?? crypto.randId(16);
|
|
@@ -157091,7 +157136,15 @@ class PlatformInstance {
|
|
|
157091
157136
|
this.replaced = true;
|
|
157092
157137
|
this.flaggedForTermination = true;
|
|
157093
157138
|
}
|
|
157094
|
-
shutdown() {
|
|
157139
|
+
shutdown(pendingJobError) {
|
|
157140
|
+
if (pendingJobError && !this.retirementError) {
|
|
157141
|
+
this.retirementError = pendingJobError;
|
|
157142
|
+
const pending = [...this.completedJobHandlers.values()];
|
|
157143
|
+
this.completedJobHandlers.clear();
|
|
157144
|
+
this.completedJobHandlerTimestamps.clear();
|
|
157145
|
+
for (const handler of pending)
|
|
157146
|
+
this.failRetiredJob(handler);
|
|
157147
|
+
}
|
|
157095
157148
|
if (!this.shutdownResult) {
|
|
157096
157149
|
this.shutdownResult = this.teardown();
|
|
157097
157150
|
}
|
|
@@ -157140,10 +157193,26 @@ class PlatformInstance {
|
|
|
157140
157193
|
});
|
|
157141
157194
|
}
|
|
157142
157195
|
registerCompletedJobHandler(title, handler) {
|
|
157196
|
+
if (this.retirementError) {
|
|
157197
|
+
this.failRetiredJob(handler);
|
|
157198
|
+
return;
|
|
157199
|
+
}
|
|
157143
157200
|
this.pruneExpiredJobHandlers();
|
|
157144
157201
|
this.completedJobHandlers.set(title, handler);
|
|
157145
157202
|
this.completedJobHandlerTimestamps.set(title, Date.now());
|
|
157146
157203
|
}
|
|
157204
|
+
failRetiredJob(handler) {
|
|
157205
|
+
try {
|
|
157206
|
+
handler({
|
|
157207
|
+
"@context": buildCanonicalContext(this.contextUrl ?? INTERNAL_PLATFORM_CONTEXT_URL),
|
|
157208
|
+
type: "error",
|
|
157209
|
+
actor: { id: this.actor ?? this.name, type: "service" },
|
|
157210
|
+
error: this.retirementError
|
|
157211
|
+
});
|
|
157212
|
+
} catch (error) {
|
|
157213
|
+
this.log.error(`failed to acknowledge retired job: ${errorMessage(error)}`);
|
|
157214
|
+
}
|
|
157215
|
+
}
|
|
157147
157216
|
takeCompletedJobHandler(title) {
|
|
157148
157217
|
const handler = this.completedJobHandlers.get(title);
|
|
157149
157218
|
if (handler) {
|
|
@@ -157218,6 +157287,8 @@ class PlatformInstance {
|
|
|
157218
157287
|
return payload;
|
|
157219
157288
|
}
|
|
157220
157289
|
async handleJobResult(state, job, result) {
|
|
157290
|
+
if (this.retirementError)
|
|
157291
|
+
return;
|
|
157221
157292
|
let payload = result;
|
|
157222
157293
|
if (state === "failed") {
|
|
157223
157294
|
payload = job.msg;
|
|
@@ -157563,6 +157634,8 @@ class ProcessManager {
|
|
|
157563
157634
|
parentSecret2;
|
|
157564
157635
|
init;
|
|
157565
157636
|
ensureChains = new Map;
|
|
157637
|
+
startsPerIp = new Map;
|
|
157638
|
+
startsWindowBegan = 0;
|
|
157566
157639
|
constructor(parentId, parentSecret1, parentSecret2, init) {
|
|
157567
157640
|
this.parentId = parentId;
|
|
157568
157641
|
this.parentSecret1 = parentSecret1;
|
|
@@ -157574,7 +157647,8 @@ class ProcessManager {
|
|
|
157574
157647
|
const connectionScope = platformDetails.config.persist ? await resolveConnectionScope(platform, actorId, {
|
|
157575
157648
|
credentialSessionId: credentialSessionId ?? sessionId,
|
|
157576
157649
|
socketSessionId: sessionId,
|
|
157577
|
-
sessionIp
|
|
157650
|
+
sessionIp,
|
|
157651
|
+
shareConnections: platformDetails.config.shareConnections
|
|
157578
157652
|
}) : undefined;
|
|
157579
157653
|
const pi = platformDetails.config.persist ? await this.ensureProcess(platform, sessionId, actorId, sessionIp, connectionScope) : await this.ensureProcess(platform);
|
|
157580
157654
|
pi.config = platformDetails.config;
|
|
@@ -157605,23 +157679,38 @@ class ProcessManager {
|
|
|
157605
157679
|
}
|
|
157606
157680
|
ensureProcess(platform, sessionId, actor, sessionIp, connectionScope) {
|
|
157607
157681
|
const identifier = getPlatformId(platform, actor, connectionScope?.scope);
|
|
157608
|
-
const
|
|
157682
|
+
const platformConfig = this.init.platforms.get(platform).config;
|
|
157683
|
+
const privateSession = platformConfig.persist && platformConfig.shareConnections === false && sessionId;
|
|
157684
|
+
const chainKey = privateSession ? JSON.stringify([platform, actor, sessionId]) : identifier;
|
|
157685
|
+
const prior = this.ensureChains.get(chainKey) ?? Promise.resolve();
|
|
157609
157686
|
const run = prior.then(() => this.ensureProcessNow(identifier, platform, sessionId, actor, sessionIp, connectionScope));
|
|
157610
157687
|
const settled = run.then(() => {
|
|
157611
157688
|
return;
|
|
157612
157689
|
}, () => {
|
|
157613
157690
|
return;
|
|
157614
157691
|
});
|
|
157615
|
-
this.ensureChains.set(
|
|
157692
|
+
this.ensureChains.set(chainKey, settled);
|
|
157616
157693
|
settled.then(() => {
|
|
157617
|
-
if (this.ensureChains.get(
|
|
157618
|
-
this.ensureChains.delete(
|
|
157694
|
+
if (this.ensureChains.get(chainKey) === settled) {
|
|
157695
|
+
this.ensureChains.delete(chainKey);
|
|
157619
157696
|
}
|
|
157620
157697
|
});
|
|
157621
157698
|
return run;
|
|
157622
157699
|
}
|
|
157623
157700
|
async ensureProcessNow(identifier, platform, sessionId, actor, sessionIp, connectionScope) {
|
|
157701
|
+
const platformConfig = this.init.platforms.get(platform).config;
|
|
157624
157702
|
const existing = platformInstances.get(identifier);
|
|
157703
|
+
if (actor !== undefined && !(existing && this.isProcessAlive(existing)))
|
|
157704
|
+
this.assertStartRate(sessionIp, false);
|
|
157705
|
+
if (platformConfig.persist && platformConfig.shareConnections === false && sessionId) {
|
|
157706
|
+
for (const previous of platformInstances.values()) {
|
|
157707
|
+
if (previous.id === identifier || previous.name !== platform || previous.actorId !== actor || !previous.sessions.has(sessionId))
|
|
157708
|
+
continue;
|
|
157709
|
+
previous.deregisterSession(sessionId);
|
|
157710
|
+
if (!previous.sessions.size)
|
|
157711
|
+
await previous.shutdown("credentials replaced; pending operation interrupted; message submission may already have succeeded; do not automatically retry sends");
|
|
157712
|
+
}
|
|
157713
|
+
}
|
|
157625
157714
|
const reusable = existing && this.isProcessAlive(existing);
|
|
157626
157715
|
this.assertInstanceCapacity(platform, identifier, actor === undefined, sessionId, sessionIp, !!reusable);
|
|
157627
157716
|
let inheritedQueueId;
|
|
@@ -157631,6 +157720,8 @@ class ProcessManager {
|
|
|
157631
157720
|
await existing.shutdown();
|
|
157632
157721
|
this.assertInstanceCapacity(platform, identifier, actor === undefined, sessionId, sessionIp, !!reusable);
|
|
157633
157722
|
}
|
|
157723
|
+
if (!reusable && actor !== undefined)
|
|
157724
|
+
this.assertStartRate(sessionIp, true);
|
|
157634
157725
|
const platformInstance = reusable ? existing : this.createPlatformInstance(identifier, platform, actor, connectionScope?.scope, inheritedQueueId);
|
|
157635
157726
|
if (sessionIp && !platformInstance.global) {
|
|
157636
157727
|
platformInstance.ownerIps.add(sessionIp);
|
|
@@ -157661,6 +157752,22 @@ class ProcessManager {
|
|
|
157661
157752
|
throw new Error(`per-address platform instance limit reached (${perIp})`);
|
|
157662
157753
|
}
|
|
157663
157754
|
}
|
|
157755
|
+
assertStartRate(sessionIp, charge) {
|
|
157756
|
+
const max = Number(config_default.get("limits:maxStartsPerIpPerMinute") ?? 0);
|
|
157757
|
+
if (!(max > 0) || !sessionIp)
|
|
157758
|
+
return;
|
|
157759
|
+
const now = Date.now();
|
|
157760
|
+
if (now - this.startsWindowBegan >= 60000) {
|
|
157761
|
+
this.startsPerIp.clear();
|
|
157762
|
+
this.startsWindowBegan = now;
|
|
157763
|
+
}
|
|
157764
|
+
const starts = this.startsPerIp.get(sessionIp) ?? 0;
|
|
157765
|
+
if (starts >= max) {
|
|
157766
|
+
throw new Error(`per-address platform start rate limit reached (${max} per minute)`);
|
|
157767
|
+
}
|
|
157768
|
+
if (charge)
|
|
157769
|
+
this.startsPerIp.set(sessionIp, starts + 1);
|
|
157770
|
+
}
|
|
157664
157771
|
isProcessAlive(platformInstance) {
|
|
157665
157772
|
const pid = platformInstance.process?.pid;
|
|
157666
157773
|
if (!pid) {
|
|
@@ -64,12 +64,14 @@ export default class PlatformInstance {
|
|
|
64
64
|
private heartbeatFailureHandled;
|
|
65
65
|
private replaced;
|
|
66
66
|
private shutdownResult?;
|
|
67
|
+
private retirementError?;
|
|
67
68
|
/**
|
|
68
69
|
* Actor this instance was opened for. Updated when the platform re-keys
|
|
69
70
|
* (IRC nick change) so a later rename moves the credential scope off the
|
|
70
71
|
* actor the client is using now, not the one from process start.
|
|
71
72
|
*/
|
|
72
73
|
private actor?;
|
|
74
|
+
get actorId(): string | undefined;
|
|
73
75
|
constructor(params: PlatformInstanceParams);
|
|
74
76
|
createQueue(): void;
|
|
75
77
|
resolveSentryEnv(): string | undefined;
|
|
@@ -98,7 +100,7 @@ export default class PlatformInstance {
|
|
|
98
100
|
* independent run would resolve while the first is still obliterating
|
|
99
101
|
* the queue name the replacement is about to reuse.
|
|
100
102
|
*/
|
|
101
|
-
shutdown(): Promise<void>;
|
|
103
|
+
shutdown(pendingJobError?: string): Promise<void>;
|
|
102
104
|
private teardown;
|
|
103
105
|
/**
|
|
104
106
|
* When jobs are completed or failed, we prepare the results and send them to the client socket
|
|
@@ -111,6 +113,7 @@ export default class PlatformInstance {
|
|
|
111
113
|
* mid-job) don't leak handlers for the lifetime of the instance.
|
|
112
114
|
*/
|
|
113
115
|
registerCompletedJobHandler(title: string, handler: CompletedJobHandler): void;
|
|
116
|
+
private failRetiredJob;
|
|
114
117
|
private takeCompletedJobHandler;
|
|
115
118
|
private pruneExpiredJobHandlers;
|
|
116
119
|
/**
|