@casual-simulation/aux-vm 2.0.27 → 2.0.31
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/auth/AuxAuth.d.ts +80 -0
- package/managers/AuthHelperInterface.d.ts +33 -1
- package/managers/BaseSimulation.d.ts +13 -1
- package/managers/BaseSimulation.js +20 -6
- package/managers/BaseSimulation.js.map +1 -1
- package/managers/PortalManager.d.ts +24 -2
- package/managers/PortalManager.js.map +1 -1
- package/managers/RecordsManager.d.ts +2 -0
- package/managers/RecordsManager.js +164 -5
- package/managers/RecordsManager.js.map +1 -1
- package/managers/index.d.ts +0 -1
- package/managers/index.js +0 -1
- package/managers/index.js.map +1 -1
- package/package.json +5 -6
- package/portals/CustomAppHelper.js +8 -5
- package/portals/CustomAppHelper.js.map +1 -1
- package/managers/PortalBundler.d.ts +0 -154
- package/managers/PortalBundler.js +0 -364
- package/managers/PortalBundler.js.map +0 -1
package/auth/AuxAuth.d.ts
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
import { AuthData } from '@casual-simulation/aux-common';
|
|
2
2
|
import { CreatePublicRecordKeyResult } from '@casual-simulation/aux-records';
|
|
3
|
+
/**
|
|
4
|
+
* Defines an interface that represents the login state of the user.
|
|
5
|
+
*/
|
|
6
|
+
export interface LoginStatus {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the auth services are loading.
|
|
9
|
+
*/
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the user is in the process of logging in.
|
|
13
|
+
*/
|
|
14
|
+
isLoggingIn?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The auth data for the user.
|
|
17
|
+
*/
|
|
18
|
+
authData?: AuthData;
|
|
19
|
+
}
|
|
20
|
+
export declare type LoginUIStatus = LoginUINoStatus | LoginUIEmailStatus | LoginUICheckEmailStatus;
|
|
21
|
+
export interface LoginUINoStatus {
|
|
22
|
+
page: false;
|
|
23
|
+
}
|
|
24
|
+
export interface LoginUIEmailStatus {
|
|
25
|
+
page: 'enter_email';
|
|
26
|
+
/**
|
|
27
|
+
* The page that should be linked to as the terms of service.
|
|
28
|
+
*/
|
|
29
|
+
termsOfServiceUrl: string;
|
|
30
|
+
/**
|
|
31
|
+
* The name of the site that is being logged into.
|
|
32
|
+
*/
|
|
33
|
+
siteName: string;
|
|
34
|
+
showAcceptTermsOfServiceError?: boolean;
|
|
35
|
+
showEnterEmailError?: boolean;
|
|
36
|
+
showInvalidEmailError?: boolean;
|
|
37
|
+
errorCode?: string;
|
|
38
|
+
errorMessage?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LoginUICheckEmailStatus {
|
|
41
|
+
page: 'check_email';
|
|
42
|
+
}
|
|
3
43
|
/**
|
|
4
44
|
* Defines an interface for an object that is able to communicate with an authentication service.
|
|
5
45
|
*/
|
|
@@ -23,5 +63,45 @@ export interface AuxAuth {
|
|
|
23
63
|
* Gets the auth token for the user.
|
|
24
64
|
*/
|
|
25
65
|
getAuthToken(): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the protocol version that this object supports.
|
|
68
|
+
*/
|
|
69
|
+
getProtocolVersion(): Promise<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Requests that the account page or login page (if not authenticated) be opened in a new tab.
|
|
72
|
+
* Only supported on protocol version 2 or more.
|
|
73
|
+
*/
|
|
74
|
+
openAccountPage(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Adds the given function as a callback for login status information.
|
|
77
|
+
* Only supported on protocol version 2 or more.
|
|
78
|
+
* @param callback The function that should be called when the login status changes.
|
|
79
|
+
*/
|
|
80
|
+
addLoginStatusCallback(callback: (status: LoginStatus) => void): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Adds the given function as a callback for login UI status information.
|
|
83
|
+
* Only supported on protocol version 2 or more.
|
|
84
|
+
* @param callback The function that should be called when the login UI should change.
|
|
85
|
+
*/
|
|
86
|
+
addLoginUICallback(callback: (status: LoginUIStatus) => void): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Sets whether a custom user interface should be used for the login process.
|
|
89
|
+
* If set to true, then there should be at least one callback registered for the login UI.
|
|
90
|
+
* Only supported on protocol version 2 or more.
|
|
91
|
+
* @param useCustomUI Whether a custom user interface should be used instead of the new tab login flow.
|
|
92
|
+
*/
|
|
93
|
+
setUseCustomUI(useCustomUI: boolean): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Specifies the email address and whether the user accepted the terms of service during the login process.
|
|
96
|
+
* Resolves with a validation result that indicates whether an error occurred and what should be shown to the user.
|
|
97
|
+
* Only supported on protocol version 2 or more.
|
|
98
|
+
* @param email The email address that should be used to login.
|
|
99
|
+
* @param acceptedTermsOfService Whether the user accepted the terms of service.
|
|
100
|
+
*/
|
|
101
|
+
provideEmailAddress(email: string, acceptedTermsOfService: boolean): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Cancels the in-progress login attempt.
|
|
104
|
+
*/
|
|
105
|
+
cancelLogin(): Promise<void>;
|
|
26
106
|
}
|
|
27
107
|
//# sourceMappingURL=AuxAuth.d.ts.map
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { AuthData } from '@casual-simulation/aux-common';
|
|
2
2
|
import { CreatePublicRecordKeyResult } from '@casual-simulation/aux-records';
|
|
3
|
-
import { SubscriptionLike } from 'rxjs';
|
|
3
|
+
import { Observable, SubscriptionLike } from 'rxjs';
|
|
4
|
+
import { LoginStatus, LoginUIStatus } from '../auth/AuxAuth';
|
|
4
5
|
/**
|
|
5
6
|
* Defines an interface for objects that are able to keep track of the user's authentication state.
|
|
6
7
|
*/
|
|
7
8
|
export interface AuthHelperInterface extends SubscriptionLike {
|
|
9
|
+
/**
|
|
10
|
+
* Gets whether this inst supports authentication.
|
|
11
|
+
*/
|
|
12
|
+
supportsAuthentication: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Gets an observable that resolves whenever a login status is available.
|
|
15
|
+
*/
|
|
16
|
+
loginStatus: Observable<LoginStatus>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets an observable that resolves whenever the login UI should be updated.
|
|
19
|
+
*/
|
|
20
|
+
loginUIStatus: Observable<LoginUIStatus>;
|
|
8
21
|
/**
|
|
9
22
|
* Determines whether the user is currently authenticated.
|
|
10
23
|
* Returns true if the user is logged in, false otherwise.
|
|
@@ -23,5 +36,24 @@ export interface AuthHelperInterface extends SubscriptionLike {
|
|
|
23
36
|
* @param recordName The name of the record that the key should be created for.
|
|
24
37
|
*/
|
|
25
38
|
createPublicRecordKey(recordName: string): Promise<CreatePublicRecordKeyResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Opens the user account page or the login page in a new tab.
|
|
41
|
+
*/
|
|
42
|
+
openAccountPage(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets whether a custom login UI should be used.
|
|
45
|
+
* @param useCustomUI Whether the custom login UI should be used.
|
|
46
|
+
*/
|
|
47
|
+
setUseCustomUI(useCustomUI: boolean): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Provides the given email address and whether the user accepted the terms of service for the login flow.
|
|
50
|
+
* @param email The email address that the user provided.
|
|
51
|
+
* @param acceptedTermsOfService Whether the user accepted the terms of service.
|
|
52
|
+
*/
|
|
53
|
+
provideEmailAddress(email: string, acceptedTermsOfService: boolean): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Cancels the current login if it is using the custom UI flow.
|
|
56
|
+
*/
|
|
57
|
+
cancelLogin(): Promise<void>;
|
|
26
58
|
}
|
|
27
59
|
//# sourceMappingURL=AuthHelperInterface.d.ts.map
|
|
@@ -90,8 +90,20 @@ export declare class BaseSimulation implements Simulation {
|
|
|
90
90
|
export(): Promise<StoredAux>;
|
|
91
91
|
private _getTreeName;
|
|
92
92
|
private _init;
|
|
93
|
+
/**
|
|
94
|
+
* Initializes the BotWatcher service.
|
|
95
|
+
*/
|
|
93
96
|
protected _initBotWatcher(): void;
|
|
94
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Triggered before the VM is initialized.
|
|
99
|
+
* Useful if services need to be configured to listen to VM events.
|
|
100
|
+
*/
|
|
101
|
+
protected _beforeVmInit(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Triggered after the VM is initialized.
|
|
104
|
+
* Useful if services need to be configured after the VM has been initialized.
|
|
105
|
+
*/
|
|
106
|
+
protected _afterVmInit(): void;
|
|
95
107
|
protected _setStatus(status: string): void;
|
|
96
108
|
unsubscribe(): void;
|
|
97
109
|
}
|
|
@@ -148,24 +148,38 @@ export class BaseSimulation {
|
|
|
148
148
|
}
|
|
149
149
|
this._setStatus('Starting...');
|
|
150
150
|
this._subscriptions.push(this._vm);
|
|
151
|
-
|
|
152
|
-
// so that it is already listening for any events that get emitted
|
|
153
|
-
// during initialization.
|
|
154
|
-
this._initBotWatcher();
|
|
151
|
+
this._beforeVmInit();
|
|
155
152
|
this._subscriptions.push(this._vm.connectionStateChanged.subscribe((s) => {
|
|
156
153
|
if (s.type === 'message') {
|
|
157
154
|
console.log(`[${s.source}] ${s.message}`);
|
|
158
155
|
}
|
|
159
156
|
}));
|
|
160
157
|
yield this._vm.init();
|
|
161
|
-
|
|
158
|
+
this._afterVmInit();
|
|
162
159
|
this._setStatus('Initialized.');
|
|
163
160
|
});
|
|
164
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Initializes the BotWatcher service.
|
|
164
|
+
*/
|
|
165
165
|
_initBotWatcher() {
|
|
166
166
|
this._watcher = new BotWatcher(this._helper, this._index, this._vm.stateUpdated, this._vm.versionUpdated);
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Triggered before the VM is initialized.
|
|
170
|
+
* Useful if services need to be configured to listen to VM events.
|
|
171
|
+
*/
|
|
172
|
+
_beforeVmInit() {
|
|
173
|
+
// BotWatcher should be initialized before the VM
|
|
174
|
+
// so that it is already listening for any events that get emitted
|
|
175
|
+
// during initialization.
|
|
176
|
+
this._initBotWatcher();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Triggered after the VM is initialized.
|
|
180
|
+
* Useful if services need to be configured after the VM has been initialized.
|
|
181
|
+
*/
|
|
182
|
+
_afterVmInit() { }
|
|
169
183
|
_setStatus(status) {
|
|
170
184
|
this._status = status;
|
|
171
185
|
console.log('[BaseSimulation] Status:', status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSimulation.js","sourceRoot":"","sources":["BaseSimulation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAEH,iBAAiB,EAEjB,QAAQ,GAGX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAUxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,cAAc;IAgGvB;;;;;;;OAOG;IACH,YACI,EAAU,EACV,MAA2B,EAC3B,UAA8B,EAC9B,QAAsC;QAEtC,IAAI,CAAC,WAAW,GAAG,EAAE,IAAI,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;YAChB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,UAAU;SACz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I,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACO,YAAY,KAAU,CAAC;IAEvB,UAAU,CAAC,MAAc;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAEM,WAAW;QACd,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC7B,CAAC;CACJ;AAED,MAAM,UAAU,WAAW,CAAC,EAAU;IAClC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5C,CAAC"}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import { Observable, SubscriptionLike } from 'rxjs';
|
|
2
2
|
import { AuxVM } from '../vm/AuxVM';
|
|
3
|
-
import { DefineGlobalBotAction } from '@casual-simulation/aux-common';
|
|
4
|
-
|
|
3
|
+
import { DefineGlobalBotAction, RegisterPrefixOptions } from '@casual-simulation/aux-common';
|
|
4
|
+
/**
|
|
5
|
+
* Defines an interface that represents a script prefix.
|
|
6
|
+
* That is, a prefix that indicates the value should be treated as a particular language.
|
|
7
|
+
*/
|
|
8
|
+
export interface ScriptPrefix {
|
|
9
|
+
/**
|
|
10
|
+
* The prefix.
|
|
11
|
+
*/
|
|
12
|
+
prefix: string;
|
|
13
|
+
/**
|
|
14
|
+
* The language that values should be treated as.
|
|
15
|
+
*/
|
|
16
|
+
language: RegisterPrefixOptions['language'];
|
|
17
|
+
/**
|
|
18
|
+
* Whether the prefix is a builtin value.
|
|
19
|
+
*/
|
|
20
|
+
isDefault?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the prefix should be treated as a fallback.
|
|
23
|
+
* That is, values that are imported using it will be imported verbatim.
|
|
24
|
+
*/
|
|
25
|
+
isFallback?: boolean;
|
|
26
|
+
}
|
|
5
27
|
/**
|
|
6
28
|
* The list of default script prefixes.
|
|
7
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalManager.js","sourceRoot":"","sources":["PortalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,OAAO,EACP,YAAY,GAEf,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,
|
|
1
|
+
{"version":3,"file":"PortalManager.js","sourceRoot":"","sources":["PortalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,OAAO,EACP,YAAY,GAEf,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAEH,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GAIrB,MAAM,+BAA+B,CAAC;AA6BvC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACnD;QACI,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,IAAI;KAClB;IACD;QACI,MAAM,EAAE,cAAc;QACtB,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,IAAI;KAClB;IACD;QACI,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;KACnB;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,aAAa;IA8DtB,YAAY,EAAS;QAxDb,gBAAW,GAAuC,IAAI,GAAG,EAAE,CAAC;QAyDhE,IAAI,CAAC,GAAG,GAAG,EAA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AAC,CAAC;iBACpD;gBAAC,OAAO,GAAG,EAAE;oBACV,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;iBAC7C;aACJ;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE;gBAC3C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACxC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC7B;SACJ;QAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SACnC;QACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC9C;QACD,IAAI,eAAe,CAAC,IAAI,GAAG,CAAC,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;SAC7D;QACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAClD;IACL,CAAC;IAED,WAAW;QACP,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACpB;IACL,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;CACJ"}
|
|
@@ -18,7 +18,9 @@ export declare class RecordsManager {
|
|
|
18
18
|
handleEvents(events: BotAction[]): void;
|
|
19
19
|
private _recordData;
|
|
20
20
|
private _getRecordData;
|
|
21
|
+
private _eraseRecordData;
|
|
21
22
|
private _recordFile;
|
|
23
|
+
private _eraseFile;
|
|
22
24
|
private _getAuthToken;
|
|
23
25
|
private _publishUrl;
|
|
24
26
|
}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { hasValue, asyncResult, asyncError, } from '@casual-simulation/aux-common';
|
|
10
|
+
import { hasValue, asyncResult, asyncError, APPROVED_SYMBOL, } from '@casual-simulation/aux-common';
|
|
11
11
|
import axios from 'axios';
|
|
12
12
|
import { sha256 } from 'hash.js';
|
|
13
13
|
import stringify from '@casual-simulation/fast-json-stable-stringify';
|
|
@@ -47,14 +47,33 @@ export class RecordsManager {
|
|
|
47
47
|
else if (event.type === 'get_record_data') {
|
|
48
48
|
this._getRecordData(event);
|
|
49
49
|
}
|
|
50
|
+
else if (event.type === 'erase_record_data') {
|
|
51
|
+
this._eraseRecordData(event);
|
|
52
|
+
}
|
|
50
53
|
else if (event.type === 'record_file') {
|
|
51
54
|
this._recordFile(event);
|
|
52
55
|
}
|
|
56
|
+
else if (event.type === 'erase_file') {
|
|
57
|
+
this._eraseFile(event);
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
_recordData(event) {
|
|
56
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (event.requiresApproval && !event[APPROVED_SYMBOL]) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
57
66
|
try {
|
|
67
|
+
if (!hasValue(this._config.recordsOrigin)) {
|
|
68
|
+
if (hasValue(event.taskId)) {
|
|
69
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
70
|
+
success: false,
|
|
71
|
+
errorCode: 'not_supported',
|
|
72
|
+
errorMessage: 'Records are not supported on this inst.',
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
58
77
|
console.log('[RecordsManager] Recording data...', event);
|
|
59
78
|
const token = yield this._getAuthToken();
|
|
60
79
|
if (!token) {
|
|
@@ -67,7 +86,9 @@ export class RecordsManager {
|
|
|
67
86
|
}
|
|
68
87
|
return;
|
|
69
88
|
}
|
|
70
|
-
const result = yield axios.post(this._publishUrl(
|
|
89
|
+
const result = yield axios.post(this._publishUrl(!event.requiresApproval
|
|
90
|
+
? '/api/v2/records/data'
|
|
91
|
+
: '/api/v2/records/manual/data'), {
|
|
71
92
|
recordKey: event.recordKey,
|
|
72
93
|
address: event.address,
|
|
73
94
|
data: event.data,
|
|
@@ -93,9 +114,24 @@ export class RecordsManager {
|
|
|
93
114
|
}
|
|
94
115
|
_getRecordData(event) {
|
|
95
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (event.requiresApproval && !event[APPROVED_SYMBOL]) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
96
120
|
try {
|
|
121
|
+
if (!hasValue(this._config.recordsOrigin)) {
|
|
122
|
+
if (hasValue(event.taskId)) {
|
|
123
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
124
|
+
success: false,
|
|
125
|
+
errorCode: 'not_supported',
|
|
126
|
+
errorMessage: 'Records are not supported on this inst.',
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
97
131
|
if (hasValue(event.taskId)) {
|
|
98
|
-
const result = yield axios.get(this._publishUrl(
|
|
132
|
+
const result = yield axios.get(this._publishUrl(!event.requiresApproval
|
|
133
|
+
? '/api/v2/records/data'
|
|
134
|
+
: '/api/v2/records/manual/data', {
|
|
99
135
|
recordName: event.recordName,
|
|
100
136
|
address: event.address,
|
|
101
137
|
}));
|
|
@@ -110,9 +146,75 @@ export class RecordsManager {
|
|
|
110
146
|
}
|
|
111
147
|
});
|
|
112
148
|
}
|
|
149
|
+
_eraseRecordData(event) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
if (event.requiresApproval && !event[APPROVED_SYMBOL]) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
if (!hasValue(this._config.recordsOrigin)) {
|
|
156
|
+
if (hasValue(event.taskId)) {
|
|
157
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
158
|
+
success: false,
|
|
159
|
+
errorCode: 'not_supported',
|
|
160
|
+
errorMessage: 'Records are not supported on this inst.',
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
console.log('[RecordsManager] Deleting data...', event);
|
|
166
|
+
const token = yield this._getAuthToken();
|
|
167
|
+
if (!token) {
|
|
168
|
+
if (hasValue(event.taskId)) {
|
|
169
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
170
|
+
success: false,
|
|
171
|
+
errorCode: 'not_logged_in',
|
|
172
|
+
errorMessage: 'The user is not logged in.',
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const result = yield axios.request({
|
|
178
|
+
method: 'DELETE',
|
|
179
|
+
url: this._publishUrl(!event.requiresApproval
|
|
180
|
+
? '/api/v2/records/data'
|
|
181
|
+
: '/api/v2/records/manual/data'),
|
|
182
|
+
data: {
|
|
183
|
+
recordKey: event.recordKey,
|
|
184
|
+
address: event.address,
|
|
185
|
+
},
|
|
186
|
+
headers: {
|
|
187
|
+
Authorization: `Bearer ${token}`,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
if (result.data.success) {
|
|
191
|
+
console.log('[RecordsManager] Data deleted!');
|
|
192
|
+
}
|
|
193
|
+
if (hasValue(event.taskId)) {
|
|
194
|
+
this._helper.transaction(asyncResult(event.taskId, result.data));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
console.error('[RecordsManager] Error deleting record:', e);
|
|
199
|
+
if (hasValue(event.taskId)) {
|
|
200
|
+
this._helper.transaction(asyncError(event.taskId, e.toString()));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
113
205
|
_recordFile(event) {
|
|
114
206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
207
|
try {
|
|
208
|
+
if (!hasValue(this._config.recordsOrigin)) {
|
|
209
|
+
if (hasValue(event.taskId)) {
|
|
210
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
211
|
+
success: false,
|
|
212
|
+
errorCode: 'not_supported',
|
|
213
|
+
errorMessage: 'Records are not supported on this inst.',
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
116
218
|
console.log('[RecordsManager] Recording file...', event);
|
|
117
219
|
const token = yield this._getAuthToken();
|
|
118
220
|
if (!token) {
|
|
@@ -183,9 +285,15 @@ export class RecordsManager {
|
|
|
183
285
|
const obj = event.data;
|
|
184
286
|
if ('data' in obj &&
|
|
185
287
|
'mimeType' in obj &&
|
|
186
|
-
obj.data instanceof ArrayBuffer
|
|
288
|
+
(obj.data instanceof ArrayBuffer ||
|
|
289
|
+
typeof obj.data === 'string') &&
|
|
187
290
|
typeof obj.mimeType === 'string') {
|
|
188
|
-
|
|
291
|
+
if (typeof obj.data === 'string') {
|
|
292
|
+
data = new TextEncoder().encode(obj.data);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
data = new Uint8Array(obj.data);
|
|
296
|
+
}
|
|
189
297
|
byteLength = data.byteLength;
|
|
190
298
|
mimeType = event.mimeType || obj.mimeType;
|
|
191
299
|
hash = getHash(data);
|
|
@@ -258,6 +366,57 @@ export class RecordsManager {
|
|
|
258
366
|
}
|
|
259
367
|
});
|
|
260
368
|
}
|
|
369
|
+
_eraseFile(event) {
|
|
370
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
371
|
+
try {
|
|
372
|
+
if (!hasValue(this._config.recordsOrigin)) {
|
|
373
|
+
if (hasValue(event.taskId)) {
|
|
374
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
375
|
+
success: false,
|
|
376
|
+
errorCode: 'not_supported',
|
|
377
|
+
errorMessage: 'Records are not supported on this inst.',
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
console.log('[RecordsManager] Deleting file...', event);
|
|
383
|
+
const token = yield this._getAuthToken();
|
|
384
|
+
if (!token) {
|
|
385
|
+
if (hasValue(event.taskId)) {
|
|
386
|
+
this._helper.transaction(asyncResult(event.taskId, {
|
|
387
|
+
success: false,
|
|
388
|
+
errorCode: 'not_logged_in',
|
|
389
|
+
errorMessage: 'The user is not logged in.',
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const result = yield axios.request({
|
|
395
|
+
method: 'DELETE',
|
|
396
|
+
url: this._publishUrl('/api/v2/records/file'),
|
|
397
|
+
data: {
|
|
398
|
+
recordKey: event.recordKey,
|
|
399
|
+
fileUrl: event.fileUrl,
|
|
400
|
+
},
|
|
401
|
+
headers: {
|
|
402
|
+
Authorization: `Bearer ${token}`,
|
|
403
|
+
},
|
|
404
|
+
});
|
|
405
|
+
if (result.data.success) {
|
|
406
|
+
console.log('[RecordsManager] File deleted!');
|
|
407
|
+
}
|
|
408
|
+
if (hasValue(event.taskId)) {
|
|
409
|
+
this._helper.transaction(asyncResult(event.taskId, result.data));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
catch (e) {
|
|
413
|
+
console.error('[RecordsManager] Error deleting file:', e);
|
|
414
|
+
if (hasValue(event.taskId)) {
|
|
415
|
+
this._helper.transaction(asyncError(event.taskId, e.toString()));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
261
420
|
_getAuthToken() {
|
|
262
421
|
return __awaiter(this, void 0, void 0, function* () {
|
|
263
422
|
if (!(yield this._auth.isAuthenticated())) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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C,uCAAuC,EAAE,CAAC,CAAC,CAAC;gBAC1D,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;oBACxB,IAAI,CAAC,OAAO,CAAC,WAAW,CACpB,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CACzC,CAAC;iBACL;aACJ;QACL,CAAC;KAAA;IAEa,aAAa;;YACvB,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,EAAE;gBACvC,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;aACnC;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;QACrC,CAAC;KAAA;IAEO,WAAW,CAAC,IAAY,EAAE,cAAmB,EAAE;QACnD,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAEpD,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE;YACzB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C;QAED,OAAO,GAAG,CAAC,IAAI,CAAC;IACpB,CAAC;CACJ;AAED,SAAS,OAAO,CAAC,MAAkB;IAC/B,OAAO,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC"}
|
package/managers/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from './ConnectionManager';
|
|
|
8
8
|
export * from './LoginManager';
|
|
9
9
|
export * from './ProgressManager';
|
|
10
10
|
export * from './BotDimensionManager';
|
|
11
|
-
export * from './PortalBundler';
|
|
12
11
|
export * from './PortalManager';
|
|
13
12
|
export * from './RecordsManager';
|
|
14
13
|
export * from './BaseSimulation';
|
package/managers/index.js
CHANGED
|
@@ -8,7 +8,6 @@ export * from './ConnectionManager';
|
|
|
8
8
|
export * from './LoginManager';
|
|
9
9
|
export * from './ProgressManager';
|
|
10
10
|
export * from './BotDimensionManager';
|
|
11
|
-
export * from './PortalBundler';
|
|
12
11
|
export * from './PortalManager';
|
|
13
12
|
export * from './RecordsManager';
|
|
14
13
|
export * from './BaseSimulation';
|
package/managers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-vm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.31",
|
|
4
4
|
"description": "A set of abstractions required to securely run an AUX.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aux"
|
|
@@ -40,13 +40,12 @@
|
|
|
40
40
|
"url": "https://github.com/casual-simulation/casualos/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@casual-simulation/aux-common": "^2.0.
|
|
44
|
-
"@casual-simulation/aux-records": "^2.0.
|
|
45
|
-
"@casual-simulation/causal-tree-client-socketio": "^2.0.22",
|
|
43
|
+
"@casual-simulation/aux-common": "^2.0.31",
|
|
44
|
+
"@casual-simulation/aux-records": "^2.0.31",
|
|
46
45
|
"@casual-simulation/causal-trees": "^2.0.22",
|
|
47
46
|
"@casual-simulation/crypto": "^2.0.22",
|
|
48
47
|
"@casual-simulation/fast-json-stable-stringify": "^2.0.14",
|
|
49
|
-
"@casual-simulation/undom": "^2.0.
|
|
48
|
+
"@casual-simulation/undom": "^2.0.30",
|
|
50
49
|
"esbuild": "^0.13.8",
|
|
51
50
|
"esbuild-wasm": "^0.8.43",
|
|
52
51
|
"lodash": "4.17.21",
|
|
@@ -54,5 +53,5 @@
|
|
|
54
53
|
"rxjs": "^6.5.2",
|
|
55
54
|
"uuid": "^8.3.2"
|
|
56
55
|
},
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "7dbb0b8d8d98060b770be7dd6489aae288600846"
|
|
58
57
|
}
|
|
@@ -14,12 +14,15 @@ export class CustomAppHelper {
|
|
|
14
14
|
for (let event of events) {
|
|
15
15
|
if (event.type === 'register_custom_app') {
|
|
16
16
|
let appId = event.appId;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (!this.portals.has(appId)) {
|
|
18
|
+
const backend = new HtmlAppBackend(appId, event.botId, this.helper, event.taskId);
|
|
19
|
+
this.portals.set(appId, backend);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (hasValue(event.taskId)) {
|
|
23
|
+
this.helper.transaction(asyncResult(event.taskId, null));
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
|
-
this.portals.set(appId, backend);
|
|
23
26
|
}
|
|
24
27
|
else if (event.type === 'unregister_custom_app') {
|
|
25
28
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAppHelper.js","sourceRoot":"","sources":["CustomAppHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,WAAW,EAGX,QAAQ,GACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,eAAe;IAMxB,YAAY,MAAiB;QAH7B,+GAA+G;QAC/G,YAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;QAGzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,YAAY,CAAC,MAAmB;QAC5B,yFAAyF;QACzF,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;YACtB,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,EAAE;gBACtC,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;gBAExB,IAAI,OAAO,GAAe,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"CustomAppHelper.js","sourceRoot":"","sources":["CustomAppHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,WAAW,EAGX,QAAQ,GACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,eAAe;IAMxB,YAAY,MAAiB;QAH7B,+GAA+G;QAC/G,YAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;QAGzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,YAAY,CAAC,MAAmB;QAC5B,yFAAyF;QACzF,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE;YACtB,IAAI,KAAK,CAAC,IAAI,K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BACJ;aACJ;SACJ;QAED,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;YACtC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;SAC/B;IACL,CAAC;CACJ"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { BotsState, RegisterPrefixOptions } from '@casual-simulation/aux-common';
|
|
2
|
-
export declare const DEFAULT_IMPORT_LANGUAGE = "js";
|
|
3
|
-
/**
|
|
4
|
-
* Defines an interface that represents the list of bots and tags that are included in a bundle.
|
|
5
|
-
*/
|
|
6
|
-
export interface BundleModules {
|
|
7
|
-
[id: string]: Set<string>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Defines an interface that represents data about an external module.
|
|
11
|
-
*/
|
|
12
|
-
export interface ExternalModule {
|
|
13
|
-
/**
|
|
14
|
-
* The ID that was imported.
|
|
15
|
-
*/
|
|
16
|
-
id: string;
|
|
17
|
-
/**
|
|
18
|
-
* The URL that was imported.
|
|
19
|
-
*/
|
|
20
|
-
url: string;
|
|
21
|
-
/**
|
|
22
|
-
* The URL to the typescript definitions
|
|
23
|
-
*/
|
|
24
|
-
typescriptDefinitionsURL: string | null;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Defines an interface that represents data about an injected library.
|
|
28
|
-
*/
|
|
29
|
-
export interface LibraryModule {
|
|
30
|
-
/**
|
|
31
|
-
* The ID that was imported.
|
|
32
|
-
*/
|
|
33
|
-
id: string;
|
|
34
|
-
/**
|
|
35
|
-
* The source code that was imported.
|
|
36
|
-
*/
|
|
37
|
-
source: string;
|
|
38
|
-
/**
|
|
39
|
-
* The typescript definitions that should be used for the module.
|
|
40
|
-
*/
|
|
41
|
-
typescriptDefinitions?: string;
|
|
42
|
-
/**
|
|
43
|
-
* The language that this module is in.
|
|
44
|
-
*/
|
|
45
|
-
language: RegisterPrefixOptions['language'];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Defines an interface that represents a bundle of code.
|
|
49
|
-
*/
|
|
50
|
-
export interface CodeBundle {
|
|
51
|
-
/**
|
|
52
|
-
* The tag the bundle was built from.
|
|
53
|
-
*/
|
|
54
|
-
tag: string;
|
|
55
|
-
/**
|
|
56
|
-
* The source code that the bundle contains.
|
|
57
|
-
* If an error occurred, then this will be null/undefined.
|
|
58
|
-
*/
|
|
59
|
-
source?: string;
|
|
60
|
-
/**
|
|
61
|
-
* The error that occurred while building the bundle.
|
|
62
|
-
* Null/Undefined if an error did not happen.
|
|
63
|
-
*/
|
|
64
|
-
error?: string;
|
|
65
|
-
/**
|
|
66
|
-
* The list of warnings that occurred while building the bundle.
|
|
67
|
-
*/
|
|
68
|
-
warnings: string[];
|
|
69
|
-
/**
|
|
70
|
-
* The list of modules that the bundle contains.
|
|
71
|
-
*/
|
|
72
|
-
modules: BundleModules;
|
|
73
|
-
/**
|
|
74
|
-
* The list of modules that were imported from the web.
|
|
75
|
-
*/
|
|
76
|
-
externals: {
|
|
77
|
-
[id: string]: ExternalModule;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* The list of libraries that were imported.
|
|
81
|
-
*/
|
|
82
|
-
libraries: {
|
|
83
|
-
[id: string]: LibraryModule;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Defines an interface that represents a script prefix.
|
|
88
|
-
* That is, a prefix that indicates the value should be treated as a particular language.
|
|
89
|
-
*/
|
|
90
|
-
export interface ScriptPrefix {
|
|
91
|
-
/**
|
|
92
|
-
* The prefix.
|
|
93
|
-
*/
|
|
94
|
-
prefix: string;
|
|
95
|
-
/**
|
|
96
|
-
* The language that values should be treated as.
|
|
97
|
-
*/
|
|
98
|
-
language: RegisterPrefixOptions['language'];
|
|
99
|
-
/**
|
|
100
|
-
* Whether the prefix is a builtin value.
|
|
101
|
-
*/
|
|
102
|
-
isDefault?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Whether the prefix should be treated as a fallback.
|
|
105
|
-
* That is, values that are imported using it will be imported verbatim.
|
|
106
|
-
*/
|
|
107
|
-
isFallback?: boolean;
|
|
108
|
-
}
|
|
109
|
-
export declare const DEFAULT_BASE_MODULE_URL: string;
|
|
110
|
-
/**
|
|
111
|
-
* Defines an interface that can bundle AUX code from tags into a single script.
|
|
112
|
-
*/
|
|
113
|
-
export interface PortalBundler {
|
|
114
|
-
/**
|
|
115
|
-
* Creates a bundle from the given bots.
|
|
116
|
-
* @param state The bots state that the bundle should be created from.
|
|
117
|
-
* @param tag The tag that should be used as the entry point for the bundle.
|
|
118
|
-
* @param prefixes The prefixes that should be used to distinguish tag types.
|
|
119
|
-
*/
|
|
120
|
-
bundleTag(state: BotsState, tag: string, prefixes: ScriptPrefix[]): Promise<CodeBundle>;
|
|
121
|
-
/**
|
|
122
|
-
* Adds the given library source under the given name.
|
|
123
|
-
* @param module The module that should be used.
|
|
124
|
-
*/
|
|
125
|
-
addLibrary(module: LibraryModule): void;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Defines a class that is used to bundle scripts for portals.
|
|
129
|
-
* It listens for state updates and is able to asynchrounously emit bundles that should be injected into custom portals.
|
|
130
|
-
*/
|
|
131
|
-
export declare class ESBuildPortalBundler implements PortalBundler {
|
|
132
|
-
private _baseModuleUrl;
|
|
133
|
-
private _httpCache;
|
|
134
|
-
private _libraries;
|
|
135
|
-
private _esbuildWasmUrl;
|
|
136
|
-
constructor(options?: {
|
|
137
|
-
esbuildWasmUrl?: string;
|
|
138
|
-
});
|
|
139
|
-
/**
|
|
140
|
-
* Adds the given library source under the given name.
|
|
141
|
-
* @param source The source code to use.
|
|
142
|
-
*/
|
|
143
|
-
addLibrary(module: LibraryModule): void;
|
|
144
|
-
/**
|
|
145
|
-
* Creates a bundle from the given bots that starts with the given tag.
|
|
146
|
-
* @param state The bots state that the bundle should be created from.
|
|
147
|
-
* @param tag The tag that should be bundled.
|
|
148
|
-
* @param prefixes The list of script prefixes.
|
|
149
|
-
*/
|
|
150
|
-
bundleTag(state: BotsState, tag: string, prefixes: ScriptPrefix[]): Promise<CodeBundle>;
|
|
151
|
-
private _esbuild;
|
|
152
|
-
private _esbuildPlugin;
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=PortalBundler.d.ts.map
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { calculateBotValue, getScriptPrefix, isPortalScript, trimPrefixedScript, hasValue, } from '@casual-simulation/aux-common';
|
|
11
|
-
import { values, sortBy } from 'lodash';
|
|
12
|
-
import axios from 'axios';
|
|
13
|
-
import * as esbuild from 'esbuild';
|
|
14
|
-
export const DEFAULT_IMPORT_LANGUAGE = 'js';
|
|
15
|
-
export const DEFAULT_BASE_MODULE_URL = 'https://cdn.skypack.dev';
|
|
16
|
-
let _startedEsbuild = false;
|
|
17
|
-
/**
|
|
18
|
-
* Defines a class that is used to bundle scripts for portals.
|
|
19
|
-
* It listens for state updates and is able to asynchrounously emit bundles that should be injected into custom portals.
|
|
20
|
-
*/
|
|
21
|
-
export class ESBuildPortalBundler {
|
|
22
|
-
constructor(options = {}) {
|
|
23
|
-
this._baseModuleUrl = DEFAULT_BASE_MODULE_URL;
|
|
24
|
-
this._httpCache = new Map();
|
|
25
|
-
this._libraries = new Map();
|
|
26
|
-
this._libraries;
|
|
27
|
-
this._esbuildWasmUrl = options.esbuildWasmUrl || null;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Adds the given library source under the given name.
|
|
31
|
-
* @param source The source code to use.
|
|
32
|
-
*/
|
|
33
|
-
addLibrary(module) {
|
|
34
|
-
this._libraries.set(module.id, module);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Creates a bundle from the given bots that starts with the given tag.
|
|
38
|
-
* @param state The bots state that the bundle should be created from.
|
|
39
|
-
* @param tag The tag that should be bundled.
|
|
40
|
-
* @param prefixes The list of script prefixes.
|
|
41
|
-
*/
|
|
42
|
-
bundleTag(state, tag, prefixes) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
let entryModules = new Set();
|
|
45
|
-
let entryCode = '';
|
|
46
|
-
let scriptPrefixes = prefixes.map((p) => p.prefix);
|
|
47
|
-
let bots = sortBy(values(state), (b) => b.id);
|
|
48
|
-
const entryPrefix = getScriptPrefix(scriptPrefixes, tag);
|
|
49
|
-
const entryPrefixes = entryPrefix !== null ? [entryPrefix] : scriptPrefixes;
|
|
50
|
-
tag = entryPrefix !== null ? trimPrefixedScript(entryPrefix, tag) : tag;
|
|
51
|
-
let tagModules = bots
|
|
52
|
-
.map((b) => ({
|
|
53
|
-
prefix: getScriptPrefix(entryPrefixes, calculateBotValue(null, b, tag)),
|
|
54
|
-
tag: tag,
|
|
55
|
-
id: b.id,
|
|
56
|
-
code: calculateBotValue(null, b, tag),
|
|
57
|
-
}))
|
|
58
|
-
.filter((value) => value.prefix !== null)
|
|
59
|
-
.map((m) => ({
|
|
60
|
-
name: auxModuleId(m.prefix, m.id, m.tag),
|
|
61
|
-
code: trimPrefixedScript(m.prefix, m.code),
|
|
62
|
-
}));
|
|
63
|
-
if (tagModules.length <= 0) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
for (let m of tagModules) {
|
|
67
|
-
entryModules.add(m.name);
|
|
68
|
-
}
|
|
69
|
-
for (let name of entryModules) {
|
|
70
|
-
entryCode += `import ${JSON.stringify(name)};\n`;
|
|
71
|
-
}
|
|
72
|
-
return yield this._esbuild(tag, entryCode, prefixes, state, bots);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
_esbuild(tag, entryCode, prefixes, state, bots) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
if (!_startedEsbuild) {
|
|
78
|
-
let options = {};
|
|
79
|
-
if (this._esbuildWasmUrl) {
|
|
80
|
-
options.wasmURL = this._esbuildWasmUrl;
|
|
81
|
-
}
|
|
82
|
-
yield esbuild.initialize(options);
|
|
83
|
-
_startedEsbuild = true;
|
|
84
|
-
}
|
|
85
|
-
let modules = {};
|
|
86
|
-
let externals = {};
|
|
87
|
-
let libraries = {};
|
|
88
|
-
try {
|
|
89
|
-
const result = yield esbuild.build({
|
|
90
|
-
entryPoints: ['__entry'],
|
|
91
|
-
bundle: true,
|
|
92
|
-
format: 'iife',
|
|
93
|
-
write: false,
|
|
94
|
-
logLevel: 'silent',
|
|
95
|
-
plugins: [
|
|
96
|
-
this._esbuildPlugin(prefixes, entryCode, state, bots, modules, externals, libraries),
|
|
97
|
-
],
|
|
98
|
-
});
|
|
99
|
-
let final = '';
|
|
100
|
-
for (let file of result.outputFiles) {
|
|
101
|
-
final += file.text;
|
|
102
|
-
}
|
|
103
|
-
const warnings = result.warnings.map((w) => w.text);
|
|
104
|
-
return {
|
|
105
|
-
tag,
|
|
106
|
-
source: final,
|
|
107
|
-
warnings,
|
|
108
|
-
modules,
|
|
109
|
-
externals,
|
|
110
|
-
libraries,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
return {
|
|
115
|
-
tag,
|
|
116
|
-
error: err.toString(),
|
|
117
|
-
warnings: [],
|
|
118
|
-
modules,
|
|
119
|
-
externals,
|
|
120
|
-
libraries,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
_esbuildPlugin(prefixes, entryCode, state, bots, modules, externals, libraries) {
|
|
126
|
-
return {
|
|
127
|
-
name: 'casualos',
|
|
128
|
-
setup: (build) => {
|
|
129
|
-
build.onResolve({ filter: /^__entry$/ }, (args) => ({
|
|
130
|
-
path: args.path,
|
|
131
|
-
namespace: 'entry-ns',
|
|
132
|
-
}));
|
|
133
|
-
build.onLoad({ filter: /^__entry$/, namespace: 'entry-ns' }, (args) => ({
|
|
134
|
-
contents: entryCode,
|
|
135
|
-
loader: 'js',
|
|
136
|
-
}));
|
|
137
|
-
build.onResolve({ filter: /\\?auxmodule$/ }, (args) => ({
|
|
138
|
-
path: args.path,
|
|
139
|
-
namespace: 'aux-ns',
|
|
140
|
-
}));
|
|
141
|
-
for (let p of prefixes) {
|
|
142
|
-
let prefix = p;
|
|
143
|
-
build.onResolve({ filter: new RegExp(`^${prefix.prefix}`) }, (args) => {
|
|
144
|
-
const tag = trimPrefixedScript(prefix.prefix, args.path);
|
|
145
|
-
const bot = p.isFallback
|
|
146
|
-
? bots.find((b) => hasValue(calculateBotValue(null, b, tag)))
|
|
147
|
-
: bots.find((b) => isPortalScript(prefix.prefix, calculateBotValue(null, b, tag)));
|
|
148
|
-
if (!bot) {
|
|
149
|
-
return {
|
|
150
|
-
errors: [
|
|
151
|
-
{
|
|
152
|
-
text: `Unable to resolve "${prefix.prefix}${tag}". No matching script could be found.`,
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
path: auxModuleId(prefix.prefix, bot.id, tag),
|
|
159
|
-
namespace: p.isFallback
|
|
160
|
-
? 'aux-fallback-ns'
|
|
161
|
-
: 'aux-ns',
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
build.onLoad({ filter: /\\?auxmodule$/, namespace: 'aux-ns' }, buildAuxLoader(false));
|
|
166
|
-
build.onLoad({ filter: /\\?auxmodule$/, namespace: 'aux-fallback-ns' }, buildAuxLoader(true));
|
|
167
|
-
build.onResolve({ filter: /^https?/ }, (args) => ({
|
|
168
|
-
path: args.path,
|
|
169
|
-
namespace: 'http-ns',
|
|
170
|
-
}));
|
|
171
|
-
build.onResolve({ filter: /.*/ }, (args) => {
|
|
172
|
-
const importee = args.path;
|
|
173
|
-
let importer = args.importer;
|
|
174
|
-
if (this._libraries.has(importee)) {
|
|
175
|
-
return {
|
|
176
|
-
path: importee,
|
|
177
|
-
namespace: 'lib-ns',
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
// convert to HTTP(S) import.
|
|
181
|
-
if (importee.startsWith('/') ||
|
|
182
|
-
importee.startsWith('./') ||
|
|
183
|
-
importee.startsWith('../')) {
|
|
184
|
-
const lastForwardSlash = importer.lastIndexOf('/');
|
|
185
|
-
const lastDot = importer.lastIndexOf('.');
|
|
186
|
-
// We can determine that the importer was a file with an extension
|
|
187
|
-
// by looking at whether the index of the last period is after the
|
|
188
|
-
// index of the last forward slash. If it is, then we know the file has
|
|
189
|
-
// a valid extension. If it is not, then it should be treated as a directory name.
|
|
190
|
-
const hasFileExtension = lastDot >= 0 && lastForwardSlash < lastDot;
|
|
191
|
-
// use importer as base URL
|
|
192
|
-
if (!hasFileExtension && !importer.endsWith('/')) {
|
|
193
|
-
const importerUrl = new URL(importer);
|
|
194
|
-
importer = `${importerUrl.origin}${importerUrl.pathname}/`;
|
|
195
|
-
}
|
|
196
|
-
const url = new URL(importee, importer);
|
|
197
|
-
return { path: url.href, namespace: 'http-ns' };
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
const url = `${this._baseModuleUrl}/${importee}?dts`;
|
|
201
|
-
externals[importee] = {
|
|
202
|
-
id: importee,
|
|
203
|
-
url,
|
|
204
|
-
typescriptDefinitionsURL: null,
|
|
205
|
-
};
|
|
206
|
-
return {
|
|
207
|
-
path: url,
|
|
208
|
-
namespace: 'http-ns',
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
build.onLoad({ filter: /^https?/, namespace: 'http-ns' }, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
try {
|
|
214
|
-
const cached = this._httpCache.get(args.path);
|
|
215
|
-
if (typeof cached !== 'undefined') {
|
|
216
|
-
return {
|
|
217
|
-
contents: handleHttpResponse(args.path, yield cached, externals),
|
|
218
|
-
loader: 'js',
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
let promise = axios.get(args.path);
|
|
222
|
-
this._httpCache.set(args.path, promise);
|
|
223
|
-
const script = handleHttpResponse(args.path, yield promise, externals);
|
|
224
|
-
return {
|
|
225
|
-
contents: script,
|
|
226
|
-
loader: 'js',
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
return {
|
|
231
|
-
errors: [
|
|
232
|
-
{
|
|
233
|
-
text: `${err}`,
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
}));
|
|
239
|
-
build.onLoad({ filter: /.*/, namespace: 'lib-ns' }, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
try {
|
|
241
|
-
const module = this._libraries.get(args.path);
|
|
242
|
-
if (module) {
|
|
243
|
-
libraries[args.path] = module;
|
|
244
|
-
return {
|
|
245
|
-
contents: module.source,
|
|
246
|
-
loader: loaderForLanguage(module.language, DEFAULT_IMPORT_LANGUAGE),
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
return {
|
|
250
|
-
errors: [
|
|
251
|
-
{
|
|
252
|
-
text: `Unable to find library for ${args.path}`,
|
|
253
|
-
},
|
|
254
|
-
],
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
catch (err) {
|
|
258
|
-
return {
|
|
259
|
-
errors: [
|
|
260
|
-
{
|
|
261
|
-
text: `${err}`,
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}));
|
|
267
|
-
function buildAuxLoader(isFallback) {
|
|
268
|
-
return (args) => {
|
|
269
|
-
const { prefix, botId, tag } = parseAuxModuleId(prefixes, args.path);
|
|
270
|
-
if (prefix && botId && tag) {
|
|
271
|
-
const bot = state[botId];
|
|
272
|
-
if (!bot) {
|
|
273
|
-
return {
|
|
274
|
-
errors: [
|
|
275
|
-
{
|
|
276
|
-
text: `Unable to import "${prefix.prefix}${tag}". No matching script could be found.`,
|
|
277
|
-
},
|
|
278
|
-
],
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
let moduleTags = modules[botId];
|
|
282
|
-
if (!moduleTags) {
|
|
283
|
-
moduleTags = new Set();
|
|
284
|
-
modules[botId] = moduleTags;
|
|
285
|
-
}
|
|
286
|
-
moduleTags.add(tag);
|
|
287
|
-
const code = calculateBotValue(null, bot, tag);
|
|
288
|
-
return {
|
|
289
|
-
contents: isFallback
|
|
290
|
-
? code
|
|
291
|
-
: trimPrefixedScript(prefix.prefix, code),
|
|
292
|
-
loader: loaderForLanguage(prefix.language, DEFAULT_IMPORT_LANGUAGE),
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
296
|
-
errors: [
|
|
297
|
-
{
|
|
298
|
-
text: `Did you forget to use 📖 when importing?`,
|
|
299
|
-
},
|
|
300
|
-
],
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function loaderForLanguage(language, defaultLoader) {
|
|
309
|
-
return language === 'javascript'
|
|
310
|
-
? 'js'
|
|
311
|
-
: language === 'typescript'
|
|
312
|
-
? 'ts'
|
|
313
|
-
: language === 'json'
|
|
314
|
-
? 'json'
|
|
315
|
-
: language === 'jsx'
|
|
316
|
-
? 'jsx'
|
|
317
|
-
: language === 'tsx'
|
|
318
|
-
? 'tsx'
|
|
319
|
-
: language === 'text'
|
|
320
|
-
? 'text'
|
|
321
|
-
: defaultLoader;
|
|
322
|
-
}
|
|
323
|
-
function handleHttpResponse(path, response, externals) {
|
|
324
|
-
var _a;
|
|
325
|
-
if (typeof response.data === 'string') {
|
|
326
|
-
const script = response.data;
|
|
327
|
-
const external = values(externals).find((e) => e.url === path);
|
|
328
|
-
if (external) {
|
|
329
|
-
const declarations = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['x-typescript-types'];
|
|
330
|
-
if (typeof declarations === 'string') {
|
|
331
|
-
external.typescriptDefinitionsURL = new URL(declarations, path).href;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return script;
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
throw new Error(`The module server did not return a string.`);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function auxModuleId(prefix, botId, tag) {
|
|
341
|
-
return `${prefix}${botId}.${tag}?auxmodule`;
|
|
342
|
-
}
|
|
343
|
-
function parseAuxModuleId(prefixes, id) {
|
|
344
|
-
if (isAuxModuleId(id)) {
|
|
345
|
-
for (let prefix of prefixes) {
|
|
346
|
-
if (id.startsWith(prefix.prefix)) {
|
|
347
|
-
id = id.substring(prefix.prefix.length);
|
|
348
|
-
const dotIndex = id.indexOf('.');
|
|
349
|
-
const botId = id.slice(0, dotIndex);
|
|
350
|
-
const tag = id.slice(dotIndex + 1, id.length - '?auxmodule'.length);
|
|
351
|
-
return {
|
|
352
|
-
prefix,
|
|
353
|
-
botId,
|
|
354
|
-
tag,
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return { prefix: null, botId: null, tag: null };
|
|
360
|
-
}
|
|
361
|
-
function isAuxModuleId(id) {
|
|
362
|
-
return id.endsWith('?auxmodule');
|
|
363
|
-
}
|
|
364
|
-
//# sourceMappingURL=PortalBundler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PortalBundler.js","sourceRoot":"","sources":["PortalBundler.ts"],"names":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