@takaro/helpers 0.0.0-dev.4dbe15b
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/README.md +4 -0
- package/dist/.source-hash +1 -0
- package/dist/TakaroUserError.d.ts +4 -0
- package/dist/TakaroUserError.d.ts.map +1 -0
- package/dist/TakaroUserError.js +7 -0
- package/dist/TakaroUserError.js.map +1 -0
- package/dist/checkPermission.d.ts +23 -0
- package/dist/checkPermission.d.ts.map +1 -0
- package/dist/checkPermission.js +26 -0
- package/dist/checkPermission.js.map +1 -0
- package/dist/egress.d.ts +21 -0
- package/dist/egress.d.ts.map +1 -0
- package/dist/egress.js +151 -0
- package/dist/egress.js.map +1 -0
- package/dist/executeVM.d.ts +28 -0
- package/dist/executeVM.d.ts.map +1 -0
- package/dist/executeVM.js +138 -0
- package/dist/executeVM.js.map +1 -0
- package/dist/executionLimits.d.ts +3 -0
- package/dist/executionLimits.d.ts.map +1 -0
- package/dist/executionLimits.js +5 -0
- package/dist/executionLimits.js.map +1 -0
- package/dist/getTakaro.d.ts +7 -0
- package/dist/getTakaro.d.ts.map +1 -0
- package/dist/getTakaro.js +33 -0
- package/dist/getTakaro.js.map +1 -0
- package/dist/main.d.ts +16 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +12 -0
- package/dist/main.js.map +1 -0
- package/dist/nextCronJobRun.d.ts +2 -0
- package/dist/nextCronJobRun.d.ts.map +1 -0
- package/dist/nextCronJobRun.js +5 -0
- package/dist/nextCronJobRun.js.map +1 -0
- package/dist/userModules.d.ts +16 -0
- package/dist/userModules.d.ts.map +1 -0
- package/dist/userModules.js +4 -0
- package/dist/userModules.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f24e906a747ddc057f91ffdd966565e64dc6ab9adc078f80a4340dab80306d9c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TakaroUserError.d.ts","sourceRoot":"","sources":["../src/TakaroUserError.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TakaroUserError.js","sourceRoot":"","sources":["../src/TakaroUserError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PlayerOnGameserverOutputWithRolesDTO } from '@takaro/apiclient';
|
|
2
|
+
export interface CheckPermissionOptions {
|
|
3
|
+
/** Name or id of the Module that declares the permission; defaults to the executing Module. */
|
|
4
|
+
module?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function checkModulePermission(player: PlayerOnGameserverOutputWithRolesDTO, permission: string, moduleId: string | undefined, options?: CheckPermissionOptions): boolean | {
|
|
7
|
+
module?: import("@takaro/apiclient").PermissionModuleDTO;
|
|
8
|
+
version?: import("@takaro/apiclient").PermissionVersionDTO;
|
|
9
|
+
permission: string;
|
|
10
|
+
friendlyName: string;
|
|
11
|
+
description: string;
|
|
12
|
+
canHaveCount?: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: import("@takaro/apiclient").NOTDOMAINSCOPEDTakaroModelDTOCreatedAt;
|
|
15
|
+
updatedAt: import("@takaro/apiclient").NOTDOMAINSCOPEDTakaroModelDTOCreatedAt;
|
|
16
|
+
count: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Checks a permission of this Module, or of the Module named in `options.module`.
|
|
20
|
+
* Returns the permission with its `count` when held, `true` for ROOT, `false` otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkPermission(player: PlayerOnGameserverOutputWithRolesDTO, permission: string, options?: CheckPermissionOptions): any;
|
|
23
|
+
//# sourceMappingURL=checkPermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkPermission.d.ts","sourceRoot":"","sources":["../src/checkPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACrC,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,oCAAoC,EAC5C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE,sBAAsB;;;;;;;;;;;EAkBjC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,oCAAoC,EAC5C,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,sBAAsB,GAE/B,GAAG,CAIL"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// GH #4686: a Module only sees grants on its own permissions, plus ROOT; no moduleId means ROOT only.
|
|
2
|
+
// GH #4898: naming another Module in `options.module` reads that Module's grant instead.
|
|
3
|
+
export function checkModulePermission(player, permission, moduleId, options) {
|
|
4
|
+
const grants = player.roles.flatMap((assignment) => assignment.role.permissions);
|
|
5
|
+
const named = options?.module;
|
|
6
|
+
const ownedBy = (module) => named ? module?.id === named || module?.name === named : !!moduleId && module?.id === moduleId;
|
|
7
|
+
const held = grants
|
|
8
|
+
.filter((g) => g.permission.permission === permission && ownedBy(g.permission.module))
|
|
9
|
+
.sort((a, b) => b.count - a.count)
|
|
10
|
+
.at(0);
|
|
11
|
+
if (held) {
|
|
12
|
+
return { ...held.permission, count: held.count };
|
|
13
|
+
}
|
|
14
|
+
if (grants.some((g) => g.permission.permission === 'ROOT' && !g.permission.module)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks a permission of this Module, or of the Module named in `options.module`.
|
|
21
|
+
* Returns the permission with its `count` when held, `true` for ROOT, `false` otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export function checkPermission(player, permission, options) {
|
|
24
|
+
throw new Error(`checkPermission(pog ${player.id}, '${permission}', ${JSON.stringify(options)}) only runs inside Module code`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=checkPermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkPermission.js","sourceRoot":"","sources":["../src/checkPermission.ts"],"names":[],"mappings":"AAOA,sGAAsG;AACtG,yFAAyF;AACzF,MAAM,UAAU,qBAAqB,CACnC,MAA4C,EAC5C,UAAkB,EAClB,QAA4B,EAC5B,OAAgC;IAEhC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjF,MAAM,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC;IAC9B,MAAM,OAAO,GAAG,CAAC,MAAqC,EAAE,EAAE,CACxD,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,KAAK,IAAI,MAAM,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,MAAM,EAAE,EAAE,KAAK,QAAQ,CAAC;IACjG,MAAM,IAAI,GAAG,MAAM;SAChB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACrF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,EAAE,CAAC,CAAC,CAAC,CAAC;IAET,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA4C,EAC5C,UAAkB,EAClB,OAAgC;IAGhC,MAAM,IAAI,KAAK,CACb,uBAAuB,MAAM,CAAC,EAAE,MAAM,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gCAAgC,CAC9G,CAAC;AACJ,CAAC"}
|
package/dist/egress.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import axios, { type AxiosInstance, type CreateAxiosDefaults } from 'axios';
|
|
2
|
+
export declare const EGRESS_DENIED_REASON = "egress-denied";
|
|
3
|
+
export declare class EgressDeniedError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function parseAllowedHosts(raw: string): string[];
|
|
7
|
+
export interface GuardedAxiosOptions {
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
allowedHosts: readonly string[];
|
|
10
|
+
maxResponseBytes?: number;
|
|
11
|
+
maxConcurrentRequests?: number;
|
|
12
|
+
egressProxyUrl?: string;
|
|
13
|
+
onDenied(message: string): void;
|
|
14
|
+
}
|
|
15
|
+
declare const CARRIED_STATICS: readonly ['AxiosError', 'CanceledError', 'Cancel', 'CancelToken', 'isCancel', 'isAxiosError', 'all', 'spread', 'toFormData', 'formToJSON', 'AxiosHeaders', 'HttpStatusCode', 'VERSION'];
|
|
16
|
+
export type GuardedAxiosInstance = AxiosInstance & Pick<typeof axios, (typeof CARRIED_STATICS)[number]> & {
|
|
17
|
+
create(config?: CreateAxiosDefaults): GuardedAxiosInstance;
|
|
18
|
+
};
|
|
19
|
+
export declare function createGuardedAxios(opts: GuardedAxiosOptions): GuardedAxiosInstance;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=egress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.d.ts","sourceRoot":"","sources":["../src/egress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAK/F,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAaD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAcvD;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAGD,QAAA,MAAM,eAAe,YACnB,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAC9C,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG;IACrD,MAAM,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAAC;CAC5D,CAAC;AAEJ,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,oBAAoB,CA2GlF"}
|
package/dist/egress.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
3
|
+
// Author-facing half of sandbox egress (GH #4020, ADR 0027); enforced separately by the
|
|
4
|
+
// CiliumNetworkPolicy in deploy/charts/takaro/templates/module-runner/network-policy.yaml.
|
|
5
|
+
export const EGRESS_DENIED_REASON = 'egress-denied';
|
|
6
|
+
export class EgressDeniedError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'EgressDeniedError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
// Exact hostnames only: a wildcard would need a Cilium DNS matchPattern, which reopens DNS-label
|
|
13
|
+
// exfiltration (gettakaro/cloud ADR 0014) and splits this check from the network policy.
|
|
14
|
+
const ALLOWED_HOST = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/;
|
|
15
|
+
// The sandbox API URL is written absolute (trailing dot) because of resolver ndots:5; compare past it.
|
|
16
|
+
function normaliseHost(host) {
|
|
17
|
+
const lower = host.toLowerCase();
|
|
18
|
+
return lower.endsWith('.') ? lower.slice(0, -1) : lower;
|
|
19
|
+
}
|
|
20
|
+
// Throws on a malformed entry: an allowlist typo must fail boot, not silently narrow egress.
|
|
21
|
+
export function parseAllowedHosts(raw) {
|
|
22
|
+
return raw
|
|
23
|
+
.split(',')
|
|
24
|
+
.map((entry) => entry.trim().toLowerCase())
|
|
25
|
+
.filter((entry) => entry !== '')
|
|
26
|
+
.map((entry) => {
|
|
27
|
+
if (!ALLOWED_HOST.test(entry)) {
|
|
28
|
+
throw new Error(`'${entry}' is not a valid egress allowlist entry: bare, exact, lowercase hostnames only — ` +
|
|
29
|
+
'no scheme, no port, no path, no wildcard');
|
|
30
|
+
}
|
|
31
|
+
return entry;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// Deliberately not carried: default, Axios, getAdapter and create; each leads back to an unguarded instance.
|
|
35
|
+
const CARRIED_STATICS = [
|
|
36
|
+
'AxiosError',
|
|
37
|
+
'CanceledError',
|
|
38
|
+
'Cancel',
|
|
39
|
+
'CancelToken',
|
|
40
|
+
'isCancel',
|
|
41
|
+
'isAxiosError',
|
|
42
|
+
'all',
|
|
43
|
+
'spread',
|
|
44
|
+
'toFormData',
|
|
45
|
+
'formToJSON',
|
|
46
|
+
'AxiosHeaders',
|
|
47
|
+
'HttpStatusCode',
|
|
48
|
+
'VERSION',
|
|
49
|
+
];
|
|
50
|
+
export function createGuardedAxios(opts) {
|
|
51
|
+
const apiHost = normaliseHost(new URL(opts.apiUrl).hostname);
|
|
52
|
+
const allowed = new Set([apiHost, ...opts.allowedHosts.map((host) => normaliseHost(host))]);
|
|
53
|
+
const proxyAgent = opts.egressProxyUrl === undefined ? undefined : new HttpsProxyAgent(opts.egressProxyUrl);
|
|
54
|
+
// One budget shared by every create() descendant, so a derived instance cannot reset the cap.
|
|
55
|
+
let inFlight = 0;
|
|
56
|
+
// Requests past the cap wait their turn rather than fail: built-in Modules fan out with Promise.all.
|
|
57
|
+
const waiting = [];
|
|
58
|
+
const acquire = async () => {
|
|
59
|
+
if (opts.maxConcurrentRequests === undefined || inFlight < opts.maxConcurrentRequests) {
|
|
60
|
+
inFlight += 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
await new Promise((resolve) => waiting.push(resolve));
|
|
64
|
+
};
|
|
65
|
+
// A freed slot passes straight to the next waiter, so a newcomer cannot jump the queue.
|
|
66
|
+
const release = () => {
|
|
67
|
+
const next = waiting.shift();
|
|
68
|
+
if (next) {
|
|
69
|
+
next();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
inFlight -= 1;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// The slot is held around the adapter call itself, so every settled request frees it, whatever it threw.
|
|
76
|
+
// A re-sent `error.config` carries an adapter wrapped here already; unwrap it, or it would need two slots.
|
|
77
|
+
const unthrottled = new WeakMap();
|
|
78
|
+
const throttled = (adapter) => {
|
|
79
|
+
const inner = unthrottled.get(adapter) ?? adapter;
|
|
80
|
+
const wrapped = async (config) => {
|
|
81
|
+
await acquire();
|
|
82
|
+
try {
|
|
83
|
+
return await inner(config);
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
release();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
unthrottled.set(wrapped, inner);
|
|
90
|
+
return wrapped;
|
|
91
|
+
};
|
|
92
|
+
const deny = (message) => {
|
|
93
|
+
opts.onDenied(message);
|
|
94
|
+
throw new EgressDeniedError(message);
|
|
95
|
+
};
|
|
96
|
+
const build = (defaults) => {
|
|
97
|
+
const instance = axios.create({
|
|
98
|
+
...defaults,
|
|
99
|
+
maxRedirects: 0,
|
|
100
|
+
proxy: false,
|
|
101
|
+
...(opts.maxResponseBytes === undefined
|
|
102
|
+
? {}
|
|
103
|
+
: { maxContentLength: opts.maxResponseBytes, maxBodyLength: opts.maxResponseBytes }),
|
|
104
|
+
});
|
|
105
|
+
instance.interceptors.request.use((config) => {
|
|
106
|
+
const target = new URL(config.url ?? '', config.baseURL);
|
|
107
|
+
const host = normaliseHost(target.hostname);
|
|
108
|
+
if (!allowed.has(host)) {
|
|
109
|
+
deny(`Host "${host}" is not allowed from Modules. Ask an operator to add it to the Takaro egress allowlist.`);
|
|
110
|
+
}
|
|
111
|
+
const proxied = proxyAgent !== undefined && host !== apiHost;
|
|
112
|
+
// The proxy tunnels TLS and checks its SNI; it refuses everything else.
|
|
113
|
+
if (proxied && target.protocol !== 'https:') {
|
|
114
|
+
deny(`"${target.protocol}//${host}" is not allowed from Modules: external hosts are reachable over https:// only.`);
|
|
115
|
+
}
|
|
116
|
+
// Re-applied per request: instance defaults and per-call config are caller-controlled.
|
|
117
|
+
const hardened = config;
|
|
118
|
+
config.maxRedirects = 0;
|
|
119
|
+
config.proxy = false;
|
|
120
|
+
config.adapter = throttled(typeof config.adapter === 'function' ? config.adapter : axios.getAdapter('http'));
|
|
121
|
+
for (const key of [
|
|
122
|
+
'socketPath',
|
|
123
|
+
'httpAgent',
|
|
124
|
+
'httpsAgent',
|
|
125
|
+
'transport',
|
|
126
|
+
'lookup',
|
|
127
|
+
'beforeRedirect',
|
|
128
|
+
'httpVersion',
|
|
129
|
+
'http2Options',
|
|
130
|
+
]) {
|
|
131
|
+
delete hardened[key];
|
|
132
|
+
}
|
|
133
|
+
// After the deletion above, so nothing the Module passed can replace it.
|
|
134
|
+
if (proxied) {
|
|
135
|
+
config.httpsAgent = proxyAgent;
|
|
136
|
+
}
|
|
137
|
+
if (opts.maxResponseBytes !== undefined) {
|
|
138
|
+
config.maxContentLength = opts.maxResponseBytes;
|
|
139
|
+
config.maxBodyLength = opts.maxResponseBytes;
|
|
140
|
+
}
|
|
141
|
+
return config;
|
|
142
|
+
});
|
|
143
|
+
for (const key of CARRIED_STATICS) {
|
|
144
|
+
Reflect.set(instance, key, Reflect.get(axios, key));
|
|
145
|
+
}
|
|
146
|
+
instance.create = (config) => build(config);
|
|
147
|
+
return instance;
|
|
148
|
+
};
|
|
149
|
+
return build();
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=egress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.js","sourceRoot":"","sources":["../src/egress.ts"],"names":[],"mappings":"AAAA,OAAO,KAA0E,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,wFAAwF;AACxF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEpD,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,Y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AAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,QAAQ,CAAC,MAAM,GAAG,CAAC,MAA4B,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAElE,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,KAAK,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Client } from '@takaro/apiclient';
|
|
2
|
+
export interface VMExecutionResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
logs: Array<{
|
|
5
|
+
msg: string;
|
|
6
|
+
details?: Record<string, unknown> | string;
|
|
7
|
+
}>;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface VMExecutionOptions {
|
|
11
|
+
fn: string;
|
|
12
|
+
data: Record<string, any>;
|
|
13
|
+
userModules: Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
code: string;
|
|
16
|
+
}>;
|
|
17
|
+
clientOverride?: Client;
|
|
18
|
+
contextOverride?: Record<string, unknown>;
|
|
19
|
+
apiUrl?: string;
|
|
20
|
+
allowedHosts?: readonly string[];
|
|
21
|
+
maxResponseBytes?: number;
|
|
22
|
+
maxConcurrentRequests?: number;
|
|
23
|
+
egressProxyUrl?: string;
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
onLog?: (entry: VMExecutionResult['logs'][number]) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function executeVM(opts: VMExecutionOptions): Promise<VMExecutionResult>;
|
|
28
|
+
//# sourceMappingURL=executeVM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeVM.d.ts","sourceRoot":"","sources":["../src/executeVM.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAC5D;AAID,wBAAsB,SAAS,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyKpF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { getTakaro } from './getTakaro.js';
|
|
2
|
+
import { checkModulePermission } from './checkPermission.js';
|
|
3
|
+
import { TakaroUserError } from './TakaroUserError.js';
|
|
4
|
+
import { nextCronJobRun } from './nextCronJobRun.js';
|
|
5
|
+
import { createGuardedAxios, EGRESS_DENIED_REASON } from './egress.js';
|
|
6
|
+
import { DEADLINE_EXCEEDED_REASON } from './executionLimits.js';
|
|
7
|
+
import * as _ from 'lodash-es';
|
|
8
|
+
import axios from 'axios';
|
|
9
|
+
import vm from 'node:vm';
|
|
10
|
+
const SCRIPT_TIMEOUT_CODE = 'ERR_SCRIPT_EXECUTION_TIMEOUT';
|
|
11
|
+
export async function executeVM(opts) {
|
|
12
|
+
const { fn, data, userModules, clientOverride, contextOverride, apiUrl, allowedHosts, maxResponseBytes, maxConcurrentRequests, egressProxyUrl, timeoutMs, onLog, } = opts;
|
|
13
|
+
const logs = [];
|
|
14
|
+
const denials = [];
|
|
15
|
+
function emitLog(entry) {
|
|
16
|
+
if (onLog) {
|
|
17
|
+
onLog(entry);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
logs.push(entry);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const guardedAxios = apiUrl !== undefined && allowedHosts !== undefined
|
|
24
|
+
? createGuardedAxios({
|
|
25
|
+
apiUrl,
|
|
26
|
+
allowedHosts,
|
|
27
|
+
maxResponseBytes,
|
|
28
|
+
maxConcurrentRequests,
|
|
29
|
+
egressProxyUrl,
|
|
30
|
+
onDenied: (message) => {
|
|
31
|
+
denials.push(message);
|
|
32
|
+
emitLog({ msg: `${EGRESS_DENIED_REASON}: ${message}`, details: EGRESS_DENIED_REASON });
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
: undefined;
|
|
36
|
+
const moduleAxios = guardedAxios ?? axios;
|
|
37
|
+
function pushLog(...args) {
|
|
38
|
+
emitLog({ msg: args[0], details: { args: args.slice(1) } });
|
|
39
|
+
}
|
|
40
|
+
const patchedConsole = {
|
|
41
|
+
log: pushLog,
|
|
42
|
+
error: pushLog,
|
|
43
|
+
warn: pushLog,
|
|
44
|
+
info: pushLog,
|
|
45
|
+
debug: pushLog,
|
|
46
|
+
};
|
|
47
|
+
const contextifiedObject = vm.createContext({
|
|
48
|
+
console: patchedConsole,
|
|
49
|
+
...contextOverride,
|
|
50
|
+
});
|
|
51
|
+
const toEval = new vm.SourceTextModule(fn, { context: contextifiedObject });
|
|
52
|
+
// Deadline covers linking too: a user module's top-level code evaluates during LINKING.
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
const evaluateOptions = () => timeoutMs === undefined ? undefined : { timeout: Math.max(1, timeoutMs - (Date.now() - startedAt)) };
|
|
55
|
+
const deadlineResult = () => {
|
|
56
|
+
emitLog({
|
|
57
|
+
msg: `${DEADLINE_EXCEEDED_REASON}: the Execution did not finish within ${timeoutMs} ms`,
|
|
58
|
+
details: DEADLINE_EXCEEDED_REASON,
|
|
59
|
+
});
|
|
60
|
+
return { logs, success: false, reason: DEADLINE_EXCEEDED_REASON };
|
|
61
|
+
};
|
|
62
|
+
const { takaro, data: hydratedData } = getTakaro(data, patchedConsole, clientOverride, guardedAxios && ((config) => guardedAxios.create(config)));
|
|
63
|
+
const monkeyPatchedGetData = () => {
|
|
64
|
+
return hydratedData;
|
|
65
|
+
};
|
|
66
|
+
const monkeyPatchedGetTakaro = function () {
|
|
67
|
+
return takaro;
|
|
68
|
+
};
|
|
69
|
+
const scopedCheckPermission = (pog, permission, options) => checkModulePermission(pog, permission, data.module?.moduleId, options);
|
|
70
|
+
try {
|
|
71
|
+
await link();
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code === SCRIPT_TIMEOUT_CODE) {
|
|
75
|
+
return deadlineResult();
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
function link() {
|
|
80
|
+
return toEval.link(async (specifier, referencingModule) => {
|
|
81
|
+
const takaroHelpersModule = new vm.SyntheticModule([
|
|
82
|
+
'getTakaro',
|
|
83
|
+
'checkPermission',
|
|
84
|
+
'TakaroUserError',
|
|
85
|
+
'getData',
|
|
86
|
+
'axios',
|
|
87
|
+
'_',
|
|
88
|
+
'lodash',
|
|
89
|
+
'nextCronJobRun',
|
|
90
|
+
'takaro',
|
|
91
|
+
'data',
|
|
92
|
+
], function () {
|
|
93
|
+
this.setExport('getTakaro', monkeyPatchedGetTakaro);
|
|
94
|
+
this.setExport('checkPermission', scopedCheckPermission);
|
|
95
|
+
this.setExport('TakaroUserError', TakaroUserError);
|
|
96
|
+
this.setExport('getData', monkeyPatchedGetData);
|
|
97
|
+
this.setExport('axios', moduleAxios);
|
|
98
|
+
this.setExport('_', _);
|
|
99
|
+
this.setExport('lodash', _);
|
|
100
|
+
this.setExport('nextCronJobRun', nextCronJobRun);
|
|
101
|
+
this.setExport('takaro', takaro);
|
|
102
|
+
this.setExport('data', hydratedData);
|
|
103
|
+
}, { context: referencingModule.context });
|
|
104
|
+
if (specifier === '@takaro/helpers') {
|
|
105
|
+
return takaroHelpersModule;
|
|
106
|
+
}
|
|
107
|
+
const userModuleData = userModules.find((m) => `./${m.name}.js` === specifier);
|
|
108
|
+
if (userModuleData) {
|
|
109
|
+
const userModule = new vm.SourceTextModule(userModuleData.code, { context: referencingModule.context });
|
|
110
|
+
await userModule.link(() => {
|
|
111
|
+
return takaroHelpersModule;
|
|
112
|
+
});
|
|
113
|
+
await userModule.evaluate(evaluateOptions());
|
|
114
|
+
return userModule;
|
|
115
|
+
}
|
|
116
|
+
throw new Error(`Unable to resolve dependency: ${specifier}`);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
await toEval.evaluate(evaluateOptions());
|
|
121
|
+
return {
|
|
122
|
+
logs,
|
|
123
|
+
success: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
emitLog({ msg: error.message, details: error.stack });
|
|
128
|
+
if (error.code === SCRIPT_TIMEOUT_CODE) {
|
|
129
|
+
return deadlineResult();
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
logs,
|
|
133
|
+
success: false,
|
|
134
|
+
reason: denials.length > 0 ? EGRESS_DENIED_REASON : undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=executeVM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeVM.js","sourceRoot":"","sources":["../src/executeVM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAA6B,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,MAAM,SAAS,CAAC;AA0BzB,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAwB;IACtD,MAAM,EACJ,EAAE,EACF,IAAI,EACJ,WAAW,EACX,cAAc,EACd,eAAe,EACf,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,KAAK,GACN,GAAG,IAAI,CAAC;IAET,MAAM,IAAI,GAA8B,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,SAAS,OAAO,CAAC,KAAwC;QACvD,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,KAAK,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,MAAM,YAAY,GAChB,MAAM,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS;QAChD,CAAC,CAAC,kBAAkB,CAAC;YACjB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CAAC,GAAG,EAAE;oBACzB,OAAO,mBAAmB,CAAC;gBAC7B,CAAC,CAAC,CAAC;gBACH,MAAM,UAAU,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;gBAC7C,OAAO,UAAU,CAAC;YACpB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;QACzC,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,EAAE,GAAG,EAAG,KAAe,CAAC,OAAO,EAAE,OAAO,EAAG,KAAe,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5E,IAAK,KAA2B,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YAC9D,OAAO,cAAc,EAAE,CAAC;QAC1B,CAAC;QACD,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionLimits.d.ts","sourceRoot":"","sources":["../src/executionLimits.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,eAAO,MAAM,sBAAsB,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Execution limit result reasons (GH #4021, ADR 0027); kept equal to the import-free copy in
|
|
2
|
+
// packages/app-api/src/executors/executionReasons.ts by a unit test.
|
|
3
|
+
export const DEADLINE_EXCEEDED_REASON = 'deadline-exceeded';
|
|
4
|
+
export const MEMORY_EXCEEDED_REASON = 'memory-exceeded';
|
|
5
|
+
//# sourceMappingURL=executionLimits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionLimits.js","sourceRoot":"","sources":["../src/executionLimits.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Client } from '@takaro/apiclient';
|
|
2
|
+
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
3
|
+
export declare function getTakaro(data: Record<string, any>, logger?: Pick<Console, 'log' | 'debug' | 'error' | 'warn' | 'info'>, clientOverride?: Client, axiosFactory?: (config: AxiosRequestConfig) => AxiosInstance): {
|
|
4
|
+
takaro: Client;
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=getTakaro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTakaro.d.ts","sourceRoot":"","sources":["../src/getTakaro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,EACnE,cAAc,CAAC,EAAE,MAAM,EAEvB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,aAAa,GAC3D;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAkC/C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Client } from '@takaro/apiclient';
|
|
2
|
+
export function getTakaro(data, logger, clientOverride,
|
|
3
|
+
// Sandbox passes its guarded axios, so the GH #4021 caps cover `takaro.*()` too.
|
|
4
|
+
axiosFactory) {
|
|
5
|
+
const takaro = clientOverride ??
|
|
6
|
+
new Client({
|
|
7
|
+
url: data.url,
|
|
8
|
+
auth: {
|
|
9
|
+
token: data.token,
|
|
10
|
+
},
|
|
11
|
+
log: logger ? logger : console,
|
|
12
|
+
axiosFactory,
|
|
13
|
+
});
|
|
14
|
+
takaro.setHeader('X-Takaro-Module', data.module.moduleId);
|
|
15
|
+
if (data.pog) {
|
|
16
|
+
const sendPmToPlayer = async (message) => {
|
|
17
|
+
return takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
|
|
18
|
+
message,
|
|
19
|
+
opts: {
|
|
20
|
+
recipient: {
|
|
21
|
+
gameId: data.pog.gameId,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
data.pog.pm = sendPmToPlayer;
|
|
27
|
+
if (data.player) {
|
|
28
|
+
data.player.pm = sendPmToPlayer;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { takaro, data };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=getTakaro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTakaro.js","sourceRoot":"","sources":["../src/getTakaro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,MAAM,UAAU,SAAS,CACvB,IAAyB,EACzB,MAAmE,EACnE,cAAuB;AACvB,iFAAiF;AACjF,YAA4D;IAE5D,MAAM,MAAM,GACV,cAAc;QACd,IAAI,MAAM,CAAC;YACT,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE;gBACJ,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB;YACD,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;YAC9B,YAAY;SACb,CAAC,CAAC;IAEL,MAAM,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE1D,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,MAAM,cAAc,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;YAC/C,OAAO,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,IAAI,CAAC,YAAY,EAAE;gBAC1E,OAAO;gBACP,IAAI,EAAE;oBACJ,SAAS,EAAE;wBACT,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM;qBACxB;iBACF;aACF,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,cAAc,CAAC;QAE7B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,cAAc,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Client } from '@takaro/apiclient';
|
|
2
|
+
export { getTakaro } from './getTakaro.js';
|
|
3
|
+
export { checkPermission, checkModulePermission } from './checkPermission.js';
|
|
4
|
+
export { nextCronJobRun } from './nextCronJobRun.js';
|
|
5
|
+
export { TakaroUserError } from './TakaroUserError.js';
|
|
6
|
+
export { executeVM } from './executeVM.js';
|
|
7
|
+
export { userModulesOf } from './userModules.js';
|
|
8
|
+
export type { UserModuleSource, ModuleFunctionsData } from './userModules.js';
|
|
9
|
+
export type { VMExecutionResult, VMExecutionOptions } from './executeVM.js';
|
|
10
|
+
export { EGRESS_DENIED_REASON, EgressDeniedError, parseAllowedHosts, createGuardedAxios } from './egress.js';
|
|
11
|
+
export type { GuardedAxiosOptions, GuardedAxiosInstance } from './egress.js';
|
|
12
|
+
export { DEADLINE_EXCEEDED_REASON, MEMORY_EXCEEDED_REASON } from './executionLimits.js';
|
|
13
|
+
export * as _ from 'lodash-es';
|
|
14
|
+
export { default as axios } from 'axios';
|
|
15
|
+
export declare const takaro: Client;
|
|
16
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7G,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AAEzC,eAAO,MAAM,MAAM,EAAE,MAAgC,CAAC"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { getTakaro } from './getTakaro.js';
|
|
2
|
+
export { checkPermission, checkModulePermission } from './checkPermission.js';
|
|
3
|
+
export { nextCronJobRun } from './nextCronJobRun.js';
|
|
4
|
+
export { TakaroUserError } from './TakaroUserError.js';
|
|
5
|
+
export { executeVM } from './executeVM.js';
|
|
6
|
+
export { userModulesOf } from './userModules.js';
|
|
7
|
+
export { EGRESS_DENIED_REASON, EgressDeniedError, parseAllowedHosts, createGuardedAxios } from './egress.js';
|
|
8
|
+
export { DEADLINE_EXCEEDED_REASON, MEMORY_EXCEEDED_REASON } from './executionLimits.js';
|
|
9
|
+
export * as _ from 'lodash-es';
|
|
10
|
+
export { default as axios } from 'axios';
|
|
11
|
+
export const takaro = {};
|
|
12
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE7G,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAW,EAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextCronJobRun.d.ts","sourceRoot":"","sources":["../src/nextCronJobRun.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,IAAI,GAAG,IAEpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextCronJobRun.js","sourceRoot":"","sources":["../src/nextCronJobRun.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAe,EAAE;IAC1D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UserModuleSource {
|
|
2
|
+
name: string;
|
|
3
|
+
code: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ModuleFunctionsData {
|
|
6
|
+
module: {
|
|
7
|
+
version: {
|
|
8
|
+
functions: ReadonlyArray<{
|
|
9
|
+
name?: string | null;
|
|
10
|
+
code: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function userModulesOf(data: ModuleFunctionsData): UserModuleSource[];
|
|
16
|
+
//# sourceMappingURL=userModules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userModules.d.ts","sourceRoot":"","sources":["../src/userModules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QAAE,OAAO,EAAE;YAAE,SAAS,EAAE,aAAa,CAAC;gBAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,CAAA;KAAE,CAAC;CAC3F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,gBAAgB,EAAE,CAE3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userModules.js","sourceRoot":"","sources":["../src/userModules.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAc,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@takaro/helpers",
|
|
3
|
+
"description": "A collection of helpers, used inside Takaro Functions",
|
|
4
|
+
"version": "0.0.0-dev.4dbe15b",
|
|
5
|
+
"author": "",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@takaro/apiclient": "0.0.0-dev.4dbe15b",
|
|
8
|
+
"@types/lodash-es": "4.17.12",
|
|
9
|
+
"axios": "1.7.7",
|
|
10
|
+
"croner": "8.1.2",
|
|
11
|
+
"https-proxy-agent": "9.1.0",
|
|
12
|
+
"lodash-es": "4.17.23"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"main": "dist/main.js",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"types": "dist/main.d.ts",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "24.19.2",
|
|
21
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
22
|
+
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p ./tsconfig.build.json",
|
|
32
|
+
"start:dev": ":"
|
|
33
|
+
}
|
|
34
|
+
}
|