@interop/was-react 0.2.1 → 0.2.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/README.md +1 -14
- package/package.json +1 -4
- package/dist/dev/cli.d.ts +0 -16
- package/dist/dev/cli.d.ts.map +0 -1
- package/dist/dev/cli.js +0 -119
- package/dist/dev/cli.js.map +0 -1
package/README.md
CHANGED
|
@@ -419,7 +419,7 @@ cost.
|
|
|
419
419
|
| ------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------ |
|
|
420
420
|
| `@interop/was-react` | Core: config, identity, auth, sync, storage, session store, React provider and hooks | `react`, `zustand`, `rxdb` |
|
|
421
421
|
| `@interop/was-react/mui` | Optional `ProtectedRoute`, `ReconnectBanner`, `SyncStatusChip` | `@mui/material`, `@mui/icons-material`, `react-router` |
|
|
422
|
-
| `@interop/was-react/dev` | Node-only `provisionDevGrants`
|
|
422
|
+
| `@interop/was-react/dev` | Node-only `provisionDevGrants` | (none; Node only) |
|
|
423
423
|
|
|
424
424
|
MUI usage:
|
|
425
425
|
|
|
@@ -463,19 +463,6 @@ The `./dev` entry provisions a Space, collections, and delegated read/write
|
|
|
463
463
|
grants against a running was-teaching-server, so an app can dev-sync without a
|
|
464
464
|
CHAPI wallet in the loop. It is Node-only (uses `node:fs`).
|
|
465
465
|
|
|
466
|
-
CLI:
|
|
467
|
-
|
|
468
|
-
```
|
|
469
|
-
was-provision-dev-grants \
|
|
470
|
-
--server-url http://localhost:3002 \
|
|
471
|
-
--seed <hex-or-base64url 32-byte seed> \
|
|
472
|
-
--collections notes \
|
|
473
|
-
--space-name "Dev Space" \
|
|
474
|
-
--out ./public/dev-grants.local.json
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
Programmatic:
|
|
478
|
-
|
|
479
466
|
```ts
|
|
480
467
|
import { provisionDevGrants } from '@interop/was-react/dev'
|
|
481
468
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/was-react",
|
|
3
3
|
"description": "React library for building 'Bring Your Own Everything' (BYOE) apps on Wallet Attached Storage: DID Auth login via CHAPI wallet, local-first encrypted storage, and background sync to a WAS server.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"test:node": "vitest run",
|
|
19
19
|
"test:coverage": "vitest run --coverage"
|
|
20
20
|
},
|
|
21
|
-
"bin": {
|
|
22
|
-
"was-provision-dev-grants": "./dist/dev/cli.js"
|
|
23
|
-
},
|
|
24
21
|
"files": [
|
|
25
22
|
"dist",
|
|
26
23
|
"README.md",
|
package/dist/dev/cli.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Decodes a seed string as hex (all hex chars, even length) or base64url.
|
|
4
|
-
*
|
|
5
|
-
* @param input {string}
|
|
6
|
-
* @returns {Uint8Array}
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseSeed(input: string): Uint8Array;
|
|
9
|
-
/**
|
|
10
|
-
* Splits a comma-separated collection-ids string into a trimmed, non-empty list.
|
|
11
|
-
*
|
|
12
|
-
* @param input {string}
|
|
13
|
-
* @returns {string[]}
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseCollections(input: string): string[];
|
|
16
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/dev/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/dev/cli.ts"],"names":[],"mappings":";AAqCA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAOnD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxD"}
|
package/dist/dev/cli.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* CLI wrapper around `provisionDevGrants`. Creates a dev Space + collections on a
|
|
7
|
-
* running was-teaching-server and delegates per-collection RW zcaps to the app
|
|
8
|
-
* DID derived from `--seed`, optionally writing the grants JSON to `--out`.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* was-provision-dev-grants \
|
|
12
|
-
* --server-url http://localhost:3002 \
|
|
13
|
-
* --seed <hex-or-base64url 32-byte seed> \
|
|
14
|
-
* --collections action-items,projects,goals \
|
|
15
|
-
* [--space-name "Dev Space"] [--out ./public/dev-grants.local.json] [--probe]
|
|
16
|
-
*/
|
|
17
|
-
import { parseArgs } from 'node:util';
|
|
18
|
-
import { argv } from 'node:process';
|
|
19
|
-
import { pathToFileURL } from 'node:url';
|
|
20
|
-
import { base64urlnopad, hex } from '@scure/base';
|
|
21
|
-
import { provisionDevGrants } from './provisionDevGrants.js';
|
|
22
|
-
const USAGE = `Usage: was-provision-dev-grants [options]
|
|
23
|
-
|
|
24
|
-
Required:
|
|
25
|
-
--server-url <url> base URL of a running was-teaching-server
|
|
26
|
-
--seed <string> the app master seed, hex or base64url encoded
|
|
27
|
-
--collections <ids> comma-separated WAS collection ids
|
|
28
|
-
|
|
29
|
-
Optional:
|
|
30
|
-
--space-name <name> Space name (default "Dev Space")
|
|
31
|
-
--out <path> write the { grants } JSON to this file
|
|
32
|
-
--probe probe whether the delegated RW zcap authorizes the
|
|
33
|
-
encryption-marker PUT
|
|
34
|
-
--help show this message
|
|
35
|
-
`;
|
|
36
|
-
/**
|
|
37
|
-
* Decodes a seed string as hex (all hex chars, even length) or base64url.
|
|
38
|
-
*
|
|
39
|
-
* @param input {string}
|
|
40
|
-
* @returns {Uint8Array}
|
|
41
|
-
*/
|
|
42
|
-
export function parseSeed(input) {
|
|
43
|
-
const value = input.trim();
|
|
44
|
-
if (/^[0-9a-fA-F]+$/.test(value) && value.length % 2 === 0) {
|
|
45
|
-
// hex.decode requires lowercase, even-length input.
|
|
46
|
-
return hex.decode(value.toLowerCase());
|
|
47
|
-
}
|
|
48
|
-
return base64urlnopad.decode(value);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Splits a comma-separated collection-ids string into a trimmed, non-empty list.
|
|
52
|
-
*
|
|
53
|
-
* @param input {string}
|
|
54
|
-
* @returns {string[]}
|
|
55
|
-
*/
|
|
56
|
-
export function parseCollections(input) {
|
|
57
|
-
return input
|
|
58
|
-
.split(',')
|
|
59
|
-
.map(id => id.trim())
|
|
60
|
-
.filter(id => id.length > 0);
|
|
61
|
-
}
|
|
62
|
-
async function main() {
|
|
63
|
-
const { values } = parseArgs({
|
|
64
|
-
options: {
|
|
65
|
-
'server-url': { type: 'string' },
|
|
66
|
-
seed: { type: 'string' },
|
|
67
|
-
collections: { type: 'string' },
|
|
68
|
-
'space-name': { type: 'string' },
|
|
69
|
-
out: { type: 'string' },
|
|
70
|
-
probe: { type: 'boolean', default: false },
|
|
71
|
-
help: { type: 'boolean', default: false }
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (values.help) {
|
|
75
|
-
console.log(USAGE);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const serverUrl = values['server-url'];
|
|
79
|
-
const seedInput = values.seed;
|
|
80
|
-
const collectionsInput = values.collections;
|
|
81
|
-
const missing = [];
|
|
82
|
-
if (!serverUrl) {
|
|
83
|
-
missing.push('--server-url');
|
|
84
|
-
}
|
|
85
|
-
if (!seedInput) {
|
|
86
|
-
missing.push('--seed');
|
|
87
|
-
}
|
|
88
|
-
if (!collectionsInput) {
|
|
89
|
-
missing.push('--collections');
|
|
90
|
-
}
|
|
91
|
-
if (missing.length > 0) {
|
|
92
|
-
console.error(`Missing required argument(s): ${missing.join(', ')}\n`);
|
|
93
|
-
console.error(USAGE);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
const collections = parseCollections(collectionsInput);
|
|
97
|
-
if (collections.length === 0) {
|
|
98
|
-
console.error('--collections must list at least one collection id.\n');
|
|
99
|
-
console.error(USAGE);
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
await provisionDevGrants({
|
|
103
|
-
serverUrl: serverUrl,
|
|
104
|
-
seed: parseSeed(seedInput),
|
|
105
|
-
collections,
|
|
106
|
-
spaceName: values['space-name'],
|
|
107
|
-
outFile: values.out,
|
|
108
|
-
probe: values.probe,
|
|
109
|
-
log: console.log
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
// Run only when invoked as a script, not when imported (e.g. by tests).
|
|
113
|
-
if (argv[1] !== undefined && import.meta.url === pathToFileURL(argv[1]).href) {
|
|
114
|
-
main().catch(err => {
|
|
115
|
-
console.error('Provisioning failed:', err);
|
|
116
|
-
process.exit(1);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/dev/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/dev/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,KAAK,GAAG;;;;;;;;;;;;;CAab,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,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