@tinycloud/node-sdk 2.3.1-beta.0 → 2.4.0-beta.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/dist/{core-D2hPECHW.d.cts → core-Dbzm1kA_.d.cts} +21 -0
- package/dist/{core-D2hPECHW.d.ts → core-Dbzm1kA_.d.ts} +21 -0
- package/dist/core.cjs +46 -0
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +46 -0
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -914,6 +914,27 @@ declare class TinyCloudNode {
|
|
|
914
914
|
private ownedSpaceId;
|
|
915
915
|
private writeManifestRegistryRecords;
|
|
916
916
|
private ensureOwnedSpaceHosted;
|
|
917
|
+
/**
|
|
918
|
+
* Host one of this user's owned spaces by name (e.g. `"applications"`).
|
|
919
|
+
*
|
|
920
|
+
* Resolves the name to the owned space URI
|
|
921
|
+
* (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`) and registers it on the
|
|
922
|
+
* server via the host-SIWE delegation flow, so subsequent KV/SQL writes to
|
|
923
|
+
* that space succeed instead of returning `404 - Space not found`. The
|
|
924
|
+
* caller is the root authority of their own owned spaces, so no additional
|
|
925
|
+
* delegation is required.
|
|
926
|
+
*
|
|
927
|
+
* Unlike {@link ensureOwnedSpaceHosted}, this always submits the host
|
|
928
|
+
* delegation rather than inferring hosting from session activation: a space
|
|
929
|
+
* the current session has never referenced is reported neither as
|
|
930
|
+
* `activated` nor `skipped`, so activation-based detection would wrongly
|
|
931
|
+
* skip the host. The host SIWE is idempotent server-side, so re-hosting an
|
|
932
|
+
* existing space is a safe no-op. Must be called after {@link signIn}.
|
|
933
|
+
*
|
|
934
|
+
* @param name - The owned space name (e.g. `"applications"`).
|
|
935
|
+
* @returns The hosted space URI.
|
|
936
|
+
*/
|
|
937
|
+
hostOwnedSpace(name: string): Promise<string>;
|
|
917
938
|
/**
|
|
918
939
|
* Restore a previously established session from stored delegation data.
|
|
919
940
|
*
|
|
@@ -914,6 +914,27 @@ declare class TinyCloudNode {
|
|
|
914
914
|
private ownedSpaceId;
|
|
915
915
|
private writeManifestRegistryRecords;
|
|
916
916
|
private ensureOwnedSpaceHosted;
|
|
917
|
+
/**
|
|
918
|
+
* Host one of this user's owned spaces by name (e.g. `"applications"`).
|
|
919
|
+
*
|
|
920
|
+
* Resolves the name to the owned space URI
|
|
921
|
+
* (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`) and registers it on the
|
|
922
|
+
* server via the host-SIWE delegation flow, so subsequent KV/SQL writes to
|
|
923
|
+
* that space succeed instead of returning `404 - Space not found`. The
|
|
924
|
+
* caller is the root authority of their own owned spaces, so no additional
|
|
925
|
+
* delegation is required.
|
|
926
|
+
*
|
|
927
|
+
* Unlike {@link ensureOwnedSpaceHosted}, this always submits the host
|
|
928
|
+
* delegation rather than inferring hosting from session activation: a space
|
|
929
|
+
* the current session has never referenced is reported neither as
|
|
930
|
+
* `activated` nor `skipped`, so activation-based detection would wrongly
|
|
931
|
+
* skip the host. The host SIWE is idempotent server-side, so re-hosting an
|
|
932
|
+
* existing space is a safe no-op. Must be called after {@link signIn}.
|
|
933
|
+
*
|
|
934
|
+
* @param name - The owned space name (e.g. `"applications"`).
|
|
935
|
+
* @returns The hosted space URI.
|
|
936
|
+
*/
|
|
937
|
+
hostOwnedSpace(name: string): Promise<string>;
|
|
917
938
|
/**
|
|
918
939
|
* Restore a previously established session from stored delegation data.
|
|
919
940
|
*
|
package/dist/core.cjs
CHANGED
|
@@ -1971,6 +1971,52 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
1971
1971
|
);
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Host one of this user's owned spaces by name (e.g. `"applications"`).
|
|
1976
|
+
*
|
|
1977
|
+
* Resolves the name to the owned space URI
|
|
1978
|
+
* (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`) and registers it on the
|
|
1979
|
+
* server via the host-SIWE delegation flow, so subsequent KV/SQL writes to
|
|
1980
|
+
* that space succeed instead of returning `404 - Space not found`. The
|
|
1981
|
+
* caller is the root authority of their own owned spaces, so no additional
|
|
1982
|
+
* delegation is required.
|
|
1983
|
+
*
|
|
1984
|
+
* Unlike {@link ensureOwnedSpaceHosted}, this always submits the host
|
|
1985
|
+
* delegation rather than inferring hosting from session activation: a space
|
|
1986
|
+
* the current session has never referenced is reported neither as
|
|
1987
|
+
* `activated` nor `skipped`, so activation-based detection would wrongly
|
|
1988
|
+
* skip the host. The host SIWE is idempotent server-side, so re-hosting an
|
|
1989
|
+
* existing space is a safe no-op. Must be called after {@link signIn}.
|
|
1990
|
+
*
|
|
1991
|
+
* @param name - The owned space name (e.g. `"applications"`).
|
|
1992
|
+
* @returns The hosted space URI.
|
|
1993
|
+
*/
|
|
1994
|
+
async hostOwnedSpace(name) {
|
|
1995
|
+
if (!this.auth || !this.auth.tinyCloudSession) {
|
|
1996
|
+
throw new Error("Not signed in. Call signIn() first.");
|
|
1997
|
+
}
|
|
1998
|
+
const spaceId = this.ownedSpaceId(name);
|
|
1999
|
+
const host = this.hosts[0] ?? this.config.host;
|
|
2000
|
+
if (!host) {
|
|
2001
|
+
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
2002
|
+
}
|
|
2003
|
+
const hosted = await this.auth.hostOwnedSpace(
|
|
2004
|
+
spaceId
|
|
2005
|
+
);
|
|
2006
|
+
if (!hosted) {
|
|
2007
|
+
throw new Error(`Failed to host owned space: ${spaceId}`);
|
|
2008
|
+
}
|
|
2009
|
+
const activation = await (0, import_sdk_core6.activateSessionWithHost)(
|
|
2010
|
+
host,
|
|
2011
|
+
this.auth.tinyCloudSession.delegationHeader
|
|
2012
|
+
);
|
|
2013
|
+
if (!activation.success || activation.skipped?.includes(spaceId)) {
|
|
2014
|
+
throw new Error(
|
|
2015
|
+
`Failed to activate session for owned space ${spaceId}: ${activation.error ?? "space was skipped"}`
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
return spaceId;
|
|
2019
|
+
}
|
|
1974
2020
|
/**
|
|
1975
2021
|
* Restore a previously established session from stored delegation data.
|
|
1976
2022
|
*
|