@portalshq/resolver 0.0.2 → 0.0.4
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.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/nap-resolver-adapter.d.ts +28 -0
- package/dist/nap-resolver-adapter.js +23 -0
- package/package.json +21 -3
- package/src/index.ts +0 -1
- package/src/nap-resolver-adapter.ts +0 -40
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nap-resolver-adapter.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nap-resolver-adapter.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTANT: this does not reimplement NAP. It wraps the existing NAP v0
|
|
3
|
+
* client (already running in studio-app and 25thChapter) so that any
|
|
4
|
+
* capability in this repo can resolve a NAP address through one stable
|
|
5
|
+
* interface, without depending on the v0 client's internal API surface
|
|
6
|
+
* directly. If/when NAP moves past v0, only this adapter should need to
|
|
7
|
+
* change — not every capability that consumes it.
|
|
8
|
+
*
|
|
9
|
+
* TODO(integration): replace the placeholder import below with the actual
|
|
10
|
+
* NAP v0 client package once it's extracted from studio-app into its own
|
|
11
|
+
* package. Until then this adapter defines the target interface so other
|
|
12
|
+
* packages can be built against it in parallel.
|
|
13
|
+
*/
|
|
14
|
+
export interface NarrativeObject {
|
|
15
|
+
napAddress: string;
|
|
16
|
+
kind: "narrative" | "world" | "asset" | "identity";
|
|
17
|
+
lineage?: string[];
|
|
18
|
+
payload: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface NapResolver {
|
|
21
|
+
resolve(napAddress: string): Promise<NarrativeObject>;
|
|
22
|
+
exists(napAddress: string): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare class NapResolverAdapter implements NapResolver {
|
|
25
|
+
constructor();
|
|
26
|
+
resolve(napAddress: string): Promise<NarrativeObject>;
|
|
27
|
+
exists(napAddress: string): Promise<boolean>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTANT: this does not reimplement NAP. It wraps the existing NAP v0
|
|
3
|
+
* client (already running in studio-app and 25thChapter) so that any
|
|
4
|
+
* capability in this repo can resolve a NAP address through one stable
|
|
5
|
+
* interface, without depending on the v0 client's internal API surface
|
|
6
|
+
* directly. If/when NAP moves past v0, only this adapter should need to
|
|
7
|
+
* change — not every capability that consumes it.
|
|
8
|
+
*
|
|
9
|
+
* TODO(integration): replace the placeholder import below with the actual
|
|
10
|
+
* NAP v0 client package once it's extracted from studio-app into its own
|
|
11
|
+
* package. Until then this adapter defines the target interface so other
|
|
12
|
+
* packages can be built against it in parallel.
|
|
13
|
+
*/
|
|
14
|
+
export class NapResolverAdapter {
|
|
15
|
+
constructor( /* private client: NapClientV0 */) { }
|
|
16
|
+
async resolve(napAddress) {
|
|
17
|
+
// return this.client.resolve(napAddress);
|
|
18
|
+
throw new Error("NapResolverAdapter.resolve: wire up to NAP v0 client — see TODO above");
|
|
19
|
+
}
|
|
20
|
+
async exists(napAddress) {
|
|
21
|
+
throw new Error("NapResolverAdapter.exists: wire up to NAP v0 client — see TODO above");
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portalshq/resolver",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "git+https://github.com/portalshq/portals-cloud"
|
|
6
|
+
"url": "git+https://github.com/portalshq/portals-cloud.git",
|
|
7
|
+
"directory": "packages/resolver"
|
|
7
8
|
},
|
|
8
9
|
"description": "Adapter over the existing NAP v0 client. Gives NAP a stable, contract-compliant interface consumable by any capability, not just studio-app/25thChapter's bespoke integrations.",
|
|
9
|
-
"
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
19
|
+
},
|
|
10
20
|
"dependencies": {
|
|
11
21
|
"@portalshq/contracts": "*"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.5.0",
|
|
25
|
+
"@types/node": "^20.0.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
30
|
}
|
|
13
31
|
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./nap-resolver-adapter";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTANT: this does not reimplement NAP. It wraps the existing NAP v0
|
|
3
|
-
* client (already running in studio-app and 25thChapter) so that any
|
|
4
|
-
* capability in this repo can resolve a NAP address through one stable
|
|
5
|
-
* interface, without depending on the v0 client's internal API surface
|
|
6
|
-
* directly. If/when NAP moves past v0, only this adapter should need to
|
|
7
|
-
* change — not every capability that consumes it.
|
|
8
|
-
*
|
|
9
|
-
* TODO(integration): replace the placeholder import below with the actual
|
|
10
|
-
* NAP v0 client package once it's extracted from studio-app into its own
|
|
11
|
-
* package. Until then this adapter defines the target interface so other
|
|
12
|
-
* packages can be built against it in parallel.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// import { NapClientV0 } from "@portalshq/protocol-v0"; // <-- existing v0 client, once extracted
|
|
16
|
-
|
|
17
|
-
export interface NarrativeObject {
|
|
18
|
-
napAddress: string;
|
|
19
|
-
kind: "narrative" | "world" | "asset" | "identity";
|
|
20
|
-
lineage?: string[]; // provenance chain — see docs ADR on remixing/attribution
|
|
21
|
-
payload: unknown;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface NapResolver {
|
|
25
|
-
resolve(napAddress: string): Promise<NarrativeObject>;
|
|
26
|
-
exists(napAddress: string): Promise<boolean>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class NapResolverAdapter implements NapResolver {
|
|
30
|
-
constructor(/* private client: NapClientV0 */) {}
|
|
31
|
-
|
|
32
|
-
async resolve(napAddress: string): Promise<NarrativeObject> {
|
|
33
|
-
// return this.client.resolve(napAddress);
|
|
34
|
-
throw new Error("NapResolverAdapter.resolve: wire up to NAP v0 client — see TODO above");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async exists(napAddress: string): Promise<boolean> {
|
|
38
|
-
throw new Error("NapResolverAdapter.exists: wire up to NAP v0 client — see TODO above");
|
|
39
|
-
}
|
|
40
|
-
}
|