@ambasada/sdk 0.7.5 → 0.8.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/index.d.ts CHANGED
@@ -1,28 +1,131 @@
1
1
  /**
2
- * @ambasada/sdk: accept and spend TON in the Hack A Ton village.
2
+ * @ambasada/sdk: the Ambasada platform client. Sign-in, mini-app notifications, the project store, files.
3
3
  *
4
- * import { village } from "@ambasada/sdk"; // AMBASADA_API_KEY, AMBASADA_API_URL from the env
5
- * const { url } = await village.checkout({ amount: 3, description: "Coffee", success_url });
6
- * export const POST = village.sell("translate", async ({ text, to }) => ({ text: await village.llm(`Translate to ${to}: ${text}`) }));
7
- * const user = await village.auth.user(req); // Sign in with Ambasada (docs/AUTH.md)
8
- * await village.apps.notify({ notification_id, title, body, url, tokens }); // mini-app pushes (docs/MINI-APPS.md §7)
4
+ * import { ambasada } from "@ambasada/sdk"; // AMBASADA_API_KEY, AMBASADA_API_URL from the env
5
+ * const user = await ambasada.auth.user(req); // Sign in with Ambasada (docs/AUTH.md)
6
+ * await ambasada.apps.notify({ notification_id, title, body, url, users }); // mini-app pushes (docs/MINI-APPS.md §7)
7
+ * await ambasada.store.put("settings", { theme: "dark" });
9
8
  *
10
9
  * Works in Node ≥ 22, Bun, Cloudflare Workers (`createAmbasada({ env })`) and Next.js route handlers.
10
+ * The Hack A Ton economy (TON, checkout, offerings, the agent) is the add-on `@ambasada/village`.
11
11
  */
