@receiz/sdk 97.0.0 → 97.1.0
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 +64 -5
- package/dist/cli.js +106 -2
- package/dist/index.d.ts +322 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +520 -13
- package/docs/app-runtime-commerce-cloud.md +127 -0
- package/docs/app-state-public-projections.md +82 -7
- package/docs/cli-and-conformance.md +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -205,27 +205,86 @@ Receiz apps can publish durable public app-state projections without adding Supa
|
|
|
205
205
|
import {
|
|
206
206
|
RECEIZ_PUBLIC_STORE_STATE_PROJECTION_SCHEMA,
|
|
207
207
|
createReceizClient,
|
|
208
|
+
createReceizPublicStoreStateRecord,
|
|
208
209
|
} from "@receiz/sdk";
|
|
209
210
|
|
|
210
211
|
const receiz = createReceizClient({ accessToken });
|
|
211
212
|
|
|
212
|
-
await receiz.appState.publishRecord({
|
|
213
|
+
await receiz.appState.publishRecord(createReceizPublicStoreStateRecord({
|
|
213
214
|
sourceUrl: "bjklock.receiz.app",
|
|
214
215
|
externalCreatorId: "bjklock.receiz.id",
|
|
215
216
|
title: "BJ Klock storefront",
|
|
216
|
-
platform: "Receiz.app Commerce Cloud",
|
|
217
|
-
schema: RECEIZ_PUBLIC_STORE_STATE_PROJECTION_SCHEMA,
|
|
218
217
|
data: { storeStateRecord },
|
|
218
|
+
}));
|
|
219
|
+
|
|
220
|
+
const restored = await createReceizClient().appState.restoreByHost<{
|
|
221
|
+
storeStateRecord: StoreStateRecord;
|
|
222
|
+
}>("bjklock.receiz.app", {
|
|
223
|
+
schema: RECEIZ_PUBLIC_STORE_STATE_PROJECTION_SCHEMA,
|
|
224
|
+
state: "published",
|
|
225
|
+
requiredDataKey: "storeStateRecord",
|
|
219
226
|
});
|
|
220
227
|
|
|
221
|
-
|
|
222
|
-
renderStorefront(restored.record?.data?.storeStateRecord);
|
|
228
|
+
if (restored.ok && restored.data) renderStorefront(restored.data.storeStateRecord);
|
|
223
229
|
```
|
|
224
230
|
|
|
225
231
|
`receiz.appState.publish(feed)` remains available for batch writes. `receiz.publicProof.registryFeed(feed)` remains available and aliases the same publish path for existing integrations.
|
|
232
|
+
Raw reads remain available through `byUrl()`, `byHost()`, `byCreator()`, `byNamespace()`, and `byId()` when an app needs the full public projection envelope instead of direct restored data.
|
|
226
233
|
|
|
227
234
|
Full quickstart: `docs/app-state-public-projections.md`.
|
|
228
235
|
|
|
236
|
+
## Receiz App Runtime Rails
|
|
237
|
+
|
|
238
|
+
`@receiz/sdk@97.1.0` adds typed rails for Commerce Cloud style apps. These helpers compose existing Receiz primitives; they do not replace proof objects, local proof memory, Connect, or the public app-state projection rail.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { createReceizClient } from "@receiz/sdk";
|
|
242
|
+
|
|
243
|
+
const receiz = createReceizClient({ accessToken });
|
|
244
|
+
|
|
245
|
+
const doctor = await receiz.doctor({
|
|
246
|
+
tenantHost: "bjklock.receiz.app",
|
|
247
|
+
callbackUrl: "https://bjklock.receiz.app/api/auth/receiz/callback",
|
|
248
|
+
scopes: ["openid", "profile", "receiz:record", "receiz:wallet.read"],
|
|
249
|
+
});
|
|
250
|
+
if (!doctor.ok) console.table(doctor.fixes);
|
|
251
|
+
|
|
252
|
+
const caps = await receiz.capabilities({ tenantHost: "bjklock.receiz.app" });
|
|
253
|
+
if (caps.capabilities.commerce.available) {
|
|
254
|
+
await receiz.commerce.oneClickCheckout({
|
|
255
|
+
tenantHost: "bjklock.receiz.app",
|
|
256
|
+
orderId: "order_123",
|
|
257
|
+
amountUsd: "42.00",
|
|
258
|
+
walletFirst: true,
|
|
259
|
+
cardFallback: true,
|
|
260
|
+
idempotencyKey: "order_123",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
await receiz.appState.publish({
|
|
265
|
+
tenantHost: "bjklock.receiz.app",
|
|
266
|
+
creatorReceizId: "bjklock.receiz.id",
|
|
267
|
+
title: "BJ Klock storefront",
|
|
268
|
+
state: { storeStateRecord },
|
|
269
|
+
idempotencyKey: "storefront_state_1",
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const restored = await createReceizClient().appState.resolve({
|
|
273
|
+
host: "bjklock.receiz.app",
|
|
274
|
+
requiredDataKey: "storeStateRecord",
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Additional typed surfaces:
|
|
279
|
+
|
|
280
|
+
- `receiz.media.upload(file, { tenantHost, purpose, idempotencyKey })`
|
|
281
|
+
- `receiz.domains.normalizeHost()`, `tenantUrl()`, `namespace()`, `objectId()`, `resolveTenant()`
|
|
282
|
+
- `receiz.events.subscribe({ tenantHost, types, webhookUrl, idempotencyKey })`
|
|
283
|
+
- `receiz.proof.query({ namespace, tenantHost, type, customerReceizId })`
|
|
284
|
+
- `receiz.jobs.enqueue({ tenantHost, kind, payload, idempotencyKey })`
|
|
285
|
+
- `receiz.sandbox.seedStore()`, `sandbox.wallet()`, `sandbox.checkout()`
|
|
286
|
+
- CLI: `receiz doctor`, `receiz dev`, `receiz deploy-check`, `receiz seed-store`, `receiz simulate-checkout`
|
|
287
|
+
|
|
229
288
|
## Sports Card And Event Proof Integration
|
|
230
289
|
|
|
231
290
|
```ts
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { assertReceizAssetManifest, assertReceizProofRegisterSnapshot, assertReceizSportsCardManifest, assertReceizWebhookEvent, createReceizInMemoryProofMemoryStorage, createReceizProofMemory, projectReceizAssetManifest, projectReceizSportsCardManifest, receizProofMemoryAdditionsQuery, } from "./index.js";
|
|
5
|
+
import { RECEIZ_SDK_VERSION, assertReceizAssetManifest, assertReceizProofRegisterSnapshot, assertReceizSportsCardManifest, assertReceizWebhookEvent, createReceizClient, createReceizInMemoryProofMemoryStorage, createReceizProofMemory, projectReceizAssetManifest, projectReceizSportsCardManifest, receizProofMemoryAdditionsQuery, } from "./index.js";
|
|
6
6
|
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const packageRoot = moduleDir.endsWith(`${join("packages", "receiz-sdk", "dist")}`)
|
|
8
8
|
? dirname(moduleDir)
|
|
@@ -19,6 +19,27 @@ function printError(error, detail) {
|
|
|
19
19
|
function readJsonFile(path) {
|
|
20
20
|
return JSON.parse(readFileSync(resolve(path), "utf8"));
|
|
21
21
|
}
|
|
22
|
+
function optionValue(args, name) {
|
|
23
|
+
const index = args.indexOf(name);
|
|
24
|
+
if (index < 0)
|
|
25
|
+
return undefined;
|
|
26
|
+
const value = args[index + 1];
|
|
27
|
+
return value && !value.startsWith("--") ? value : undefined;
|
|
28
|
+
}
|
|
29
|
+
function optionNumber(args, name, fallback) {
|
|
30
|
+
const value = optionValue(args, name);
|
|
31
|
+
if (!value)
|
|
32
|
+
return fallback;
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
35
|
+
}
|
|
36
|
+
function optionScopes(args) {
|
|
37
|
+
const raw = optionValue(args, "--scopes") ?? optionValue(args, "--scope") ?? "";
|
|
38
|
+
return raw
|
|
39
|
+
.split(/[,\s]+/)
|
|
40
|
+
.map((scope) => scope.trim())
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
}
|
|
22
43
|
async function inspectProofObject(path) {
|
|
23
44
|
const value = readJsonFile(path);
|
|
24
45
|
const storage = createReceizInMemoryProofMemoryStorage();
|
|
@@ -188,9 +209,14 @@ Usage:
|
|
|
188
209
|
receiz inspect <path-to-proof-json>
|
|
189
210
|
receiz conformance
|
|
190
211
|
receiz init <target-dir>
|
|
212
|
+
receiz doctor --tenant-host <host> [--access-token <token>] [--callback-url <url>] [--scopes <csv>]
|
|
213
|
+
receiz dev
|
|
214
|
+
receiz deploy-check --tenant-host <host>
|
|
215
|
+
receiz seed-store --tenant-host <host> [--products <count>]
|
|
216
|
+
receiz simulate-checkout --amount-usd <amount>
|
|
191
217
|
|
|
192
218
|
This CLI uses local Receiz SDK validators, projections, and durable proof memory.
|
|
193
|
-
It does not make network or database calls for inspect or
|
|
219
|
+
It does not make network or database calls for inspect, conformance, doctor, deploy-check, seed-store, or simulate-checkout.
|
|
194
220
|
`);
|
|
195
221
|
}
|
|
196
222
|
async function main(argv) {
|
|
@@ -229,6 +255,84 @@ async function main(argv) {
|
|
|
229
255
|
});
|
|
230
256
|
return;
|
|
231
257
|
}
|
|
258
|
+
if (command === "doctor") {
|
|
259
|
+
const clientOptions = {};
|
|
260
|
+
const accessToken = optionValue(args, "--access-token");
|
|
261
|
+
const baseUrl = optionValue(args, "--base-url");
|
|
262
|
+
if (accessToken)
|
|
263
|
+
clientOptions.accessToken = accessToken;
|
|
264
|
+
if (baseUrl)
|
|
265
|
+
clientOptions.baseUrl = baseUrl;
|
|
266
|
+
const client = createReceizClient(clientOptions);
|
|
267
|
+
const doctorOptions = {};
|
|
268
|
+
const tenantHost = optionValue(args, "--tenant-host");
|
|
269
|
+
const callbackUrl = optionValue(args, "--callback-url");
|
|
270
|
+
const scopes = optionScopes(args);
|
|
271
|
+
if (tenantHost)
|
|
272
|
+
doctorOptions.tenantHost = tenantHost;
|
|
273
|
+
if (callbackUrl)
|
|
274
|
+
doctorOptions.callbackUrl = callbackUrl;
|
|
275
|
+
if (scopes.length > 0)
|
|
276
|
+
doctorOptions.scopes = scopes;
|
|
277
|
+
const report = await client.doctor(doctorOptions);
|
|
278
|
+
printJson({
|
|
279
|
+
...report,
|
|
280
|
+
schema: "receiz.sdk.cli.doctor.v1",
|
|
281
|
+
sdkVersion: RECEIZ_SDK_VERSION,
|
|
282
|
+
});
|
|
283
|
+
if (!report.ok)
|
|
284
|
+
process.exitCode = 1;
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (command === "dev") {
|
|
288
|
+
printJson({
|
|
289
|
+
ok: true,
|
|
290
|
+
schema: "receiz.sdk.cli.dev.v1",
|
|
291
|
+
sdkVersion: RECEIZ_SDK_VERSION,
|
|
292
|
+
networkCalls: 0,
|
|
293
|
+
dbCalls: 0,
|
|
294
|
+
message: "Use the SDK sandbox helpers for deterministic local Receiz IDs, app state, wallet balances, checkout outcomes, webhooks, and proof objects.",
|
|
295
|
+
commands: ["receiz seed-store", "receiz simulate-checkout", "receiz doctor", "receiz inspect"],
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (command === "deploy-check") {
|
|
300
|
+
const tenantHost = optionValue(args, "--tenant-host");
|
|
301
|
+
const checks = [
|
|
302
|
+
{ code: "tenant_host_present", ok: Boolean(tenantHost), message: "tenantHost scopes app-state, domains, commerce, permissions, search, and jobs." },
|
|
303
|
+
{ code: "sdk_version_pinned", ok: true, message: `@receiz/sdk ${RECEIZ_SDK_VERSION}` },
|
|
304
|
+
{ code: "network_authority_required", ok: false, level: "info", message: "Deploy check is local. Production route availability is verified by receiz.doctor() and app capability probes." },
|
|
305
|
+
];
|
|
306
|
+
printJson({
|
|
307
|
+
ok: checks.every((check) => check.ok || check.level === "info"),
|
|
308
|
+
schema: "receiz.sdk.cli.deploy_check.v1",
|
|
309
|
+
tenantHost: tenantHost ?? null,
|
|
310
|
+
checks,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (command === "seed-store") {
|
|
315
|
+
const tenantHost = optionValue(args, "--tenant-host");
|
|
316
|
+
if (!tenantHost) {
|
|
317
|
+
printError("missing_tenant_host", "Usage: receiz seed-store --tenant-host <host> [--products <count>]");
|
|
318
|
+
process.exitCode = 1;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const client = createReceizClient();
|
|
322
|
+
printJson(client.sandbox.seedStore({ tenantHost, products: optionNumber(args, "--products", 3) }));
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (command === "simulate-checkout") {
|
|
326
|
+
const amountUsd = optionValue(args, "--amount-usd");
|
|
327
|
+
if (!amountUsd) {
|
|
328
|
+
printError("missing_amount_usd", "Usage: receiz simulate-checkout --amount-usd <amount>");
|
|
329
|
+
process.exitCode = 1;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const client = createReceizClient();
|
|
333
|
+
printJson(client.sandbox.checkout({ amountUsd, outcome: optionValue(args, "--outcome") === "failure" ? "failure" : "success" }));
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
232
336
|
printError("unknown_command", command);
|
|
233
337
|
process.exitCode = 1;
|
|
234
338
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildReceizIdContinueRequest, createReceizIdIdentity, projectReceizIdentityAccount, readReceizIdentityArtifact, signReceizIdentityLoginProof, verifyReceizIdentityLoginProof, type ReceizDeviceIdentity, type ReceizIdContinueOptions } from "./identity.js";
|
|
2
2
|
export * from "./identity.js";
|
|
3
|
-
export declare const RECEIZ_SDK_VERSION = "97.
|
|
3
|
+
export declare const RECEIZ_SDK_VERSION = "97.1.0";
|
|
4
4
|
export declare const RECEIZ_DEFAULT_BASE_URL = "https://receiz.com";
|
|
5
5
|
export declare const RECEIZ_WEBHOOK_SIGNATURE_HEADER = "x-receiz-signature";
|
|
6
6
|
export declare const RECEIZ_WEBHOOK_TIMESTAMP_HEADER = "x-receiz-timestamp";
|
|
@@ -95,7 +95,7 @@ export type DocumentSealResponseMetadata = {
|
|
|
95
95
|
proofBundle?: ReceizProofBundle | null;
|
|
96
96
|
[key: string]: unknown;
|
|
97
97
|
};
|
|
98
|
-
export type PublicProofRecord = {
|
|
98
|
+
export type PublicProofRecord<TData extends JsonObject = JsonObject> = {
|
|
99
99
|
ok?: boolean;
|
|
100
100
|
id?: string;
|
|
101
101
|
sourceUrl?: string;
|
|
@@ -106,7 +106,7 @@ export type PublicProofRecord = {
|
|
|
106
106
|
appObjectId?: string | null;
|
|
107
107
|
createdAt?: string;
|
|
108
108
|
record?: JsonObject | null;
|
|
109
|
-
data?:
|
|
109
|
+
data?: TData | null;
|
|
110
110
|
proof?: JsonObject | null;
|
|
111
111
|
[key: string]: unknown;
|
|
112
112
|
};
|
|
@@ -122,14 +122,14 @@ export type PublicProofRegistryFeed = {
|
|
|
122
122
|
signature?: string;
|
|
123
123
|
[key: string]: unknown;
|
|
124
124
|
};
|
|
125
|
-
export type ReceizPublicProjectionRecord = PublicProofRecord & {
|
|
125
|
+
export type ReceizPublicProjectionRecord<TData extends JsonObject = JsonObject> = PublicProofRecord<TData> & {
|
|
126
126
|
schema?: string | null;
|
|
127
127
|
state?: string | null;
|
|
128
128
|
platform?: string | null;
|
|
129
129
|
appNamespace?: string | null;
|
|
130
130
|
appObjectId?: string | null;
|
|
131
131
|
record?: JsonObject | null;
|
|
132
|
-
data?:
|
|
132
|
+
data?: TData | null;
|
|
133
133
|
};
|
|
134
134
|
export type ReceizAppStateRecord = {
|
|
135
135
|
id: string;
|
|
@@ -170,24 +170,231 @@ export type ReceizAppStatePublishRecordOptions = {
|
|
|
170
170
|
externalCreatorId?: string;
|
|
171
171
|
signature?: string;
|
|
172
172
|
};
|
|
173
|
-
export type
|
|
173
|
+
export type ReceizAppStateFeedOptions = {
|
|
174
|
+
schema?: string;
|
|
175
|
+
namespace?: string;
|
|
176
|
+
externalCreatorId?: string;
|
|
177
|
+
};
|
|
178
|
+
export type ReceizPublicStoreStateRecordInput = {
|
|
179
|
+
id?: string;
|
|
180
|
+
sourceUrl: string;
|
|
181
|
+
externalCreatorId?: string;
|
|
182
|
+
title?: string;
|
|
183
|
+
namespace?: string;
|
|
184
|
+
state?: string;
|
|
185
|
+
schema?: string;
|
|
186
|
+
platform?: string;
|
|
187
|
+
record?: JsonObject | null;
|
|
188
|
+
data: JsonObject;
|
|
189
|
+
[key: string]: unknown;
|
|
190
|
+
};
|
|
191
|
+
export type ReceizAppStateFeedResponse<TData extends JsonObject = JsonObject> = {
|
|
174
192
|
ok: boolean;
|
|
175
193
|
accepted?: number;
|
|
176
194
|
rejected?: number;
|
|
177
|
-
records?: ReceizPublicProjectionRecord[];
|
|
195
|
+
records?: ReceizPublicProjectionRecord<TData>[];
|
|
178
196
|
error?: string;
|
|
179
197
|
[key: string]: unknown;
|
|
180
198
|
};
|
|
181
|
-
export type ReceizAppStateRecordResponse = {
|
|
199
|
+
export type ReceizAppStateRecordResponse<TData extends JsonObject = JsonObject> = {
|
|
182
200
|
ok: boolean;
|
|
183
|
-
record: ReceizPublicProjectionRecord | null;
|
|
201
|
+
record: ReceizPublicProjectionRecord<TData> | null;
|
|
184
202
|
[key: string]: unknown;
|
|
185
203
|
};
|
|
186
|
-
export type ReceizAppStateCollectionResponse = {
|
|
204
|
+
export type ReceizAppStateCollectionResponse<TData extends JsonObject = JsonObject> = {
|
|
187
205
|
ok: boolean;
|
|
188
|
-
records: ReceizPublicProjectionRecord[];
|
|
206
|
+
records: ReceizPublicProjectionRecord<TData>[];
|
|
189
207
|
[key: string]: unknown;
|
|
190
208
|
};
|
|
209
|
+
export type ReceizAppStateRestoreOptions = {
|
|
210
|
+
schema?: string;
|
|
211
|
+
state?: string;
|
|
212
|
+
requiredDataKey?: string;
|
|
213
|
+
};
|
|
214
|
+
export type ReceizAppStateRestoreResult<TData extends JsonObject = JsonObject> = {
|
|
215
|
+
ok: boolean;
|
|
216
|
+
record: ReceizPublicProjectionRecord<TData> | null;
|
|
217
|
+
data: TData | null;
|
|
218
|
+
error?: string;
|
|
219
|
+
};
|
|
220
|
+
export type ReceizAppStateTenantPublishInput = {
|
|
221
|
+
tenantHost: string;
|
|
222
|
+
creatorReceizId?: string;
|
|
223
|
+
externalCreatorId?: string;
|
|
224
|
+
title?: string;
|
|
225
|
+
schema?: string;
|
|
226
|
+
schemaVersion?: number;
|
|
227
|
+
platform?: string;
|
|
228
|
+
state: JsonObject;
|
|
229
|
+
record?: JsonObject | null;
|
|
230
|
+
data?: JsonObject;
|
|
231
|
+
sourceUrl?: string;
|
|
232
|
+
id?: string;
|
|
233
|
+
namespace?: string;
|
|
234
|
+
projectionState?: string;
|
|
235
|
+
visibility?: "public" | "private";
|
|
236
|
+
idempotencyKey?: string;
|
|
237
|
+
[key: string]: unknown;
|
|
238
|
+
};
|
|
239
|
+
export type ReceizAppStatePublishInput = ReceizAppStateFeed | ReceizAppStateTenantPublishInput;
|
|
240
|
+
export type ReceizAppStateResolveInput = ReceizAppStateRestoreOptions & {
|
|
241
|
+
url?: string;
|
|
242
|
+
host?: string;
|
|
243
|
+
tenantHost?: string;
|
|
244
|
+
id?: string;
|
|
245
|
+
namespace?: string;
|
|
246
|
+
creatorReceizId?: string;
|
|
247
|
+
receizId?: string;
|
|
248
|
+
migrateTo?: number;
|
|
249
|
+
};
|
|
250
|
+
export type ReceizAppStateResolveResult<TData extends JsonObject = JsonObject> = ReceizAppStateRestoreResult<TData> & {
|
|
251
|
+
records?: ReceizPublicProjectionRecord<TData>[];
|
|
252
|
+
};
|
|
253
|
+
export type ReceizCapabilityKey = "identity" | "wallet" | "payments" | "proofStore" | "media" | "domains" | "twin" | "commerce" | "rewards" | "events" | "search" | "permissions" | "jobs";
|
|
254
|
+
export type ReceizCapabilityStatus = "available" | "missing" | "unknown";
|
|
255
|
+
export type ReceizCapability = {
|
|
256
|
+
available: boolean;
|
|
257
|
+
status: ReceizCapabilityStatus;
|
|
258
|
+
reason?: string;
|
|
259
|
+
fixUrl?: string;
|
|
260
|
+
[key: string]: unknown;
|
|
261
|
+
};
|
|
262
|
+
export type ReceizCapabilities = {
|
|
263
|
+
ok: true;
|
|
264
|
+
schema: "receiz.sdk.capabilities.v1";
|
|
265
|
+
baseUrl: string;
|
|
266
|
+
tenantHost?: string;
|
|
267
|
+
scopes: string[];
|
|
268
|
+
capabilities: Record<ReceizCapabilityKey, ReceizCapability>;
|
|
269
|
+
};
|
|
270
|
+
export type ReceizCapabilitiesOptions = {
|
|
271
|
+
tenantHost?: string;
|
|
272
|
+
callbackUrl?: string;
|
|
273
|
+
scopes?: string[];
|
|
274
|
+
};
|
|
275
|
+
export type ReceizDoctorIssue = {
|
|
276
|
+
code: string;
|
|
277
|
+
message: string;
|
|
278
|
+
fixUrl?: string;
|
|
279
|
+
};
|
|
280
|
+
export type ReceizDoctorReport = {
|
|
281
|
+
ok: boolean;
|
|
282
|
+
schema: "receiz.sdk.doctor.v1";
|
|
283
|
+
baseUrl: string;
|
|
284
|
+
tenantHost?: string;
|
|
285
|
+
capabilities: ReceizCapabilities["capabilities"];
|
|
286
|
+
missing: ReceizDoctorIssue[];
|
|
287
|
+
warnings: ReceizDoctorIssue[];
|
|
288
|
+
fixes: ReceizDoctorIssue[];
|
|
289
|
+
};
|
|
290
|
+
export type ReceizCommerceCartItem = {
|
|
291
|
+
id: string;
|
|
292
|
+
title?: string;
|
|
293
|
+
quantity: number;
|
|
294
|
+
amountUsd?: string;
|
|
295
|
+
amountUsdCents?: string;
|
|
296
|
+
[key: string]: unknown;
|
|
297
|
+
};
|
|
298
|
+
export type ReceizCommerceCart = {
|
|
299
|
+
items: ReceizCommerceCartItem[];
|
|
300
|
+
[key: string]: unknown;
|
|
301
|
+
};
|
|
302
|
+
export type ReceizOneClickCheckoutRequest = {
|
|
303
|
+
tenantHost: string;
|
|
304
|
+
orderId?: string;
|
|
305
|
+
amountUsd: string;
|
|
306
|
+
currency?: "usd";
|
|
307
|
+
walletFirst?: boolean;
|
|
308
|
+
cardFallback?: boolean;
|
|
309
|
+
customerReceizId?: string;
|
|
310
|
+
customerEmail?: string;
|
|
311
|
+
cart?: ReceizCommerceCart;
|
|
312
|
+
successUrl?: string;
|
|
313
|
+
cancelUrl?: string;
|
|
314
|
+
idempotencyKey?: string;
|
|
315
|
+
[key: string]: unknown;
|
|
316
|
+
};
|
|
317
|
+
export type ReceizOneClickCheckoutResponse = {
|
|
318
|
+
ok: boolean;
|
|
319
|
+
tenantHost: string;
|
|
320
|
+
orderId?: string;
|
|
321
|
+
funding: {
|
|
322
|
+
totalUsdCents: string;
|
|
323
|
+
walletAppliedUsdCents: string;
|
|
324
|
+
cardDeltaUsdCents: string;
|
|
325
|
+
walletFirst: boolean;
|
|
326
|
+
cardFallback: boolean;
|
|
327
|
+
};
|
|
328
|
+
wallet?: ConnectWalletResponse | null;
|
|
329
|
+
checkoutSession?: CheckoutSessionResponse | null;
|
|
330
|
+
proofObject?: JsonObject | null;
|
|
331
|
+
events: JsonObject[];
|
|
332
|
+
error?: string;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
};
|
|
335
|
+
export type ReceizMediaUploadOptions = {
|
|
336
|
+
tenantHost?: string;
|
|
337
|
+
purpose?: string;
|
|
338
|
+
filename?: string;
|
|
339
|
+
idempotencyKey?: string;
|
|
340
|
+
metadata?: JsonObject;
|
|
341
|
+
};
|
|
342
|
+
export type ReceizMediaUploadResponse = {
|
|
343
|
+
ok: boolean;
|
|
344
|
+
media?: JsonObject | null;
|
|
345
|
+
proof?: JsonObject | null;
|
|
346
|
+
error?: string;
|
|
347
|
+
[key: string]: unknown;
|
|
348
|
+
};
|
|
349
|
+
export type ReceizEventSubscribeRequest = {
|
|
350
|
+
tenantHost?: string;
|
|
351
|
+
types: string[];
|
|
352
|
+
webhookUrl?: string;
|
|
353
|
+
idempotencyKey?: string;
|
|
354
|
+
replayFrom?: string;
|
|
355
|
+
[key: string]: unknown;
|
|
356
|
+
};
|
|
357
|
+
export type ReceizProofQuery = {
|
|
358
|
+
namespace?: string;
|
|
359
|
+
tenantHost?: string;
|
|
360
|
+
type?: string;
|
|
361
|
+
customerReceizId?: string;
|
|
362
|
+
cursor?: string;
|
|
363
|
+
limit?: number;
|
|
364
|
+
[key: string]: unknown;
|
|
365
|
+
};
|
|
366
|
+
export type ReceizJobRequest = {
|
|
367
|
+
tenantHost?: string;
|
|
368
|
+
kind: string;
|
|
369
|
+
payload: JsonObject;
|
|
370
|
+
runAfter?: string;
|
|
371
|
+
idempotencyKey?: string;
|
|
372
|
+
[key: string]: unknown;
|
|
373
|
+
};
|
|
374
|
+
export type ReceizSandboxStoreOptions = {
|
|
375
|
+
tenantHost: string;
|
|
376
|
+
products?: number;
|
|
377
|
+
seed?: string;
|
|
378
|
+
};
|
|
379
|
+
export type ReceizSandboxStore = {
|
|
380
|
+
ok: true;
|
|
381
|
+
schema: "receiz.sdk.sandbox.store.v1";
|
|
382
|
+
tenantHost: string;
|
|
383
|
+
state: {
|
|
384
|
+
brand: string;
|
|
385
|
+
products: JsonObject[];
|
|
386
|
+
rewards: JsonObject[];
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
export type ReceizSandboxCheckoutOptions = {
|
|
390
|
+
amountUsd: string;
|
|
391
|
+
outcome?: "success" | "failure";
|
|
392
|
+
};
|
|
393
|
+
export type ReceizWebhookVerifyRequestOptions = {
|
|
394
|
+
secret: string;
|
|
395
|
+
toleranceSeconds?: number;
|
|
396
|
+
nowMs?: number;
|
|
397
|
+
};
|
|
191
398
|
export type WalletLedgerEvent = {
|
|
192
399
|
id: string;
|
|
193
400
|
kind: "transfer" | "note_mint" | "note_claim" | string;
|
|
@@ -986,10 +1193,19 @@ export declare function receizAppStateUrlFromHost(hostOrUrl: string): string;
|
|
|
986
1193
|
export declare function receizAppStateNamespaceFromUrl(sourceUrl: string): string;
|
|
987
1194
|
export declare function receizAppStateObjectIdFromUrl(sourceUrl: string, prefix?: string): string;
|
|
988
1195
|
export declare function createReceizAppStateRecord(input: ReceizAppStateRecordInput): ReceizAppStateRecord;
|
|
1196
|
+
export declare function createReceizAppStateFeed(records: Array<ReceizAppStateRecord | ReceizAppStateRecordInput>, options?: ReceizAppStateFeedOptions): ReceizAppStateFeed;
|
|
1197
|
+
export declare function createReceizPublicStoreStateRecord(input: ReceizPublicStoreStateRecordInput): ReceizAppStateRecord;
|
|
1198
|
+
export declare function createReceizTenantAppStateRecord(input: ReceizAppStateTenantPublishInput): ReceizAppStateRecord;
|
|
1199
|
+
export declare function normalizeReceizHost(hostOrUrl: string): string;
|
|
1200
|
+
export declare function verifyReceizWebhookRequest(request: Request, options: ReceizWebhookVerifyRequestOptions): Promise<boolean>;
|
|
1201
|
+
export declare function extractReceizAppStateData<TData extends JsonObject = JsonObject>(input: ReceizAppStateRecordResponse<TData> | ReceizPublicProjectionRecord<TData> | null | undefined, options?: ReceizAppStateRestoreOptions): TData | null;
|
|
1202
|
+
export declare function restoreReceizAppStateProjection<TData extends JsonObject = JsonObject>(input: ReceizAppStateRecordResponse<TData> | ReceizPublicProjectionRecord<TData> | null | undefined, options?: ReceizAppStateRestoreOptions): ReceizAppStateRestoreResult<TData>;
|
|
989
1203
|
export declare class ReceizClient {
|
|
990
1204
|
readonly baseUrl: string;
|
|
991
1205
|
private readonly accessToken;
|
|
992
1206
|
private readonly fetchImpl;
|
|
1207
|
+
readonly doctor: (options?: ReceizCapabilitiesOptions) => Promise<ReceizDoctorReport>;
|
|
1208
|
+
readonly capabilities: (options?: ReceizCapabilitiesOptions) => Promise<ReceizCapabilities>;
|
|
993
1209
|
readonly verification: {
|
|
994
1210
|
verifyArtifact: (file: Blob) => Promise<DocumentVerifyResponse>;
|
|
995
1211
|
sealArtifact: (file: Blob, options?: {
|
|
@@ -998,27 +1214,41 @@ export declare class ReceizClient {
|
|
|
998
1214
|
conformance: () => Promise<JsonObject>;
|
|
999
1215
|
};
|
|
1000
1216
|
readonly publicProof: {
|
|
1001
|
-
observe: (body: PublicProofObserveRequest) => Promise<PublicProofRecord
|
|
1002
|
-
byUrl: (url: string) => Promise<PublicProofRecord
|
|
1003
|
-
byId: (id: string) => Promise<PublicProofRecord
|
|
1217
|
+
observe: (body: PublicProofObserveRequest) => Promise<PublicProofRecord<JsonObject>>;
|
|
1218
|
+
byUrl: (url: string) => Promise<PublicProofRecord<JsonObject>>;
|
|
1219
|
+
byId: (id: string) => Promise<PublicProofRecord<JsonObject>>;
|
|
1004
1220
|
byCreator: (externalCreatorId: string) => Promise<{
|
|
1005
1221
|
ok: boolean;
|
|
1006
1222
|
records: PublicProofRecord[];
|
|
1007
1223
|
}>;
|
|
1008
1224
|
registryFeed: (feed: PublicProofRegistryFeed, options?: {
|
|
1009
1225
|
signature?: string;
|
|
1010
|
-
}) => Promise<ReceizAppStateFeedResponse
|
|
1226
|
+
}) => Promise<ReceizAppStateFeedResponse<JsonObject>>;
|
|
1011
1227
|
};
|
|
1012
1228
|
readonly appState: {
|
|
1013
|
-
publish: (
|
|
1229
|
+
publish: (input: ReceizAppStatePublishInput, options?: {
|
|
1014
1230
|
signature?: string;
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1231
|
+
idempotencyKey?: string;
|
|
1232
|
+
}) => Promise<ReceizAppStateFeedResponse<JsonObject>>;
|
|
1233
|
+
publishRecord: (record: ReceizAppStateRecord | ReceizAppStateRecordInput, options?: ReceizAppStatePublishRecordOptions) => Promise<ReceizAppStateFeedResponse<JsonObject>>;
|
|
1234
|
+
resolve: <TData extends JsonObject = JsonObject>(input: ReceizAppStateResolveInput) => Promise<ReceizAppStateResolveResult<TData>>;
|
|
1235
|
+
byUrl: (url: string) => Promise<ReceizAppStateRecordResponse<JsonObject>>;
|
|
1236
|
+
byHost: (host: string) => Promise<ReceizAppStateRecordResponse<JsonObject>>;
|
|
1237
|
+
byCreator: (receizId: string) => Promise<ReceizAppStateCollectionResponse<JsonObject>>;
|
|
1238
|
+
byNamespace: (namespace: string) => Promise<ReceizAppStateCollectionResponse<JsonObject>>;
|
|
1239
|
+
byId: (id: string) => Promise<ReceizAppStateRecordResponse<JsonObject>>;
|
|
1240
|
+
restoreByUrl: <TData extends JsonObject = JsonObject>(url: string, options?: ReceizAppStateRestoreOptions) => Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1241
|
+
restoreByHost: <TData extends JsonObject = JsonObject>(host: string, options?: ReceizAppStateRestoreOptions) => Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1242
|
+
restoreById: <TData extends JsonObject = JsonObject>(id: string, options?: ReceizAppStateRestoreOptions) => Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1243
|
+
createRecord: typeof createReceizAppStateRecord;
|
|
1244
|
+
createTenantRecord: typeof createReceizTenantAppStateRecord;
|
|
1245
|
+
createFeed: typeof createReceizAppStateFeed;
|
|
1246
|
+
createPublicStoreRecord: typeof createReceizPublicStoreStateRecord;
|
|
1247
|
+
urlFromHost: typeof receizAppStateUrlFromHost;
|
|
1248
|
+
namespaceFromUrl: typeof receizAppStateNamespaceFromUrl;
|
|
1249
|
+
objectIdFromUrl: typeof receizAppStateObjectIdFromUrl;
|
|
1250
|
+
extractData: typeof extractReceizAppStateData;
|
|
1251
|
+
restoreProjection: typeof restoreReceizAppStateProjection;
|
|
1022
1252
|
};
|
|
1023
1253
|
readonly sports: {
|
|
1024
1254
|
conformance: () => Promise<JsonObject>;
|
|
@@ -1105,12 +1335,49 @@ export declare class ReceizClient {
|
|
|
1105
1335
|
bootstrap: (username: string) => Promise<JsonObject>;
|
|
1106
1336
|
authorizeUrl: (options: ReceizAuthorizeUrlOptions) => string;
|
|
1107
1337
|
};
|
|
1338
|
+
readonly commerce: {
|
|
1339
|
+
oneClickCheckout: (body: ReceizOneClickCheckoutRequest) => Promise<ReceizOneClickCheckoutResponse>;
|
|
1340
|
+
};
|
|
1108
1341
|
readonly payments: {
|
|
1109
1342
|
embeddedCheckout: (body: CheckoutRequest) => Promise<CheckoutSessionResponse>;
|
|
1110
1343
|
embeddedNoteClaim: (body: JsonObject) => Promise<JsonObject>;
|
|
1111
1344
|
};
|
|
1345
|
+
readonly media: {
|
|
1346
|
+
upload: (file: Blob, options?: ReceizMediaUploadOptions) => Promise<ReceizMediaUploadResponse>;
|
|
1347
|
+
objectUrl: (query: {
|
|
1348
|
+
bucket: string;
|
|
1349
|
+
path: string;
|
|
1350
|
+
}) => string;
|
|
1351
|
+
};
|
|
1352
|
+
readonly domains: {
|
|
1353
|
+
normalizeHost: typeof normalizeReceizHost;
|
|
1354
|
+
tenantUrl: typeof receizAppStateUrlFromHost;
|
|
1355
|
+
namespace: typeof receizAppStateNamespaceFromUrl;
|
|
1356
|
+
objectId: typeof receizAppStateObjectIdFromUrl;
|
|
1357
|
+
resolveTenant: <TData extends JsonObject = JsonObject>(host: string, options?: ReceizAppStateRestoreOptions) => Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1358
|
+
reserveSubdomain: (body: JsonObject, options?: {
|
|
1359
|
+
idempotencyKey?: string;
|
|
1360
|
+
}) => Promise<JsonObject>;
|
|
1361
|
+
verifyCustomDomain: (body: JsonObject, options?: {
|
|
1362
|
+
idempotencyKey?: string;
|
|
1363
|
+
}) => Promise<JsonObject>;
|
|
1364
|
+
status: (query?: {
|
|
1365
|
+
host?: string;
|
|
1366
|
+
domain?: string;
|
|
1367
|
+
}) => Promise<JsonObject>;
|
|
1368
|
+
};
|
|
1369
|
+
readonly events: {
|
|
1370
|
+
subscribe: (body: ReceizEventSubscribeRequest) => Promise<JsonObject>;
|
|
1371
|
+
};
|
|
1372
|
+
readonly proof: {
|
|
1373
|
+
query: (query: ReceizProofQuery) => Promise<JsonObject>;
|
|
1374
|
+
};
|
|
1375
|
+
readonly jobs: {
|
|
1376
|
+
enqueue: (body: ReceizJobRequest) => Promise<JsonObject>;
|
|
1377
|
+
};
|
|
1112
1378
|
readonly webhooks: {
|
|
1113
1379
|
sign: typeof createReceizWebhookSignature;
|
|
1380
|
+
verify: typeof verifyReceizWebhookRequest;
|
|
1114
1381
|
verifySignature: typeof verifyReceizWebhookSignature;
|
|
1115
1382
|
signaturePayload: typeof buildReceizWebhookSignaturePayload;
|
|
1116
1383
|
assertEvent: typeof assertReceizWebhookEvent;
|
|
@@ -1314,6 +1581,24 @@ export declare class ReceizClient {
|
|
|
1314
1581
|
assetManifest: typeof projectReceizAssetManifest;
|
|
1315
1582
|
sportsCardManifest: typeof projectReceizSportsCardManifest;
|
|
1316
1583
|
};
|
|
1584
|
+
readonly sandbox: {
|
|
1585
|
+
seedStore: (options: ReceizSandboxStoreOptions) => ReceizSandboxStore;
|
|
1586
|
+
wallet: (options?: {
|
|
1587
|
+
balanceUsdCents?: string;
|
|
1588
|
+
balancePhiMicro?: string;
|
|
1589
|
+
}) => {
|
|
1590
|
+
ok: boolean;
|
|
1591
|
+
userId: string;
|
|
1592
|
+
balanceUsdCents: string;
|
|
1593
|
+
balancePhiMicro: string;
|
|
1594
|
+
};
|
|
1595
|
+
checkout: (options: ReceizSandboxCheckoutOptions) => {
|
|
1596
|
+
ok: boolean;
|
|
1597
|
+
checkoutSessionId: string;
|
|
1598
|
+
status: string;
|
|
1599
|
+
amountUsd: string;
|
|
1600
|
+
};
|
|
1601
|
+
};
|
|
1317
1602
|
readonly proofMemory: {
|
|
1318
1603
|
createRegister: typeof createReceizProofRegister;
|
|
1319
1604
|
createMemory: typeof createReceizProofMemory;
|
|
@@ -1335,8 +1620,15 @@ export declare class ReceizClient {
|
|
|
1335
1620
|
}): Promise<WalletLedgerFeed>;
|
|
1336
1621
|
observePublicProof(body: PublicProofObserveRequest): Promise<PublicProofRecord>;
|
|
1337
1622
|
readPublicProofByUrl(url: string): Promise<PublicProofRecord>;
|
|
1623
|
+
inspectCapabilities(options?: ReceizCapabilitiesOptions): Promise<ReceizCapabilities>;
|
|
1624
|
+
runDoctor(options?: ReceizCapabilitiesOptions): Promise<ReceizDoctorReport>;
|
|
1338
1625
|
publishAppState(feed: ReceizAppStateFeed, options?: {
|
|
1339
1626
|
signature?: string;
|
|
1627
|
+
idempotencyKey?: string;
|
|
1628
|
+
}): Promise<ReceizAppStateFeedResponse>;
|
|
1629
|
+
publishAppStateInput(input: ReceizAppStatePublishInput, options?: {
|
|
1630
|
+
signature?: string;
|
|
1631
|
+
idempotencyKey?: string;
|
|
1340
1632
|
}): Promise<ReceizAppStateFeedResponse>;
|
|
1341
1633
|
publishAppStateRecord(record: ReceizAppStateRecord | ReceizAppStateRecordInput, options?: ReceizAppStatePublishRecordOptions): Promise<ReceizAppStateFeedResponse>;
|
|
1342
1634
|
readAppStateByUrl(url: string): Promise<ReceizAppStateRecordResponse>;
|
|
@@ -1344,6 +1636,13 @@ export declare class ReceizClient {
|
|
|
1344
1636
|
readAppStateByCreator(receizId: string): Promise<ReceizAppStateCollectionResponse>;
|
|
1345
1637
|
readAppStateByNamespace(namespace: string): Promise<ReceizAppStateCollectionResponse>;
|
|
1346
1638
|
readAppStateById(id: string): Promise<ReceizAppStateRecordResponse>;
|
|
1639
|
+
restoreAppStateByUrl<TData extends JsonObject = JsonObject>(url: string, options?: ReceizAppStateRestoreOptions): Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1640
|
+
restoreAppStateByHost<TData extends JsonObject = JsonObject>(host: string, options?: ReceizAppStateRestoreOptions): Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1641
|
+
restoreAppStateById<TData extends JsonObject = JsonObject>(id: string, options?: ReceizAppStateRestoreOptions): Promise<ReceizAppStateRestoreResult<TData>>;
|
|
1642
|
+
resolveAppState<TData extends JsonObject = JsonObject>(input: ReceizAppStateResolveInput): Promise<ReceizAppStateResolveResult<TData>>;
|
|
1643
|
+
oneClickCheckout(body: ReceizOneClickCheckoutRequest): Promise<ReceizOneClickCheckoutResponse>;
|
|
1644
|
+
uploadMedia(file: Blob, options?: ReceizMediaUploadOptions): Promise<ReceizMediaUploadResponse>;
|
|
1645
|
+
eventSubscribe(body: ReceizEventSubscribeRequest): Promise<JsonObject>;
|
|
1347
1646
|
sportsConformance(): Promise<JsonObject>;
|
|
1348
1647
|
signalCircuitConformance(): Promise<JsonObject>;
|
|
1349
1648
|
delegated<T>(path: string, options?: Omit<RequestOptions, "bearerToken">): Promise<T>;
|