autolang-compiler 0.0.16 → 0.0.17

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/index.d.mts CHANGED
@@ -15,6 +15,14 @@ interface LibraryConfig {
15
15
  interface AException {
16
16
  message: string;
17
17
  }
18
+ declare enum AllowRuleType {
19
+ PLAIN_PREFIX = 0,// Plain string prefix match (special chars escaped automatically)
20
+ REGEX = 1
21
+ }
22
+ type AllowRule = string | [AllowRuleType, string] | {
23
+ type: AllowRuleType;
24
+ value: string;
25
+ };
18
26
  declare class ACompiler {
19
27
  private instance;
20
28
  private constructor();
@@ -26,9 +34,15 @@ declare class ACompiler {
26
34
  setMainSourceConfig(config: LibraryConfig): void;
27
35
  setLimitOpcodeCount(limit: number): void;
28
36
  getLimitOpcodeCount(): number;
29
- compileAndRun(path: string, code: string): boolean;
30
- compile(path: string, code: string): boolean;
31
- run(): boolean;
37
+ setAllowedDomainsRules(rules: AllowRule[]): void;
38
+ setAllowFileRead(allow: boolean): void;
39
+ setAllowFileWrite(allow: boolean): void;
40
+ setAllowFileDelete(allow: boolean): void;
41
+ setAllowedFilePathsRules(rules: AllowRule[]): void;
42
+ setFileBasePath(path: string): void;
43
+ compileAndRun(path: string, code: string): Promise<boolean>;
44
+ compile(path: string, code: string): Promise<boolean>;
45
+ run(): Promise<boolean>;
32
46
  hasCompilerError(): boolean;
33
47
  throwException(message: string): boolean;
34
48
  hasException(): boolean;
@@ -38,4 +52,4 @@ declare class ACompiler {
38
52
  refresh(): void;
39
53
  }
40
54
 
41
- export { ACompiler, type ACompilerConfig, type AException, type AObject, type AutolangNativeFunc, type AutolangType, type LibraryConfig };
55
+ export { ACompiler, type ACompilerConfig, type AException, type AObject, type AllowRule, AllowRuleType, type AutolangNativeFunc, type AutolangType, type LibraryConfig };
package/dist/index.d.ts CHANGED
@@ -15,6 +15,14 @@ interface LibraryConfig {
15
15
  interface AException {
16
16
  message: string;
17
17
  }
18
+ declare enum AllowRuleType {
19
+ PLAIN_PREFIX = 0,// Plain string prefix match (special chars escaped automatically)
20
+ REGEX = 1
21
+ }
22
+ type AllowRule = string | [AllowRuleType, string] | {
23
+ type: AllowRuleType;
24
+ value: string;
25
+ };
18
26
  declare class ACompiler {
19
27
  private instance;
20
28
  private constructor();
@@ -26,9 +34,15 @@ declare class ACompiler {
26
34
  setMainSourceConfig(config: LibraryConfig): void;
27
35
  setLimitOpcodeCount(limit: number): void;
28
36
  getLimitOpcodeCount(): number;
29
- compileAndRun(path: string, code: string): boolean;
30
- compile(path: string, code: string): boolean;
31
- run(): boolean;
37
+ setAllowedDomainsRules(rules: AllowRule[]): void;
38
+ setAllowFileRead(allow: boolean): void;
39
+ setAllowFileWrite(allow: boolean): void;
40
+ setAllowFileDelete(allow: boolean): void;
41
+ setAllowedFilePathsRules(rules: AllowRule[]): void;
42
+ setFileBasePath(path: string): void;
43
+ compileAndRun(path: string, code: string): Promise<boolean>;
44
+ compile(path: string, code: string): Promise<boolean>;
45
+ run(): Promise<boolean>;
32
46
  hasCompilerError(): boolean;
33
47
  throwException(message: string): boolean;
34
48
  hasException(): boolean;
@@ -38,4 +52,4 @@ declare class ACompiler {
38
52
  refresh(): void;
39
53
  }
40
54
 
41
- export { ACompiler, type ACompilerConfig, type AException, type AObject, type AutolangNativeFunc, type AutolangType, type LibraryConfig };
55
+ export { ACompiler, type ACompilerConfig, type AException, type AObject, type AllowRule, AllowRuleType, type AutolangNativeFunc, type AutolangType, type LibraryConfig };