@proto-kit/common 0.1.1-develop.211 → 0.1.1-develop.2137
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/cache/CacheManifest.d.ts +11 -0
- package/dist/cache/CacheManifest.d.ts.map +1 -0
- package/dist/cache/CacheManifest.js +56 -0
- package/dist/cache/CacheManifest.js.map +1 -0
- package/dist/cache/ProxyCache.d.ts +13 -0
- package/dist/cache/ProxyCache.d.ts.map +1 -0
- package/dist/cache/ProxyCache.js +24 -0
- package/dist/cache/ProxyCache.js.map +1 -0
- package/dist/cache/RemoteCache.d.ts +8 -0
- package/dist/cache/RemoteCache.d.ts.map +1 -0
- package/dist/cache/RemoteCache.js +2 -0
- package/dist/cache/RemoteCache.js.map +1 -0
- package/dist/cache/RemoteCacheCompiler.d.ts +16 -0
- package/dist/cache/RemoteCacheCompiler.d.ts.map +1 -0
- package/dist/cache/RemoteCacheCompiler.js +104 -0
- package/dist/cache/RemoteCacheCompiler.js.map +1 -0
- package/dist/compiling/AtomicCompileHelper.d.ts +15 -0
- package/dist/compiling/AtomicCompileHelper.d.ts.map +1 -0
- package/dist/compiling/AtomicCompileHelper.js +61 -0
- package/dist/compiling/AtomicCompileHelper.js.map +1 -0
- package/dist/compiling/CompilableModule.d.ts +6 -0
- package/dist/compiling/CompilableModule.d.ts.map +1 -0
- package/dist/compiling/CompilableModule.js +2 -0
- package/dist/compiling/CompilableModule.js.map +1 -0
- package/dist/compiling/CompileRegistry.d.ts +25 -0
- package/dist/compiling/CompileRegistry.d.ts.map +1 -0
- package/dist/compiling/CompileRegistry.js +62 -0
- package/dist/compiling/CompileRegistry.js.map +1 -0
- package/dist/compiling/services/ChildVerificationKeyService.d.ts +10 -0
- package/dist/compiling/services/ChildVerificationKeyService.d.ts.map +1 -0
- package/dist/compiling/services/ChildVerificationKeyService.js +27 -0
- package/dist/compiling/services/ChildVerificationKeyService.js.map +1 -0
- package/dist/config/ChildContainerCreatable.d.ts +5 -0
- package/dist/config/ChildContainerCreatable.d.ts.map +1 -0
- package/dist/config/ChildContainerCreatable.js +2 -0
- package/dist/config/ChildContainerCreatable.js.map +1 -0
- package/dist/config/ChildContainerProvider.d.ts +5 -0
- package/dist/config/ChildContainerProvider.d.ts.map +1 -0
- package/dist/config/ChildContainerProvider.js +2 -0
- package/dist/config/ChildContainerProvider.js.map +1 -0
- package/dist/config/ConfigurableModule.d.ts +6 -2
- package/dist/config/ConfigurableModule.d.ts.map +1 -1
- package/dist/config/ConfigurableModule.js +5 -0
- package/dist/config/ConfigurableModule.js.map +1 -0
- package/dist/config/ModuleContainer.d.ts +70 -23
- package/dist/config/ModuleContainer.d.ts.map +1 -1
- package/dist/config/ModuleContainer.js +164 -31
- package/dist/config/ModuleContainer.js.map +1 -0
- package/dist/config/Startable.d.ts +4 -0
- package/dist/config/Startable.d.ts.map +1 -0
- package/dist/config/Startable.js +2 -0
- package/dist/config/Startable.js.map +1 -0
- package/dist/config/injectAlias.d.ts +18 -0
- package/dist/config/injectAlias.d.ts.map +1 -0
- package/dist/config/injectAlias.js +47 -0
- package/dist/config/injectAlias.js.map +1 -0
- package/dist/dependencyFactory/DependencyFactory.d.ts +14 -9
- package/dist/dependencyFactory/DependencyFactory.d.ts.map +1 -1
- package/dist/dependencyFactory/DependencyFactory.js +2 -96
- package/dist/dependencyFactory/DependencyFactory.js.map +1 -0
- package/dist/dependencyFactory/injectOptional.d.ts +16 -0
- package/dist/dependencyFactory/injectOptional.d.ts.map +1 -0
- package/dist/dependencyFactory/injectOptional.js +40 -0
- package/dist/dependencyFactory/injectOptional.js.map +1 -0
- package/dist/dummyVerificationKey.d.ts +3 -0
- package/dist/dummyVerificationKey.d.ts.map +1 -0
- package/dist/dummyVerificationKey.js +8 -0
- package/dist/dummyVerificationKey.js.map +1 -0
- package/dist/events/EventEmitter.d.ts +19 -0
- package/dist/events/EventEmitter.d.ts.map +1 -0
- package/dist/events/EventEmitter.js +35 -0
- package/dist/events/EventEmitter.js.map +1 -0
- package/dist/events/EventEmitterProxy.d.ts +18 -0
- package/dist/events/EventEmitterProxy.d.ts.map +1 -0
- package/dist/events/EventEmitterProxy.js +35 -0
- package/dist/events/EventEmitterProxy.js.map +1 -0
- package/dist/events/EventEmittingComponent.d.ts +9 -0
- package/dist/events/EventEmittingComponent.d.ts.map +1 -0
- package/dist/events/EventEmittingComponent.js +2 -0
- package/dist/events/EventEmittingComponent.js.map +1 -0
- package/dist/events/ReplayingSingleUseEventEmitter.d.ts +17 -0
- package/dist/events/ReplayingSingleUseEventEmitter.d.ts.map +1 -0
- package/dist/events/ReplayingSingleUseEventEmitter.js +34 -0
- package/dist/events/ReplayingSingleUseEventEmitter.js.map +1 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +37 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +117 -0
- package/dist/log.js.map +1 -0
- package/dist/trees/InMemoryLinkedLeafStore.d.ts +21 -0
- package/dist/trees/InMemoryLinkedLeafStore.d.ts.map +1 -0
- package/dist/trees/InMemoryLinkedLeafStore.js +26 -0
- package/dist/trees/InMemoryLinkedLeafStore.js.map +1 -0
- package/dist/trees/InMemoryLinkedMerkleLeafStore.d.ts +7 -0
- package/dist/trees/InMemoryLinkedMerkleLeafStore.d.ts.map +1 -0
- package/dist/trees/InMemoryLinkedMerkleLeafStore.js +6 -0
- package/dist/trees/InMemoryLinkedMerkleLeafStore.js.map +1 -0
- package/dist/trees/InMemoryMerkleTreeStorage.d.ts +11 -0
- package/dist/trees/InMemoryMerkleTreeStorage.d.ts.map +1 -0
- package/dist/trees/InMemoryMerkleTreeStorage.js +13 -0
- package/dist/trees/InMemoryMerkleTreeStorage.js.map +1 -0
- package/dist/trees/LinkedMerkleTree.d.ts +345 -0
- package/dist/trees/LinkedMerkleTree.d.ts.map +1 -0
- package/dist/trees/LinkedMerkleTree.js +337 -0
- package/dist/trees/LinkedMerkleTree.js.map +1 -0
- package/dist/trees/LinkedMerkleTreeStore.d.ts +24 -0
- package/dist/trees/LinkedMerkleTreeStore.d.ts.map +1 -0
- package/dist/trees/LinkedMerkleTreeStore.js +2 -0
- package/dist/trees/LinkedMerkleTreeStore.js.map +1 -0
- package/dist/trees/MerkleTreeStore.d.ts +5 -0
- package/dist/trees/MerkleTreeStore.d.ts.map +1 -0
- package/dist/trees/MerkleTreeStore.js +2 -0
- package/dist/trees/MerkleTreeStore.js.map +1 -0
- package/dist/trees/MockAsyncMerkleStore.d.ts +9 -0
- package/dist/trees/MockAsyncMerkleStore.d.ts.map +1 -0
- package/dist/trees/MockAsyncMerkleStore.js +20 -0
- package/dist/trees/MockAsyncMerkleStore.js.map +1 -0
- package/dist/trees/RollupMerkleTree.d.ts +147 -0
- package/dist/trees/RollupMerkleTree.d.ts.map +1 -0
- package/dist/trees/RollupMerkleTree.js +218 -0
- package/dist/trees/RollupMerkleTree.js.map +1 -0
- package/dist/trees/VirtualMerkleTreeStore.d.ts +13 -0
- package/dist/trees/VirtualMerkleTreeStore.d.ts.map +1 -0
- package/dist/trees/VirtualMerkleTreeStore.js +18 -0
- package/dist/trees/VirtualMerkleTreeStore.js.map +1 -0
- package/dist/trees/lmt/AbstractLinkedMerkleTree.d.ts +288 -0
- package/dist/trees/lmt/AbstractLinkedMerkleTree.d.ts.map +1 -0
- package/dist/trees/lmt/AbstractLinkedMerkleTree.js +22 -0
- package/dist/trees/lmt/AbstractLinkedMerkleTree.js.map +1 -0
- package/dist/trees/lmt/InMemoryLinkedLeafStore.d.ts +21 -0
- package/dist/trees/lmt/InMemoryLinkedLeafStore.d.ts.map +1 -0
- package/dist/trees/lmt/InMemoryLinkedLeafStore.js +26 -0
- package/dist/trees/lmt/InMemoryLinkedLeafStore.js.map +1 -0
- package/dist/trees/lmt/InMemoryLinkedMerkleLeafStore.d.ts +7 -0
- package/dist/trees/lmt/InMemoryLinkedMerkleLeafStore.d.ts.map +1 -0
- package/dist/trees/lmt/InMemoryLinkedMerkleLeafStore.js +6 -0
- package/dist/trees/lmt/InMemoryLinkedMerkleLeafStore.js.map +1 -0
- package/dist/trees/lmt/LinkedLeafStore.d.ts +16 -0
- package/dist/trees/lmt/LinkedLeafStore.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedLeafStore.js +2 -0
- package/dist/trees/lmt/LinkedLeafStore.js.map +1 -0
- package/dist/trees/lmt/LinkedLinkedStore.d.ts +16 -0
- package/dist/trees/lmt/LinkedLinkedStore.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedLinkedStore.js +2 -0
- package/dist/trees/lmt/LinkedLinkedStore.js.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTree.d.ts +11 -0
- package/dist/trees/lmt/LinkedMerkleTree.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTree.js +241 -0
- package/dist/trees/lmt/LinkedMerkleTree.js.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeCircuitOps.d.ts +113 -0
- package/dist/trees/lmt/LinkedMerkleTreeCircuitOps.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeCircuitOps.js +113 -0
- package/dist/trees/lmt/LinkedMerkleTreeCircuitOps.js.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeDatabase.d.ts +7 -0
- package/dist/trees/lmt/LinkedMerkleTreeDatabase.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeDatabase.js +2 -0
- package/dist/trees/lmt/LinkedMerkleTreeDatabase.js.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeStore.d.ts +16 -0
- package/dist/trees/lmt/LinkedMerkleTreeStore.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeStore.js +2 -0
- package/dist/trees/lmt/LinkedMerkleTreeStore.js.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeTypes.d.ts +74 -0
- package/dist/trees/lmt/LinkedMerkleTreeTypes.d.ts.map +1 -0
- package/dist/trees/lmt/LinkedMerkleTreeTypes.js +50 -0
- package/dist/trees/lmt/LinkedMerkleTreeTypes.js.map +1 -0
- package/dist/trees/sparse/InMemoryMerkleTreeStorage.d.ts +11 -0
- package/dist/trees/sparse/InMemoryMerkleTreeStorage.d.ts.map +1 -0
- package/dist/trees/sparse/InMemoryMerkleTreeStorage.js +13 -0
- package/dist/trees/sparse/InMemoryMerkleTreeStorage.js.map +1 -0
- package/dist/trees/sparse/MerkleTreeStore.d.ts +5 -0
- package/dist/trees/sparse/MerkleTreeStore.d.ts.map +1 -0
- package/dist/trees/sparse/MerkleTreeStore.js +2 -0
- package/dist/trees/sparse/MerkleTreeStore.js.map +1 -0
- package/dist/trees/sparse/MockAsyncMerkleStore.d.ts +9 -0
- package/dist/trees/sparse/MockAsyncMerkleStore.d.ts.map +1 -0
- package/dist/trees/sparse/MockAsyncMerkleStore.js +20 -0
- package/dist/trees/sparse/MockAsyncMerkleStore.js.map +1 -0
- package/dist/trees/sparse/RollupMerkleTree.d.ts +158 -0
- package/dist/trees/sparse/RollupMerkleTree.d.ts.map +1 -0
- package/dist/trees/sparse/RollupMerkleTree.js +330 -0
- package/dist/trees/sparse/RollupMerkleTree.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +14 -1
- package/dist/types.js.map +1 -0
- package/dist/union/union.d.ts +177 -0
- package/dist/union/union.d.ts.map +1 -0
- package/dist/union/union.js +35 -0
- package/dist/union/union.js.map +1 -0
- package/dist/utils.d.ts +57 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +153 -4
- package/dist/utils.js.map +1 -0
- package/dist/zkProgrammable/ProvableMethodExecutionContext.d.ts +4 -3
- package/dist/zkProgrammable/ProvableMethodExecutionContext.d.ts.map +1 -1
- package/dist/zkProgrammable/ProvableMethodExecutionContext.js +2 -3
- package/dist/zkProgrammable/ProvableMethodExecutionContext.js.map +1 -0
- package/dist/zkProgrammable/ZkProgrammable.d.ts +32 -11
- package/dist/zkProgrammable/ZkProgrammable.d.ts.map +1 -1
- package/dist/zkProgrammable/ZkProgrammable.js +36 -17
- package/dist/zkProgrammable/ZkProgrammable.js.map +1 -0
- package/dist/zkProgrammable/provableMethod.d.ts +7 -4
- package/dist/zkProgrammable/provableMethod.d.ts.map +1 -1
- package/dist/zkProgrammable/provableMethod.js +30 -14
- package/dist/zkProgrammable/provableMethod.js.map +1 -0
- package/jest.config.cjs +12 -1
- package/package.json +9 -7
- package/src/cache/CacheManifest.ts +57 -0
- package/src/cache/ProxyCache.ts +30 -0
- package/src/cache/RemoteCache.ts +9 -0
- package/src/cache/RemoteCacheCompiler.ts +131 -0
- package/src/compiling/AtomicCompileHelper.ts +71 -0
- package/src/compiling/CompilableModule.ts +6 -0
- package/src/compiling/CompileRegistry.ts +64 -0
- package/src/compiling/services/ChildVerificationKeyService.ts +26 -0
- package/src/config/ChildContainerCreatable.ts +5 -0
- package/src/config/ChildContainerProvider.ts +5 -0
- package/src/config/ConfigurableModule.ts +15 -2
- package/src/config/ModuleContainer.ts +286 -58
- package/src/config/Startable.ts +3 -0
- package/src/config/injectAlias.ts +70 -0
- package/src/dependencyFactory/DependencyFactory.ts +34 -109
- package/src/dummyVerificationKey.ts +10 -0
- package/src/events/EventEmitter.ts +61 -0
- package/src/events/EventEmitterProxy.ts +81 -0
- package/src/events/EventEmittingComponent.ts +11 -0
- package/src/events/ReplayingSingleUseEventEmitter.ts +42 -0
- package/src/index.ts +27 -2
- package/src/log.ts +145 -0
- package/src/trees/lmt/AbstractLinkedMerkleTree.ts +102 -0
- package/src/trees/lmt/InMemoryLinkedLeafStore.ts +42 -0
- package/src/trees/lmt/LinkedLeafStore.ts +13 -0
- package/src/trees/lmt/LinkedMerkleTree.ts +335 -0
- package/src/trees/lmt/LinkedMerkleTreeCircuitOps.ts +188 -0
- package/src/trees/lmt/LinkedMerkleTreeTypes.ts +53 -0
- package/src/trees/sparse/InMemoryMerkleTreeStorage.ts +17 -0
- package/src/trees/sparse/MerkleTreeStore.ts +5 -0
- package/src/trees/sparse/MockAsyncMerkleStore.ts +30 -0
- package/src/trees/sparse/RollupMerkleTree.ts +512 -0
- package/src/types.ts +53 -2
- package/src/utils.ts +281 -5
- package/src/zkProgrammable/ProvableMethodExecutionContext.ts +6 -6
- package/src/zkProgrammable/ZkProgrammable.ts +90 -35
- package/src/zkProgrammable/provableMethod.ts +50 -23
- package/test/config/ContainerEvents.test.ts +65 -0
- package/test/config/ModuleContainer.test.ts +146 -15
- package/test/config/injectAlias.test.ts +28 -0
- package/test/trees/LinkedMerkleTree.test.ts +124 -0
- package/test/trees/LinkedMerkleTreeCircuitOps.test.ts +147 -0
- package/test/trees/MerkleTree.test.ts +251 -0
- package/test/tsconfig.json +5 -2
- package/test/zkProgrammable/ZkProgrammable.test.ts +145 -119
- package/tsconfig.json +1 -1
- package/LICENSE.md +0 -201
- package/tsconfig.test.json +0 -9
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class CacheManifest {
|
|
2
|
+
manifestFile(): string;
|
|
3
|
+
manifestRead: boolean;
|
|
4
|
+
manifest: string[];
|
|
5
|
+
private readManifest;
|
|
6
|
+
private ensureManifestRead;
|
|
7
|
+
getManifest(): string[];
|
|
8
|
+
writeToManifest(program: string): void;
|
|
9
|
+
includes(program: string): boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CacheManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheManifest.d.ts","sourceRoot":"","sources":["../../src/cache/CacheManifest.ts"],"names":[],"mappings":"AAMA,qBAEa,aAAa;IACjB,YAAY,IAAI,MAAM;IAQ7B,YAAY,UAAS;IAErB,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,kBAAkB;IAOnB,WAAW;IAMX,eAAe,CAAC,OAAO,EAAE,MAAM;IAS/B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAK1C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import { injectable, singleton } from "tsyringe";
|
|
10
|
+
import cachedir from "cachedir";
|
|
11
|
+
export let CacheManifest = class CacheManifest {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.manifestRead = false;
|
|
14
|
+
this.manifest = [];
|
|
15
|
+
}
|
|
16
|
+
manifestFile() {
|
|
17
|
+
return path.format({
|
|
18
|
+
dir: cachedir("o1js"),
|
|
19
|
+
name: "protokit-cache-manifest",
|
|
20
|
+
ext: "json",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
readManifest() {
|
|
24
|
+
const file = this.manifestFile();
|
|
25
|
+
if (fs.existsSync(file)) {
|
|
26
|
+
return JSON.parse(fs.readFileSync(file).toString());
|
|
27
|
+
}
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
ensureManifestRead() {
|
|
31
|
+
if (!this.manifestRead) {
|
|
32
|
+
this.manifest = this.readManifest();
|
|
33
|
+
this.manifestRead = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
getManifest() {
|
|
37
|
+
this.ensureManifestRead();
|
|
38
|
+
return this.manifest;
|
|
39
|
+
}
|
|
40
|
+
writeToManifest(program) {
|
|
41
|
+
this.ensureManifestRead();
|
|
42
|
+
if (!this.manifest.includes(program)) {
|
|
43
|
+
this.manifest.push(program);
|
|
44
|
+
fs.writeFileSync(this.manifestFile(), JSON.stringify(this.manifest));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
includes(program) {
|
|
48
|
+
this.ensureManifestRead();
|
|
49
|
+
return this.manifest.includes(program);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
CacheManifest = __decorate([
|
|
53
|
+
injectable(),
|
|
54
|
+
singleton()
|
|
55
|
+
], CacheManifest);
|
|
56
|
+
//# sourceMappingURL=CacheManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheManifest.js","sourceRoot":"","sources":["../../src/cache/CacheManifest.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAIzB,WAAM,aAAa,GAAnB,MAAM,aAAa;IAAnB;QASL,iBAAY,GAAG,KAAK,CAAC;QAErB,aAAQ,GAAa,EAAE,CAAC;IAqC1B,CAAC;IA/CQ,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC;YACrB,IAAI,EAAE,yBAAyB;YAC/B,GAAG,EAAE,MAAM;SACZ,CAAC,CAAC;IACL,CAAC;IAMO,YAAY;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrD;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEM,eAAe,CAAC,OAAe;QACpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SACtE;IACH,CAAC;IAEM,QAAQ,CAAC,OAAe;QAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF,CAAA;AAhDY,aAAa;IAFzB,UAAU,EAAE;IACZ,SAAS,EAAE;GACC,aAAa,CAgDzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CacheHeader, Cache as O1Cache } from "o1js";
|
|
2
|
+
export declare class ProxyCache implements O1Cache {
|
|
3
|
+
private realCache;
|
|
4
|
+
private log;
|
|
5
|
+
canWrite: boolean;
|
|
6
|
+
debug: boolean;
|
|
7
|
+
cacheDirectory: string | undefined;
|
|
8
|
+
read(header: CacheHeader): Uint8Array | undefined;
|
|
9
|
+
write(header: CacheHeader, value: Uint8Array): void;
|
|
10
|
+
getLog(): string[];
|
|
11
|
+
startLog(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ProxyCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyCache.d.ts","sourceRoot":"","sources":["../../src/cache/ProxyCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AAErD,qBAAa,UAAW,YAAW,OAAO;IACxC,OAAO,CAAC,SAAS,CAA6B;IAE9C,OAAO,CAAC,GAAG,CAAgB;IAE3B,QAAQ,UAAQ;IAEhB,KAAK,UAAS;IAEd,cAAc,qBAAiC;IAExC,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS;IAIjD,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAKnD,MAAM;IAIN,QAAQ;CAGhB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Cache as O1Cache } from "o1js";
|
|
2
|
+
export class ProxyCache {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.realCache = O1Cache.FileSystemDefault;
|
|
5
|
+
this.log = [];
|
|
6
|
+
this.canWrite = true;
|
|
7
|
+
this.debug = false;
|
|
8
|
+
this.cacheDirectory = this.realCache.cacheDirectory;
|
|
9
|
+
}
|
|
10
|
+
read(header) {
|
|
11
|
+
return this.realCache.read(header);
|
|
12
|
+
}
|
|
13
|
+
write(header, value) {
|
|
14
|
+
this.log.push(header.persistentId);
|
|
15
|
+
return this.realCache.write(header, value);
|
|
16
|
+
}
|
|
17
|
+
getLog() {
|
|
18
|
+
return this.log;
|
|
19
|
+
}
|
|
20
|
+
startLog() {
|
|
21
|
+
this.log = [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ProxyCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyCache.js","sourceRoot":"","sources":["../../src/cache/ProxyCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AAErD,MAAM,OAAO,UAAU;IAAvB;QACU,cAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAEtC,QAAG,GAAa,EAAE,CAAC;QAE3B,aAAQ,GAAG,IAAI,CAAC;QAEhB,UAAK,GAAG,KAAK,CAAC;QAEd,mBAAc,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;IAkBjD,CAAC;IAhBQ,IAAI,CAAC,MAAmB;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,MAAmB,EAAE,KAAiB;QACjD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from "node:stream";
|
|
3
|
+
export interface RemoteCache {
|
|
4
|
+
storeObject(program: string, object: string, file: Readable): Promise<void>;
|
|
5
|
+
getObjects(program: string): Promise<string[]>;
|
|
6
|
+
readObject(program: string, object: string): Promise<Readable>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=RemoteCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteCache.d.ts","sourceRoot":"","sources":["../../src/cache/RemoteCache.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE/C,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAChE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteCache.js","sourceRoot":"","sources":["../../src/cache/RemoteCache.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CompileArtifact, PlainZkProgram } from "../zkProgrammable/ZkProgrammable";
|
|
2
|
+
import { RemoteCache } from "./RemoteCache";
|
|
3
|
+
import { CacheManifest } from "./CacheManifest";
|
|
4
|
+
export declare class RemoteCacheCompiler {
|
|
5
|
+
private readonly remoteCache;
|
|
6
|
+
private readonly manifest;
|
|
7
|
+
constructor(remoteCache: RemoteCache | undefined, manifest: CacheManifest);
|
|
8
|
+
private getFileFromObjectName;
|
|
9
|
+
private download;
|
|
10
|
+
private uploadFile;
|
|
11
|
+
private upload;
|
|
12
|
+
private isSRSFile;
|
|
13
|
+
private compileWithRemoteCache;
|
|
14
|
+
compileWithCache(program: Pick<PlainZkProgram, "name" | "compile">): Promise<CompileArtifact>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RemoteCacheCompiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteCacheCompiler.d.ts","sourceRoot":"","sources":["../../src/cache/RemoteCacheCompiler.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,eAAe,EACf,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAEa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,WAAW,EAAE,WAAW,GAAG,SAAS,EACpC,QAAQ,EAAE,aAAa;IAW1C,OAAO,CAAC,qBAAqB;YASf,QAAQ;YAkBR,UAAU;YAUV,MAAM;IAWpB,OAAO,CAAC,SAAS;YAIH,sBAAsB;IAmCvB,gBAAgB,CAC3B,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,GAChD,OAAO,CAAC,eAAe,CAAC;CAO5B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { inject, injectable, Lifecycle, scoped } from "tsyringe";
|
|
16
|
+
import cachedir from "cachedir";
|
|
17
|
+
import { log } from "../log";
|
|
18
|
+
import { mapSequential } from "../utils";
|
|
19
|
+
import { ProxyCache } from "./ProxyCache";
|
|
20
|
+
import { CacheManifest } from "./CacheManifest";
|
|
21
|
+
export let RemoteCacheCompiler = class RemoteCacheCompiler {
|
|
22
|
+
constructor(remoteCache, manifest) {
|
|
23
|
+
this.remoteCache = remoteCache;
|
|
24
|
+
this.manifest = manifest;
|
|
25
|
+
if (remoteCache === undefined) {
|
|
26
|
+
log.debug("No remote cache configured, only using local file system cache for circuits");
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
log.debug("Using remote cache for circuit caching");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getFileFromObjectName(object) {
|
|
33
|
+
const dir = cachedir("o1js");
|
|
34
|
+
return path.format({
|
|
35
|
+
dir,
|
|
36
|
+
base: object,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async download(remoteCache, name) {
|
|
40
|
+
const objects = await remoteCache.getObjects(name);
|
|
41
|
+
log.debug(`Downloading ${objects.length} cached objects for ${name}`);
|
|
42
|
+
await mapSequential(objects, async (object) => {
|
|
43
|
+
const readable = await remoteCache.readObject(name, object);
|
|
44
|
+
const file = this.getFileFromObjectName(object);
|
|
45
|
+
const writeStream = fs.createWriteStream(file);
|
|
46
|
+
readable.pipe(writeStream);
|
|
47
|
+
await new Promise((res) => {
|
|
48
|
+
writeStream.on("close", res);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async uploadFile(remoteCache, program, fileName) {
|
|
53
|
+
const file = path.resolve(cachedir("o1js"), fileName);
|
|
54
|
+
const readStream = fs.createReadStream(file);
|
|
55
|
+
await remoteCache.storeObject(program, fileName, readStream);
|
|
56
|
+
}
|
|
57
|
+
async upload(remoteCache, name, identifiers) {
|
|
58
|
+
await mapSequential(identifiers, async (identifier) => {
|
|
59
|
+
await this.uploadFile(remoteCache, name, identifier);
|
|
60
|
+
await this.uploadFile(remoteCache, name, `${identifier}.header`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
isSRSFile(file) {
|
|
64
|
+
return file.includes("srs-") || file.includes("lagrange-");
|
|
65
|
+
}
|
|
66
|
+
async compileWithRemoteCache(remoteCache, program) {
|
|
67
|
+
const { name } = program;
|
|
68
|
+
if (!this.manifest.includes("srs")) {
|
|
69
|
+
await this.download(remoteCache, "srs");
|
|
70
|
+
}
|
|
71
|
+
if (!this.manifest.includes(name)) {
|
|
72
|
+
await this.download(remoteCache, name);
|
|
73
|
+
}
|
|
74
|
+
const cache = new ProxyCache();
|
|
75
|
+
cache.startLog();
|
|
76
|
+
const result = await program.compile({
|
|
77
|
+
cache,
|
|
78
|
+
});
|
|
79
|
+
const files = cache.getLog();
|
|
80
|
+
log.debug("Uploading files", files);
|
|
81
|
+
const srsFiles = files.filter((file) => this.isSRSFile(file));
|
|
82
|
+
await this.upload(remoteCache, "srs", srsFiles);
|
|
83
|
+
this.manifest.writeToManifest("srs");
|
|
84
|
+
const circuitFiles = files.filter((file) => !this.isSRSFile(file));
|
|
85
|
+
await this.upload(remoteCache, name, circuitFiles);
|
|
86
|
+
this.manifest.writeToManifest(name);
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
async compileWithCache(program) {
|
|
90
|
+
if (this.remoteCache !== undefined) {
|
|
91
|
+
return await this.compileWithRemoteCache(this.remoteCache, program);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return await program.compile();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
RemoteCacheCompiler = __decorate([
|
|
99
|
+
injectable(),
|
|
100
|
+
scoped(Lifecycle.ContainerScoped),
|
|
101
|
+
__param(0, inject("RemoteCache", { isOptional: true })),
|
|
102
|
+
__metadata("design:paramtypes", [Object, CacheManifest])
|
|
103
|
+
], RemoteCacheCompiler);
|
|
104
|
+
//# sourceMappingURL=RemoteCacheCompiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteCacheCompiler.js","sourceRoot":"","sources":["../../src/cache/RemoteCacheCompiler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AreProofsEnabled, CompileArtifact } from "../zkProgrammable/ZkProgrammable";
|
|
2
|
+
import { RemoteCacheCompiler } from "../cache/RemoteCacheCompiler";
|
|
3
|
+
export type ArtifactRecord = Record<string, CompileArtifact>;
|
|
4
|
+
export type CompileTarget = {
|
|
5
|
+
name: string;
|
|
6
|
+
compile: () => Promise<CompileArtifact>;
|
|
7
|
+
};
|
|
8
|
+
export declare class AtomicCompileHelper {
|
|
9
|
+
private readonly areProofsEnabled;
|
|
10
|
+
private readonly remoteCacheCompiler;
|
|
11
|
+
constructor(areProofsEnabled: AreProofsEnabled, remoteCacheCompiler: RemoteCacheCompiler);
|
|
12
|
+
private compilationPromises;
|
|
13
|
+
compileContract(contract: CompileTarget, overrideProofsEnabled?: boolean): Promise<CompileArtifact>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AtomicCompileHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AtomicCompileHelper.d.ts","sourceRoot":"","sources":["../../src/compiling/AtomicCompileHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CACzC,CAAC;AAEF,qBACa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBADnB,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB;IAG3D,OAAO,CAAC,mBAAmB,CAEpB;IAEM,eAAe,CAC1B,QAAQ,EAAE,aAAa,EACvB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,eAAe,CAAC;CAoC5B"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "tsyringe";
|
|
14
|
+
import { MOCK_VERIFICATION_KEY, } from "../zkProgrammable/ZkProgrammable";
|
|
15
|
+
import { isSubtypeOfName } from "../utils";
|
|
16
|
+
import { log } from "../log";
|
|
17
|
+
import { RemoteCacheCompiler } from "../cache/RemoteCacheCompiler";
|
|
18
|
+
export let AtomicCompileHelper = class AtomicCompileHelper {
|
|
19
|
+
constructor(areProofsEnabled, remoteCacheCompiler) {
|
|
20
|
+
this.areProofsEnabled = areProofsEnabled;
|
|
21
|
+
this.remoteCacheCompiler = remoteCacheCompiler;
|
|
22
|
+
this.compilationPromises = {};
|
|
23
|
+
}
|
|
24
|
+
async compileContract(contract, overrideProofsEnabled) {
|
|
25
|
+
let newPromise = false;
|
|
26
|
+
const { name } = contract;
|
|
27
|
+
if (this.compilationPromises[name] === undefined) {
|
|
28
|
+
const proofsEnabled = overrideProofsEnabled ?? this.areProofsEnabled.areProofsEnabled;
|
|
29
|
+
// We only care about proofs enabled here if it's a contract, because
|
|
30
|
+
// in all other cases, ZkProgrammable already handles this switch, and we
|
|
31
|
+
// want to preserve the artifact layout (which might be more than one
|
|
32
|
+
// entry for ZkProgrammables)
|
|
33
|
+
if (proofsEnabled ||
|
|
34
|
+
!isSubtypeOfName(
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
36
|
+
contract, "SmartContract")) {
|
|
37
|
+
log.time(`Compiling ${name}`);
|
|
38
|
+
this.compilationPromises[name] =
|
|
39
|
+
this.remoteCacheCompiler.compileWithCache(contract);
|
|
40
|
+
newPromise = true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
log.debug(`Compiling ${name} - mock`);
|
|
44
|
+
this.compilationPromises[name] = Promise.resolve({
|
|
45
|
+
verificationKey: MOCK_VERIFICATION_KEY,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const result = await this.compilationPromises[name];
|
|
50
|
+
if (newPromise) {
|
|
51
|
+
log.timeEnd.info(`Compiling ${name}`);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
AtomicCompileHelper = __decorate([
|
|
57
|
+
injectable(),
|
|
58
|
+
__param(0, inject("AreProofsEnabled")),
|
|
59
|
+
__metadata("design:paramtypes", [Object, RemoteCacheCompiler])
|
|
60
|
+
], AtomicCompileHelper);
|
|
61
|
+
//# sourceMappingURL=AtomicCompileHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AtomicCompileHelper.js","sourceRoot":"","sources":["../../src/compiling/AtomicCompileHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAGL,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAU5D,WAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAEE,gBAAmD,EAClC,mBAAwC;QADxC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAGnD,wBAAmB,GAEvB,EAAE,CAAC;IAJJ,CAAC;IAMG,KAAK,CAAC,eAAe,CAC1B,QAAuB,EACvB,qBAA+B;QAE/B,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QAC1B,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;YAChD,MAAM,aAAa,GACjB,qBAAqB,IAAI,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;YAElE,qEAAqE;YACrE,yEAAyE;YACzE,qEAAqE;YACrE,6BAA6B;YAC7B,IACE,aAAa;gBACb,CAAC,eAAe;gBACd,yEAAyE;gBACzE,QAAsC,EACtC,eAAe,CAChB,EACD;gBACA,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;gBAC9B,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC;oBAC5B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBACtD,UAAU,GAAG,IAAI,CAAC;aACnB;iBAAM;gBACL,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,SAAS,CAAC,CAAC;gBACtC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;oBAC/C,eAAe,EAAE,qBAAqB;iBACvC,CAAC,CAAC;aACJ;SACF;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,UAAU,EAAE;YACd,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;SACvC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAlDY,mBAAmB;IAD/B,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,CAAA;6CAEW,mBAAmB;GAJhD,mBAAmB,CAkD/B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CompileRegistry } from "./CompileRegistry";
|
|
2
|
+
import type { ArtifactRecord } from "./AtomicCompileHelper";
|
|
3
|
+
export interface CompilableModule {
|
|
4
|
+
compile(registry: CompileRegistry): Promise<ArtifactRecord | void>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=CompilableModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilableModule.d.ts","sourceRoot":"","sources":["../../src/compiling/CompilableModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilableModule.js","sourceRoot":"","sources":["../../src/compiling/CompilableModule.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CompileArtifact } from "../zkProgrammable/ZkProgrammable";
|
|
2
|
+
import { ArtifactRecord, AtomicCompileHelper, CompileTarget } from "./AtomicCompileHelper";
|
|
3
|
+
/**
|
|
4
|
+
* The CompileRegistry compiles "compilable modules"
|
|
5
|
+
* (i.e. zkprograms, contracts or contractmodules)
|
|
6
|
+
* while making sure they don't get compiled twice in the same process in parallel.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CompileRegistry {
|
|
9
|
+
private readonly compiler;
|
|
10
|
+
constructor(compiler: AtomicCompileHelper);
|
|
11
|
+
private artifacts;
|
|
12
|
+
private inForceProverBlock;
|
|
13
|
+
/**
|
|
14
|
+
* This function forces compilation even if the artifact itself is in the registry.
|
|
15
|
+
* Basically the statement is: The artifact along is not enough, we need to
|
|
16
|
+
* actually have the prover compiled.
|
|
17
|
+
* This is true for non-sideloaded circuit dependencies.
|
|
18
|
+
*/
|
|
19
|
+
forceProverExists<R>(f: (registry: CompileRegistry) => Promise<R>): Promise<R>;
|
|
20
|
+
compile(target: CompileTarget, nameOverride?: string): Promise<CompileArtifact>;
|
|
21
|
+
getArtifact(name: string): CompileArtifact | undefined;
|
|
22
|
+
addArtifactsRaw(artifacts: ArtifactRecord): void;
|
|
23
|
+
getAllArtifacts(): ArtifactRecord;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=CompileRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompileRegistry.d.ts","sourceRoot":"","sources":["../../src/compiling/CompileRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,qBAEa,eAAe;IACP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,mBAAmB;IAEjE,OAAO,CAAC,SAAS,CAAsB;IAEvC,OAAO,CAAC,kBAAkB,CAAK;IAE/B;;;;;OAKG;IACU,iBAAiB,CAAC,CAAC,EAC9B,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,CAAC,CAAC;IAOA,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM;IAU1D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItD,eAAe,CAAC,SAAS,EAAE,cAAc;IAOzC,eAAe;CAGvB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { injectable, singleton } from "tsyringe";
|
|
11
|
+
import { AtomicCompileHelper, } from "./AtomicCompileHelper";
|
|
12
|
+
/**
|
|
13
|
+
* The CompileRegistry compiles "compilable modules"
|
|
14
|
+
* (i.e. zkprograms, contracts or contractmodules)
|
|
15
|
+
* while making sure they don't get compiled twice in the same process in parallel.
|
|
16
|
+
*/
|
|
17
|
+
export let CompileRegistry = class CompileRegistry {
|
|
18
|
+
constructor(compiler) {
|
|
19
|
+
this.compiler = compiler;
|
|
20
|
+
this.artifacts = {};
|
|
21
|
+
this.inForceProverBlock = 0;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This function forces compilation even if the artifact itself is in the registry.
|
|
25
|
+
* Basically the statement is: The artifact along is not enough, we need to
|
|
26
|
+
* actually have the prover compiled.
|
|
27
|
+
* This is true for non-sideloaded circuit dependencies.
|
|
28
|
+
*/
|
|
29
|
+
async forceProverExists(f) {
|
|
30
|
+
this.inForceProverBlock += 1;
|
|
31
|
+
const result = await f(this);
|
|
32
|
+
this.inForceProverBlock -= 1;
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
async compile(target, nameOverride) {
|
|
36
|
+
const name = nameOverride ?? target.name;
|
|
37
|
+
if (this.artifacts[name] === undefined || this.inForceProverBlock > 0) {
|
|
38
|
+
const artifact = await this.compiler.compileContract(target);
|
|
39
|
+
this.artifacts[name] = artifact;
|
|
40
|
+
return artifact;
|
|
41
|
+
}
|
|
42
|
+
return this.artifacts[name];
|
|
43
|
+
}
|
|
44
|
+
getArtifact(name) {
|
|
45
|
+
return this.artifacts[name];
|
|
46
|
+
}
|
|
47
|
+
addArtifactsRaw(artifacts) {
|
|
48
|
+
this.artifacts = {
|
|
49
|
+
...this.artifacts,
|
|
50
|
+
...artifacts,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
getAllArtifacts() {
|
|
54
|
+
return this.artifacts;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
CompileRegistry = __decorate([
|
|
58
|
+
injectable(),
|
|
59
|
+
singleton(),
|
|
60
|
+
__metadata("design:paramtypes", [AtomicCompileHelper])
|
|
61
|
+
], CompileRegistry);
|
|
62
|
+
//# sourceMappingURL=CompileRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompileRegistry.js","sourceRoot":"","sources":["../../src/compiling/CompileRegistry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIjD,OAAO,EAEL,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AAGI,WAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAAoC,QAA6B;QAA7B,aAAQ,GAAR,QAAQ,CAAqB;QAEzD,cAAS,GAAmB,EAAE,CAAC;QAE/B,uBAAkB,GAAG,CAAC,CAAC;IAJqC,CAAC;IAMrE;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB,CAC5B,CAA4C;QAE5C,IAAI,CAAC,kBAAkB,IAAI,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,kBAAkB,IAAI,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,MAAqB,EAAE,YAAqB;QAC/D,MAAM,IAAI,GAAG,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC;QACzC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,kBAAkB,GAAG,CAAC,EAAE;YACrE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;YAChC,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,WAAW,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,eAAe,CAAC,SAAyB;QAC9C,IAAI,CAAC,SAAS,GAAG;YACf,GAAG,IAAI,CAAC,SAAS;YACjB,GAAG,SAAS;SACb,CAAC;IACJ,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF,CAAA;AA9CY,eAAe;IAF3B,UAAU,EAAE;IACZ,SAAS,EAAE;qCAEoC,mBAAmB;GADtD,eAAe,CA8C3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CompileRegistry } from "../CompileRegistry";
|
|
2
|
+
export declare class ChildVerificationKeyService {
|
|
3
|
+
private compileRegistry?;
|
|
4
|
+
setCompileRegistry(registry: CompileRegistry): void;
|
|
5
|
+
getVerificationKey(name: string): {
|
|
6
|
+
data: string;
|
|
7
|
+
hash: import("o1js/dist/node/lib/provable/field").Field;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ChildVerificationKeyService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildVerificationKeyService.d.ts","sourceRoot":"","sources":["../../../src/compiling/services/ChildVerificationKeyService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAEa,2BAA2B;IACtC,OAAO,CAAC,eAAe,CAAC,CAAkB;IAEnC,kBAAkB,CAAC,QAAQ,EAAE,eAAe;IAI5C,kBAAkB,CAAC,IAAI,EAAE,MAAM;;;;CAYvC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { injectable, Lifecycle, scoped } from "tsyringe";
|
|
8
|
+
export let ChildVerificationKeyService = class ChildVerificationKeyService {
|
|
9
|
+
setCompileRegistry(registry) {
|
|
10
|
+
this.compileRegistry = registry;
|
|
11
|
+
}
|
|
12
|
+
getVerificationKey(name) {
|
|
13
|
+
if (this.compileRegistry === undefined) {
|
|
14
|
+
throw new Error("CompileRegistry hasn't been set yet");
|
|
15
|
+
}
|
|
16
|
+
const artifact = this.compileRegistry.getArtifact(name);
|
|
17
|
+
if (artifact === undefined) {
|
|
18
|
+
throw new Error(`Verification Key for child program ${name} not found in registry`);
|
|
19
|
+
}
|
|
20
|
+
return artifact.verificationKey;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
ChildVerificationKeyService = __decorate([
|
|
24
|
+
injectable(),
|
|
25
|
+
scoped(Lifecycle.ContainerScoped)
|
|
26
|
+
], ChildVerificationKeyService);
|
|
27
|
+
//# sourceMappingURL=ChildVerificationKeyService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildVerificationKeyService.js","sourceRoot":"","sources":["../../../src/compiling/services/ChildVerificationKeyService.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlD,WAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAG/B,kBAAkB,CAAC,QAAyB;QACjD,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;IAClC,CAAC;IAEM,kBAAkB,CAAC,IAAY;QACpC,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,sCAAsC,IAAI,wBAAwB,CACnE,CAAC;SACH;QACD,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;CACF,CAAA;AAnBY,2BAA2B;IAFvC,UAAU,EAAE;IACZ,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;GACrB,2BAA2B,CAmBvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildContainerCreatable.d.ts","sourceRoot":"","sources":["../../src/config/ChildContainerCreatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildContainerCreatable.js","sourceRoot":"","sources":["../../src/config/ChildContainerCreatable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildContainerProvider.d.ts","sourceRoot":"","sources":["../../src/config/ChildContainerProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,IAAI,mBAAmB,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildContainerProvider.js","sourceRoot":"","sources":["../../src/config/ChildContainerProvider.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { ChildContainerProvider } from "./ChildContainerProvider";
|
|
2
|
+
import type { BaseModuleInstanceType } from "./ModuleContainer";
|
|
3
|
+
export type Preset<Config> = Config | ((...args: unknown[]) => Config);
|
|
2
4
|
export type Presets<Config> = Record<string, Preset<Config>>;
|
|
3
5
|
export interface Configurable<Config> {
|
|
4
6
|
config: Config;
|
|
5
7
|
}
|
|
8
|
+
export type NoConfig = Record<never, never>;
|
|
6
9
|
/**
|
|
7
10
|
* Used by various module sub-types that may need to be configured
|
|
8
11
|
*/
|
|
9
|
-
export declare class ConfigurableModule<Config> implements
|
|
12
|
+
export declare class ConfigurableModule<Config = NoConfig> implements BaseModuleInstanceType {
|
|
10
13
|
/**
|
|
11
14
|
* Store the config separately, so that we can apply additional
|
|
12
15
|
* checks when retrieving it via the getter
|
|
@@ -14,6 +17,7 @@ export declare class ConfigurableModule<Config> implements Configurable<Config>
|
|
|
14
17
|
protected currentConfig: Config | undefined;
|
|
15
18
|
get config(): Config;
|
|
16
19
|
set config(config: Config);
|
|
20
|
+
create(childContainerProvider: ChildContainerProvider): void;
|
|
17
21
|
}
|
|
18
22
|
export interface StaticConfigurableModule<Config> {
|
|
19
23
|
presets: Presets<Config>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableModule.d.ts","sourceRoot":"","sources":["../../src/config/ConfigurableModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigurableModule.d.ts","sourceRoot":"","sources":["../../src/config/ConfigurableModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAUhE,MAAM,MAAM,MAAM,CAAC,MAAM,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC,CAAC;AACvE,MAAM,MAAM,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAG7D,MAAM,WAAW,YAAY,CAAC,MAAM;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE5C;;GAEG;AACH,qBAAa,kBAAkB,CAAC,MAAM,GAAG,QAAQ,CAC/C,YAAW,sBAAsB;IAEjC;;;OAGG;IACH,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAG5C,IAAW,MAAM,IAAI,MAAM,CAK1B;IAGD,IAAW,MAAM,CAAC,MAAM,EAAE,MAAM,EAE/B;IAEM,MAAM,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,IAAI;CAGpE;AAGD,MAAM,WAAW,wBAAwB,CAAC,MAAM;IAC9C,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { noop } from "../utils";
|
|
1
2
|
const errors = {
|
|
2
3
|
configNotSet: (moduleName) => new Error(`Trying to retrieve config of ${moduleName}, which was not yet set`),
|
|
3
4
|
};
|
|
@@ -16,4 +17,8 @@ export class ConfigurableModule {
|
|
|
16
17
|
set config(config) {
|
|
17
18
|
this.currentConfig = config;
|
|
18
19
|
}
|
|
20
|
+
create(childContainerProvider) {
|
|
21
|
+
noop();
|
|
22
|
+
}
|
|
19
23
|
}
|
|
24
|
+
//# sourceMappingURL=ConfigurableModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurableModule.js","sourceRoot":"","sources":["../../src/config/ConfigurableModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,MAAM,MAAM,GAAG;IACb,YAAY,EAAE,CAAC,UAAkB,EAAE,EAAE,CACnC,IAAI,KAAK,CACP,gCAAgC,UAAU,yBAAyB,CACpE;CACJ,CAAC;AAaF;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAS7B,+BAA+B;IAC/B,IAAW,MAAM;QACf,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE;YACpC,MAAM,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAClD;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,iBAAiB;IACjB,IAAW,MAAM,CAAC,MAAc;QAC9B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC;IAEM,MAAM,CAAC,sBAA8C;QAC1D,IAAI,EAAE,CAAC;IACT,CAAC;CACF"}
|