-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- typedoc support to generate docs for all the clients - add list of Abilities types - renamed `any.js` to `wildcard.js` - added `parseAbility` and `canDelegateAbility` functions to the capabilities `utils.js` - cli is mostly commented out needs to be updated in a follow PR - StoreData interface revamped - added more exports to index.js to help with the generated docs until typedoc supports export maps - added a bunch of delegation utilities to `delegation.js` - agent has new methods, `addProof`, `proofs`, `delegations`, `delegationsWithMeta`, `createSpace`, `setCurrentSpace`, `currentSpace`, `currentSpaceWithMeta` and `execute` - old createAccount renamed to `registerSpace` - a bunch of jsdocs preview docs https://vigorous-chandrasekhar-6b427f.netlify.app/ todo: - [x] rename caps - [x] rename account to space in api - [x] finish setup wrangler migrations for staging and prod (using CI) - [x] more docs for agent methods - [x] feedback - [x] support multiple invocations to be executed on a connection
- Loading branch information
1 parent
c44a252
commit 7fbf2a1
Showing
64 changed files
with
2,255 additions
and
1,251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ on: | |
- upload-client | ||
- access-client | ||
- wallet | ||
- docs | ||
environment: | ||
description: 'Environment to deploy' | ||
required: true | ||
|
@@ -96,3 +97,29 @@ jobs: | |
- run: pnpm -r --filter @web3-storage/upload-client publish --tag next --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
deploy-docs: | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.package == 'docs' | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm run lint | ||
- run: pnpm run docs | ||
- uses: actions/configure-pages@v2 | ||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: './docs' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,11 @@ jobs: | |
node-version: 18 | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
# Migration database | ||
- run: pnpm -r --filter @web3-storage/access-api exec wrangler d1 migrations apply __D1_BETA__ --env ${{ inputs.environment }} | ||
env: | ||
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_TOKEN }} | ||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | ||
# Publish worker to cloudflare | ||
- uses: cloudflare/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/access-api/migrations/0000_create_spaces_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Migration number: 0000 2022-11-17T15:52:48.968Z | ||
CREATE TABLE | ||
IF NOT EXISTS 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')), | ||
UNIQUE (did) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// import { escapeSQLiteIdentifier } from '@databases/escape-identifier' | ||
import split from '@databases/split-sql-query' | ||
import sql from '@databases/sql' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
|
||
/** @type {import('@databases/sql').FormatConfig} */ | ||
const sqliteFormat = { | ||
// escapeIdentifier: (str) => escapeSQLiteIdentifier(str), | ||
// formatValue: (value) => ({ placeholder: '?', value }), | ||
|
||
escapeIdentifier: (_) => '', | ||
formatValue: (_, __) => ({ placeholder: '', value: '' }), | ||
} | ||
const migrations = [ | ||
sql.file(`${__dirname}/../migrations/0000_create_spaces_table.sql`), | ||
] | ||
|
||
/** | ||
* Migrate from migration files | ||
* | ||
* @param {D1Database} db | ||
*/ | ||
export async function migrate(db) { | ||
try { | ||
for (const m of migrations) { | ||
/** @type {import('@databases/sql').SQLQuery[]} */ | ||
// @ts-ignore | ||
const qs = split.default(m) | ||
await db.batch( | ||
qs.map((q) => { | ||
return db.prepare(q.format(sqliteFormat).text.replace(/^--.*$/gm, '')) | ||
}) | ||
) | ||
} | ||
} catch (error) { | ||
const err = /** @type {Error} */ (error) | ||
// eslint-disable-next-line no-console | ||
console.error('D1 Error', { | ||
message: err.message, | ||
// @ts-ignore | ||
cause: err.cause?.message, | ||
}) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.