@ambasada/sdk 0.8.1 → 0.8.3
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/define.d.ts +23 -2
- package/dist/index.d.ts +56 -56
- package/dist/index.js +27 -2522
- package/dist/platform.d.ts +2 -1
- package/dist/platform.js +821 -0
- package/package.json +9 -3
- package/dist/village/client.d.ts +0 -148
- package/dist/village/define.d.ts +0 -44
- package/dist/village/errors.d.ts +0 -19
- package/dist/village/index.d.ts +0 -27
- package/dist/village/receipt.d.ts +0 -50
- package/dist/village/types.d.ts +0 -307
- package/dist/village/webhook.d.ts +0 -30
package/dist/define.d.ts
CHANGED
|
@@ -2,18 +2,39 @@
|
|
|
2
2
|
* `ambasada.config.ts` (docs/PLATFORM.md §3). Types and checks only; the CLI reads the values
|
|
3
3
|
* (`ambasada dev`, `deploy`, `link`, `check`). Add-ons add their own keys (the village: `idea`, `offerings`, `agent`).
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* The app's Ambasada mini app (docs/MINI-APPS.md §15, decision 15.6): optional. With it, `ambasada dev` and `deploy`
|
|
7
|
+
* serve /.well-known/ambasada.json (from this and `id`, `name`, `description`), `ambasada check` runs the mini-app
|
|
8
|
+
* rules on the entry, and the deploy registers the app with the Ambasada app. `ambasada miniapp enable` adds it.
|
|
9
|
+
*/
|
|
10
|
+
export interface MiniAppConfig {
|
|
11
|
+
/** The path the Ambasada app opens: "/app" (the in-app layout under it), or "/" for the whole site. */
|
|
12
|
+
entry: string;
|
|
13
|
+
/** A 1024×1024 opaque PNG, a path on the app (default "/icon.png"). */
|
|
14
|
+
icon?: string;
|
|
15
|
+
/** Manifest fields beyond the defaults (docs/MINI-APPS.md §2). */
|
|
16
|
+
category?: "shopping" | "food" | "events" | "tools" | "learning" | "community" | "games" | "finance" | "other";
|
|
17
|
+
accent?: string;
|
|
18
|
+
/** What the app asks the shell for (default: identity and notifications, which the templates' routes serve). */
|
|
19
|
+
scopes?: ("identity" | "notifications")[];
|
|
20
|
+
visibility?: "public" | "builders" | "unlisted" | `event:${string}`;
|
|
21
|
+
}
|
|
5
22
|
export interface AppConfig {
|
|
6
23
|
/** The app's slug (lowercase): it lives at https://<id>.ambasada.dev. */
|
|
7
24
|
id: string;
|
|
8
25
|
/** Display name. */
|
|
9
26
|
name: string;
|
|
10
|
-
/** One line about the app
|
|
27
|
+
/** One line about the app (the mini app's subtitle and description, when there is one). */
|
|
11
28
|
description?: string;
|
|
12
29
|
/** Where the app runs; `ambasada link` sets it when you host elsewhere. */
|
|
13
30
|
product?: {
|
|
14
31
|
url?: string;
|
|
15
32
|
};
|
|
16
|
-
/**
|
|
33
|
+
/** The mini app inside the Ambasada app, at a path of this one. Off without it. */
|
|
34
|
+
miniapp?: MiniAppConfig;
|
|
35
|
+
/** Add-ons to load besides the ones found in node_modules (package names, e.g. "@ambasada/village"). */
|
|
17
36
|
addons?: string[];
|
|
18
37
|
}
|
|
38
|
+
/** A path the mini app may open at: absolute, no query, hash, `..` or `//`. */
|
|
39
|
+
export declare const MINIAPP_ENTRY: RegExp;
|
|
19
40
|
export declare function defineApp<T extends AppConfig>(config: T): T;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,123 +9,123 @@
|
|
|
9
9
|
* Works in Node ≥ 22, Bun, Cloudflare Workers (`createAmbasada({ env })`) and Next.js route handlers.
|
|
10
10
|
* The Hack A Ton economy (TON, checkout, offerings, the agent) is the add-on `@ambasada/village`.
|
|
11
11
|
*/
|
|
12
|
-
import * as V from "
|
|
12
|
+
import * as V from "@ambasada/village";
|
|
13
13
|
export * from "./platform.js";
|
|
14
14
|
export { default } from "./platform.js";
|
|
15
|
-
/** @deprecated Import it from "
|
|
15
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
16
16
|
export declare const village: V.Village;
|
|
17
|
-
/** @deprecated Import it from "
|
|
17
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
18
18
|
export declare const createVillage: typeof V.createVillage;
|
|
19
|
-
/** @deprecated Import it from "
|
|
19
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
20
20
|
export declare const Village: typeof V.Village;
|
|
21
21
|
export type Village = V.Village;
|
|
22
|
-
/** @deprecated Import it from "
|
|
22
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
23
23
|
export declare const VillageError: typeof V.AmbasadaError;
|
|
24
24
|
export type VillageError = V.VillageError;
|
|
25
|
-
/** @deprecated Import it from "
|
|
25
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
26
26
|
export declare const isVillageError: typeof V.isAmbasadaError;
|
|
27
|
-
/** @deprecated Import it from "
|
|
27
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
28
28
|
export declare const ReceiptInvalidError: typeof V.ReceiptInvalidError;
|
|
29
29
|
export type ReceiptInvalidError = V.ReceiptInvalidError;
|
|
30
|
-
/** @deprecated Import it from "
|
|
30
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
31
31
|
export declare const DEFAULT_MODEL = "deepseek-v4.1-flash";
|
|
32
|
-
/** @deprecated Import it from "
|
|
32
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
33
33
|
export declare const verifyWebhookPayload: typeof V.verifyWebhookPayload;
|
|
34
|
-
/** @deprecated Import it from "
|
|
34
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
35
35
|
export declare const webhookHeaders: (secret: string, id: string, timestamp: number, body: string) => Promise<Record<string, string>>;
|
|
36
|
-
/** @deprecated Import it from "
|
|
36
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
37
37
|
export declare const generateWebhookSecret: () => string;
|
|
38
|
-
/** @deprecated Import it from "
|
|
38
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
39
39
|
export declare const WEBHOOK_HEADERS: {
|
|
40
40
|
readonly id: "webhook-id";
|
|
41
41
|
readonly timestamp: "webhook-timestamp";
|
|
42
42
|
readonly signature: "webhook-signature";
|
|
43
43
|
};
|
|
44
|
-
/** @deprecated Import it from "
|
|
44
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
45
45
|
export declare const RECEIPT_HEADER = "x-village-receipt";
|
|
46
|
-
/** @deprecated Import it from "
|
|
46
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
47
47
|
export declare const readIncoming: typeof V.readIncoming;
|
|
48
|
-
/** @deprecated Import it from "
|
|
48
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
49
49
|
export declare const verifyCallReceipt: typeof V.verifyCallReceipt;
|
|
50
|
-
/** @deprecated Import it from "
|
|
50
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
51
51
|
export declare const verifyCheckoutReceiptToken: typeof V.verifyCheckoutReceiptToken;
|
|
52
|
-
/** @deprecated Import it from "
|
|
52
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
53
53
|
export declare const defineCompany: typeof V.defineCompany;
|
|
54
|
-
/** @deprecated Import it from "
|
|
54
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
55
55
|
export declare const offering: typeof V.offering;
|
|
56
|
-
/** @deprecated Import it from "
|
|
56
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
57
57
|
export declare const DEFAULT_VILLAGE_API_URL = "https://hackaton.ambasada.id";
|
|
58
|
-
/** @deprecated Import it from "
|
|
58
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
59
59
|
export type VillageOptions = V.VillageOptions;
|
|
60
|
-
/** @deprecated Import it from "
|
|
60
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
61
61
|
export type VerifyReceiptOptions = V.VerifyReceiptOptions;
|
|
62
|
-
/** @deprecated Import it from "
|
|
62
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
63
63
|
export type SellHandler<Input, Output> = V.SellHandler<Input, Output>;
|
|
64
|
-
/** @deprecated Import it from "
|
|
64
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
65
65
|
export type ReceiptFailure = V.ReceiptFailure;
|
|
66
|
-
/** @deprecated Import it from "
|
|
66
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
67
67
|
export type IncomingRequest = V.IncomingRequest;
|
|
68
|
-
/** @deprecated Import it from "
|
|
68
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
69
69
|
export type CompanyConfig = V.CompanyConfig;
|
|
70
|
-
/** @deprecated Import it from "
|
|
70
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
71
71
|
export type OfferingDef = V.OfferingDef;
|
|
72
|
-
/** @deprecated Import it from "
|
|
72
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
73
73
|
export type ReceiptClaims = V.ReceiptClaims;
|
|
74
|
-
/** @deprecated Import it from "
|
|
74
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
75
75
|
export type PaidCall<Input = any> = V.PaidCall<Input>;
|
|
76
|
-
/** @deprecated Import it from "
|
|
76
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
77
77
|
export type CheckoutReceiptClaims = V.CheckoutReceiptClaims;
|
|
78
|
-
/** @deprecated Import it from "
|
|
78
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
79
79
|
export type CheckoutInput = V.CheckoutInput;
|
|
80
|
-
/** @deprecated Import it from "
|
|
80
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
81
81
|
export type CheckoutSession = V.CheckoutSession;
|
|
82
|
-
/** @deprecated Import it from "
|
|
82
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
83
83
|
export type PaymentLinkInput = V.PaymentLinkInput;
|
|
84
|
-
/** @deprecated Import it from "
|
|
84
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
85
85
|
export type PaymentLink = V.PaymentLink;
|
|
86
|
-
/** @deprecated Import it from "
|
|
86
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
87
87
|
export type WebhookDelivery = V.WebhookDelivery;
|
|
88
|
-
/** @deprecated Import it from "
|
|
88
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
89
89
|
export type WebhookEvent<Data = any> = V.WebhookEvent<Data>;
|
|
90
|
-
/** @deprecated Import it from "
|
|
90
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
91
91
|
export type BuyOptions = V.BuyOptions;
|
|
92
|
-
/** @deprecated Import it from "
|
|
92
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
93
93
|
export type BuyResult<Output = any> = V.BuyResult<Output>;
|
|
94
|
-
/** @deprecated Import it from "
|
|
94
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
95
95
|
export type ChatModel = V.ChatModel;
|
|
96
|
-
/** @deprecated Import it from "
|
|
96
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
97
97
|
export type ChatMessage = V.ChatMessage;
|
|
98
|
-
/** @deprecated Import it from "
|
|
98
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
99
99
|
export type ChatRequest = V.ChatRequest;
|
|
100
|
-
/** @deprecated Import it from "
|
|
100
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
101
101
|
export type ChatResponse = V.ChatResponse;
|
|
102
|
-
/** @deprecated Import it from "
|
|
102
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
103
103
|
export type ImageRequest = V.ImageRequest;
|
|
104
|
-
/** @deprecated Import it from "
|
|
104
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
105
105
|
export type ImageResult = V.ImageResult;
|
|
106
|
-
/** @deprecated Import it from "
|
|
106
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
107
107
|
export type ToolListing = V.ToolListing;
|
|
108
|
-
/** @deprecated Import it from "
|
|
108
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
109
109
|
export type ToolResult<Output = any> = V.ToolResult<Output>;
|
|
110
|
-
/** @deprecated Import it from "
|
|
110
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
111
111
|
export type FieldSchema = V.FieldSchema;
|
|
112
|
-
/** @deprecated Import it from "
|
|
112
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
113
113
|
export type ListingInput = V.ListingInput;
|
|
114
|
-
/** @deprecated Import it from "
|
|
114
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
115
115
|
export type Listing = V.Listing;
|
|
116
|
-
/** @deprecated Import it from "
|
|
116
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
117
117
|
export type Wallet = V.Wallet;
|
|
118
|
-
/** @deprecated Import it from "
|
|
118
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
119
119
|
export type LedgerEntry = V.LedgerEntry;
|
|
120
|
-
/** @deprecated Import it from "
|
|
120
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
121
121
|
export type LedgerPage = V.LedgerPage;
|
|
122
|
-
/** @deprecated Import it from "
|
|
122
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
123
123
|
export type TransferOptions = V.TransferOptions;
|
|
124
|
-
/** @deprecated Import it from "
|
|
124
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
125
125
|
export type AgentSettings = V.AgentSettings;
|
|
126
|
-
/** @deprecated Import it from "
|
|
126
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
127
127
|
export type AgentConfigInput = V.AgentConfigInput;
|
|
128
|
-
/** @deprecated Import it from "
|
|
128
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
129
129
|
export type TranscriptEntry = V.TranscriptEntry;
|
|
130
|
-
/** @deprecated Import it from "
|
|
130
|
+
/** @deprecated Import it from "@ambasada/village" (removed in 2.0). */
|
|
131
131
|
export type MarketOffering = V.MarketOffering;
|