@builder6/server 0.2.5 → 0.2.6
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/app.config.js +9 -4
- package/dist/app.config.js.map +1 -1
- package/dist/app.controller.js.map +1 -1
- package/dist/app.express.js.map +1 -1
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/b6.config.js +1 -1
- package/dist/b6.config.js.map +1 -1
- package/dist/b6.server.js +84 -60
- package/dist/b6.server.js.map +1 -1
- package/dist/files/files.service.js +2 -1
- package/dist/files/files.service.js.map +1 -1
- package/dist/files/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/microsoft365/microsoft365.controller.js.map +1 -1
- package/dist/microsoft365/microsoft365.module.js +1 -1
- package/dist/microsoft365/microsoft365.service.js +1 -1
- package/dist/microsoft365/microsoft365.service.js.map +1 -1
- package/dist/moleculer/moleculer.config.js +14 -15
- package/dist/moleculer/moleculer.config.js.map +1 -1
- package/dist/moleculer/moleculer.module.js +1 -1
- package/dist/moleculer/moleculer.service.js +8 -6
- package/dist/moleculer/moleculer.service.js.map +1 -1
- package/dist/oidc/oidc.controller.js +1 -1
- package/dist/oidc/oidc.controller.js.map +1 -1
- package/dist/oidc/oidc.module.js +1 -1
- package/dist/oidc/oidc.service.js.map +1 -1
- package/dist/plugin/plugin.module.d.ts +14 -0
- package/dist/plugin/plugin.module.js +67 -0
- package/dist/plugin/plugin.module.js.map +1 -0
- package/dist/plugin/plugin.service.d.ts +3 -0
- package/dist/plugin/plugin.service.js +21 -0
- package/dist/plugin/plugin.service.js.map +1 -0
- package/dist/rooms/globals/augmentation.d.ts +16 -16
- package/dist/rooms/lib/Json.js +3 -3
- package/dist/rooms/lib/utils.d.ts +1 -1
- package/dist/rooms/lib/utils.js +7 -7
- package/dist/rooms/protocol/AuthToken.d.ts +2 -2
- package/dist/rooms/protocol/AuthToken.js +3 -3
- package/dist/rooms/protocol/Authentication.d.ts +4 -4
- package/dist/rooms/protocol/BaseActivitiesData.d.ts +1 -1
- package/dist/rooms/protocol/BaseRoomInfo.d.ts +1 -1
- package/dist/rooms/protocol/BaseUserMeta.d.ts +1 -1
- package/dist/rooms/protocol/ClientMsg.d.ts +2 -2
- package/dist/rooms/protocol/Comments.d.ts +19 -19
- package/dist/rooms/protocol/InboxNotifications.d.ts +6 -6
- package/dist/rooms/protocol/Op.d.ts +6 -6
- package/dist/rooms/protocol/Op.js +2 -2
- package/dist/rooms/protocol/SerializedCrdt.d.ts +1 -1
- package/dist/rooms/protocol/ServerMsg.d.ts +6 -6
- package/dist/rooms/protocol/VersionHistory.d.ts +2 -2
- package/dist/rooms/rooms.controller.js +2 -2
- package/dist/rooms/rooms.controller.js.map +1 -1
- package/dist/rooms/rooms.gateway.js +1 -1
- package/dist/rooms/rooms.gateway.js.map +1 -1
- package/dist/rooms/rooms.service.js.map +1 -1
- package/dist/steedos/mongodb.controller.js.map +1 -1
- package/dist/steedos/steedos.module.js +1 -3
- package/dist/steedos/steedos.module.js.map +1 -1
- package/dist/tables/meta.service.js +21 -3
- package/dist/tables/meta.service.js.map +1 -1
- package/dist/tables/records.service.d.ts +3 -1
- package/dist/tables/records.service.js +5 -3
- package/dist/tables/records.service.js.map +1 -1
- package/dist/tables/tables.controller.js +11 -4
- package/dist/tables/tables.controller.js.map +1 -1
- package/dist/tables/tables.module.js +1 -3
- package/dist/tables/tables.module.js.map +1 -1
- package/package.json +2 -2
|
@@ -21,9 +21,9 @@ let MoleculerService = MoleculerService_1 = class MoleculerService {
|
|
|
21
21
|
constructor(configService) {
|
|
22
22
|
this.configService = configService;
|
|
23
23
|
this.logger = new common_1.Logger(MoleculerService_1.name);
|
|
24
|
-
const transporter = this.configService.get(
|
|
24
|
+
const transporter = this.configService.get('transporter');
|
|
25
25
|
if (!transporter) {
|
|
26
|
-
console.error(
|
|
26
|
+
console.error('B6_TRANSPORTER env is required.');
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
this.broker = new moleculer_1.ServiceBroker({
|
|
@@ -33,7 +33,7 @@ let MoleculerService = MoleculerService_1 = class MoleculerService {
|
|
|
33
33
|
this.broker.start();
|
|
34
34
|
}
|
|
35
35
|
loadServices() {
|
|
36
|
-
const plugins = this.configService.get(
|
|
36
|
+
const plugins = this.configService.get('plugin.services');
|
|
37
37
|
if (plugins) {
|
|
38
38
|
for (const plugin of plugins.split(',')) {
|
|
39
39
|
this.loadService(plugin);
|
|
@@ -47,19 +47,21 @@ let MoleculerService = MoleculerService_1 = class MoleculerService {
|
|
|
47
47
|
this.logger.warn(`插件格式无效: ${plugin}`);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
const [, packageName
|
|
50
|
+
const [, packageName] = match;
|
|
51
51
|
this.logger.log(`加载插件: 名称:${packageName}`);
|
|
52
52
|
if (!this.isPackageInstalled(packageName)) {
|
|
53
53
|
this.logger.error(`插件 ${packageName} 未安装,请先安装`);
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
const packageServicePath = path.resolve(this.getPackagePath(packageName),
|
|
56
|
+
const packageServicePath = path.resolve(this.getPackagePath(packageName), './dist/package.service.js');
|
|
57
57
|
if (!fs.existsSync(packageServicePath)) {
|
|
58
58
|
this.logger.error(`插件 ${packageName} 缺少文件: ${packageServicePath}`);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
const serviceModule = require(packageServicePath);
|
|
62
|
-
const serviceSchema = serviceModule.default
|
|
62
|
+
const serviceSchema = serviceModule.default
|
|
63
|
+
? serviceModule.default
|
|
64
|
+
: serviceModule;
|
|
63
65
|
if (serviceSchema) {
|
|
64
66
|
this.broker.createService(serviceSchema);
|
|
65
67
|
this.logger.log(`插件服务已创建: ${packageName}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moleculer.service.js","sourceRoot":"","sources":["../../src/moleculer/moleculer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;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AAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAAmB;QACxC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,WAAW,eAAe,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,aAAa,WAAW,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF,CAAA;AA7FY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAKwB,sBAAa;GAJrC,gBAAgB,CA6F5B"}
|
|
@@ -57,7 +57,7 @@ let OidcController = class OidcController {
|
|
|
57
57
|
const tokenSet = await client.callback(provider.redirect_uri, params, {
|
|
58
58
|
state: storedState,
|
|
59
59
|
code_verifier: storedVerifier,
|
|
60
|
-
nonce: storedNonce
|
|
60
|
+
nonce: storedNonce,
|
|
61
61
|
});
|
|
62
62
|
delete req.session[`oidc_${providerId}_state`];
|
|
63
63
|
delete req.session[`oidc_${providerId}_code_verifier`];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.controller.js","sourceRoot":"","sources":["../../src/oidc/oidc.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"oidc.controller.js","sourceRoot":"","sources":["../../src/oidc/oidc.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAQwB;AAGxB,iDAA+C;AAE/C,iDAA6C;AAGtC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGnD,AAAN,KAAK,CAAC,KAAK,CAAsB,UAAkB,EAAS,GAAG,EAAS,GAAG;QACzE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC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,IAAA,YAAG,GAAE,CAAA;IAAO,WAAA,IAAA,YAAG,GAAE,CAAA;;;;2CAyBtE;AAGK;IADL,IAAA,YAAG,EAAC,sBAAsB,CAAC;IAEzB,WAAA,IAAA,cAAK,EAAC,YAAY,CAAC,CAAA;IACnB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,YAAG,GAAE,CAAA;;;;8CAoCP;yBAvEU,cAAc;IAD1B,IAAA,mBAAU,EAAC,aAAa,CAAC;qCAEkB,0BAAW;GAD1C,cAAc,CAwE1B"}
|
package/dist/oidc/oidc.module.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.OidcModule = OidcModule;
|
|
|
16
16
|
exports.OidcModule = OidcModule = __decorate([
|
|
17
17
|
(0, common_1.Module)({
|
|
18
18
|
providers: [oidc_service_1.OidcService],
|
|
19
|
-
controllers: [oidc_controller_1.OidcController]
|
|
19
|
+
controllers: [oidc_controller_1.OidcController],
|
|
20
20
|
})
|
|
21
21
|
], OidcModule);
|
|
22
22
|
//# sourceMappingURL=oidc.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.service.js","sourceRoot":"","sources":["../../src/oidc/oidc.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,iDAA2C;
|
|
1
|
+
{"version":3,"file":"oidc.service.js","sourceRoot":"","sources":["../../src/oidc/oidc.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,iDAA2C;AAGpC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,KAAK,CAAC,iBAAiB,CAAC,UAAkB;QACxC,MAAM,qBAAqB,GAAG,MAAM,CAAC;QACrC,MAAM,aAAa,GAAG,0BAAU,CAAC,YAAY,EAAE,CAAC;QAChD,MAAM,cAAc,GAAG,0BAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC/D,MAAM,KAAK,GAAG,0BAAU,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,0BAAU,CAAC,MAAM,EAAE,CAAC;QAGlC,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;YAClC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;YACzC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;YACxC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;YAChD,YAAY,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,gBAAgB,UAAU,WAAW;YAC1E,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,sBAAsB;YACjE,KAAK;YACL,KAAK;YACL,qBAAqB;YACrB,aAAa;YACb,cAAc;SACf,CAAC;IACJ,CAAC;CACF,CAAA;AAvBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;GACA,WAAW,CAuBvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DynamicModule, Logger } from '@nestjs/common';
|
|
2
|
+
export declare class PluginModule {
|
|
3
|
+
static readonly logger: Logger;
|
|
4
|
+
static plugins: Plugin[];
|
|
5
|
+
static forRoot(modules: any): DynamicModule;
|
|
6
|
+
static loadPlugin(packageName: string): any;
|
|
7
|
+
static isPackageInstalled(packageName: string): boolean;
|
|
8
|
+
static getPackagePath(packageName: string): string;
|
|
9
|
+
}
|
|
10
|
+
interface Plugin {
|
|
11
|
+
name: string;
|
|
12
|
+
module: DynamicModule;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var PluginModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PluginModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const plugin_service_1 = require("./plugin.service");
|
|
15
|
+
let PluginModule = PluginModule_1 = class PluginModule {
|
|
16
|
+
static forRoot(modules) {
|
|
17
|
+
if (modules) {
|
|
18
|
+
for (const module of modules.split(',')) {
|
|
19
|
+
const pluginModule = this.loadPlugin(module);
|
|
20
|
+
this.plugins.push({
|
|
21
|
+
name: module,
|
|
22
|
+
module: pluginModule,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
console.log('this.plugins', this.plugins);
|
|
27
|
+
return {
|
|
28
|
+
module: PluginModule_1,
|
|
29
|
+
imports: [...this.plugins.map((plugin) => plugin.module)],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static loadPlugin(packageName) {
|
|
33
|
+
const packageModulePath = path.resolve(this.getPackagePath(packageName), './dist/plugin.module.js');
|
|
34
|
+
if (!fs.existsSync(packageModulePath)) {
|
|
35
|
+
this.logger.error(`插件 ${packageName} 缺少文件: ${packageModulePath}`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const PluginModule = require(packageModulePath);
|
|
39
|
+
return PluginModule.default;
|
|
40
|
+
}
|
|
41
|
+
static isPackageInstalled(packageName) {
|
|
42
|
+
try {
|
|
43
|
+
require.resolve(`${packageName}/package.json`);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static getPackagePath(packageName) {
|
|
51
|
+
try {
|
|
52
|
+
return path.dirname(require.resolve(`${packageName}/package.json`));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
throw new Error(`无法解析插件路径: ${packageName}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.PluginModule = PluginModule;
|
|
60
|
+
PluginModule.logger = new common_1.Logger(PluginModule_1.name);
|
|
61
|
+
PluginModule.plugins = [];
|
|
62
|
+
exports.PluginModule = PluginModule = PluginModule_1 = __decorate([
|
|
63
|
+
(0, common_1.Module)({
|
|
64
|
+
providers: [plugin_service_1.PluginService],
|
|
65
|
+
})
|
|
66
|
+
], PluginModule);
|
|
67
|
+
//# sourceMappingURL=plugin.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.module.js","sourceRoot":"","sources":["../../src/plugin/plugin.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,yBAAyB;AACzB,6BAA6B;AAC7B,qDAAiD;AAK1C,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAIvB,MAAM,CAAC,OAAO,CAAC,OAAO;QACpB,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxC,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,YAAY;iBACrB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EA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0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var PluginService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PluginService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
let PluginService = PluginService_1 = class PluginService {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(PluginService_1.name);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.PluginService = PluginService;
|
|
18
|
+
exports.PluginService = PluginService = PluginService_1 = __decorate([
|
|
19
|
+
(0, common_1.Injectable)()
|
|
20
|
+
], PluginService);
|
|
21
|
+
//# sourceMappingURL=plugin.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.service.js","sourceRoot":"","sources":["../../src/plugin/plugin.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAG7C,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAAnB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;CAAA,CAAA;AAFY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAEzB"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Json, JsonObject } from
|
|
2
|
-
import type { BaseActivitiesData } from
|
|
3
|
-
import type { BaseRoomInfo } from
|
|
4
|
-
import type { BaseUserMeta } from
|
|
5
|
-
import type { BaseMetadata } from
|
|
1
|
+
import type { Json, JsonObject } from '../lib/Json';
|
|
2
|
+
import type { BaseActivitiesData } from '../protocol/BaseActivitiesData';
|
|
3
|
+
import type { BaseRoomInfo } from '../protocol/BaseRoomInfo';
|
|
4
|
+
import type { BaseUserMeta } from '../protocol/BaseUserMeta';
|
|
5
|
+
import type { BaseMetadata } from '../protocol/Comments';
|
|
6
6
|
declare global {
|
|
7
7
|
export interface Liveblocks {
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
type ExtendableTypes =
|
|
12
|
-
type MakeErrorString<K extends ExtendableTypes, Reason extends string =
|
|
13
|
-
type GetOverride<K extends ExtendableTypes, B, Reason extends string =
|
|
11
|
+
type ExtendableTypes = 'Presence' | 'Storage' | 'UserMeta' | 'RoomEvent' | 'ThreadMetadata' | 'RoomInfo' | 'ActivitiesData';
|
|
12
|
+
type MakeErrorString<K extends ExtendableTypes, Reason extends string = 'does not match its requirements'> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
|
|
13
|
+
type GetOverride<K extends ExtendableTypes, B, Reason extends string = 'does not match its requirements'> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
14
14
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
15
|
-
export type DP = GetOverride<
|
|
16
|
-
export type DS = GetOverride<
|
|
17
|
-
export type DU = GetOverrideOrErrorValue<
|
|
18
|
-
export type DE = GetOverride<
|
|
19
|
-
export type DM = GetOverride<
|
|
20
|
-
export type DRI = GetOverride<
|
|
21
|
-
export type DAD = GetOverrideOrErrorValue<
|
|
22
|
-
[K in keyof Liveblocks[
|
|
15
|
+
export type DP = GetOverride<'Presence', JsonObject, 'is not a valid JSON object'>;
|
|
16
|
+
export type DS = GetOverride<'Storage', JsonObject, 'is not a valid LSON value'>;
|
|
17
|
+
export type DU = GetOverrideOrErrorValue<'UserMeta', BaseUserMeta, Record<'id' | 'info', MakeErrorString<'UserMeta'>>>;
|
|
18
|
+
export type DE = GetOverride<'RoomEvent', Json, 'is not a valid JSON value'>;
|
|
19
|
+
export type DM = GetOverride<'ThreadMetadata', BaseMetadata>;
|
|
20
|
+
export type DRI = GetOverride<'RoomInfo', BaseRoomInfo>;
|
|
21
|
+
export type DAD = GetOverrideOrErrorValue<'ActivitiesData', BaseActivitiesData, {
|
|
22
|
+
[K in keyof Liveblocks['ActivitiesData']]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
23
23
|
}>;
|
|
24
24
|
export type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
25
25
|
export {};
|
package/dist/rooms/lib/Json.js
CHANGED
|
@@ -5,9 +5,9 @@ exports.isJsonArray = isJsonArray;
|
|
|
5
5
|
exports.isJsonObject = isJsonObject;
|
|
6
6
|
function isJsonScalar(data) {
|
|
7
7
|
return (data === null ||
|
|
8
|
-
typeof data ===
|
|
9
|
-
typeof data ===
|
|
10
|
-
typeof data ===
|
|
8
|
+
typeof data === 'string' ||
|
|
9
|
+
typeof data === 'number' ||
|
|
10
|
+
typeof data === 'boolean');
|
|
11
11
|
}
|
|
12
12
|
function isJsonArray(data) {
|
|
13
13
|
return Array.isArray(data);
|
package/dist/rooms/lib/utils.js
CHANGED
|
@@ -20,8 +20,8 @@ function raise(msg) {
|
|
|
20
20
|
}
|
|
21
21
|
function isPlainObject(blob) {
|
|
22
22
|
return (blob !== null &&
|
|
23
|
-
typeof blob ===
|
|
24
|
-
Object.prototype.toString.call(blob) ===
|
|
23
|
+
typeof blob === 'object' &&
|
|
24
|
+
Object.prototype.toString.call(blob) === '[object Object]');
|
|
25
25
|
}
|
|
26
26
|
function entries(obj) {
|
|
27
27
|
return Object.entries(obj);
|
|
@@ -36,7 +36,7 @@ function mapValues(obj, mapFn) {
|
|
|
36
36
|
const result = {};
|
|
37
37
|
for (const pair of Object.entries(obj)) {
|
|
38
38
|
const key = pair[0];
|
|
39
|
-
if (key ===
|
|
39
|
+
if (key === '__proto__') {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
const value = pair[1];
|
|
@@ -57,13 +57,13 @@ function deepClone(value) {
|
|
|
57
57
|
}
|
|
58
58
|
function b64decode(b64value) {
|
|
59
59
|
try {
|
|
60
|
-
const formattedValue = b64value.replace(/-/g,
|
|
60
|
+
const formattedValue = b64value.replace(/-/g, '+').replace(/_/g, '/');
|
|
61
61
|
const decodedValue = decodeURIComponent(atob(formattedValue)
|
|
62
|
-
.split(
|
|
62
|
+
.split('')
|
|
63
63
|
.map(function (c) {
|
|
64
|
-
return
|
|
64
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
65
65
|
})
|
|
66
|
-
.join(
|
|
66
|
+
.join(''));
|
|
67
67
|
return decodedValue;
|
|
68
68
|
}
|
|
69
69
|
catch (err) {
|
|
@@ -33,13 +33,13 @@ function isValidAuthTokenPayload(data) {
|
|
|
33
33
|
data.k === TokenKind.SECRET_LEGACY));
|
|
34
34
|
}
|
|
35
35
|
function parseAuthToken(rawTokenString) {
|
|
36
|
-
const tokenParts = rawTokenString.split(
|
|
36
|
+
const tokenParts = rawTokenString.split('.');
|
|
37
37
|
if (tokenParts.length !== 3) {
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error('Authentication error: invalid JWT token');
|
|
39
39
|
}
|
|
40
40
|
const payload = (0, utils_1.tryParseJson)((0, utils_1.b64decode)(tokenParts[1]));
|
|
41
41
|
if (!(payload && isValidAuthTokenPayload(payload))) {
|
|
42
|
-
throw new Error(
|
|
42
|
+
throw new Error('Authentication error: expected a valid token but did not get one. Hint: if you are using a callback, ensure the room is passed when creating the token. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientCallback');
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
45
|
raw: rawTokenString,
|
|
@@ -3,7 +3,7 @@ export type CustomAuthenticationResult = {
|
|
|
3
3
|
error?: never;
|
|
4
4
|
} | {
|
|
5
5
|
token?: never;
|
|
6
|
-
error:
|
|
6
|
+
error: 'forbidden';
|
|
7
7
|
reason: string;
|
|
8
8
|
} | {
|
|
9
9
|
token?: never;
|
|
@@ -11,12 +11,12 @@ export type CustomAuthenticationResult = {
|
|
|
11
11
|
reason: string;
|
|
12
12
|
};
|
|
13
13
|
export type Authentication = {
|
|
14
|
-
type:
|
|
14
|
+
type: 'public';
|
|
15
15
|
publicApiKey: string;
|
|
16
16
|
} | {
|
|
17
|
-
type:
|
|
17
|
+
type: 'private';
|
|
18
18
|
url: string;
|
|
19
19
|
} | {
|
|
20
|
-
type:
|
|
20
|
+
type: 'custom';
|
|
21
21
|
callback: (room?: string) => Promise<CustomAuthenticationResult>;
|
|
22
22
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DM } from
|
|
2
|
-
import type { DateToString } from
|
|
1
|
+
import type { DM } from '../globals/augmentation';
|
|
2
|
+
import type { DateToString } from '../lib/DateToString';
|
|
3
3
|
export type BaseMetadata = Record<string, string | boolean | number | undefined>;
|
|
4
4
|
export type CommentReaction = {
|
|
5
5
|
emoji: string;
|
|
@@ -9,15 +9,15 @@ export type CommentReaction = {
|
|
|
9
9
|
}[];
|
|
10
10
|
};
|
|
11
11
|
export type CommentAttachment = {
|
|
12
|
-
type:
|
|
12
|
+
type: 'attachment';
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
15
|
size: number;
|
|
16
16
|
mimeType: string;
|
|
17
17
|
};
|
|
18
18
|
export type CommentLocalAttachmentIdle = {
|
|
19
|
-
type:
|
|
20
|
-
status:
|
|
19
|
+
type: 'localAttachment';
|
|
20
|
+
status: 'idle';
|
|
21
21
|
id: string;
|
|
22
22
|
name: string;
|
|
23
23
|
size: number;
|
|
@@ -25,8 +25,8 @@ export type CommentLocalAttachmentIdle = {
|
|
|
25
25
|
file: File;
|
|
26
26
|
};
|
|
27
27
|
export type CommentLocalAttachmentUploading = {
|
|
28
|
-
type:
|
|
29
|
-
status:
|
|
28
|
+
type: 'localAttachment';
|
|
29
|
+
status: 'uploading';
|
|
30
30
|
id: string;
|
|
31
31
|
name: string;
|
|
32
32
|
size: number;
|
|
@@ -34,8 +34,8 @@ export type CommentLocalAttachmentUploading = {
|
|
|
34
34
|
file: File;
|
|
35
35
|
};
|
|
36
36
|
export type CommentLocalAttachmentUploaded = {
|
|
37
|
-
type:
|
|
38
|
-
status:
|
|
37
|
+
type: 'localAttachment';
|
|
38
|
+
status: 'uploaded';
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
41
|
size: number;
|
|
@@ -43,8 +43,8 @@ export type CommentLocalAttachmentUploaded = {
|
|
|
43
43
|
file: File;
|
|
44
44
|
};
|
|
45
45
|
export type CommentLocalAttachmentError = {
|
|
46
|
-
type:
|
|
47
|
-
status:
|
|
46
|
+
type: 'localAttachment';
|
|
47
|
+
status: 'error';
|
|
48
48
|
id: string;
|
|
49
49
|
name: string;
|
|
50
50
|
size: number;
|
|
@@ -55,7 +55,7 @@ export type CommentLocalAttachmentError = {
|
|
|
55
55
|
export type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
|
|
56
56
|
export type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
57
57
|
export type CommentData = {
|
|
58
|
-
type:
|
|
58
|
+
type: 'comment';
|
|
59
59
|
id: string;
|
|
60
60
|
threadId: string;
|
|
61
61
|
roomId: string;
|
|
@@ -71,7 +71,7 @@ export type CommentData = {
|
|
|
71
71
|
body?: never;
|
|
72
72
|
deletedAt: Date;
|
|
73
73
|
});
|
|
74
|
-
export type CommentDataPlain = Omit<DateToString<CommentData>,
|
|
74
|
+
export type CommentDataPlain = Omit<DateToString<CommentData>, 'reactions' | 'body'> & {
|
|
75
75
|
reactions: DateToString<CommentReaction>[];
|
|
76
76
|
} & ({
|
|
77
77
|
body: CommentBody;
|
|
@@ -84,15 +84,15 @@ export type CommentBodyBlockElement = CommentBodyParagraph;
|
|
|
84
84
|
export type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
|
|
85
85
|
export type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
|
|
86
86
|
export type CommentBodyParagraph = {
|
|
87
|
-
type:
|
|
87
|
+
type: 'paragraph';
|
|
88
88
|
children: CommentBodyInlineElement[];
|
|
89
89
|
};
|
|
90
90
|
export type CommentBodyMention = {
|
|
91
|
-
type:
|
|
91
|
+
type: 'mention';
|
|
92
92
|
id: string;
|
|
93
93
|
};
|
|
94
94
|
export type CommentBodyLink = {
|
|
95
|
-
type:
|
|
95
|
+
type: 'link';
|
|
96
96
|
url: string;
|
|
97
97
|
text?: string;
|
|
98
98
|
};
|
|
@@ -114,7 +114,7 @@ export type CommentUserReaction = {
|
|
|
114
114
|
};
|
|
115
115
|
export type CommentUserReactionPlain = DateToString<CommentUserReaction>;
|
|
116
116
|
export type ThreadData<M extends BaseMetadata = DM> = {
|
|
117
|
-
type:
|
|
117
|
+
type: 'thread';
|
|
118
118
|
id: string;
|
|
119
119
|
roomId: string;
|
|
120
120
|
createdAt: Date;
|
|
@@ -126,12 +126,12 @@ export type ThreadData<M extends BaseMetadata = DM> = {
|
|
|
126
126
|
export interface ThreadDataWithDeleteInfo<M extends BaseMetadata = DM> extends ThreadData<M> {
|
|
127
127
|
deletedAt?: Date;
|
|
128
128
|
}
|
|
129
|
-
export type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>,
|
|
129
|
+
export type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>, 'comments' | 'metadata'> & {
|
|
130
130
|
comments: CommentDataPlain[];
|
|
131
131
|
metadata: M;
|
|
132
132
|
};
|
|
133
133
|
export type ThreadDeleteInfo = {
|
|
134
|
-
type:
|
|
134
|
+
type: 'deletedThread';
|
|
135
135
|
id: string;
|
|
136
136
|
roomId: string;
|
|
137
137
|
deletedAt: Date;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DAD } from
|
|
2
|
-
import type { DateToString } from
|
|
1
|
+
import type { DAD } from '../globals/augmentation';
|
|
2
|
+
import type { DateToString } from '../lib/DateToString';
|
|
3
3
|
export type InboxNotificationThreadData = {
|
|
4
|
-
kind:
|
|
4
|
+
kind: 'thread';
|
|
5
5
|
id: string;
|
|
6
6
|
roomId: string;
|
|
7
7
|
threadId: string;
|
|
@@ -9,7 +9,7 @@ export type InboxNotificationThreadData = {
|
|
|
9
9
|
readAt: Date | null;
|
|
10
10
|
};
|
|
11
11
|
export type InboxNotificationTextMentionData = {
|
|
12
|
-
kind:
|
|
12
|
+
kind: 'textMention';
|
|
13
13
|
id: string;
|
|
14
14
|
roomId: string;
|
|
15
15
|
notifiedAt: Date;
|
|
@@ -35,12 +35,12 @@ export type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
|
|
|
35
35
|
};
|
|
36
36
|
export type InboxNotificationData = InboxNotificationThreadData | InboxNotificationCustomData | InboxNotificationTextMentionData;
|
|
37
37
|
export type InboxNotificationThreadDataPlain = DateToString<InboxNotificationThreadData>;
|
|
38
|
-
export type InboxNotificationCustomDataPlain = Omit<DateToString<InboxNotificationCustomData>,
|
|
38
|
+
export type InboxNotificationCustomDataPlain = Omit<DateToString<InboxNotificationCustomData>, 'activities'> & {
|
|
39
39
|
activities: DateToString<InboxNotificationActivity>[];
|
|
40
40
|
};
|
|
41
41
|
export type InboxNotificationDataPlain = InboxNotificationThreadDataPlain | InboxNotificationCustomDataPlain | InboxNotificationTextMentionDataPlain;
|
|
42
42
|
export type InboxNotificationDeleteInfo = {
|
|
43
|
-
type:
|
|
43
|
+
type: 'deletedInboxNotification';
|
|
44
44
|
id: string;
|
|
45
45
|
roomId: string;
|
|
46
46
|
deletedAt: Date;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Json, JsonObject } from
|
|
1
|
+
import type { Json, JsonObject } from '../lib/Json';
|
|
2
2
|
export declare enum OpCode {
|
|
3
3
|
INIT = 0,
|
|
4
4
|
SET_PARENT_KEY = 1,
|
|
@@ -21,7 +21,7 @@ export type UpdateObjectOp = {
|
|
|
21
21
|
export type CreateObjectOp = {
|
|
22
22
|
readonly opId?: string;
|
|
23
23
|
readonly id: string;
|
|
24
|
-
readonly intent?:
|
|
24
|
+
readonly intent?: 'set';
|
|
25
25
|
readonly deletedId?: string;
|
|
26
26
|
readonly type: OpCode.CREATE_OBJECT;
|
|
27
27
|
readonly parentId: string;
|
|
@@ -31,7 +31,7 @@ export type CreateObjectOp = {
|
|
|
31
31
|
export type CreateListOp = {
|
|
32
32
|
readonly opId?: string;
|
|
33
33
|
readonly id: string;
|
|
34
|
-
readonly intent?:
|
|
34
|
+
readonly intent?: 'set';
|
|
35
35
|
readonly deletedId?: string;
|
|
36
36
|
readonly type: OpCode.CREATE_LIST;
|
|
37
37
|
readonly parentId: string;
|
|
@@ -40,7 +40,7 @@ export type CreateListOp = {
|
|
|
40
40
|
export type CreateMapOp = {
|
|
41
41
|
readonly opId?: string;
|
|
42
42
|
readonly id: string;
|
|
43
|
-
readonly intent?:
|
|
43
|
+
readonly intent?: 'set';
|
|
44
44
|
readonly deletedId?: string;
|
|
45
45
|
readonly type: OpCode.CREATE_MAP;
|
|
46
46
|
readonly parentId: string;
|
|
@@ -49,7 +49,7 @@ export type CreateMapOp = {
|
|
|
49
49
|
export type CreateRegisterOp = {
|
|
50
50
|
readonly opId?: string;
|
|
51
51
|
readonly id: string;
|
|
52
|
-
readonly intent?:
|
|
52
|
+
readonly intent?: 'set';
|
|
53
53
|
readonly deletedId?: string;
|
|
54
54
|
readonly type: OpCode.CREATE_REGISTER;
|
|
55
55
|
readonly parentId: string;
|
|
@@ -63,7 +63,7 @@ export type DeleteCrdtOp = {
|
|
|
63
63
|
};
|
|
64
64
|
export type AckOp = {
|
|
65
65
|
readonly type: OpCode.DELETE_CRDT;
|
|
66
|
-
readonly id:
|
|
66
|
+
readonly id: 'ACK';
|
|
67
67
|
readonly opId: string;
|
|
68
68
|
};
|
|
69
69
|
export declare function ackOp(opId: string): AckOp;
|
|
@@ -18,11 +18,11 @@ var OpCode;
|
|
|
18
18
|
function ackOp(opId) {
|
|
19
19
|
return {
|
|
20
20
|
type: OpCode.DELETE_CRDT,
|
|
21
|
-
id:
|
|
21
|
+
id: 'ACK',
|
|
22
22
|
opId,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function isAckOp(op) {
|
|
26
|
-
return op.type === OpCode.DELETE_CRDT && op.id ===
|
|
26
|
+
return op.type === OpCode.DELETE_CRDT && op.id === 'ACK';
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=Op.js.map
|