@xapps-platform/xapp-manifest 0.1.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 +73 -0
- package/dist/hookContracts.d.ts +22 -0
- package/dist/hookContracts.d.ts.map +1 -0
- package/dist/hookRegistry.d.ts +14 -0
- package/dist/hookRegistry.d.ts.map +1 -0
- package/dist/hookResolution.d.ts +23 -0
- package/dist/hookResolution.d.ts.map +1 -0
- package/dist/index.d.ts +1531 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8291 -0
- package/dist/index.js.map +7 -0
- package/dist/invoices.d.ts +60 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/notifications.d.ts +66 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/subjectProfileGuardDefinitions.d.ts +33 -0
- package/dist/subjectProfileGuardDefinitions.d.ts.map +1 -0
- package/dist/subjectProfileRequirement.d.ts +42 -0
- package/dist/subjectProfileRequirement.d.ts.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# `@xapps-platform/xapp-manifest`
|
|
2
|
+
|
|
3
|
+
Shared Xapp manifest schema, types, and structural validator.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @xapps-platform/xapp-manifest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
Use this package when you need manifest parsing and validation without pulling in the broader backend/runtime SDK surface.
|
|
14
|
+
|
|
15
|
+
It is the direct public home for:
|
|
16
|
+
|
|
17
|
+
- `xappManifestJsonSchema`
|
|
18
|
+
- `parseXappManifest(...)`
|
|
19
|
+
- manifest-facing TypeScript types such as `XappManifest`
|
|
20
|
+
|
|
21
|
+
## What moved here
|
|
22
|
+
|
|
23
|
+
This package now owns the shared manifest contract that was previously implemented only in the core validator.
|
|
24
|
+
|
|
25
|
+
That shared surface includes:
|
|
26
|
+
|
|
27
|
+
- JSON schema validation
|
|
28
|
+
- structural manifest normalization/parsing
|
|
29
|
+
- shared governance checks for hook/notification/invoice/subject-profile manifest sections
|
|
30
|
+
- structured warnings for unreferenced definitions/templates
|
|
31
|
+
|
|
32
|
+
## What stayed in core
|
|
33
|
+
|
|
34
|
+
Gateway/runtime-only behavior still stays in core API code.
|
|
35
|
+
|
|
36
|
+
The current core wrapper in `src/validation/xappManifest.ts` exists only to:
|
|
37
|
+
|
|
38
|
+
- reuse this shared validator
|
|
39
|
+
- map shared warnings into gateway logger output
|
|
40
|
+
|
|
41
|
+
## Minimal usage
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { parseXappManifest, xappManifestJsonSchema } from "@xapps-platform/xapp-manifest";
|
|
45
|
+
|
|
46
|
+
const manifest = parseXappManifest({
|
|
47
|
+
name: "Example Xapp",
|
|
48
|
+
slug: "example-xapp",
|
|
49
|
+
version: "1.0.0",
|
|
50
|
+
tools: [],
|
|
51
|
+
widgets: [],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(manifest.slug);
|
|
55
|
+
console.log(xappManifestJsonSchema.type);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Relation to other packages
|
|
59
|
+
|
|
60
|
+
- `@xapps-platform/server-sdk` re-exports this package for convenience in backend-oriented code.
|
|
61
|
+
- `@xapps/cli` uses this validator through `@xapps-platform/server-sdk` so current CLI publish flows stay non-breaking.
|
|
62
|
+
|
|
63
|
+
## Build
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run build --workspace packages/xapp-manifest
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Smoke
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm run smoke --workspace packages/xapp-manifest
|
|
73
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const CURRENT_GUARD_TRIGGERS: readonly ["before:installation_create", "before:widget_load", "before:session_open", "before:thread_create", "before:tool_run", "after:install", "after:link_complete", "before:link_revoke", "before:uninstall", "after:tool_complete", "after:uninstall"];
|
|
2
|
+
export declare const RESERVED_POST_ACTION_GUARD_TRIGGERS: readonly ["after:payment_completed", "after:payment_failed", "after:request_created", "after:response_ready", "after:response_finalized"];
|
|
3
|
+
export declare const ALL_KNOWN_GUARD_TRIGGERS: readonly ["before:installation_create", "before:widget_load", "before:session_open", "before:thread_create", "before:tool_run", "after:install", "after:link_complete", "before:link_revoke", "before:uninstall", "after:tool_complete", "after:uninstall", "after:payment_completed", "after:payment_failed", "after:request_created", "after:response_ready", "after:response_finalized"];
|
|
4
|
+
export declare const HOOK_EFFECT_KINDS: readonly ["policy", "invoice", "notification", "integration_call"];
|
|
5
|
+
export declare const HOOK_EXECUTION_MODES: readonly ["gateway_managed", "tenant_managed", "publisher_managed", "gateway_delegated"];
|
|
6
|
+
export declare const HOOK_PROVIDER_SCOPES: readonly ["gateway", "tenant", "publisher"];
|
|
7
|
+
export declare const HOOK_FAILURE_POLICIES: readonly ["fail_closed", "fail_open", "audit_only", "retry"];
|
|
8
|
+
export declare const HOOK_IDEMPOTENCY_SCOPES: readonly ["none", "request", "request_response", "payment_session", "payment_receipt", "response_version"];
|
|
9
|
+
export type CurrentGuardTrigger = (typeof CURRENT_GUARD_TRIGGERS)[number];
|
|
10
|
+
export type ReservedPostActionGuardTrigger = (typeof RESERVED_POST_ACTION_GUARD_TRIGGERS)[number];
|
|
11
|
+
export type KnownGuardTrigger = (typeof ALL_KNOWN_GUARD_TRIGGERS)[number];
|
|
12
|
+
export type HookEffectKind = (typeof HOOK_EFFECT_KINDS)[number];
|
|
13
|
+
export type HookExecutionMode = (typeof HOOK_EXECUTION_MODES)[number];
|
|
14
|
+
export type HookProviderScope = (typeof HOOK_PROVIDER_SCOPES)[number];
|
|
15
|
+
export type HookFailurePolicy = (typeof HOOK_FAILURE_POLICIES)[number];
|
|
16
|
+
export type HookIdempotencyScope = (typeof HOOK_IDEMPOTENCY_SCOPES)[number];
|
|
17
|
+
export declare function normalizeHookEffectKind(value: unknown): HookEffectKind | null;
|
|
18
|
+
export declare function normalizeHookExecutionMode(value: unknown): HookExecutionMode | null;
|
|
19
|
+
export declare function normalizeHookProviderScope(value: unknown): HookProviderScope | null;
|
|
20
|
+
export declare function normalizeHookFailurePolicy(value: unknown): HookFailurePolicy | null;
|
|
21
|
+
export declare function normalizeHookIdempotencyScope(value: unknown): HookIdempotencyScope | null;
|
|
22
|
+
//# sourceMappingURL=hookContracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookContracts.d.ts","sourceRoot":"","sources":["../src/hookContracts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,6PAYzB,CAAC;AAEX,eAAO,MAAM,mCAAmC,2IAMtC,CAAC;AAEX,eAAO,MAAM,wBAAwB,6XAG3B,CAAC;AAEX,eAAO,MAAM,iBAAiB,oEAAqE,CAAC;AACpG,eAAO,MAAM,oBAAoB,0FAKvB,CAAC;AACX,eAAO,MAAM,oBAAoB,6CAA8C,CAAC;AAChF,eAAO,MAAM,qBAAqB,8DAA+D,CAAC;AAClG,eAAO,MAAM,uBAAuB,4GAO1B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1E,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC;AAClG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAO7E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAOnF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAOnF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAOnF;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,IAAI,CAOzF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CurrentGuardTrigger, type HookEffectKind, type HookFailurePolicy, type KnownGuardTrigger } from "./hookContracts.js";
|
|
2
|
+
export type HookRegistryEntry = {
|
|
3
|
+
trigger: KnownGuardTrigger;
|
|
4
|
+
implemented: boolean;
|
|
5
|
+
blockingDefault: boolean;
|
|
6
|
+
allowedEffectKinds: HookEffectKind[];
|
|
7
|
+
allowsDelegatedExecution: boolean;
|
|
8
|
+
auditCategory: "guard_policy" | "lifecycle" | "payment" | "request" | "response";
|
|
9
|
+
notes?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getHookRegistryEntry(trigger: string): HookRegistryEntry | null;
|
|
12
|
+
export declare function getDefaultFailurePolicyForEffectKind(effectKind: HookEffectKind): HookFailurePolicy;
|
|
13
|
+
export declare function isImplementedHookTrigger(trigger: string): trigger is CurrentGuardTrigger;
|
|
14
|
+
//# sourceMappingURL=hookRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookRegistry.d.ts","sourceRoot":"","sources":["../src/hookRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,cAAc,EAAE,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,aAAa,EAAE,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAuBF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAI9E;AAED,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,cAAc,GACzB,iBAAiB,CAKnB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,mBAAmB,CAGxF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HookEffectKind, type HookExecutionMode, type HookFailurePolicy, type HookIdempotencyScope, type HookProviderScope } from "./hookContracts.js";
|
|
2
|
+
import { type HookRegistryEntry } from "./hookRegistry.js";
|
|
3
|
+
export type HookResolutionInput = {
|
|
4
|
+
slug: string;
|
|
5
|
+
trigger: string;
|
|
6
|
+
config?: Record<string, unknown> | null;
|
|
7
|
+
};
|
|
8
|
+
export type NormalizedHookGuardConfig = {
|
|
9
|
+
effectKind: HookEffectKind;
|
|
10
|
+
executionMode: HookExecutionMode | null;
|
|
11
|
+
providerScope: HookProviderScope | null;
|
|
12
|
+
failurePolicy: HookFailurePolicy;
|
|
13
|
+
idempotencyScope: HookIdempotencyScope | null;
|
|
14
|
+
providerKey: string | null;
|
|
15
|
+
};
|
|
16
|
+
export type ResolvedHookGuardSemantics = {
|
|
17
|
+
slug: string;
|
|
18
|
+
trigger: string;
|
|
19
|
+
hook: HookRegistryEntry | null;
|
|
20
|
+
config: NormalizedHookGuardConfig;
|
|
21
|
+
};
|
|
22
|
+
export declare function normalizeHookGuardConfig(input: HookResolutionInput): ResolvedHookGuardSemantics;
|
|
23
|
+
//# sourceMappingURL=hookResolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookResolution.d.ts","sourceRoot":"","sources":["../src/hookResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8D,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEvH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACxC,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACxC,aAAa,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,yBAAyB,CAAC;CACnC,CAAC;AAWF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,GAAG,0BAA0B,CAiC/F"}
|