javascript-solid-server 0.0.72 → 0.0.73

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.
@@ -225,7 +225,10 @@
225
225
  "Bash(gh pr review:*)",
226
226
  "Bash(gh api:*)",
227
227
  "Bash(gh pr comment:*)",
228
- "Bash(git pull:*)"
228
+ "Bash(git pull:*)",
229
+ "Bash(gh pr:*)",
230
+ "Bash(node --test:*)",
231
+ "Bash(TOKEN_SECRET=test node --test:*)"
229
232
  ]
230
233
  }
231
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/wac/parser.js CHANGED
@@ -55,7 +55,7 @@ export async function parseAcl(content, aclUrl) {
55
55
  const authorizations = [];
56
56
 
57
57
  // Handle @graph array or single object
58
- const nodes = doc['@graph'] || [doc];
58
+ const nodes = Array.isArray(doc) ? doc : (doc['@graph'] || [doc]);
59
59
 
60
60
  for (const node of nodes) {
61
61
  if (isAuthorization(node)) {
package/test/wac.test.js CHANGED
@@ -38,6 +38,42 @@ describe('WAC Parser', () => {
38
38
  assert.ok(auths[0].modes.includes(AccessMode.WRITE));
39
39
  });
40
40
 
41
+ it('should parse top-level JSON-LD array format', async () => {
42
+ // ACL as top-level array (without @graph wrapper)
43
+ const acl = [
44
+ {
45
+ '@context': { 'acl': 'http://www.w3.org/ns/auth/acl#' },
46
+ '@id': '#owner',
47
+ '@type': 'acl:Authorization',
48
+ 'acl:agent': { '@id': 'https://alice.example/#me' },
49
+ 'acl:accessTo': { '@id': 'https://alice.example/resource' },
50
+ 'acl:mode': [{ '@id': 'acl:Read' }, { '@id': 'acl:Write' }, { '@id': 'acl:Control' }]
51
+ },
52
+ {
53
+ '@context': { 'acl': 'http://www.w3.org/ns/auth/acl#', 'foaf': 'http://xmlns.com/foaf/0.1/' },
54
+ '@id': '#public',
55
+ '@type': 'acl:Authorization',
56
+ 'acl:agentClass': { '@id': 'foaf:Agent' },
57
+ 'acl:accessTo': { '@id': 'https://alice.example/resource' },
58
+ 'acl:mode': [{ '@id': 'acl:Read' }]
59
+ }
60
+ ];
61
+
62
+ const auths = await parseAcl(JSON.stringify(acl), 'https://alice.example/.acl');
63
+
64
+ assert.strictEqual(auths.length, 2);
65
+ // Check owner authorization
66
+ const ownerAuth = auths.find(a => a.agents.includes('https://alice.example/#me'));
67
+ assert.ok(ownerAuth, 'Should have owner authorization');
68
+ assert.ok(ownerAuth.modes.includes(AccessMode.READ));
69
+ assert.ok(ownerAuth.modes.includes(AccessMode.WRITE));
70
+ assert.ok(ownerAuth.modes.includes(AccessMode.CONTROL));
71
+ // Check public authorization
72
+ const publicAuth = auths.find(a => a.agentClasses.includes('foaf:Agent'));
73
+ assert.ok(publicAuth, 'Should have public authorization');
74
+ assert.ok(publicAuth.modes.includes(AccessMode.READ));
75
+ });
76
+
41
77
  it('should parse public access', async () => {
42
78
  const acl = {
43
79
  '@context': { 'acl': 'http://www.w3.org/ns/auth/acl#', 'foaf': 'http://xmlns.com/foaf/0.1/' },