diff --git a/package.json b/package.json index 35e5447ac..fb59758d5 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "depcheck": "^1.4.3", - "typedoc": "^0.23.21", + "typedoc": "^0.23.22", "typedoc-plugin-missing-exports": "^1.0.0" } } diff --git a/packages/access-api/migrations/0003_space.metadata_can_be_null.sql b/packages/access-api/migrations/0003_space.metadata_can_be_null.sql new file mode 100644 index 000000000..e7926c093 --- /dev/null +++ b/packages/access-api/migrations/0003_space.metadata_can_be_null.sql @@ -0,0 +1,44 @@ +-- Migration number: 0003 2022-12-12T18:58:30.339Z +ALTER TABLE spaces +RENAME TO _spaces_old; + +CREATE TABLE + spaces ( + did TEXT NOT NULL PRIMARY KEY, + product TEXT NOT NULL, + email TEXT NOT NULL, + agent TEXT NOT NULL, + inserted_at TEXT NOT NULL DEFAULT (strftime ('%Y-%m-%dT%H:%M:%fZ', 'now')), + updated_at TEXT NOT NULL DEFAULT (strftime ('%Y-%m-%dT%H:%M:%fZ', 'now')), + metadata JSON DEFAULT EMPTY, + invocation TEXT NOT NULL DEFAULT EMPTY, + delegation TEXT DEFAULT NULL, + UNIQUE (did) + ); + +INSERT INTO + spaces ( + did, + product, + email, + agent, + inserted_at, + updated_at, + metadata, + invocation, + delegation + ) +SELECT + did, + product, + email, + agent, + inserted_at, + updated_at, + metadata, + invocation, + delegation +FROM + _spaces_old; + +DROP TABLE "_spaces_old"; \ No newline at end of file diff --git a/packages/access-api/package.json b/packages/access-api/package.json index 0931a38bb..b22f3cb1a 100644 --- a/packages/access-api/package.json +++ b/packages/access-api/package.json @@ -26,12 +26,13 @@ "@web3-storage/access": "workspace:^", "@web3-storage/capabilities": "workspace:^", "@web3-storage/worker-utils": "0.4.3-dev", + "kysely": "^0.22.0", + "kysely-d1": "^0.0.6", "p-retry": "^5.1.2", "preact": "^10.11.3", "preact-render-to-string": "^5.2.6", "qrcode": "^1.5.1", - "toucan-js": "^2.7.0", - "workers-qb": "^0.1.2" + "toucan-js": "^2.7.0" }, "devDependencies": { "@cloudflare/workers-types": "^3.18.0", @@ -41,17 +42,17 @@ "@types/assert": "^1.5.6", "@types/git-rev-sync": "^2.0.0", "@types/mocha": "^10.0.1", - "@types/node": "^18.11.12", + "@types/node": "^18.11.13", "@types/qrcode": "^1.5.0", "better-sqlite3": "8.0.1", "buffer": "^6.0.3", "dotenv": "^16.0.3", - "esbuild": "^0.16.3", + "esbuild": "^0.16.4", "git-rev-sync": "^3.0.2", "hd-scripts": "^3.0.2", "is-subset": "^0.1.1", "miniflare": "^2.11.0", - "mocha": "^10.1.0", + "mocha": "^10.2.0", "p-wait-for": "^5.0.0", "process": "^0.11.10", "readable-stream": "^4.2.0", diff --git a/packages/access-api/src/bindings.d.ts b/packages/access-api/src/bindings.d.ts index 38c2de5d7..32b78f9dc 100644 --- a/packages/access-api/src/bindings.d.ts +++ b/packages/access-api/src/bindings.d.ts @@ -1,10 +1,9 @@ import type { Logging } from '@web3-storage/worker-utils/logging' +import type { SpaceTable } from '@web3-storage/access/types' import type { Handler as _Handler } from '@web3-storage/worker-utils/router' -import type { Signer } from '@ucanto/interface' import { Email } from './utils/email.js' -import { Spaces } from './kvs/spaces.js' -import { Validations } from './kvs/validations.js' -import { D1QB } from 'workers-qb' +import { Spaces } from './models/spaces.js' +import { Validations } from './models/validations.js' import { loadConfig } from './config.js' export {} @@ -47,11 +46,10 @@ export interface RouteContext { config: ReturnType url: URL email: Email - kvs: { + models: { spaces: Spaces validations: Validations } - db: D1QB } export type Handler = _Handler @@ -84,6 +82,12 @@ export interface ModuleWorker { scheduled?: ModuleWorker.CronHandler } +// D1 types + export interface D1ErrorRaw extends Error { cause: Error & { code: string } } + +export interface D1Schema { + spaces: SpaceTable +} diff --git a/packages/access-api/src/kvs/spaces.js b/packages/access-api/src/kvs/spaces.js deleted file mode 100644 index 31ed3e8bf..000000000 --- a/packages/access-api/src/kvs/spaces.js +++ /dev/null @@ -1,148 +0,0 @@ -// @ts-ignore -// eslint-disable-next-line no-unused-vars -import * as Ucanto from '@ucanto/interface' -import { - delegationToString, - stringToDelegation, -} from '@web3-storage/access/encoding' - -/** - * @typedef {import('@web3-storage/access/types').SpaceD1} SpaceD1 - */ - -/** - * @implements {Ucanto.Failure} - */ -export class D1Error extends Error { - /** @type {true} */ - get error() { - return true - } - - /** - * - * @param {import('../bindings').D1ErrorRaw} error - */ - constructor(error) { - super(`${error.cause.message} (${error.cause.code})`, { - cause: error.cause, - }) - this.name = 'D1Error' - this.code = error.cause.code - } -} - -/** - * Spaces - */ -export class Spaces { - /** - * - * @param {import('workers-qb').D1QB} db - */ - constructor(db) { - this.db = db - } - - /** - * @param {import('@web3-storage/capabilities/types').VoucherRedeem} capability - * @param {Ucanto.Invocation} invocation - * @param {Ucanto.Delegation<[import('@web3-storage/access/src/types').Top]> | undefined} delegation - */ - async create(capability, invocation, delegation) { - try { - const result = await this.db.insert({ - tableName: 'spaces', - data: { - did: capability.nb.space, - product: capability.nb.product, - email: capability.nb.identity.replace('mailto:', ''), - agent: invocation.issuer.did(), - metadata: JSON.stringify(invocation.facts[0]), - invocation: delegationToString(invocation), - // eslint-disable-next-line unicorn/no-null - delegation: !delegation ? null : delegationToString(delegation), - }, - }) - return { data: result } - } catch (error) { - return { - error: new D1Error( - /** @type {import('../bindings').D1ErrorRaw} */ (error) - ), - } - } - } - - /** - * Get space by DID - * - * @param {string} did - */ - async get(did) { - const { results } = await this.db.fetchOne({ - tableName: 'spaces', - fields: '*', - where: { - conditions: 'did=?1', - params: [did], - }, - }) - - if (!results) { - return - } - - return /** @type {SpaceD1} */ ({ - did: results.did, - agent: results.agent, - email: results.email, - product: results.product, - updated_at: results.update_at, - inserted_at: results.inserted_at, - // @ts-ignore - metadata: JSON.parse(results.metadata), - }) - } - - /** - * @param {string} email - */ - async getByEmail(email) { - const s = await this.db.fetchAll({ - tableName: 'spaces', - fields: '*', - where: { - conditions: 'email=?1', - params: [email], - }, - }) - - if (!s.results || s.results.length === 0) { - return - } - - const out = [] - - for (const r of s.results) { - out.push({ - did: r.did, - agent: r.agent, - email: r.email, - product: r.product, - updated_at: r.update_at, - inserted_at: r.inserted_at, - // @ts-ignore - metadata: JSON.parse(r.metadata), - delegation: !r.delegation - ? undefined - : stringToDelegation( - /** @type {import('@web3-storage/access/types').EncodedDelegation<[import('@web3-storage/access/types').Top]>} */ ( - r.delegation - ) - ), - }) - } - return out - } -} diff --git a/packages/access-api/src/models/spaces.js b/packages/access-api/src/models/spaces.js new file mode 100644 index 000000000..442003e9d --- /dev/null +++ b/packages/access-api/src/models/spaces.js @@ -0,0 +1,95 @@ +// @ts-ignore +// eslint-disable-next-line no-unused-vars +import * as Ucanto from '@ucanto/interface' +import { delegationToString } from '@web3-storage/access/encoding' +import { Kysely } from 'kysely' +import { D1Dialect } from 'kysely-d1' +import { D1Error, SpacePlugin } from '../utils/d1.js' + +const spacePlugin = new SpacePlugin() + +/** + * Spaces + */ +export class Spaces { + /** + * + * @param {D1Database} d1 + */ + constructor(d1) { + this.d1 = /** @type {Kysely} */ ( + new Kysely({ dialect: new D1Dialect({ database: d1 }) }) + ) + } + + /** + * @param {import('@web3-storage/capabilities/types').VoucherRedeem} capability + * @param {Ucanto.Invocation} invocation + * @param {Ucanto.Delegation<[import('@web3-storage/access/types').Top]> | undefined} delegation + */ + async create(capability, invocation, delegation) { + try { + const metadata = + /** @type {import('@web3-storage/access/types').SpaceTableMetadata | undefined} */ ( + /** @type {unknown} */ (invocation.facts[0]) + ) + const result = await this.d1 + .withPlugin(spacePlugin) + .insertInto('spaces') + .values({ + agent: invocation.issuer.did(), + did: capability.nb.space, + email: capability.nb.identity.replace('mailto:', ''), + invocation: delegationToString(invocation), + product: capability.nb.product, + metadata, + delegation: !delegation ? undefined : delegationToString(delegation), + }) + .returning('spaces.did') + .execute() + return { data: result } + } catch (error) { + return { + error: new D1Error( + /** @type {import('../bindings').D1ErrorRaw} */ (error) + ), + } + } + } + + /** + * Get space by DID + * + * @param {Ucanto.URI<"did:">} did + */ + async get(did) { + const space = await this.d1 + .withPlugin(spacePlugin) + .selectFrom('spaces') + .selectAll() + .where('spaces.did', '=', did) + .executeTakeFirst() + + if (space) { + return space + } + } + + /** + * @param {Ucanto.URI<"mailto:">} email + */ + async getByEmail(email) { + const spaces = await this.d1 + .withPlugin(spacePlugin) + .selectFrom('spaces') + .selectAll() + .where('spaces.email', '=', email.replace('mailto:', '')) + .execute() + + if (spaces.length === 0) { + return + } + + return spaces + } +} diff --git a/packages/access-api/src/kvs/validations.js b/packages/access-api/src/models/validations.js similarity index 100% rename from packages/access-api/src/kvs/validations.js rename to packages/access-api/src/models/validations.js diff --git a/packages/access-api/src/routes/validate-email.js b/packages/access-api/src/routes/validate-email.js index a3e54257d..d3516a360 100644 --- a/packages/access-api/src/routes/validate-email.js +++ b/packages/access-api/src/routes/validate-email.js @@ -16,7 +16,7 @@ export async function validateEmail(req, env) { } if (req.query && req.query.ucan) { try { - const delegation = await env.kvs.validations.put( + const delegation = await env.models.validations.put( /** @type {import('@web3-storage/access/src/types.js').EncodedDelegation<[import('@web3-storage/access/src/types.js').VoucherClaim]>} */ ( req.query.ucan ) @@ -62,7 +62,7 @@ export async function validateEmail(req, env) { */ async function recover(req, env) { try { - const delegation = await env.kvs.validations.put( + const delegation = await env.models.validations.put( /** @type {import('@web3-storage/access/src/types.js').EncodedDelegation<[import('@web3-storage/access/src/types.js').SpaceRecover]>} */ ( req.query.ucan ) diff --git a/packages/access-api/src/routes/validate-ws.js b/packages/access-api/src/routes/validate-ws.js index 024a049ae..514cae567 100644 --- a/packages/access-api/src/routes/validate-ws.js +++ b/packages/access-api/src/routes/validate-ws.js @@ -1,7 +1,7 @@ import pRetry from 'p-retry' const run = async ( - /** @type {import('../kvs/validations').Validations} */ kv, + /** @type {import('../models/validations').Validations} */ kv, /** @type {WebSocket} */ server, /** @type {string} */ did ) => { @@ -36,7 +36,7 @@ export async function validateWS(req, env) { const { did } = JSON.parse(msg.data) try { - await pRetry(() => run(env.kvs.validations, server, did), { + await pRetry(() => run(env.models.validations, server, did), { retries: 200, minTimeout: 1000, factor: 1, diff --git a/packages/access-api/src/service/index.js b/packages/access-api/src/service/index.js index 8d5642be9..f6d2d4c24 100644 --- a/packages/access-api/src/service/index.js +++ b/packages/access-api/src/service/index.js @@ -3,7 +3,10 @@ import * as Server from '@ucanto/server' import { Failure } from '@ucanto/server' import * as Space from '@web3-storage/capabilities/space' import { top } from '@web3-storage/capabilities/top' -import { delegationToString } from '@web3-storage/access/encoding' +import { + delegationToString, + stringToDelegation, +} from '@web3-storage/access/encoding' import { voucherClaimProvider } from './voucher-claim.js' import { voucherRedeemProvider } from './voucher-redeem.js' @@ -20,7 +23,7 @@ export function service(ctx) { space: { info: Server.provide(Space.info, async ({ capability, invocation }) => { - const results = await ctx.kvs.spaces.get(capability.with) + const results = await ctx.models.spaces.get(capability.with) if (!results) { return new Failure('Space not found.') } @@ -37,8 +40,8 @@ export function service(ctx) { ) } - const spaces = await ctx.kvs.spaces.getByEmail( - capability.nb.identity.replace('mailto:', '') + const spaces = await ctx.models.spaces.getByEmail( + capability.nb.identity ) if (!spaces) { return new Failure( @@ -49,13 +52,19 @@ export function service(ctx) { const results = [] for (const { delegation, metadata } of spaces) { if (delegation) { + const proof = await stringToDelegation( + /** @type {import('@web3-storage/access/types').EncodedDelegation<[import('@web3-storage/access/types').Top]>} */ ( + delegation + ) + ) const del = await top.delegate({ audience: invocation.issuer, issuer: ctx.signer, - with: delegation.capabilities[0].with, + with: proof.capabilities[0].with, expiration: Infinity, - proofs: [delegation], - facts: [metadata], + proofs: [proof], + // @ts-ignore + facts: metadata ? [metadata] : undefined, }) results.push(delegationToString(del)) @@ -73,8 +82,8 @@ export function service(ctx) { // if yes send email with space/recover // if not error "no spaces for email X" - const spaces = await ctx.kvs.spaces.getByEmail( - capability.nb.identity.replace('mailto:', '') + const spaces = await ctx.models.spaces.getByEmail( + capability.nb.identity ) if (!spaces) { return new Failure( diff --git a/packages/access-api/src/service/voucher-redeem.js b/packages/access-api/src/service/voucher-redeem.js index 8a8065495..6579a4e73 100644 --- a/packages/access-api/src/service/voucher-redeem.js +++ b/packages/access-api/src/service/voucher-redeem.js @@ -38,7 +38,7 @@ export function voucherRedeemProvider(ctx) { return new Failure('Multiple space delegations not suppported.') } - const { error } = await ctx.kvs.spaces.create( + const { error } = await ctx.models.spaces.create( capability, // @ts-ignore - TODO fix this invocation, diff --git a/packages/access-api/src/utils/common.js b/packages/access-api/src/utils/common.js new file mode 100644 index 000000000..a8bf1d6c9 --- /dev/null +++ b/packages/access-api/src/utils/common.js @@ -0,0 +1,8 @@ +/** + * + * @param {unknown} obj + * @returns {obj is Record} + */ +export function isObject(obj) { + return typeof obj === 'object' && obj !== null +} diff --git a/packages/access-api/src/utils/context.js b/packages/access-api/src/utils/context.js index d9e5c9490..bd926a78c 100644 --- a/packages/access-api/src/utils/context.js +++ b/packages/access-api/src/utils/context.js @@ -2,10 +2,9 @@ import { Logging } from '@web3-storage/worker-utils/logging' import Toucan from 'toucan-js' import pkg from '../../package.json' import { loadConfig } from '../config.js' -import { Spaces } from '../kvs/spaces.js' -import { Validations } from '../kvs/validations.js' +import { Spaces } from '../models/spaces.js' +import { Validations } from '../models/validations.js' import { Email } from './email.js' -import { D1QB } from 'workers-qb' /** * Obtains a route context object. @@ -41,17 +40,15 @@ export function getContext(request, env, ctx) { env: config.ENV, }) const url = new URL(request.url) - const db = new D1QB(config.DB) return { log, signer: config.signer, config, url, - kvs: { - spaces: new Spaces(db), + models: { + spaces: new Spaces(config.DB), validations: new Validations(config.VALIDATIONS), }, email: new Email({ token: config.POSTMARK_TOKEN }), - db: new D1QB(config.DB), } } diff --git a/packages/access-api/src/utils/d1.js b/packages/access-api/src/utils/d1.js new file mode 100644 index 000000000..e19750055 --- /dev/null +++ b/packages/access-api/src/utils/d1.js @@ -0,0 +1,105 @@ +// @ts-ignore +// eslint-disable-next-line no-unused-vars +import * as Ucanto from '@ucanto/interface' +import { OperationNodeTransformer } from 'kysely' +import { isObject } from './common.js' + +/** + * @typedef {import('kysely').KyselyPlugin} KyselyPlugin + */ + +export class JsonTransformer extends OperationNodeTransformer { + /** + * @param {import('kysely').PrimitiveValueListNode} node + */ + transformPrimitiveValueList(node) { + return { + ...node, + values: node.values.map((v) => { + return isObject(v) ? JSON.stringify(v) : v + }), + } + } +} + +/** + * Plugin to transform queries and results for the Space table + * + * @implements {KyselyPlugin} + */ +export class SpacePlugin { + constructor() { + this.transformer = new JsonTransformer() + } + + /** + * Transform result from D1 results into JS instances like JSON strings into objects and date string into Date + * + * @param {import('kysely').PluginTransformResultArgs} args + */ + async transformResult(args) { + if (args.result.rows && Array.isArray(args.result.rows)) { + return { + ...args.result, + rows: args.result.rows.map((row) => { + const custom = {} + if (row.metadata) { + // @ts-ignore + custom.metadata = JSON.parse(row.metadata) + } + if (row.inserted_at) { + // @ts-ignore + custom.inserted_at = new Date(row.inserted_at) + } + if (row.updated_at) { + // @ts-ignore + custom.updated_at = new Date(row.updated_at) + } + return { + ...row, + ...custom, + } + }), + } + } + + return args.result + } + + /** + * Transforms objects in the query into string with JSON.stringify + * + * @param {import('kysely').PluginTransformQueryArgs} args + * @returns + */ + transformQuery(args) { + return this.transformer.transformNode(args.node) + } +} + +/** + * @implements {Ucanto.Failure} + */ +export class D1Error extends Error { + /** @type {true} */ + get error() { + return true + } + + /** + * + * @param {import('../bindings').D1ErrorRaw} error + */ + constructor(error) { + super( + `${error.cause ? error.cause.message : error.message} (${ + error.cause ? error.cause.code : '' + })`, + { + cause: error.cause, + } + ) + this.name = 'D1Error' + this.code = error.cause.code + } +} diff --git a/packages/access-api/test/helpers/context.js b/packages/access-api/test/helpers/context.js index fb6ae1465..c8695cbac 100644 --- a/packages/access-api/test/helpers/context.js +++ b/packages/access-api/test/helpers/context.js @@ -6,7 +6,6 @@ import { Miniflare } from 'miniflare' import path from 'path' import { fileURLToPath } from 'url' import { migrate } from '../../scripts/migrate.js' -import { D1QB } from 'workers-qb' const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -78,7 +77,7 @@ export async function context(options) { }), service: Signer.parse(bindings.PRIVATE_KEY), issuer: principal, - db: new D1QB(db), + d1: db, } } diff --git a/packages/access-api/test/space-recover.test.js b/packages/access-api/test/space-recover.test.js index 1c98bbd42..3545a8578 100644 --- a/packages/access-api/test/space-recover.test.js +++ b/packages/access-api/test/space-recover.test.js @@ -3,7 +3,7 @@ import { stringToDelegation } from '@web3-storage/access/encoding' import pWaitFor from 'p-wait-for' import assert from 'assert' import { context } from './helpers/context.js' -import { Validations } from '../src/kvs/validations.js' +import { Validations } from '../src/models/validations.js' import { createSpace } from './helpers/utils.js' describe('space-recover', function () { diff --git a/packages/access-api/test/voucher-redeem.test.js b/packages/access-api/test/voucher-redeem.test.js index bb16ecd1e..76e23a190 100644 --- a/packages/access-api/test/voucher-redeem.test.js +++ b/packages/access-api/test/voucher-redeem.test.js @@ -3,7 +3,7 @@ import * as Voucher from '@web3-storage/capabilities/voucher' import * as Top from '@web3-storage/capabilities/top' import { stringToDelegation } from '@web3-storage/access/encoding' import { context } from './helpers/context.js' -import { Spaces } from '../src/kvs/spaces.js' +import { Spaces } from '../src/models/spaces.js' import { Signer } from '@ucanto/principal/ed25519' // @ts-ignore import isSubset from 'is-subset' @@ -14,7 +14,7 @@ import assert from 'assert' const t = assert const test = it -describe('ucan', function () { +describe('voucher/redeem', function () { /** @type {Awaited>} */ let ctx beforeEach(async function () { @@ -22,7 +22,7 @@ describe('ucan', function () { }) test('should return voucher/redeem', async function () { - const { issuer, service, conn, db } = ctx + const { issuer, service, conn, d1 } = ctx const space = await Signer.generate() const claim = await Voucher.claim @@ -83,7 +83,7 @@ describe('ucan', function () { return t.fail() } - const spaces = new Spaces(db) + const spaces = new Spaces(d1) // check db for space t.ok( @@ -96,7 +96,7 @@ describe('ucan', function () { ) // check space delegations - const results = await spaces.getByEmail('email@dag.house') + const results = await spaces.getByEmail('mailto:email@dag.house') if (!results) { return t.fail('no delegation for email') @@ -106,7 +106,11 @@ describe('ucan', function () { return t.fail('no delegation for email') } - const del = results[0].delegation + const del = await stringToDelegation( + /** @type {import('@web3-storage/access/types').EncodedDelegation<[import('@web3-storage/access/types').Top]>} */ ( + results[0].delegation + ) + ) t.deepEqual(del.audience.did(), service.did()) t.deepEqual(del.capabilities[0].can, '*') @@ -200,7 +204,7 @@ describe('ucan', function () { const redeem = await redeemInv.execute(conn) if (redeem?.error) { - return t.fail() + return t.fail(redeem.message) } const redeem2 = await redeemInv.execute(conn) @@ -210,4 +214,66 @@ describe('ucan', function () { t.deepEqual(redeem2.message, `Space ${space.did()} already registered.`) } }) + + test('should not fail with empty metadata', async function () { + const { issuer, service, conn } = ctx + + const space = await Signer.generate() + const claim = await Voucher.claim + .invoke({ + issuer, + audience: service, + with: space.did(), + nb: { + identity: 'mailto:email@dag.house', + product: 'product:free', + service: service.did(), + }, + proofs: [ + await Top.top.delegate({ + issuer: space, + audience: issuer, + with: space.did(), + expiration: Infinity, + }), + ], + }) + .execute(conn) + + if (!claim) { + return t.fail('no output') + } + if (claim.error) { + return t.fail(claim.message) + } + + const delegation = await stringToDelegation(claim) + + const redeem = await Voucher.redeem + .invoke({ + issuer, + audience: service, + with: service.did(), + nb: { + space: space.did(), + identity: delegation.capabilities[0].nb.identity, + product: delegation.capabilities[0].nb.product, + }, + proofs: [ + delegation, + await Top.top.delegate({ + issuer: space, + audience: service, + with: space.did(), + expiration: Infinity, + }), + ], + }) + + .execute(conn) + + if (redeem?.error) { + return t.fail(redeem.message) + } + }) }) diff --git a/packages/access-client/package.json b/packages/access-client/package.json index 93bcab1cd..bdc8b1230 100644 --- a/packages/access-client/package.json +++ b/packages/access-client/package.json @@ -72,6 +72,7 @@ "conf": "^10.2.0", "inquirer": "^9.1.4", "isomorphic-ws": "^5.0.0", + "kysely": "^0.22.0", "multiformats": "^10.0.2", "one-webcrypto": "^1.0.3", "ora": "^6.1.2", @@ -81,13 +82,13 @@ "uint8arrays": "^4.0.2", "varint": "^6.0.0", "ws": "^8.11.0", - "zod": "^3.19.1" + "zod": "^3.20.0" }, "devDependencies": { "@types/assert": "^1.5.6", "@types/inquirer": "^9.0.3", "@types/mocha": "^10.0.1", - "@types/node": "^18.11.12", + "@types/node": "^18.11.13", "@types/varint": "^6.0.1", "@types/ws": "^8.5.3", "@ucanto/server": "^4.0.2", @@ -95,9 +96,9 @@ "delay": "^5.0.0", "hd-scripts": "^3.0.2", "miniflare": "^2.11.0", - "mocha": "^10.1.0", + "mocha": "^10.2.0", "p-queue": "^7.3.0", - "playwright-test": "^8.1.1", + "playwright-test": "^8.1.2", "sade": "^1.8.1", "typescript": "4.9.4", "watch": "^1.0.2" diff --git a/packages/access-client/src/types.ts b/packages/access-client/src/types.ts index a3169ebe5..ad37e7769 100644 --- a/packages/access-client/src/types.ts +++ b/packages/access-client/src/types.ts @@ -10,7 +10,6 @@ import type { Resource, ResponseDecoder, ServiceMethod, - UCAN, URI, InferInvokedCapability, CapabilityParser, @@ -35,10 +34,32 @@ import type { } from '@web3-storage/capabilities/types' import type { SetRequired } from 'type-fest' import { Driver } from './drivers/types.js' +import type { ColumnType, Selectable } from 'kysely' // export other types export * from '@web3-storage/capabilities/types' +/** + * D1 Types + */ + +export interface SpaceTable { + did: URI<'did:'> + agent: URI<'did:'> + email: string + product: URI<`${string}:`> + inserted_at: ColumnType + updated_at: ColumnType + metadata: SpaceTableMetadata | null + invocation: string + delegation: string | null +} + +export interface SpaceTableMetadata { + space: SpaceMeta + agent: AgentMeta +} + /** * Access api service definition type */ @@ -52,7 +73,7 @@ export interface Service { redeem: ServiceMethod } space: { - info: ServiceMethod + info: ServiceMethod, Failure> 'recover-validation': ServiceMethod< SpaceRecoverValidation, EncodedDelegation<[SpaceRecover]> | undefined, @@ -140,18 +161,6 @@ export interface SpaceMeta { isRegistered: boolean } -/** - * Space schema in D1 database - */ -export interface SpaceD1 { - did: UCAN.DID - agent: UCAN.DID - email: URI<'mailto:'> - product: URI<'product:'> - updated_at: string - inserted_at: string -} - /** * Agent class types */ diff --git a/packages/access-ws/package.json b/packages/access-ws/package.json index c95e7fa69..eb8888d51 100644 --- a/packages/access-ws/package.json +++ b/packages/access-ws/package.json @@ -23,11 +23,11 @@ "@cloudflare/workers-types": "^3.18.0", "@sentry/cli": "2.7.0", "@types/git-rev-sync": "^2.0.0", - "@types/node": "^18.11.12", + "@types/node": "^18.11.13", "ava": "^5.1.0", "buffer": "^6.0.3", "dotenv": "^16.0.3", - "esbuild": "^0.16.3", + "esbuild": "^0.16.4", "git-rev-sync": "^3.0.2", "hd-scripts": "^3.0.2", "miniflare": "^2.11.0", diff --git a/packages/capabilities/package.json b/packages/capabilities/package.json index 5bd1e9c19..909b7bec4 100644 --- a/packages/capabilities/package.json +++ b/packages/capabilities/package.json @@ -66,11 +66,11 @@ "devDependencies": { "@types/assert": "^1.5.6", "@types/mocha": "^10.0.0", - "@types/node": "^18.11.12", + "@types/node": "^18.11.13", "assert": "^2.0.0", "hd-scripts": "^3.0.2", - "mocha": "^10.1.0", - "playwright-test": "^8.1.1", + "mocha": "^10.2.0", + "playwright-test": "^8.1.2", "type-fest": "^3.3.0", "typescript": "4.9.4", "watch": "^1.0.2" diff --git a/packages/upload-client/package.json b/packages/upload-client/package.json index e5969a532..be0bba02b 100644 --- a/packages/upload-client/package.json +++ b/packages/upload-client/package.json @@ -85,9 +85,9 @@ "hd-scripts": "^3.0.2", "hundreds": "^0.0.9", "ipfs-unixfs-exporter": "^9.0.1", - "mocha": "^10.1.0", + "mocha": "^10.2.0", "npm-run-all": "^4.1.5", - "playwright-test": "^8.1.1", + "playwright-test": "^8.1.2", "typescript": "4.9.4" }, "eslintConfig": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac594c740..9e72939e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,14 +8,14 @@ importers: lint-staged: ^13.1.0 prettier: 2.8.1 simple-git-hooks: ^2.8.1 - typedoc: ^0.23.21 + typedoc: ^0.23.22 typedoc-plugin-missing-exports: ^1.0.0 typescript: 4.9.4 wrangler: ^2.6.2 dependencies: depcheck: 1.4.3 - typedoc: 0.23.21_typescript@4.9.4 - typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.21 + typedoc: 0.23.22_typescript@4.9.4 + typedoc-plugin-missing-exports: 1.0.0_typedoc@0.23.22 devDependencies: lint-staged: 13.1.0 prettier: 2.8.1 @@ -33,7 +33,7 @@ importers: '@types/assert': ^1.5.6 '@types/git-rev-sync': ^2.0.0 '@types/mocha': ^10.0.1 - '@types/node': ^18.11.12 + '@types/node': ^18.11.13 '@types/qrcode': ^1.5.0 '@ucanto/core': ^4.0.2 '@ucanto/interface': ^4.0.2 @@ -47,12 +47,14 @@ importers: better-sqlite3: 8.0.1 buffer: ^6.0.3 dotenv: ^16.0.3 - esbuild: ^0.16.3 + esbuild: ^0.16.4 git-rev-sync: ^3.0.2 hd-scripts: ^3.0.2 is-subset: ^0.1.1 + kysely: ^0.22.0 + kysely-d1: ^0.0.6 miniflare: ^2.11.0 - mocha: ^10.1.0 + mocha: ^10.2.0 p-retry: ^5.1.2 p-wait-for: ^5.0.0 preact: ^10.11.3 @@ -63,7 +65,6 @@ importers: sade: ^1.8.1 toucan-js: ^2.7.0 typescript: 4.9.4 - workers-qb: ^0.1.2 wrangler: ^2.6.2 dependencies: '@ipld/dag-ucan': 3.0.1 @@ -76,12 +77,13 @@ importers: '@web3-storage/access': link:../access-client '@web3-storage/capabilities': link:../capabilities '@web3-storage/worker-utils': 0.4.3-dev + kysely: 0.22.0 + kysely-d1: 0.0.6_kysely@0.22.0 p-retry: 5.1.2 preact: 10.11.3 preact-render-to-string: 5.2.6_preact@10.11.3 qrcode: 1.5.1 toucan-js: 2.7.0 - workers-qb: 0.1.2 devDependencies: '@cloudflare/workers-types': 3.18.0 '@databases/split-sql-query': 1.0.3_@databases+sql@3.2.0 @@ -90,17 +92,17 @@ importers: '@types/assert': 1.5.6 '@types/git-rev-sync': 2.0.0 '@types/mocha': 10.0.1 - '@types/node': 18.11.12 + '@types/node': 18.11.13 '@types/qrcode': 1.5.0 better-sqlite3: 8.0.1 buffer: 6.0.3 dotenv: 16.0.3 - esbuild: 0.16.3 + esbuild: 0.16.4 git-rev-sync: 3.0.2 hd-scripts: 3.0.2 is-subset: 0.1.1 miniflare: 2.11.0 - mocha: 10.1.0 + mocha: 10.2.0 p-wait-for: 5.0.0 process: 0.11.10 readable-stream: 4.2.0 @@ -116,7 +118,7 @@ importers: '@types/assert': ^1.5.6 '@types/inquirer': ^9.0.3 '@types/mocha': ^10.0.1 - '@types/node': ^18.11.12 + '@types/node': ^18.11.13 '@types/varint': ^6.0.1 '@types/ws': ^8.5.3 '@ucanto/client': ^4.0.2 @@ -134,15 +136,16 @@ importers: hd-scripts: ^3.0.2 inquirer: ^9.1.4 isomorphic-ws: ^5.0.0 + kysely: ^0.22.0 miniflare: ^2.11.0 - mocha: ^10.1.0 + mocha: ^10.2.0 multiformats: ^10.0.2 one-webcrypto: ^1.0.3 ora: ^6.1.2 p-defer: ^4.0.0 p-queue: ^7.3.0 p-wait-for: ^5.0.0 - playwright-test: ^8.1.1 + playwright-test: ^8.1.2 sade: ^1.8.1 type-fest: ^3.3.0 typescript: 4.9.4 @@ -150,7 +153,7 @@ importers: varint: ^6.0.0 watch: ^1.0.2 ws: ^8.11.0 - zod: ^3.19.1 + zod: ^3.20.0 dependencies: '@ipld/car': 5.0.1 '@ipld/dag-cbor': 8.0.0 @@ -166,6 +169,7 @@ importers: conf: 10.2.0 inquirer: 9.1.4 isomorphic-ws: 5.0.0_ws@8.11.0 + kysely: 0.22.0 multiformats: 10.0.2 one-webcrypto: 1.0.3 ora: 6.1.2 @@ -175,12 +179,12 @@ importers: uint8arrays: 4.0.2 varint: 6.0.0 ws: 8.11.0 - zod: 3.19.1 + zod: 3.20.0 devDependencies: '@types/assert': 1.5.6 '@types/inquirer': 9.0.3 '@types/mocha': 10.0.1 - '@types/node': 18.11.12 + '@types/node': 18.11.13 '@types/varint': 6.0.1 '@types/ws': 8.5.3 '@ucanto/server': 4.0.2 @@ -188,9 +192,9 @@ importers: delay: 5.0.0 hd-scripts: 3.0.2 miniflare: 2.11.0 - mocha: 10.1.0 + mocha: 10.2.0 p-queue: 7.3.0 - playwright-test: 8.1.1 + playwright-test: 8.1.2 sade: 1.8.1 typescript: 4.9.4 watch: 1.0.2 @@ -200,12 +204,12 @@ importers: '@cloudflare/workers-types': ^3.18.0 '@sentry/cli': 2.7.0 '@types/git-rev-sync': ^2.0.0 - '@types/node': ^18.11.12 + '@types/node': ^18.11.13 '@web3-storage/worker-utils': 0.4.3-dev ava: ^5.1.0 buffer: ^6.0.3 dotenv: ^16.0.3 - esbuild: ^0.16.3 + esbuild: ^0.16.4 git-rev-sync: ^3.0.2 hd-scripts: ^3.0.2 miniflare: ^2.11.0 @@ -223,11 +227,11 @@ importers: '@cloudflare/workers-types': 3.18.0 '@sentry/cli': 2.7.0 '@types/git-rev-sync': 2.0.0 - '@types/node': 18.11.12 + '@types/node': 18.11.13 ava: 5.1.0 buffer: 6.0.3 dotenv: 16.0.3 - esbuild: 0.16.3 + esbuild: 0.16.4 git-rev-sync: 3.0.2 hd-scripts: 3.0.2 miniflare: 2.11.0 @@ -242,7 +246,7 @@ importers: specifiers: '@types/assert': ^1.5.6 '@types/mocha': ^10.0.0 - '@types/node': ^18.11.12 + '@types/node': ^18.11.13 '@ucanto/core': ^4.0.2 '@ucanto/interface': ^4.0.2 '@ucanto/principal': ^4.0.2 @@ -250,8 +254,8 @@ importers: '@ucanto/validator': ^4.0.2 assert: ^2.0.0 hd-scripts: ^3.0.2 - mocha: ^10.1.0 - playwright-test: ^8.1.1 + mocha: ^10.2.0 + playwright-test: ^8.1.2 type-fest: ^3.3.0 typescript: 4.9.4 watch: ^1.0.2 @@ -264,11 +268,11 @@ importers: devDependencies: '@types/assert': 1.5.6 '@types/mocha': 10.0.1 - '@types/node': 18.11.12 + '@types/node': 18.11.13 assert: 2.0.0 hd-scripts: 3.0.2 - mocha: 10.1.0 - playwright-test: 8.1.1 + mocha: 10.2.0 + playwright-test: 8.1.2 type-fest: 3.3.0 typescript: 4.9.4 watch: 1.0.2 @@ -292,12 +296,12 @@ importers: hd-scripts: ^3.0.2 hundreds: ^0.0.9 ipfs-unixfs-exporter: ^9.0.1 - mocha: ^10.1.0 + mocha: ^10.2.0 multiformats: ^10.0.2 npm-run-all: ^4.1.5 p-queue: ^7.3.0 p-retry: ^5.1.2 - playwright-test: ^8.1.1 + playwright-test: ^8.1.2 typescript: 4.9.4 dependencies: '@ipld/car': 5.0.1 @@ -321,9 +325,9 @@ importers: hd-scripts: 3.0.2 hundreds: 0.0.9 ipfs-unixfs-exporter: 9.0.1 - mocha: 10.1.0 + mocha: 10.2.0 npm-run-all: 4.1.5 - playwright-test: 8.1.1 + playwright-test: 8.1.2 typescript: 4.9.4 packages: @@ -497,8 +501,8 @@ packages: rollup-plugin-node-polyfills: 0.2.1 dev: true - /@esbuild/android-arm/0.16.3: - resolution: {integrity: sha512-mueuEoh+s1eRbSJqq9KNBQwI4QhQV6sRXIfTyLXSHGMpyew61rOK4qY21uKbXl1iBoMb0AdL1deWFCQVlN2qHA==} + /@esbuild/android-arm/0.16.4: + resolution: {integrity: sha512-rZzb7r22m20S1S7ufIc6DC6W659yxoOrl7sKP1nCYhuvUlnCFHVSbATG4keGUtV8rDz11sRRDbWkvQZpzPaHiw==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -506,8 +510,8 @@ packages: dev: true optional: true - /@esbuild/android-arm64/0.16.3: - resolution: {integrity: sha512-RolFVeinkeraDvN/OoRf1F/lP0KUfGNb5jxy/vkIMeRRChkrX/HTYN6TYZosRJs3a1+8wqpxAo5PI5hFmxyPRg==} + /@esbuild/android-arm64/0.16.4: + resolution: {integrity: sha512-VPuTzXFm/m2fcGfN6CiwZTlLzxrKsWbPkG7ArRFpuxyaHUm/XFHQPD4xNwZT6uUmpIHhnSjcaCmcla8COzmZ5Q==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -515,8 +519,8 @@ packages: dev: true optional: true - /@esbuild/android-x64/0.16.3: - resolution: {integrity: sha512-SFpTUcIT1bIJuCCBMCQWq1bL2gPTjWoLZdjmIhjdcQHaUfV41OQfho6Ici5uvvkMmZRXIUGpM3GxysP/EU7ifQ==} + /@esbuild/android-x64/0.16.4: + resolution: {integrity: sha512-MW+B2O++BkcOfMWmuHXB15/l1i7wXhJFqbJhp82IBOais8RBEQv2vQz/jHrDEHaY2X0QY7Wfw86SBL2PbVOr0g==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -524,8 +528,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64/0.16.3: - resolution: {integrity: sha512-DO8WykMyB+N9mIDfI/Hug70Dk1KipavlGAecxS3jDUwAbTpDXj0Lcwzw9svkhxfpCagDmpaTMgxWK8/C/XcXvw==} + /@esbuild/darwin-arm64/0.16.4: + resolution: {integrity: sha512-a28X1O//aOfxwJVZVs7ZfM8Tyih2Za4nKJrBwW5Wm4yKsnwBy9aiS/xwpxiiTRttw3EaTg4Srerhcm6z0bu9Wg==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -533,8 +537,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64/0.16.3: - resolution: {integrity: sha512-uEqZQ2omc6BvWqdCiyZ5+XmxuHEi1SPzpVxXCSSV2+Sh7sbXbpeNhHIeFrIpRjAs0lI1FmA1iIOxFozKBhKgRQ==} + /@esbuild/darwin-x64/0.16.4: + resolution: {integrity: sha512-e3doCr6Ecfwd7VzlaQqEPrnbvvPjE9uoTpxG5pyLzr2rI2NMjDHmvY1E5EO81O/e9TUOLLkXA5m6T8lfjK9yAA==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -542,8 +546,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64/0.16.3: - resolution: {integrity: sha512-nJansp3sSXakNkOD5i5mIz2Is/HjzIhFs49b1tjrPrpCmwgBmH9SSzhC/Z1UqlkivqMYkhfPwMw1dGFUuwmXhw==} + /@esbuild/freebsd-arm64/0.16.4: + resolution: {integrity: sha512-Oup3G/QxBgvvqnXWrBed7xxkFNwAwJVHZcklWyQt7YCAL5bfUkaa6FVWnR78rNQiM8MqqLiT6ZTZSdUFuVIg1w==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -551,8 +555,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64/0.16.3: - resolution: {integrity: sha512-TfoDzLw+QHfc4a8aKtGSQ96Wa+6eimljjkq9HKR0rHlU83vw8aldMOUSJTUDxbcUdcgnJzPaX8/vGWm7vyV7ug==} + /@esbuild/freebsd-x64/0.16.4: + resolution: {integrity: sha512-vAP+eYOxlN/Bpo/TZmzEQapNS8W1njECrqkTpNgvXskkkJC2AwOXwZWai/Kc2vEFZUXQttx6UJbj9grqjD/+9Q==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -560,8 +564,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm/0.16.3: - resolution: {integrity: sha512-VwswmSYwVAAq6LysV59Fyqk3UIjbhuc6wb3vEcJ7HEJUtFuLK9uXWuFoH1lulEbE4+5GjtHi3MHX+w1gNHdOWQ==} + /@esbuild/linux-arm/0.16.4: + resolution: {integrity: sha512-A47ZmtpIPyERxkSvIv+zLd6kNIOtJH03XA0Hy7jaceRDdQaQVGSDt4mZqpWqJYgDk9rg96aglbF6kCRvPGDSUA==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -569,8 +573,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64/0.16.3: - resolution: {integrity: sha512-7I3RlsnxEFCHVZNBLb2w7unamgZ5sVwO0/ikE2GaYvYuUQs9Qte/w7TqWcXHtCwxvZx/2+F97ndiUQAWs47ZfQ==} + /@esbuild/linux-arm64/0.16.4: + resolution: {integrity: sha512-2zXoBhv4r5pZiyjBKrOdFP4CXOChxXiYD50LRUU+65DkdS5niPFHbboKZd/c81l0ezpw7AQnHeoCy5hFrzzs4g==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -578,8 +582,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32/0.16.3: - resolution: {integrity: sha512-X8FDDxM9cqda2rJE+iblQhIMYY49LfvW4kaEjoFbTTQ4Go8G96Smj2w3BRTwA8IHGoi9dPOPGAX63dhuv19UqA==} + /@esbuild/linux-ia32/0.16.4: + resolution: {integrity: sha512-uxdSrpe9wFhz4yBwt2kl2TxS/NWEINYBUFIxQtaEVtglm1eECvsj1vEKI0KX2k2wCe17zDdQ3v+jVxfwVfvvjw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -587,8 +591,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64/0.16.3: - resolution: {integrity: sha512-hIbeejCOyO0X9ujfIIOKjBjNAs9XD/YdJ9JXAy1lHA+8UXuOqbFe4ErMCqMr8dhlMGBuvcQYGF7+kO7waj2KHw==} + /@esbuild/linux-loong64/0.16.4: + resolution: {integrity: sha512-peDrrUuxbZ9Jw+DwLCh/9xmZAk0p0K1iY5d2IcwmnN+B87xw7kujOkig6ZRcZqgrXgeRGurRHn0ENMAjjD5DEg==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -596,8 +600,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el/0.16.3: - resolution: {integrity: sha512-znFRzICT/V8VZQMt6rjb21MtAVJv/3dmKRMlohlShrbVXdBuOdDrGb+C2cZGQAR8RFyRe7HS6klmHq103WpmVw==} + /@esbuild/linux-mips64el/0.16.4: + resolution: {integrity: sha512-sD9EEUoGtVhFjjsauWjflZklTNr57KdQ6xfloO4yH1u7vNQlOfAlhEzbyBKfgbJlW7rwXYBdl5/NcZ+Mg2XhQA==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -605,8 +609,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64/0.16.3: - resolution: {integrity: sha512-EV7LuEybxhXrVTDpbqWF2yehYRNz5e5p+u3oQUS2+ZFpknyi1NXxr8URk4ykR8Efm7iu04//4sBg249yNOwy5Q==} + /@esbuild/linux-ppc64/0.16.4: + resolution: {integrity: sha512-X1HSqHUX9D+d0l6/nIh4ZZJ94eQky8d8z6yxAptpZE3FxCWYWvTDd9X9ST84MGZEJx04VYUD/AGgciddwO0b8g==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -614,8 +618,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64/0.16.3: - resolution: {integrity: sha512-uDxqFOcLzFIJ+r/pkTTSE9lsCEaV/Y6rMlQjUI9BkzASEChYL/aSQjZjchtEmdnVxDKETnUAmsaZ4pqK1eE5BQ==} + /@esbuild/linux-riscv64/0.16.4: + resolution: {integrity: sha512-97ANpzyNp0GTXCt6SRdIx1ngwncpkV/z453ZuxbnBROCJ5p/55UjhbaG23UdHj88fGWLKPFtMoU4CBacz4j9FA==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -623,8 +627,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x/0.16.3: - resolution: {integrity: sha512-NbeREhzSxYwFhnCAQOQZmajsPYtX71Ufej3IQ8W2Gxskfz9DK58ENEju4SbpIj48VenktRASC52N5Fhyf/aliQ==} + /@esbuild/linux-s390x/0.16.4: + resolution: {integrity: sha512-pUvPQLPmbEeJRPjP0DYTC1vjHyhrnCklQmCGYbipkep+oyfTn7GTBJXoPodR7ZS5upmEyc8lzAkn2o29wD786A==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -632,8 +636,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64/0.16.3: - resolution: {integrity: sha512-SDiG0nCixYO9JgpehoKgScwic7vXXndfasjnD5DLbp1xltANzqZ425l7LSdHynt19UWOcDjG9wJJzSElsPvk0w==} + /@esbuild/linux-x64/0.16.4: + resolution: {integrity: sha512-N55Q0mJs3Sl8+utPRPBrL6NLYZKBCLLx0bme/+RbjvMforTGGzFvsRl4xLTZMUBFC1poDzBEPTEu5nxizQ9Nlw==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -641,8 +645,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64/0.16.3: - resolution: {integrity: sha512-AzbsJqiHEq1I/tUvOfAzCY15h4/7Ivp3ff/o1GpP16n48JMNAtbW0qui2WCgoIZArEHD0SUQ95gvR0oSO7ZbdA==} + /@esbuild/netbsd-x64/0.16.4: + resolution: {integrity: sha512-LHSJLit8jCObEQNYkgsDYBh2JrJT53oJO2HVdkSYLa6+zuLJh0lAr06brXIkljrlI+N7NNW1IAXGn/6IZPi3YQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -650,8 +654,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64/0.16.3: - resolution: {integrity: sha512-gSABi8qHl8k3Cbi/4toAzHiykuBuWLZs43JomTcXkjMZVkp0gj3gg9mO+9HJW/8GB5H89RX/V0QP4JGL7YEEVg==} + /@esbuild/openbsd-x64/0.16.4: + resolution: {integrity: sha512-nLgdc6tWEhcCFg/WVFaUxHcPK3AP/bh+KEwKtl69Ay5IBqUwKDaq/6Xk0E+fh/FGjnLwqFSsarsbPHeKM8t8Sw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -659,8 +663,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64/0.16.3: - resolution: {integrity: sha512-SF9Kch5Ete4reovvRO6yNjMxrvlfT0F0Flm+NPoUw5Z4Q3r1d23LFTgaLwm3Cp0iGbrU/MoUI+ZqwCv5XJijCw==} + /@esbuild/sunos-x64/0.16.4: + resolution: {integrity: sha512-08SluG24GjPO3tXKk95/85n9kpyZtXCVwURR2i4myhrOfi3jspClV0xQQ0W0PYWHioJj+LejFMt41q+PG3mlAQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -668,8 +672,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64/0.16.3: - resolution: {integrity: sha512-u5aBonZIyGopAZyOnoPAA6fGsDeHByZ9CnEzyML9NqntK6D/xl5jteZUKm/p6nD09+v3pTM6TuUIqSPcChk5gg==} + /@esbuild/win32-arm64/0.16.4: + resolution: {integrity: sha512-yYiRDQcqLYQSvNQcBKN7XogbrSvBE45FEQdH8fuXPl7cngzkCvpsG2H9Uey39IjQ6gqqc+Q4VXYHsQcKW0OMjQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -677,8 +681,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32/0.16.3: - resolution: {integrity: sha512-GlgVq1WpvOEhNioh74TKelwla9KDuAaLZrdxuuUgsP2vayxeLgVc+rbpIv0IYF4+tlIzq2vRhofV+KGLD+37EQ==} + /@esbuild/win32-ia32/0.16.4: + resolution: {integrity: sha512-5rabnGIqexekYkh9zXG5waotq8mrdlRoBqAktjx2W3kb0zsI83mdCwrcAeKYirnUaTGztR5TxXcXmQrEzny83w==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -686,8 +690,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64/0.16.3: - resolution: {integrity: sha512-5/JuTd8OWW8UzEtyf19fbrtMJENza+C9JoPIkvItgTBQ1FO2ZLvjbPO6Xs54vk0s5JB5QsfieUEshRQfu7ZHow==} + /@esbuild/win32-x64/0.16.4: + resolution: {integrity: sha512-sN/I8FMPtmtT2Yw+Dly8Ur5vQ5a/RmC8hW7jO9PtPSQUPkowxWpcUZnqOggU7VwyT3Xkj6vcXWd3V/qTXwultQ==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1312,13 +1316,13 @@ packages: /@types/better-sqlite3/7.6.2: resolution: {integrity: sha512-RgmaapusqTq6IMAr4McMyAsC6RshYTCjXCnzwVV59WctUxC8bNPyUfT9t5F81lKcU41lLurhjqjoMHfauzfqGg==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/better-sqlite3/7.6.3: resolution: {integrity: sha512-YS64N9SNDT/NAvou3QNdzAu3E2om/W/0dhORimtPGLef+zSK5l1vDzfsWb4xgXOgfhtOI5ZDTRxnvRPb22AIVQ==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/cookie/0.5.0: @@ -1356,8 +1360,8 @@ packages: resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==} dev: true - /@types/node/18.11.12: - resolution: {integrity: sha512-FgD3NtTAKvyMmD44T07zz2fEf+OKwutgBCEVM8GcvMGVGaDktiLNTDvPwC/LUe3PinMW+X6CuLOF2Ui1mAlSXg==} + /@types/node/18.11.13: + resolution: {integrity: sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==} /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -1370,7 +1374,7 @@ packages: /@types/qrcode/1.5.0: resolution: {integrity: sha512-x5ilHXRxUPIMfjtM+1vf/GPTRWZ81nqscursm5gMznJeK9M0YnZ1c3bEvRLQ0zSSgedLx1J6MGL231ObQGGhaA==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/retry/0.12.1: @@ -1388,19 +1392,19 @@ packages: /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/varint/6.0.1: resolution: {integrity: sha512-fQdOiZpDMBvaEdl12P1x7xlTPRAtd7qUUtVaWgkCy8DC//wCv19nqFFtrnR3y/ac6VFY0UUvYuQqfKzZTSE26w==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/ws/8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 18.11.12 + '@types/node': 18.11.13 dev: true /@types/yargs-parser/21.0.0: @@ -1903,7 +1907,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.4 + es-abstract: 1.20.5 is-string: 1.0.7 dev: true @@ -2485,7 +2489,7 @@ packages: dependencies: arrify: 3.0.0 cp-file: 9.1.0 - globby: 13.1.2 + globby: 13.1.3 junk: 4.0.0 micromatch: 4.0.5 nested-error-stacks: 2.1.1 @@ -2851,6 +2855,37 @@ packages: unbox-primitive: 1.0.2 dev: true + /es-abstract/1.20.5: + resolution: {integrity: sha512-7h8MM2EQhsCA7pU/Nv78qOXFpD8Rhqd12gYiSJVkrH9+e8VuA8JlPJK/hQjjlLv6pJvx/z1iRFKzYb0XT/RuAQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + es-to-primitive: 1.2.1 + function-bind: 1.1.1 + function.prototype.name: 1.1.5 + get-intrinsic: 1.1.3 + get-symbol-description: 1.0.0 + gopd: 1.0.1 + has: 1.0.3 + has-property-descriptors: 1.0.0 + has-symbols: 1.0.3 + internal-slot: 1.0.3 + is-callable: 1.2.7 + is-negative-zero: 2.0.2 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.2 + is-string: 1.0.7 + is-weakref: 1.0.2 + object-inspect: 1.12.2 + object-keys: 1.1.1 + object.assign: 4.1.4 + regexp.prototype.flags: 1.4.3 + safe-regex-test: 1.0.0 + string.prototype.trimend: 1.0.6 + string.prototype.trimstart: 1.0.6 + unbox-primitive: 1.0.2 + dev: true + /es-get-iterator/1.1.2: resolution: {integrity: sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==} dependencies: @@ -3299,34 +3334,34 @@ packages: esbuild-windows-arm64: 0.14.51 dev: true - /esbuild/0.16.3: - resolution: {integrity: sha512-71f7EjPWTiSguen8X/kxEpkAS7BFHwtQKisCDDV3Y4GLGWBaoSCyD5uXkaUew6JDzA9FEN1W23mdnSwW9kqCeg==} + /esbuild/0.16.4: + resolution: {integrity: sha512-qQrPMQpPTWf8jHugLWHoGqZjApyx3OEm76dlTXobHwh/EBbavbRdjXdYi/GWr43GyN0sfpap14GPkb05NH3ROA==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.16.3 - '@esbuild/android-arm64': 0.16.3 - '@esbuild/android-x64': 0.16.3 - '@esbuild/darwin-arm64': 0.16.3 - '@esbuild/darwin-x64': 0.16.3 - '@esbuild/freebsd-arm64': 0.16.3 - '@esbuild/freebsd-x64': 0.16.3 - '@esbuild/linux-arm': 0.16.3 - '@esbuild/linux-arm64': 0.16.3 - '@esbuild/linux-ia32': 0.16.3 - '@esbuild/linux-loong64': 0.16.3 - '@esbuild/linux-mips64el': 0.16.3 - '@esbuild/linux-ppc64': 0.16.3 - '@esbuild/linux-riscv64': 0.16.3 - '@esbuild/linux-s390x': 0.16.3 - '@esbuild/linux-x64': 0.16.3 - '@esbuild/netbsd-x64': 0.16.3 - '@esbuild/openbsd-x64': 0.16.3 - '@esbuild/sunos-x64': 0.16.3 - '@esbuild/win32-arm64': 0.16.3 - '@esbuild/win32-ia32': 0.16.3 - '@esbuild/win32-x64': 0.16.3 + '@esbuild/android-arm': 0.16.4 + '@esbuild/android-arm64': 0.16.4 + '@esbuild/android-x64': 0.16.4 + '@esbuild/darwin-arm64': 0.16.4 + '@esbuild/darwin-x64': 0.16.4 + '@esbuild/freebsd-arm64': 0.16.4 + '@esbuild/freebsd-x64': 0.16.4 + '@esbuild/linux-arm': 0.16.4 + '@esbuild/linux-arm64': 0.16.4 + '@esbuild/linux-ia32': 0.16.4 + '@esbuild/linux-loong64': 0.16.4 + '@esbuild/linux-mips64el': 0.16.4 + '@esbuild/linux-ppc64': 0.16.4 + '@esbuild/linux-riscv64': 0.16.4 + '@esbuild/linux-s390x': 0.16.4 + '@esbuild/linux-x64': 0.16.4 + '@esbuild/netbsd-x64': 0.16.4 + '@esbuild/openbsd-x64': 0.16.4 + '@esbuild/sunos-x64': 0.16.4 + '@esbuild/win32-arm64': 0.16.4 + '@esbuild/win32-ia32': 0.16.4 + '@esbuild/win32-x64': 0.16.4 dev: true /escalade/3.1.1: @@ -4086,6 +4121,17 @@ packages: slash: 4.0.0 dev: true + /globby/13.1.3: + resolution: {integrity: sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + dir-glob: 3.0.1 + fast-glob: 3.2.12 + ignore: 5.2.1 + merge2: 1.4.1 + slash: 4.0.0 + dev: true + /gopd/1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: @@ -4797,6 +4843,19 @@ packages: engines: {node: '>=6'} dev: true + /kysely-d1/0.0.6_kysely@0.22.0: + resolution: {integrity: sha512-WF0au/jHw/5ILirADKrDp/yGI/9rilRBqz0+/HIz61qSk6yDGF+DO5UXaDOw/w+q44s+HrYLTdQMlR/QSSTWtQ==} + peerDependencies: + kysely: '*' + dependencies: + kysely: 0.22.0 + dev: false + + /kysely/0.22.0: + resolution: {integrity: sha512-ZE3qWtnqLOalodzfK5QUEcm7AEulhxsPNuKaGFsC3XiqO92vMLm+mAHk/NnbSIOtC4RmGm0nsv700i8KDp1gfQ==} + engines: {node: '>=14.0.0'} + dev: false + /levn/0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -4968,8 +5027,8 @@ packages: p-defer: 1.0.0 dev: true - /marked/4.2.3: - resolution: {integrity: sha512-slWRdJkbTZ+PjkyJnE30Uid64eHwbwa1Q25INCAYfZlK4o6ylagBy/Le9eWntqJFoFT93ikUKMv47GZ4gTwHkw==} + /marked/4.2.4: + resolution: {integrity: sha512-Wcc9ikX7Q5E4BYDPvh1C6QNSxrjC9tBgz+A/vAhp59KXUgachw++uMvMKiSW8oA85nopmPZcEvBoex/YLMsiyA==} engines: {node: '>= 12'} hasBin: true dev: false @@ -5177,8 +5236,8 @@ packages: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} dev: true - /mocha/10.1.0: - resolution: {integrity: sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==} + /mocha/10.2.0: + resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} engines: {node: '>= 14.0.0'} hasBin: true dependencies: @@ -5769,14 +5828,14 @@ packages: find-up: 3.0.0 dev: false - /playwright-core/1.22.1: - resolution: {integrity: sha512-H+ZUVYnceWNXrRf3oxTEKAr81QzFsCKu5Fp//fEjQvqgKkfA1iX3E9DBrPJpPNOrgVzcE+IqeI0fDmYJe6Ynnw==} + /playwright-core/1.28.1: + resolution: {integrity: sha512-3PixLnGPno0E8rSBJjtwqTwJe3Yw72QwBBBxNoukIj3lEeBNXwbNiKrNuB1oyQgTBw5QHUhNO3SteEtHaMK6ag==} engines: {node: '>=14'} hasBin: true dev: true - /playwright-test/8.1.1: - resolution: {integrity: sha512-FFfuPH6Q/AFoJQDJ6/ateZBBQoiJx8LS8eM0pWExgB0OS9nygnM+KMR/25/dfYdlgw1bESlwtBa5UrBwulvKIw==} + /playwright-test/8.1.2: + resolution: {integrity: sha512-D+0Km5sAGhX/WOftY7JGNrcLb7jRZukGf23nJwh8tz+KAJnuZ30IrB3UHIsiasaP+YPAaw3bRgoLyrCgOMKBCw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -5786,7 +5845,7 @@ packages: cpy: 9.0.1 esbuild: 0.14.39 events: 3.3.0 - globby: 13.1.2 + globby: 13.1.3 kleur: 4.1.5 lilconfig: 2.0.6 lodash: 4.17.21 @@ -5795,7 +5854,7 @@ packages: ora: 6.1.2 p-wait-for: 4.1.0 path-browserify: 1.0.1 - playwright-core: 1.22.1 + playwright-core: 1.28.1 polka: 0.5.2 premove: 4.0.0 process: 0.11.10 @@ -5942,7 +6001,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 18.11.12 + '@types/node': 18.11.13 long: 5.2.1 /proxy-from-env/1.1.0: @@ -6598,7 +6657,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.4 + es-abstract: 1.20.5 dev: true /string.prototype.trimend/1.0.6: @@ -6919,23 +6978,23 @@ packages: resolution: {integrity: sha512-gezeeOIZyQLGW5uuCeEnXF1aXmtt2afKspXz3YqoOcZ3l/YMJq1pujvgT+cz/Nw1O/7q/kSav5fihJHsC/AOUg==} engines: {node: '>=14.16'} - /typedoc-plugin-missing-exports/1.0.0_typedoc@0.23.21: + /typedoc-plugin-missing-exports/1.0.0_typedoc@0.23.22: resolution: {integrity: sha512-7s6znXnuAj1eD9KYPyzVzR1lBF5nwAY8IKccP5sdoO9crG4lpd16RoFpLsh2PccJM+I2NASpr0+/NMka6ThwVA==} peerDependencies: typedoc: 0.22.x || 0.23.x dependencies: - typedoc: 0.23.21_typescript@4.9.4 + typedoc: 0.23.22_typescript@4.9.4 dev: false - /typedoc/0.23.21_typescript@4.9.4: - resolution: {integrity: sha512-VNE9Jv7BgclvyH9moi2mluneSviD43dCE9pY8RWkO88/DrEgJZk9KpUk7WO468c9WWs/+aG6dOnoH7ccjnErhg==} + /typedoc/0.23.22_typescript@4.9.4: + resolution: {integrity: sha512-5sJkjK60xp8A7YpcYniu3+Wf0QcgojEnhzHuCN+CkdpQkKRhOspon/9+sGTkGI8kjVkZs3KHrhltpQyVhRMVfw==} engines: {node: '>= 14.14'} hasBin: true peerDependencies: typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x dependencies: lunr: 2.3.9 - marked: 4.2.3 + marked: 4.2.4 minimatch: 5.1.1 shiki: 0.11.1 typescript: 4.9.4 @@ -7135,10 +7194,6 @@ packages: resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} dev: true - /workers-qb/0.1.2: - resolution: {integrity: sha512-y38RiVOEJPmqSSQniVPKQrWE8XocqeRWO9TwgfXTMARzQa3aGwsaBwUdOBn5MJukZwIkGOYsljK76kMGLu5aOA==} - dev: false - /wrangler/2.6.2: resolution: {integrity: sha512-+in4oEQXDs6+vE+1c6niBd3IrW1DMRTbauR6G0u3TpD6UaXOLwLdBxRLEbN3m82dN+WNm7l1MbFZrKc/TnWjhw==} engines: {node: '>=16.13.0'} @@ -7336,6 +7391,6 @@ packages: stack-trace: 0.0.10 dev: true - /zod/3.19.1: - resolution: {integrity: sha512-LYjZsEDhCdYET9ikFu6dVPGp2YH9DegXjdJToSzD9rO6fy4qiRYFoyEYwps88OseJlPyl2NOe2iJuhEhL7IpEA==} + /zod/3.20.0: + resolution: {integrity: sha512-ZWxs7oM5ixoo1BMoxTNeDMYSih/F/FUnExsnRtHT04rG6q0Bd74TKS45RGXw07TOalOZyyzdKaYH38k8yTEv9A==} dev: false