@ownables/platform-node 0.1.0 → 0.5.1
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 +30 -0
- package/dist/core/src/index.d.ts +21 -0
- package/dist/core/src/index.d.ts.map +1 -0
- package/dist/core/src/index.js +20 -0
- package/dist/core/src/index.js.map +1 -0
- package/dist/core/src/interfaces/core.d.ts +53 -0
- package/dist/core/src/interfaces/core.d.ts.map +1 -0
- package/dist/core/src/interfaces/core.js +2 -0
- package/dist/core/src/interfaces/core.js.map +1 -0
- package/dist/core/src/logger.d.ts +3 -0
- package/dist/core/src/logger.d.ts.map +1 -0
- package/dist/core/src/logger.js +2 -0
- package/dist/core/src/logger.js.map +1 -0
- package/dist/core/src/ownableErrorMessage.d.ts +2 -0
- package/dist/core/src/ownableErrorMessage.d.ts.map +1 -0
- package/dist/core/src/ownableErrorMessage.js +20 -0
- package/dist/core/src/ownableErrorMessage.js.map +1 -0
- package/dist/core/src/progress.d.ts +3 -0
- package/dist/core/src/progress.d.ts.map +1 -0
- package/dist/core/src/progress.js +8 -0
- package/dist/core/src/progress.js.map +1 -0
- package/dist/core/src/services/EventChain.service.d.ts +47 -0
- package/dist/core/src/services/EventChain.service.d.ts.map +1 -0
- package/dist/core/src/services/EventChain.service.js +113 -0
- package/dist/core/src/services/EventChain.service.js.map +1 -0
- package/dist/core/src/services/Ownable.service.d.ts +60 -0
- package/dist/core/src/services/Ownable.service.d.ts.map +1 -0
- package/dist/core/src/services/Ownable.service.js +421 -0
- package/dist/core/src/services/Ownable.service.js.map +1 -0
- package/dist/core/src/services/Polling.service.d.ts +31 -0
- package/dist/core/src/services/Polling.service.d.ts.map +1 -0
- package/dist/core/src/services/Polling.service.js +109 -0
- package/dist/core/src/services/Polling.service.js.map +1 -0
- package/dist/core/src/services/SIWE.service.d.ts +16 -0
- package/dist/core/src/services/SIWE.service.d.ts.map +1 -0
- package/dist/core/src/services/SIWE.service.js +123 -0
- package/dist/core/src/services/SIWE.service.js.map +1 -0
- package/dist/core/src/services/StateStoreRecordStore.service.d.ts +13 -0
- package/dist/core/src/services/StateStoreRecordStore.service.d.ts.map +1 -0
- package/dist/core/src/services/StateStoreRecordStore.service.js +76 -0
- package/dist/core/src/services/StateStoreRecordStore.service.js.map +1 -0
- package/dist/core/src/services/WorkerRPC.service.d.ts +37 -0
- package/dist/core/src/services/WorkerRPC.service.d.ts.map +1 -0
- package/dist/core/src/services/WorkerRPC.service.js +219 -0
- package/dist/core/src/services/WorkerRPC.service.js.map +1 -0
- package/dist/core/src/services/workerSource.d.ts +2 -0
- package/dist/core/src/services/workerSource.d.ts.map +1 -0
- package/dist/core/src/services/workerSource.js +72 -0
- package/dist/core/src/services/workerSource.js.map +1 -0
- package/dist/core/src/types/Authority.d.ts +40 -0
- package/dist/core/src/types/Authority.d.ts.map +1 -0
- package/dist/core/src/types/Authority.js +2 -0
- package/dist/core/src/types/Authority.js.map +1 -0
- package/dist/core/src/types/EventChainStore.d.ts +12 -0
- package/dist/core/src/types/EventChainStore.d.ts.map +1 -0
- package/dist/core/src/types/EventChainStore.js +2 -0
- package/dist/core/src/types/EventChainStore.js.map +1 -0
- package/dist/core/src/types/MessageInfo.d.ts +19 -0
- package/dist/core/src/types/MessageInfo.d.ts.map +1 -0
- package/dist/core/src/types/MessageInfo.js +2 -0
- package/dist/core/src/types/MessageInfo.js.map +1 -0
- package/dist/core/src/types/OwnableRuntime.d.ts +40 -0
- package/dist/core/src/types/OwnableRuntime.d.ts.map +1 -0
- package/dist/core/src/types/OwnableRuntime.js +2 -0
- package/dist/core/src/types/OwnableRuntime.js.map +1 -0
- package/dist/core/src/types/Polling.d.ts +14 -0
- package/dist/core/src/types/Polling.d.ts.map +1 -0
- package/dist/core/src/types/Polling.js +2 -0
- package/dist/core/src/types/Polling.js.map +1 -0
- package/dist/core/src/types/SIWE.d.ts +30 -0
- package/dist/core/src/types/SIWE.d.ts.map +1 -0
- package/dist/core/src/types/SIWE.js +2 -0
- package/dist/core/src/types/SIWE.js.map +1 -0
- package/dist/core/src/types/TypedCosmWasmMsg.d.ts +12 -0
- package/dist/core/src/types/TypedCosmWasmMsg.d.ts.map +1 -0
- package/dist/core/src/types/TypedCosmWasmMsg.js +2 -0
- package/dist/core/src/types/TypedCosmWasmMsg.js.map +1 -0
- package/dist/core/src/types/TypedDict.d.ts +4 -0
- package/dist/core/src/types/TypedDict.d.ts.map +1 -0
- package/dist/core/src/types/TypedDict.js +2 -0
- package/dist/core/src/types/TypedDict.js.map +1 -0
- package/dist/core/src/types/TypedOwnableInfo.d.ts +34 -0
- package/dist/core/src/types/TypedOwnableInfo.d.ts.map +1 -0
- package/dist/core/src/types/TypedOwnableInfo.js +2 -0
- package/dist/core/src/types/TypedOwnableInfo.js.map +1 -0
- package/dist/core/src/types/TypedPackage.d.ts +35 -0
- package/dist/core/src/types/TypedPackage.d.ts.map +1 -0
- package/dist/core/src/types/TypedPackage.js +2 -0
- package/dist/core/src/types/TypedPackage.js.map +1 -0
- package/dist/platform-node/src/babel/transformImportMetaUrl.d.ts +3 -0
- package/dist/platform-node/src/babel/transformImportMetaUrl.d.ts.map +1 -0
- package/dist/platform-node/src/babel/transformImportMetaUrl.js +22 -0
- package/dist/platform-node/src/babel/transformImportMetaUrl.js.map +1 -0
- package/dist/platform-node/src/index.d.ts +6 -0
- package/dist/platform-node/src/index.d.ts.map +1 -0
- package/dist/platform-node/src/index.js +6 -0
- package/dist/platform-node/src/index.js.map +1 -0
- package/dist/platform-node/src/services/BucketArchive.service.d.ts +17 -0
- package/dist/platform-node/src/services/BucketArchive.service.d.ts.map +1 -0
- package/dist/platform-node/src/services/BucketArchive.service.js +100 -0
- package/dist/platform-node/src/services/BucketArchive.service.js.map +1 -0
- package/dist/platform-node/src/services/BucketStateStore.service.d.ts +27 -0
- package/dist/platform-node/src/services/BucketStateStore.service.d.ts.map +1 -0
- package/dist/platform-node/src/services/BucketStateStore.service.js +157 -0
- package/dist/platform-node/src/services/BucketStateStore.service.js.map +1 -0
- package/dist/platform-node/src/services/NodePackageAssetIO.service.d.ts +12 -0
- package/dist/platform-node/src/services/NodePackageAssetIO.service.d.ts.map +1 -0
- package/dist/platform-node/src/services/NodePackageAssetIO.service.js +86 -0
- package/dist/platform-node/src/services/NodePackageAssetIO.service.js.map +1 -0
- package/dist/platform-node/src/services/NodeSandboxOwnableRPC.service.d.ts +39 -0
- package/dist/platform-node/src/services/NodeSandboxOwnableRPC.service.d.ts.map +1 -0
- package/dist/platform-node/src/services/NodeSandboxOwnableRPC.service.js +148 -0
- package/dist/platform-node/src/services/NodeSandboxOwnableRPC.service.js.map +1 -0
- package/dist/platform-node/src/types/PlatformNode.d.ts +25 -0
- package/dist/platform-node/src/types/PlatformNode.d.ts.map +1 -0
- package/dist/platform-node/src/types/PlatformNode.js +2 -0
- package/dist/platform-node/src/types/PlatformNode.js.map +1 -0
- package/package.json +8 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authority.js","sourceRoot":"","sources":["../../../../../core/src/types/Authority.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IEventChainJSON } from 'eqty-core';
|
|
2
|
+
export interface StoredChainInfo {
|
|
3
|
+
chain: IEventChainJSON;
|
|
4
|
+
state: string;
|
|
5
|
+
package: string;
|
|
6
|
+
isConsumed?: boolean;
|
|
7
|
+
uniqueMessageHash: string;
|
|
8
|
+
created: Date;
|
|
9
|
+
latestHash: string;
|
|
10
|
+
keywords: string[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=EventChainStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventChainStore.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/EventChainStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventChainStore.js","sourceRoot":"","sources":["../../../../../core/src/types/EventChainStore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Binary } from "eqty-core";
|
|
2
|
+
export interface MessageInfo {
|
|
3
|
+
hash: string;
|
|
4
|
+
recipient: string;
|
|
5
|
+
sender: string | Object;
|
|
6
|
+
size: number;
|
|
7
|
+
timestamp: Date;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MessageExt extends MessageInfo {
|
|
11
|
+
data: any;
|
|
12
|
+
sender: Object;
|
|
13
|
+
signature: Binary;
|
|
14
|
+
_hash: Binary;
|
|
15
|
+
parsedData: string;
|
|
16
|
+
messageHash?: string | any;
|
|
17
|
+
message?: MessageExt | any;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=MessageInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageInfo.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/MessageInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAC3B,OAAO,CAAC,EAAE,UAAU,GAAG,GAAG,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageInfo.js","sourceRoot":"","sources":["../../../../../core/src/types/MessageInfo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type TypedDict from './TypedDict';
|
|
2
|
+
export type StateDump = Array<[ArrayLike<number>, ArrayLike<number>]>;
|
|
3
|
+
export interface CosmWasmMessageInfo {
|
|
4
|
+
sender: string;
|
|
5
|
+
funds: object[];
|
|
6
|
+
}
|
|
7
|
+
export interface CosmWasmEvent {
|
|
8
|
+
type: string;
|
|
9
|
+
attributes: TypedDict<string>;
|
|
10
|
+
}
|
|
11
|
+
export interface OwnableRPC {
|
|
12
|
+
initialize: (js: string, wasm: Uint8Array) => Promise<void>;
|
|
13
|
+
instantiate: (msg: TypedDict, info: CosmWasmMessageInfo) => Promise<{
|
|
14
|
+
attributes: TypedDict<string>;
|
|
15
|
+
state: StateDump;
|
|
16
|
+
}>;
|
|
17
|
+
execute: (msg: TypedDict, info: CosmWasmMessageInfo, state: StateDump) => Promise<{
|
|
18
|
+
attributes: TypedDict<string>;
|
|
19
|
+
events: Array<CosmWasmEvent>;
|
|
20
|
+
data: string;
|
|
21
|
+
state: StateDump;
|
|
22
|
+
}>;
|
|
23
|
+
externalEvent: (msg: TypedDict, info: TypedDict, state: StateDump) => Promise<{
|
|
24
|
+
attributes: TypedDict<string>;
|
|
25
|
+
events: Array<CosmWasmEvent>;
|
|
26
|
+
data: string;
|
|
27
|
+
state: StateDump;
|
|
28
|
+
}>;
|
|
29
|
+
query: (msg: TypedDict, state: StateDump) => Promise<any>;
|
|
30
|
+
refresh: (state: StateDump) => Promise<void>;
|
|
31
|
+
terminate: () => void;
|
|
32
|
+
setWidgetWindow: (win: unknown | null) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface StateSnapshot {
|
|
35
|
+
eventIndex: number;
|
|
36
|
+
blockHash: string;
|
|
37
|
+
stateDump: StateDump;
|
|
38
|
+
timestamp: Date;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=OwnableRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnableRuntime.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/OwnableRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,WAAW,EAAE,CACX,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,mBAAmB,KACtB,OAAO,CAAC;QAAE,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAClE,OAAO,EAAE,CACP,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,SAAS,KACb,OAAO,CAAC;QACX,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC,CAAC;IACH,aAAa,EAAE,CACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,KACb,OAAO,CAAC;QACX,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC,CAAC;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnableRuntime.js","sourceRoot":"","sources":["../../../../../core/src/types/OwnableRuntime.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Relay polling is legacy and will be removed in a future major version.
|
|
3
|
+
* Prefer hub-backed notification flows.
|
|
4
|
+
*/
|
|
5
|
+
export interface RelayPollingClient {
|
|
6
|
+
url?: string;
|
|
7
|
+
relay: {
|
|
8
|
+
get(path: string, headers?: Record<string, string>): Promise<any>;
|
|
9
|
+
};
|
|
10
|
+
isAvailable(): Promise<boolean>;
|
|
11
|
+
ensureAuthenticated(): Promise<boolean>;
|
|
12
|
+
getAuthHeaders(): Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Polling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Polling.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/Polling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;IAC7E,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Polling.js","sourceRoot":"","sources":["../../../../../core/src/types/Polling.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SIWEMessage {
|
|
2
|
+
domain: string;
|
|
3
|
+
address: string;
|
|
4
|
+
statement?: string;
|
|
5
|
+
uri: string;
|
|
6
|
+
version: string;
|
|
7
|
+
chainId: number;
|
|
8
|
+
nonce: string;
|
|
9
|
+
issuedAt: string;
|
|
10
|
+
expirationTime?: string;
|
|
11
|
+
notBefore?: string;
|
|
12
|
+
requestId?: string;
|
|
13
|
+
resources?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface SIWEAuthResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
address?: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
expiresIn?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SIWEClientDeps {
|
|
23
|
+
fetchFn?: (input: string, init?: RequestInit) => Promise<{
|
|
24
|
+
ok: boolean;
|
|
25
|
+
json(): Promise<any>;
|
|
26
|
+
}>;
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
nonceGenerator?: () => string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=SIWE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SIWE.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/SIWE.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC,CAAC;IAChG,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SIWE.js","sourceRoot":"","sources":["../../../../../core/src/types/SIWE.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface TypedCosmWasmMethod {
|
|
2
|
+
required: string[];
|
|
3
|
+
properties: {
|
|
4
|
+
[methodName: string]: object;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface TypedCosmWasmMsg {
|
|
8
|
+
title: string;
|
|
9
|
+
oneOf: Array<TypedCosmWasmMethod>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=TypedCosmWasmMsg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedCosmWasmMsg.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/TypedCosmWasmMsg.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE;QACV,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedCosmWasmMsg.js","sourceRoot":"","sources":["../../../../../core/src/types/TypedCosmWasmMsg.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedDict.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/TypedDict.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG;IACxC,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedDict.js","sourceRoot":"","sources":["../../../../../core/src/types/TypedDict.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface TypedOwnableInfo {
|
|
2
|
+
owner: string;
|
|
3
|
+
issuer: string;
|
|
4
|
+
ownable_type?: string;
|
|
5
|
+
nft?: NftObject;
|
|
6
|
+
}
|
|
7
|
+
export interface NftObject {
|
|
8
|
+
address: string;
|
|
9
|
+
id: string;
|
|
10
|
+
lock_service?: any;
|
|
11
|
+
network: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TypedMetadata {
|
|
14
|
+
name: string;
|
|
15
|
+
image?: string;
|
|
16
|
+
image_data?: string;
|
|
17
|
+
external_url?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
background_color?: string;
|
|
20
|
+
animation_url?: string;
|
|
21
|
+
youtube_url?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TypedOwnable {
|
|
24
|
+
owner: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
keywords?: string[];
|
|
29
|
+
evmAddress: string;
|
|
30
|
+
network: string;
|
|
31
|
+
image: unknown | null;
|
|
32
|
+
templateId?: string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=TypedOwnableInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedOwnableInfo.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/TypedOwnableInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedOwnableInfo.js","sourceRoot":"","sources":["../../../../../core/src/types/TypedOwnableInfo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface TypedPackageCapabilities {
|
|
2
|
+
isDynamic: boolean;
|
|
3
|
+
hasMetadata: boolean;
|
|
4
|
+
hasWidgetState: boolean;
|
|
5
|
+
isConsumable: boolean;
|
|
6
|
+
isConsumer: boolean;
|
|
7
|
+
isTransferable: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TypedPackage extends TypedPackageCapabilities {
|
|
10
|
+
title: string;
|
|
11
|
+
detail?: unknown;
|
|
12
|
+
name: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
ownablesAbi?: string;
|
|
15
|
+
wireFormat?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
cid: string;
|
|
18
|
+
chain?: unknown;
|
|
19
|
+
isNotLocal?: boolean;
|
|
20
|
+
uniqueMessageHash?: string;
|
|
21
|
+
versions: Array<{
|
|
22
|
+
date: Date;
|
|
23
|
+
cid: string;
|
|
24
|
+
uniqueMessageHash?: string;
|
|
25
|
+
}>;
|
|
26
|
+
keywords?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface TypedPackageStub {
|
|
29
|
+
title: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
stub: true;
|
|
33
|
+
isNotLocal?: boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=TypedPackage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedPackage.d.ts","sourceRoot":"","sources":["../../../../../core/src/types/TypedPackage.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,wBAAwB;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedPackage.js","sourceRoot":"","sources":["../../../../../core/src/types/TypedPackage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformImportMetaUrl.d.ts","sourceRoot":"","sources":["../../../../src/babel/transformImportMetaUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQ7C,MAAM,CAAC,OAAO,UAAU,sBAAsB,IAAI,SAAS,CAuB1D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function transformImportMetaUrl() {
|
|
2
|
+
return {
|
|
3
|
+
name: 'transform-import-meta-url',
|
|
4
|
+
visitor: {
|
|
5
|
+
MemberExpression(path) {
|
|
6
|
+
const node = path.node;
|
|
7
|
+
if (node.object.type === 'MetaProperty' &&
|
|
8
|
+
node.object.meta.name === 'import' &&
|
|
9
|
+
node.object.property.name === 'meta' &&
|
|
10
|
+
node.property.type === 'Identifier' &&
|
|
11
|
+
node.property.name === 'url') {
|
|
12
|
+
const replacement = {
|
|
13
|
+
type: 'StringLiteral',
|
|
14
|
+
value: 'file:///ownable.js',
|
|
15
|
+
};
|
|
16
|
+
path.replaceWith(replacement);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=transformImportMetaUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformImportMetaUrl.js","sourceRoot":"","sources":["../../../../src/babel/transformImportMetaUrl.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,sBAAsB;IAC5C,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,OAAO,EAAE;YACP,gBAAgB,CAAC,IAA0B;gBACzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAwB,CAAC;gBAE3C,IACE,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc;oBACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;oBAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;oBACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;oBACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,EAC5B,CAAC;oBACD,MAAM,WAAW,GAAkB;wBACjC,IAAI,EAAE,eAAe;wBACrB,KAAK,EAAE,oBAAoB;qBAC5B,CAAC;oBACF,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as BucketStateStore } from './services/BucketStateStore.service';
|
|
2
|
+
export { default as BucketArchiveService } from './services/BucketArchive.service';
|
|
3
|
+
export { default as NodeSandboxOwnableRPC } from './services/NodeSandboxOwnableRPC.service';
|
|
4
|
+
export { default as NodePackageAssetIO } from './services/NodePackageAssetIO.service';
|
|
5
|
+
export * from './types/PlatformNode';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEtF,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as BucketStateStore } from './services/BucketStateStore.service';
|
|
2
|
+
export { default as BucketArchiveService } from './services/BucketArchive.service';
|
|
3
|
+
export { default as NodeSandboxOwnableRPC } from './services/NodeSandboxOwnableRPC.service';
|
|
4
|
+
export { default as NodePackageAssetIO } from './services/NodePackageAssetIO.service';
|
|
5
|
+
export * from './types/PlatformNode';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEtF,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ArchiveService, ImportedArchive } from '@ownables/core';
|
|
2
|
+
import type { BucketArchiveServiceOptions } from '../types/PlatformNode';
|
|
3
|
+
export default class BucketArchiveService implements ArchiveService {
|
|
4
|
+
private readonly bucket;
|
|
5
|
+
private readonly cidCalculator;
|
|
6
|
+
private readonly rootPrefix;
|
|
7
|
+
constructor(options: BucketArchiveServiceOptions);
|
|
8
|
+
private packagePrefix;
|
|
9
|
+
private packageZipPath;
|
|
10
|
+
private chainPath;
|
|
11
|
+
importArchive(data: Uint8Array): Promise<ImportedArchive>;
|
|
12
|
+
hasPackage(cid: string): Promise<boolean>;
|
|
13
|
+
hasChain(cid: string): Promise<boolean>;
|
|
14
|
+
readChain(cid: string): Promise<Record<string, unknown>>;
|
|
15
|
+
readPackageZip(cid: string): Promise<Uint8Array>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=BucketArchive.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BucketArchive.service.d.ts","sourceRoot":"","sources":["../../../../src/services/BucketArchive.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAiBzE,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,cAAc;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAEhB,OAAO,EAAE,2BAA2B;IAMhD,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;IAIX,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC;IAyDzD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASzC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IASxD,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAQvD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
const DEFAULT_ROOT = 'archives';
|
|
3
|
+
function normalizeName(name) {
|
|
4
|
+
return name.replaceAll('\\', '/').replace(/^\.\//, '').replace(/^\//, '');
|
|
5
|
+
}
|
|
6
|
+
function toBytes(value) {
|
|
7
|
+
if (typeof value === 'string')
|
|
8
|
+
return Uint8Array.from(Buffer.from(value, 'utf8'));
|
|
9
|
+
return Uint8Array.from(value);
|
|
10
|
+
}
|
|
11
|
+
function chainCandidateNames(files) {
|
|
12
|
+
return files.filter((name) => name === 'eventChain.json' || name === 'chain.json');
|
|
13
|
+
}
|
|
14
|
+
export default class BucketArchiveService {
|
|
15
|
+
bucket;
|
|
16
|
+
cidCalculator;
|
|
17
|
+
rootPrefix;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.bucket = options.bucket;
|
|
20
|
+
this.cidCalculator = options.cidCalculator;
|
|
21
|
+
this.rootPrefix = options.rootPrefix ?? DEFAULT_ROOT;
|
|
22
|
+
}
|
|
23
|
+
packagePrefix(cid) {
|
|
24
|
+
return `${this.rootPrefix}/packages/${cid}`;
|
|
25
|
+
}
|
|
26
|
+
packageZipPath(cid) {
|
|
27
|
+
return `${this.packagePrefix(cid)}/${cid}.zip`;
|
|
28
|
+
}
|
|
29
|
+
chainPath(cid) {
|
|
30
|
+
return `${this.rootPrefix}/chains/${cid}/eventChain.json`;
|
|
31
|
+
}
|
|
32
|
+
async importArchive(data) {
|
|
33
|
+
const loaded = await new JSZip().loadAsync(data, { createFolders: true });
|
|
34
|
+
const fileEntries = Object.entries(loaded.files)
|
|
35
|
+
.filter(([, file]) => !file.dir)
|
|
36
|
+
.map(([name, file]) => [normalizeName(name), file]);
|
|
37
|
+
const files = new Map();
|
|
38
|
+
for (const [name, file] of fileEntries) {
|
|
39
|
+
files.set(name, await file.async('uint8array'));
|
|
40
|
+
}
|
|
41
|
+
const candidates = chainCandidateNames(Array.from(files.keys()));
|
|
42
|
+
if (candidates.length === 0) {
|
|
43
|
+
throw new Error("Invalid package: 'eventChain.json' or 'chain.json' is required");
|
|
44
|
+
}
|
|
45
|
+
const chainFileName = candidates.includes('eventChain.json')
|
|
46
|
+
? 'eventChain.json'
|
|
47
|
+
: 'chain.json';
|
|
48
|
+
const chainBytes = files.get(chainFileName);
|
|
49
|
+
if (!chainBytes) {
|
|
50
|
+
throw new Error(`Missing chain payload at ${chainFileName}`);
|
|
51
|
+
}
|
|
52
|
+
const chainJson = JSON.parse(Buffer.from(chainBytes).toString('utf8'));
|
|
53
|
+
files.delete('eventChain.json');
|
|
54
|
+
files.delete('chain.json');
|
|
55
|
+
const sorted = new Map(Array.from(files.entries()).sort(([a], [b]) => a.localeCompare(b)));
|
|
56
|
+
const cid = await this.cidCalculator.calculate(sorted);
|
|
57
|
+
for (const [name, contents] of sorted.entries()) {
|
|
58
|
+
await this.bucket.put(`${this.packagePrefix(cid)}/${name}`, contents);
|
|
59
|
+
}
|
|
60
|
+
const zip = new JSZip();
|
|
61
|
+
for (const [name, contents] of sorted.entries()) {
|
|
62
|
+
zip.file(name, Buffer.from(contents));
|
|
63
|
+
}
|
|
64
|
+
const zipped = await zip.generateAsync({ type: 'uint8array' });
|
|
65
|
+
await this.bucket.put(this.packageZipPath(cid), zipped);
|
|
66
|
+
await this.bucket.put(this.chainPath(cid), chainBytes);
|
|
67
|
+
return {
|
|
68
|
+
cid,
|
|
69
|
+
chainJson,
|
|
70
|
+
chainFileName,
|
|
71
|
+
packageFiles: Array.from(sorted.keys()),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async hasPackage(cid) {
|
|
75
|
+
const zip = await this.bucket.get(this.packageZipPath(cid));
|
|
76
|
+
if (zip !== undefined)
|
|
77
|
+
return true;
|
|
78
|
+
const keys = await this.bucket.list();
|
|
79
|
+
const prefix = `${this.packagePrefix(cid)}/`;
|
|
80
|
+
return keys.some((key) => key.startsWith(prefix));
|
|
81
|
+
}
|
|
82
|
+
async hasChain(cid) {
|
|
83
|
+
return (await this.bucket.get(this.chainPath(cid))) !== undefined;
|
|
84
|
+
}
|
|
85
|
+
async readChain(cid) {
|
|
86
|
+
const chain = await this.bucket.get(this.chainPath(cid));
|
|
87
|
+
if (chain === undefined) {
|
|
88
|
+
throw new Error(`Unknown chain for cid ${cid}`);
|
|
89
|
+
}
|
|
90
|
+
return JSON.parse(Buffer.from(toBytes(chain)).toString('utf8'));
|
|
91
|
+
}
|
|
92
|
+
async readPackageZip(cid) {
|
|
93
|
+
const zip = await this.bucket.get(this.packageZipPath(cid));
|
|
94
|
+
if (zip === undefined) {
|
|
95
|
+
throw new Error(`Unknown package archive for cid ${cid}`);
|
|
96
|
+
}
|
|
97
|
+
return toBytes(zip);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=BucketArchive.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BucketArchive.service.js","sourceRoot":"","sources":["../../../../src/services/BucketArchive.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,OAAO,CAAC,KAAmC;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAClF,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC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1
|
+
import type { StateStore } from '@ownables/core';
|
|
2
|
+
import type { BucketLike } from '../types/PlatformNode';
|
|
3
|
+
type StoreData = Record<string, unknown> | Map<unknown, unknown>;
|
|
4
|
+
export default class BucketStateStore implements StateStore {
|
|
5
|
+
private readonly bucket;
|
|
6
|
+
private readonly rootPrefix;
|
|
7
|
+
constructor(bucket: BucketLike, rootPrefix?: string);
|
|
8
|
+
private markerPath;
|
|
9
|
+
private valuePath;
|
|
10
|
+
private storePrefix;
|
|
11
|
+
private allKeys;
|
|
12
|
+
private ensureStore;
|
|
13
|
+
get(store: string, key: string): Promise<unknown>;
|
|
14
|
+
getAll(store: string): Promise<Array<unknown>>;
|
|
15
|
+
getMap(store: string): Promise<Map<unknown, unknown>>;
|
|
16
|
+
keys(store: string): Promise<string[]>;
|
|
17
|
+
set(store: string, key: string, value: unknown): Promise<void>;
|
|
18
|
+
setAll(store: string, map: StoreData): Promise<void>;
|
|
19
|
+
setAll(data: Record<string, StoreData>): Promise<void>;
|
|
20
|
+
hasStore(store: string): Promise<boolean>;
|
|
21
|
+
createStore(...stores: string[]): Promise<void>;
|
|
22
|
+
deleteStore(store: string | RegExp): Promise<void>;
|
|
23
|
+
listStores(): Promise<string[]>;
|
|
24
|
+
delete(store: string, key: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=BucketStateStore.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BucketStateStore.service.d.ts","sourceRoot":"","sources":["../../../../src/services/BucketStateStore.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKxD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AA2CjE,MAAM,CAA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