12
- import { Village } from "./client.js";
13
- export { Village, createAmbasada, DEFAULT_API_URL, DEFAULT_MODEL } from "./client.js";
14
- export type { VillageOptions, VerifyReceiptOptions, SellHandler } from "./client.js";
15
- export * from "./errors.js";
16
- export type * from "./types.js";
17
- export { verifyWebhookPayload, webhookHeaders, generateWebhookSecret, WEBHOOK_HEADERS } from "./webhook.js";
18
- export { RECEIPT_HEADER, readIncoming, verifyCallReceipt, verifyCheckoutReceiptToken } from "./receipt.js";
19
- export type { IncomingRequest } from "./receipt.js";
20
- export { defineCompany, offering } from "./define.js";
21
- export { AmbasadaAuth, AUTH_PATHS, JWKS_TTL_MS, SESSION_TTL_S } from "./auth.js";
22
- export type { AmbasadaUser, AuthConfig, LoginOptions, ShellUser, WithHeaders } from "./auth.js";
23
- export { AmbasadaApps, APP_SIGNATURE_HEADER, APP_TIMESTAMP_HEADER, appWebhookHeaders, signAppWebhook } from "./apps.js";
24
- export type { AppEvent, AppEventType, AppNotifyInput, AppNotifyResult, AppsConfig, NotificationCategory, WebhookInput } from "./apps.js";
25
- export type { CompanyConfig, OfferingDef } from "./define.js";
26
- /** The default client, configured from the environment at call time. */
27
- export declare const village: Village;
28
- export default village;
12
+ import * as V from "./village/index.js";
13
+ export * from "./platform.js";
14
+ export { default } from "./platform.js";
15
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
16
+ export declare const village: V.Village;
17
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
18
+ export declare const createVillage: typeof V.createVillage;
19
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
20
+ export declare const Village: typeof V.Village;
21
+ export type Village = V.Village;
22
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
23
+ export declare const VillageError: typeof V.AmbasadaError;
24
+ export type VillageError = V.VillageError;
25
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
26
+ export declare const isVillageError: typeof V.isAmbasadaError;
27
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
28
+ export declare const ReceiptInvalidError: typeof V.ReceiptInvalidError;
29
+ export type ReceiptInvalidError = V.ReceiptInvalidError;
30
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
31
+ export declare const DEFAULT_MODEL = "deepseek-v4.1-flash";
32
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
33
+ export declare const verifyWebhookPayload: typeof V.verifyWebhookPayload;
34
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
35
+ export declare const webhookHeaders: (secret: string, id: string, timestamp: number, body: string) => Promise<Record<string, string>>;
36
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
37
+ export declare const generateWebhookSecret: () => string;
38
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
39
+ export declare const WEBHOOK_HEADERS: {
40
+ readonly id: "webhook-id";
41
+ readonly timestamp: "webhook-timestamp";
42
+ readonly signature: "webhook-signature";
43
+ };
44
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
45
+ export declare const RECEIPT_HEADER = "x-village-receipt";
46
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
47
+ export declare const readIncoming: typeof V.readIncoming;
48
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
49
+ export declare const verifyCallReceipt: typeof V.verifyCallReceipt;
50
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
51
+ export declare const verifyCheckoutReceiptToken: typeof V.verifyCheckoutReceiptToken;
52
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
53
+ export declare const defineCompany: typeof V.defineCompany;
54
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
55
+ export declare const offering: typeof V.offering;
56
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
57
+ export declare const DEFAULT_VILLAGE_API_URL = "https://hackaton.ambasada.id";
58
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
59
+ export type VillageOptions = V.VillageOptions;
60
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
61
+ export type VerifyReceiptOptions = V.VerifyReceiptOptions;
62
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
63
+ export type SellHandler<Input, Output> = V.SellHandler<Input, Output>;
64
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
65
+ export type ReceiptFailure = V.ReceiptFailure;
66
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
67
+ export type IncomingRequest = V.IncomingRequest;
68
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
69
+ export type CompanyConfig = V.CompanyConfig;
70
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
71
+ export type OfferingDef = V.OfferingDef;
72
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
73
+ export type ReceiptClaims = V.ReceiptClaims;
74
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
75
+ export type PaidCall<Input = any> = V.PaidCall<Input>;
76
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
77
+ export type CheckoutReceiptClaims = V.CheckoutReceiptClaims;
78
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
79
+ export type CheckoutInput = V.CheckoutInput;
80
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
81
+ export type CheckoutSession = V.CheckoutSession;
82
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
83
+ export type PaymentLinkInput = V.PaymentLinkInput;
84
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
85
+ export type PaymentLink = V.PaymentLink;
86
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
87
+ export type WebhookDelivery = V.WebhookDelivery;
88
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
89
+ export type WebhookEvent<Data = any> = V.WebhookEvent<Data>;
90
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
91
+ export type BuyOptions = V.BuyOptions;
92
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
93
+ export type BuyResult<Output = any> = V.BuyResult<Output>;
94
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
95
+ export type ChatModel = V.ChatModel;
96
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
97
+ export type ChatMessage = V.ChatMessage;
98
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
99
+ export type ChatRequest = V.ChatRequest;
100
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
101
+ export type ChatResponse = V.ChatResponse;
102
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
103
+ export type ImageRequest = V.ImageRequest;
104
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
105
+ export type ImageResult = V.ImageResult;
106
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
107
+ export type ToolListing = V.ToolListing;
108
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
109
+ export type ToolResult<Output = any> = V.ToolResult<Output>;
110
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
111
+ export type FieldSchema = V.FieldSchema;
112
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
113
+ export type ListingInput = V.ListingInput;
114
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
115
+ export type Listing = V.Listing;
116
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
117
+ export type Wallet = V.Wallet;
118
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
119
+ export type LedgerEntry = V.LedgerEntry;
120
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
121
+ export type LedgerPage = V.LedgerPage;
122
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
123
+ export type TransferOptions = V.TransferOptions;
124
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
125
+ export type AgentSettings = V.AgentSettings;
126
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
127
+ export type AgentConfigInput = V.AgentConfigInput;
128
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
129
+ export type TranscriptEntry = V.TranscriptEntry;
130
+ /** @deprecated Import it from "./village/index.js" (removed in 2.0). */
131
+ export type MarketOffering = V.MarketOffering;