402mob-merchant-sdk 0.4.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 — prepared, unpublished
4
+
5
+ - Add optional `artifact` commitment and `share` fields to resolved resources. Validate supplied commitments and preserve compatibility with older servers that omit them.
6
+
7
+ ## 0.4.1
8
+
9
+ - Documentation-only release. The packaged README no longer states that the CLI's published SDK dependency remains 0.3.1; it states that published CLI 0.2.0 pins SDK 0.4.0. No code changes: `dist` is byte-identical to 0.4.0.
10
+
3
11
  ## 0.4.0
4
12
 
5
13
  - Worker profiles: `setWorkerProfile`, `getMyWorkerProfile`, public `getWorkerProfile` and `searchWorkers`, with exported input/response types. No prepared artifact is required. Worker discovery uses its own explicit visibility setting.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 402Mob Merchant SDK
2
2
 
3
+ Source 0.4.2 is prepared locally with optional Payment Links commitment/share types and validation. Published 0.4.1 remains unchanged; these additions require the new source build until publication.
4
+
3
5
  **Version 0.4.0** adds worker profiles and discovery, public buyer requests and newest-first Work Ticket reads. Upgrade from 0.3.1 to use these additions. Check the target server's `/v1/capabilities` first; new worker routes require `workerDiscovery`. See [CHANGELOG.md](./CHANGELOG.md).
4
6
 
5
7
  An open-source, dependency-free TypeScript client for resolving agent resources and enrolling or operating a 402Mob merchant from a Node.js server or agent runtime.
@@ -248,7 +250,7 @@ npm test
248
250
  npm pack --pack-destination /tmp
249
251
  ```
250
252
 
251
- To test a local build in another project, install the generated file with `npm install /tmp/402mob-merchant-sdk-0.4.0.tgz`. The CLI's published SDK dependency remains 0.3.1 until a separate CLI release.
253
+ To test a local build in another project, install the generated file with `npm install /tmp/402mob-merchant-sdk-0.4.1.tgz`. Published CLI 0.2.1 pins SDK 0.4.1 and exposes worker discovery, buyer requests and inbox ordering.
252
254
 
253
255
  The SDK tests use mocked HTTP responses and type-check every bundled example. They do not contact `evidence.contact` or submit wallet transactions. Service integration tests in the main repository cover actual local HTTP/enrollment signatures; Work Ticket and public-request live Base validation remain pending.
254
256
 
package/dist/index.d.ts CHANGED
@@ -124,8 +124,16 @@ export interface AgentResourceProvider {
124
124
  payoutAddress?: EvmAddress;
125
125
  createdAt?: string;
126
126
  }
127
+ /** Public commitment; the private verifier is returned only with paid delivery. */
128
+ export interface ArtifactCommitment {
129
+ algorithm: "sha256-private-proof-v1";
130
+ commitment: string;
131
+ sizeUpperBound: number;
132
+ }
127
133
  /** A provider-published, fixed-price resource descriptor. */
128
134
  export interface AgentResource {
135
+ artifact?: ArtifactCommitment;
136
+ share?: string;
129
137
  id: string;
130
138
  seriesId: string;
131
139
  version: string;
package/dist/index.js CHANGED
@@ -443,7 +443,12 @@ function isAgentResource(value) {
443
443
  return false;
444
444
  const amountAtomic = value.amountAtomic;
445
445
  const amountUSDC = value.amountUSDC;
446
- return nonempty(value.id) && nonempty(value.seriesId) && nonempty(value.version) &&
446
+ return (value.share === undefined || nonempty(value.share)) &&
447
+ (value.artifact === undefined || (isRecord(value.artifact) && value.artifact.algorithm === "sha256-private-proof-v1" &&
448
+ typeof value.artifact.commitment === "string" && /^[a-f0-9]{64}$/.test(value.artifact.commitment) &&
449
+ Number.isSafeInteger(value.artifact.sizeUpperBound) && Number(value.artifact.sizeUpperBound) >= 1024 &&
450
+ Number(value.artifact.sizeUpperBound) <= 49152 && Number(value.artifact.sizeUpperBound) % 1024 === 0)) &&
451
+ nonempty(value.id) && nonempty(value.seriesId) && nonempty(value.version) &&
447
452
  nonempty(value.title) && typeof value.description === "string" &&
448
453
  typeof amountAtomic === "string" && /^[1-9][0-9]*$/.test(amountAtomic) &&
449
454
  typeof amountUSDC === "string" && /^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$/.test(amountUSDC) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "402mob-merchant-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "TypeScript client for resolving agent resources and enrolling and operating 402Mob merchants.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,6 +33,6 @@
33
33
  "prepare": "npm run build"
34
34
  },
35
35
  "devDependencies": {
36
- "typescript": "5.9.3"
36
+ "typescript": "7.0.2"
37
37
  }
38
38
  }