@ambasada/village 0.8.0 → 0.8.2
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/cli.mjs +11 -11
- package/dist/client.d.ts +1 -1
- package/dist/define.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -678
- package/dist/receipt.d.ts +1 -1
- package/dist/webhook.d.ts +1 -1
- package/package.json +5 -3
- package/dist/sdk/apps.d.ts +0 -110
- package/dist/sdk/auth.d.ts +0 -132
- package/dist/sdk/client.d.ts +0 -106
- package/dist/sdk/define.d.ts +0 -19
- package/dist/sdk/errors.d.ts +0 -94
- package/dist/sdk/headers.d.ts +0 -3
- package/dist/sdk/platform.d.ts +0 -20
- package/dist/sdk/types.d.ts +0 -40
package/dist/cli.mjs
CHANGED
|
@@ -150,7 +150,7 @@ export default async function receipt(req: Request, env: Env): Promise<Response>
|
|
|
150
150
|
</html>
|
|
151
151
|
` } };
|
|
152
152
|
|
|
153
|
-
//
|
|
153
|
+
// src/cli.ts
|
|
154
154
|
import { existsSync as existsSync2 } from "node:fs";
|
|
155
155
|
import { readFile } from "node:fs/promises";
|
|
156
156
|
import { join as join2 } from "node:path";
|
|
@@ -2200,7 +2200,7 @@ function getHeader(headers, name) {
|
|
|
2200
2200
|
// ../sdk/src/platform.ts
|
|
2201
2201
|
var ambasada = new Ambasada();
|
|
2202
2202
|
|
|
2203
|
-
//
|
|
2203
|
+
// src/errors.ts
|
|
2204
2204
|
var isVillageError = isAmbasadaError;
|
|
2205
2205
|
var ReceiptInvalidError = class extends AmbasadaError {
|
|
2206
2206
|
reason;
|
|
@@ -2211,7 +2211,7 @@ var ReceiptInvalidError = class extends AmbasadaError {
|
|
|
2211
2211
|
}
|
|
2212
2212
|
};
|
|
2213
2213
|
|
|
2214
|
-
//
|
|
2214
|
+
// src/receipt.ts
|
|
2215
2215
|
var RECEIPT_HEADER2 = "x-village-receipt";
|
|
2216
2216
|
async function readIncoming(req) {
|
|
2217
2217
|
if (typeof req.clone === "function" && typeof req.arrayBuffer === "function") {
|
|
@@ -2296,7 +2296,7 @@ function concat(chunks) {
|
|
|
2296
2296
|
return out;
|
|
2297
2297
|
}
|
|
2298
2298
|
|
|
2299
|
-
//
|
|
2299
|
+
// src/webhook.ts
|
|
2300
2300
|
var { WebhookError: WebhookError2, verifyWebhook: verifyProtocolWebhook } = src_exports;
|
|
2301
2301
|
var generateWebhookSecret2 = generateWebhookSecret;
|
|
2302
2302
|
var webhookHeaders2 = webhookHeaders;
|
|
@@ -2323,7 +2323,7 @@ async function verifyWebhookPayload(secret, headers, body, options = {}) {
|
|
|
2323
2323
|
return { id: plain["webhook-id"], type: String(parsed.type), timestamp: String(parsed.timestamp ?? ""), data: parsed.data };
|
|
2324
2324
|
}
|
|
2325
2325
|
|
|
2326
|
-
//
|
|
2326
|
+
// src/client.ts
|
|
2327
2327
|
var DEFAULT_VILLAGE_API_URL = "https://hackaton.ambasada.id";
|
|
2328
2328
|
var DEFAULT_MODEL = "deepseek-v4.1-flash";
|
|
2329
2329
|
function randomKey() {
|
|
@@ -2596,10 +2596,10 @@ function createVillage(options = {}) {
|
|
|
2596
2596
|
return new Village(options);
|
|
2597
2597
|
}
|
|
2598
2598
|
|
|
2599
|
-
//
|
|
2599
|
+
// src/index.ts
|
|
2600
2600
|
var village = new Village();
|
|
2601
2601
|
|
|
2602
|
-
//
|
|
2602
|
+
// src/mock/pages.ts
|
|
2603
2603
|
var esc = (v) => String(v ?? "").replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
|
|
2604
2604
|
var STYLE = `<style>
|
|
2605
2605
|
body{font-family:system-ui,sans-serif;max-width:56rem;margin:2rem auto;padding:0 1rem;color:#111;background:#fafaf7}
|
|
@@ -2648,7 +2648,7 @@ function popupResult(origin, message, fallback) {
|
|
|
2648
2648
|
</script>`;
|
|
2649
2649
|
}
|
|
2650
2650
|
|
|
2651
|
-
//
|
|
2651
|
+
// src/mock/pay-js.ts
|
|
2652
2652
|
import { readFileSync } from "node:fs";
|
|
2653
2653
|
import { fileURLToPath } from "node:url";
|
|
2654
2654
|
var cached;
|
|
@@ -2658,7 +2658,7 @@ function payJs() {
|
|
|
2658
2658
|
return cached;
|
|
2659
2659
|
}
|
|
2660
2660
|
|
|
2661
|
-
//
|
|
2661
|
+
// src/mock/bank.ts
|
|
2662
2662
|
var DEV_KEY = "sk_test_dev";
|
|
2663
2663
|
var AGENT_KEY = "sk_test_agent";
|
|
2664
2664
|
var FAKE_AGENT = "fake-agent";
|
|
@@ -3362,7 +3362,7 @@ ${key}`, s.id);
|
|
|
3362
3362
|
};
|
|
3363
3363
|
}
|
|
3364
3364
|
|
|
3365
|
-
//
|
|
3365
|
+
// src/overlay.ts
|
|
3366
3366
|
import { existsSync, readdirSync, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
3367
3367
|
import { join, relative } from "node:path";
|
|
3368
3368
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -3418,7 +3418,7 @@ ${head}`;
|
|
|
3418
3418
|
`;
|
|
3419
3419
|
}
|
|
3420
3420
|
|
|
3421
|
-
//
|
|
3421
|
+
// src/cli.ts
|
|
3422
3422
|
var OLD_NAMES = ["wallet", "ledger", "offerings", "market", "steer", "webhook", "links"];
|
|
3423
3423
|
var HELP = ` wallet | ledger [--since N] your company's TON
|
|
3424
3424
|
offerings sync | list offerings.ts \u2192 the market
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ambasada, type AmbasadaOptions } from "
|
|
1
|
+
import { Ambasada, type AmbasadaOptions } from "@ambasada/sdk/platform";
|
|
2
2
|
import { type IncomingRequest } from "./receipt.js";
|
|
3
3
|
import type { AgentConfigInput, BuyOptions, BuyResult, ChatRequest, ChatResponse, CheckoutInput, CheckoutReceiptClaims, CheckoutSession, ImageRequest, ImageResult, LedgerPage, Listing, ListingInput, MarketOffering, PaidCall, PaymentLink, PaymentLinkInput, ToolListing, ToolResult, TranscriptEntry, TransferOptions, Wallet, WebhookDelivery, WebhookEvent } from "./types.js";
|
|
4
4
|
/** The Hack A Ton API. The platform API (`@ambasada/sdk`) is https://api.ambasada.dev. */
|
package/dist/define.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* export default defineCompany(defineApp({ id, name, product }), { idea, offerings, agent });
|
|
6
6
|
*/
|
|
7
|
-
import type { AppConfig } from "
|
|
7
|
+
import type { AppConfig } from "@ambasada/sdk/platform";
|
|
8
8
|
import type { FieldSchema } from "./types.js";
|
|
9
9
|
export interface VillageConfig {
|
|
10
10
|
/** Locked Fri 20:00. */
|
package/dist/errors.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* try { await village.buy("inkwell/poem", input, { maxPrice: 2 }) }
|
|
6
6
|
* catch (e) { if (isVillageError(e, "PRICE_ABOVE_MAX")) … }
|
|
7
7
|
*/
|
|
8
|
-
import { AmbasadaError, isAmbasadaError } from "
|
|
8
|
+
import { AmbasadaError, isAmbasadaError } from "@ambasada/sdk/platform";
|
|
9
9
|
/** `AmbasadaError` under its 0.7 name. */
|
|
10
10
|
export declare const VillageError: typeof AmbasadaError;
|
|
11
11
|
export type VillageError = AmbasadaError;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export { RECEIPT_HEADER, readIncoming, verifyCallReceipt, verifyCheckoutReceiptT
|
|
|
20
20
|
export type { IncomingRequest } from "./receipt.js";
|
|
21
21
|
export { defineCompany, offering } from "./define.js";
|
|
22
22
|
export type { CompanyConfig, OfferingDef, VillageConfig } from "./define.js";
|
|
23
|
-
export { Ambasada, AmbasadaError, isAmbasadaError, defineApp, ERROR_STATUS, WebhookInvalidError } from "
|
|
24
|
-
export type { AmbasadaUser, AppConfig, ErrorCode, ErrorDetails, Jwk, StoredFile, StoreList, StoreWrite, WebhookFailure } from "
|
|
23
|
+
export { Ambasada, AmbasadaError, isAmbasadaError, defineApp, ERROR_STATUS, WebhookInvalidError } from "@ambasada/sdk/platform";
|
|
24
|
+
export type { AmbasadaUser, AppConfig, ErrorCode, ErrorDetails, Jwk, StoredFile, StoreList, StoreWrite, WebhookFailure } from "@ambasada/sdk/platform";
|
|
25
25
|
/** The default client, configured from the environment at call time. */
|
|
26
26
|
export declare const village: Village;
|
|
27
27
|
export default village;
|