Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1769601757259.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@storacha/capabilities': minor
---

Add limit property to plan/get successful result
3 changes: 2 additions & 1 deletion packages/access-client/test/agent-use-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,12 @@ describe('getAccountPlan', async function () {
const accountWithAPlan = 'did:mailto:example.com:i-have-a-plan'
const accountWithoutAPlan = 'did:mailto:example.com:i-have-no-plan'
const product = 'did:web:test.up.storacha.network'
/** @type {Record<Ucanto.DID, {product: Ucanto.DID, updatedAt: string}>} */
/** @type {Record<Ucanto.DID, {product: Ucanto.DID, updatedAt: string, limit: string}>} */
const plans = {
[accountWithAPlan]: {
product,
updatedAt: new Date().toISOString(),
limit: '0',
},
}

Expand Down
1 change: 1 addition & 0 deletions packages/capabilities/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ export type PlanGet = InferInvokedCapability<typeof PlanCaps.get>
export interface PlanGetSuccess {
updatedAt: ISO8601Date
product: DID
limit: string
}

export interface PlanNotFound extends Ucanto.Failure {
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/test/bin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ export const testSpace = {

context.plansStorage.get = async () => {
return {
ok: { product: 'did:web:free.web3.storage', updatedAt: 'now' },
ok: {
product: 'did:web:free.web3.storage',
updatedAt: 'now',
limit: '0',
},
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/upload-api/src/test/storage/plans-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as Types from '../../types.js'
export class PlansStorage {
constructor() {
/**
* @type {Record<Types.DID, {product: Types.DID, billingID: string, updatedAt: string}>}
* @type {Record<Types.DID, {product: Types.DID, billingID: string, updatedAt: string, limit: string}>}
*/
this.plans = {}
}
Expand All @@ -26,6 +26,7 @@ export class PlansStorage {
product,
billingID,
updatedAt: new Date().toISOString(),
limit: '0', // Default to unlimited for tests
}
return { ok: {} }
}
Expand Down