@enbox/protocols 0.1.0

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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Standard reusable DWN protocol definitions for the Enbox ecosystem.
3
+ *
4
+ * Each protocol exports:
5
+ * - A raw `ProtocolDefinition` (e.g. `SocialGraphDefinition`)
6
+ * - A typed protocol created via `defineProtocol()` (e.g. `SocialGraphProtocol`)
7
+ * - Data shape types for each record type (e.g. `FriendData`, `ProfileData`)
8
+ * - A `SchemaMap` type mapping type names to data shapes
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export * from './lists.js';
13
+ export * from './preferences.js';
14
+ export * from './profile.js';
15
+ export * from './social-graph.js';
16
+ export * from './status.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Lists Protocol — flexible list management with folders and collaboration.
3
+ *
4
+ * Supports both nesting patterns:
5
+ * - **Fixed-depth folders**: `folder/folder/folder` (3 levels max)
6
+ * - **Flat items with tag-based hierarchy**: `list/item` with `parentItemId` tag
7
+ *
8
+ * Composes with Social Graph for friend-scoped read access and
9
+ * defines a `collaborator` role for write access to shared lists.
10
+ *
11
+ * @module
12
+ */
13
+ import { defineProtocol } from '@enbox/api';
14
+ // ---------------------------------------------------------------------------
15
+ // Protocol definition
16
+ // ---------------------------------------------------------------------------
17
+ export const ListsDefinition = {
18
+ protocol: 'https://enbox.org/protocols/lists',
19
+ published: false,
20
+ uses: {
21
+ social: 'https://enbox.org/protocols/social-graph',
22
+ },
23
+ types: {
24
+ list: {
25
+ schema: 'https://enbox.org/schemas/lists/list',
26
+ dataFormats: ['application/json'],
27
+ },
28
+ item: {
29
+ schema: 'https://enbox.org/schemas/lists/item',
30
+ dataFormats: ['application/json'],
31
+ },
32
+ folder: {
33
+ schema: 'https://enbox.org/schemas/lists/folder',
34
+ dataFormats: ['application/json'],
35
+ },
36
+ collaborator: {
37
+ schema: 'https://enbox.org/schemas/lists/collaborator',
38
+ dataFormats: ['application/json'],
39
+ },
40
+ comment: {
41
+ schema: 'https://enbox.org/schemas/lists/comment',
42
+ dataFormats: ['application/json'],
43
+ },
44
+ },
45
+ structure: {
46
+ list: {
47
+ $actions: [
48
+ { role: 'social:friend', can: ['read'] },
49
+ ],
50
+ $tags: {
51
+ $requiredTags: ['listType'],
52
+ $allowUndefinedTags: false,
53
+ listType: { type: 'string', enum: ['todo', 'bookmarks', 'reading', 'custom'] },
54
+ },
55
+ item: {
56
+ $actions: [
57
+ { role: 'social:friend', can: ['read'] },
58
+ { role: 'list/collaborator', can: ['create', 'read', 'update', 'delete'] },
59
+ ],
60
+ $tags: {
61
+ $allowUndefinedTags: true,
62
+ parentItemId: { type: 'string' },
63
+ },
64
+ comment: {
65
+ $actions: [
66
+ { role: 'list/collaborator', can: ['create', 'read'] },
67
+ ],
68
+ },
69
+ },
70
+ collaborator: {
71
+ $role: true,
72
+ $actions: [
73
+ { who: 'anyone', can: ['read'] },
74
+ ],
75
+ $tags: {
76
+ $requiredTags: ['did'],
77
+ $allowUndefinedTags: false,
78
+ did: { type: 'string' },
79
+ },
80
+ },
81
+ },
82
+ folder: {
83
+ $actions: [],
84
+ $tags: {
85
+ $allowUndefinedTags: true,
86
+ sortOrder: { type: 'number' },
87
+ },
88
+ folder: {
89
+ $actions: [],
90
+ folder: {
91
+ $actions: [],
92
+ },
93
+ },
94
+ },
95
+ },
96
+ };
97
+ // ---------------------------------------------------------------------------
98
+ // Typed protocol export
99
+ // ---------------------------------------------------------------------------
100
+ /** Typed Lists protocol for use with `dwn.using()`. */
101
+ export const ListsProtocol = defineProtocol(ListsDefinition, {});
102
+ //# sourceMappingURL=lists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/lists.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAsD5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAI,mCAAmC;IAC/C,SAAS,EAAG,KAAK;IACjB,IAAI,EAAQ;QACV,MAAM,EAAE,0CAA0C;KACnD;IACD,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,MAAM,EAAQ,sCAAsC;YACpD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,IAAI,EAAE;YACJ,MAAM,EAAQ,sCAAsC;YACpD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,MAAM,EAAE;YACN,MAAM,EAAQ,wCAAwC;YACtD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,YAAY,EAAE;YACZ,MAAM,EAAQ,8CAA8C;YAC5D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,OAAO,EAAE;YACP,MAAM,EAAQ,yCAAyC;YACvD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACzC;YACD,KAAK,EAAE;gBACL,aAAa,EAAS,CAAC,UAAU,CAAC;gBAClC,mBAAmB,EAAG,KAAK;gBAC3B,QAAQ,EAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE;aAC3F;YACD,IAAI,EA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stores theme, locale, privacy, and notification preferences.
5
+ * Fully owner-only (no external reads). The `privacy` type uses
6
+ * `encryptionRequired` for at-rest encryption of sensitive settings.
7
+ *
8
+ * @module
9
+ */
10
+ import { defineProtocol } from '@enbox/api';
11
+ // ---------------------------------------------------------------------------
12
+ // Protocol definition
13
+ // ---------------------------------------------------------------------------
14
+ export const PreferencesDefinition = {
15
+ protocol: 'https://enbox.org/protocols/preferences',
16
+ published: false,
17
+ types: {
18
+ theme: {
19
+ schema: 'https://enbox.org/schemas/preferences/theme',
20
+ dataFormats: ['application/json'],
21
+ },
22
+ locale: {
23
+ schema: 'https://enbox.org/schemas/preferences/locale',
24
+ dataFormats: ['application/json'],
25
+ },
26
+ privacy: {
27
+ schema: 'https://enbox.org/schemas/preferences/privacy',
28
+ dataFormats: ['application/json'],
29
+ encryptionRequired: true,
30
+ },
31
+ notification: {
32
+ schema: 'https://enbox.org/schemas/preferences/notification',
33
+ dataFormats: ['application/json'],
34
+ },
35
+ },
36
+ structure: {
37
+ theme: {
38
+ $actions: [],
39
+ },
40
+ locale: {
41
+ $actions: [],
42
+ },
43
+ privacy: {
44
+ $actions: [],
45
+ },
46
+ notification: {
47
+ $actions: [],
48
+ $tags: {
49
+ $requiredTags: ['channel'],
50
+ $allowUndefinedTags: false,
51
+ channel: { type: 'string' },
52
+ },
53
+ },
54
+ },
55
+ };
56
+ // ---------------------------------------------------------------------------
57
+ // Typed protocol export
58
+ // ---------------------------------------------------------------------------
59
+ /** Typed Preferences protocol for use with `dwn.using()`. */
60
+ export const PreferencesProtocol = defineProtocol(PreferencesDefinition, {});
61
+ //# sourceMappingURL=preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/preferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAoD5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAI,yCAAyC;IACrD,SAAS,EAAG,KAAK;IACjB,KAAK,EAAO;QACV,KAAK,EAAE;YACL,MAAM,EAAQ,6CAA6C;YAC3D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,MAAM,EAAE;YACN,MAAM,EAAQ,8CAA8C;YAC5D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,OAAO,EAAE;YACP,MAAM,EAAe,+CAA+C;YACpE,WAAW,EAAU,CAAC,kBAAkB,CAAC;YACzC,kBAAkB,EAAG,IAAI;SAC1B;QACD,YAAY,EAAE;YACZ,MAAM,EAAQ,oDAAoD;YAClE,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;SACb;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE;SACb;QACD,YAAY,EAAE;YACZ,QAAQ,EAAG,EAAE;YACb,KAAK,EAAM;gBACT,aAAa,EAAS,CAAC,SAAS,CAAC;gBACjC,mBAAmB,EAAG,KAAK;gBAC3B,OAAO,EAAe,EAAE,IAAI,EAAE,QAAQ,EAAE;aACzC;SACF;KACF;CACoC,CAAC;AAExC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAC/C,qBAAqB,EACrB,EAA0B,CAC3B,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Profile Protocol — public and semi-private identity information.
3
+ *
4
+ * Supports a published profile record, avatar (binary), links, and
5
+ * private notes visible only to friends (via Social Graph composition).
6
+ *
7
+ * @module
8
+ */
9
+ import { defineProtocol } from '@enbox/api';
10
+ // ---------------------------------------------------------------------------
11
+ // Protocol definition
12
+ // ---------------------------------------------------------------------------
13
+ export const ProfileDefinition = {
14
+ protocol: 'https://enbox.org/protocols/profile',
15
+ published: true,
16
+ uses: {
17
+ social: 'https://enbox.org/protocols/social-graph',
18
+ },
19
+ types: {
20
+ profile: {
21
+ schema: 'https://enbox.org/schemas/profile/profile',
22
+ dataFormats: ['application/json'],
23
+ },
24
+ avatar: {
25
+ dataFormats: ['image/png', 'image/jpeg', 'image/gif', 'image/webp'],
26
+ },
27
+ link: {
28
+ schema: 'https://enbox.org/schemas/profile/link',
29
+ dataFormats: ['application/json'],
30
+ },
31
+ privateNote: {
32
+ schema: 'https://enbox.org/schemas/profile/private-note',
33
+ dataFormats: ['application/json'],
34
+ },
35
+ },
36
+ structure: {
37
+ profile: {
38
+ $size: { max: 10000 },
39
+ $actions: [
40
+ { who: 'anyone', can: ['read'] },
41
+ ],
42
+ avatar: {
43
+ $size: { max: 1048576 },
44
+ $actions: [
45
+ { who: 'anyone', can: ['read'] },
46
+ ],
47
+ },
48
+ link: {
49
+ $actions: [
50
+ { who: 'anyone', can: ['read'] },
51
+ ],
52
+ },
53
+ },
54
+ privateNote: {
55
+ $actions: [
56
+ { role: 'social:friend', can: ['read'] },
57
+ ],
58
+ },
59
+ },
60
+ };
61
+ // ---------------------------------------------------------------------------
62
+ // Typed protocol export
63
+ // ---------------------------------------------------------------------------
64
+ /** Typed Profile protocol for use with `dwn.using()`. */
65
+ export const ProfileProtocol = defineProtocol(ProfileDefinition, {});
66
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2C5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAI,qCAAqC;IACjD,SAAS,EAAG,IAAI;IAChB,IAAI,EAAQ;QACV,MAAM,EAAE,0CA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, block, group, and member types with role-based access.
5
+ * Other protocols compose with this via `uses` to leverage the `friend` role
6
+ * for cross-protocol authorization.
7
+ *
8
+ * @module
9
+ */
10
+ import { defineProtocol } from '@enbox/api';
11
+ // ---------------------------------------------------------------------------
12
+ // Protocol definition
13
+ // ---------------------------------------------------------------------------
14
+ export const SocialGraphDefinition = {
15
+ protocol: 'https://enbox.org/protocols/social-graph',
16
+ published: true,
17
+ types: {
18
+ friend: {
19
+ schema: 'https://enbox.org/schemas/social-graph/friend',
20
+ dataFormats: ['application/json'],
21
+ },
22
+ block: {
23
+ schema: 'https://enbox.org/schemas/social-graph/block',
24
+ dataFormats: ['application/json'],
25
+ },
26
+ group: {
27
+ schema: 'https://enbox.org/schemas/social-graph/group',
28
+ dataFormats: ['application/json'],
29
+ },
30
+ member: {
31
+ schema: 'https://enbox.org/schemas/social-graph/member',
32
+ dataFormats: ['application/json'],
33
+ },
34
+ },
35
+ structure: {
36
+ friend: {
37
+ $role: true,
38
+ $actions: [
39
+ { who: 'anyone', can: ['create'] },
40
+ { who: 'author', of: 'friend', can: ['read'] },
41
+ ],
42
+ $tags: {
43
+ $requiredTags: ['did'],
44
+ $allowUndefinedTags: false,
45
+ did: { type: 'string' },
46
+ },
47
+ },
48
+ block: {
49
+ $actions: [
50
+ { who: 'anyone', can: ['create'] },
51
+ ],
52
+ $tags: {
53
+ $requiredTags: ['did'],
54
+ $allowUndefinedTags: false,
55
+ did: { type: 'string' },
56
+ },
57
+ },
58
+ group: {
59
+ $actions: [
60
+ { who: 'anyone', can: ['read'] },
61
+ ],
62
+ member: {
63
+ $actions: [
64
+ { who: 'anyone', can: ['read'] },
65
+ ],
66
+ $tags: {
67
+ $requiredTags: ['did'],
68
+ $allowUndefinedTags: false,
69
+ did: { type: 'string' },
70
+ },
71
+ },
72
+ },
73
+ },
74
+ };
75
+ // ---------------------------------------------------------------------------
76
+ // Typed protocol export
77
+ // ---------------------------------------------------------------------------
78
+ /** Typed Social Graph protocol for use with `dwn.using()`. */
79
+ export const SocialGraphProtocol = defineProtocol(SocialGraphDefinition, {});
80
+ //# sourceMappingURL=social-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-graph.js","sourceRoot":"","sources":["../../src/social-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA4C5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAI,0CAA0C;IACtD,SAAS,EAAG,IAAI;IAChB,KAAK,EAAO;QACV,MAAM,EAAE;YACN,MAAM,EAAQ,+CAA+C;YAC7D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,KAAK,EAAE;YACL,MAAM,EAAQ,8CAA8C;YAC5D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,KAAK,EAAE;YACL,MAAM,EAAQ,8CAA8C;YAC5D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,MAAM,EAAE;YACN,MAAM,EAAQ,+CAA+C;YAC7D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE;YACN,KAAK,EAAM,IAAI;YACf,QAAQ,EAAG;gBACT,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE;gBAClC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aAC/C;YACD,KAAK,EAAE;gBACL,aAAa,EAAS,CAAC,KAAK,CAAC;gBAC7B,mBAAmB,EAAG,KAAK;gBAC3B,GAAG,EAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;aACzC;SACF;QACD,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE;aACnC;YACD,KAAK,EAAE;gBACL,aAAa,EAAS,CAAC,KAAK,CAAC;gBAC7B,mBAAmB,EAAG,KAAK;gBAC3B,GAAG,EAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;aACzC;SACF;QACD,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACjC;YACD,MAAM,EAAE;gBACN,QAAQ,EAAE;oBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;iBACjC;gBACD,KAAK,EAAE;oBACL,aAAa,EAAS,CAAC,KAAK,CAAC;oBAC7B,mBAAmB,EAAG,KAAK;oBAC3B,GAAG,EAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;iBACzC;aACF;SACF;KACF;CACoC,CAAC;AAExC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAC/C,qBAAqB,EACrB,EAA0B,CAC3B,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Status Protocol — ephemeral status updates with reactions.
3
+ *
4
+ * Uses the `published` flag on individual records to control visibility:
5
+ * published statuses are readable by anyone, unpublished ones only by friends.
6
+ * Composes with Social Graph for friend-scoped access and reactions.
7
+ *
8
+ * @module
9
+ */
10
+ import { defineProtocol } from '@enbox/api';
11
+ // ---------------------------------------------------------------------------
12
+ // Protocol definition
13
+ // ---------------------------------------------------------------------------
14
+ export const StatusDefinition = {
15
+ protocol: 'https://enbox.org/protocols/status',
16
+ published: true,
17
+ uses: {
18
+ social: 'https://enbox.org/protocols/social-graph',
19
+ },
20
+ types: {
21
+ status: {
22
+ schema: 'https://enbox.org/schemas/status/status',
23
+ dataFormats: ['application/json'],
24
+ },
25
+ reaction: {
26
+ schema: 'https://enbox.org/schemas/status/reaction',
27
+ dataFormats: ['application/json'],
28
+ },
29
+ },
30
+ structure: {
31
+ status: {
32
+ $size: { max: 5000 },
33
+ $actions: [
34
+ { who: 'anyone', can: ['read'] },
35
+ { role: 'social:friend', can: ['read'] },
36
+ ],
37
+ reaction: {
38
+ $actions: [
39
+ { role: 'social:friend', can: ['create', 'read', 'delete'] },
40
+ ],
41
+ },
42
+ },
43
+ },
44
+ };
45
+ // ---------------------------------------------------------------------------
46
+ // Typed protocol export
47
+ // ---------------------------------------------------------------------------
48
+ /** Typed Status protocol for use with `dwn.using()`. */
49
+ export const StatusProtocol = defineProtocol(StatusDefinition, {});
50
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA6B5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAI,oCAAoC;IAChD,SAAS,EAAG,IAAI;IAChB,IAAI,EAAQ;QACV,MAAM,EAAE,0CAA0C;KACnD;IACD,KAAK,EAAE;QACL,MAAM,EAAE;YACN,MAAM,EAAQ,yCAAyC;YACvD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,QAAQ,EAAE;YACR,MAAM,EAAQ,2CAA2C;YACzD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE;YACN,KAAK,EAAM,EAAE,GAAG,EAAE,IAAI,EAAE;YACxB,QAAQ,EAAG;gBACT,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;gBAChC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACzC;YACD,QAAQ,EAAE;gBACR,QAAQ,EAAE;oBACR,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE;iBAC7D;aACF;SACF;KACF;CACoC,CAAC;AAExC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAC1C,gBAAgB,EAChB,EAAqB,CACtB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Standard reusable DWN protocol definitions for the Enbox ecosystem.
3
+ *
4
+ * Each protocol exports:
5
+ * - A raw `ProtocolDefinition` (e.g. `SocialGraphDefinition`)
6
+ * - A typed protocol created via `defineProtocol()` (e.g. `SocialGraphProtocol`)
7
+ * - Data shape types for each record type (e.g. `FriendData`, `ProfileData`)
8
+ * - A `SchemaMap` type mapping type names to data shapes
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export * from './lists.js';
13
+ export * from './preferences.js';
14
+ export * from './profile.js';
15
+ export * from './social-graph.js';
16
+ export * from './status.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Lists Protocol — flexible list management with folders and collaboration.
3
+ *
4
+ * Supports both nesting patterns:
5
+ * - **Fixed-depth folders**: `folder/folder/folder` (3 levels max)
6
+ * - **Flat items with tag-based hierarchy**: `list/item` with `parentItemId` tag
7
+ *
8
+ * Composes with Social Graph for friend-scoped read access and
9
+ * defines a `collaborator` role for write access to shared lists.
10
+ *
11
+ * @module
12
+ */
13
+ /** Data shape for a list record. */
14
+ export type ListData = {
15
+ name: string;
16
+ description?: string;
17
+ icon?: string;
18
+ listType: 'todo' | 'bookmarks' | 'reading' | 'custom';
19
+ };
20
+ /** Data shape for a list item. */
21
+ export type ItemData = {
22
+ title: string;
23
+ url?: string;
24
+ note?: string;
25
+ completed?: boolean;
26
+ sortOrder?: number;
27
+ };
28
+ /** Data shape for a folder record. */
29
+ export type FolderData = {
30
+ name: string;
31
+ icon?: string;
32
+ sortOrder?: number;
33
+ };
34
+ /** Data shape for a collaborator record. */
35
+ export type CollaboratorData = {
36
+ did: string;
37
+ alias?: string;
38
+ };
39
+ /** Data shape for a comment on a list item. */
40
+ export type CommentData = {
41
+ text: string;
42
+ };
43
+ /** Maps protocol type names to their TypeScript data shapes. */
44
+ export type ListsSchemaMap = {
45
+ list: ListData;
46
+ item: ItemData;
47
+ folder: FolderData;
48
+ collaborator: CollaboratorData;
49
+ comment: CommentData;
50
+ };
51
+ export declare const ListsDefinition: {
52
+ readonly protocol: "https://enbox.org/protocols/lists";
53
+ readonly published: false;
54
+ readonly uses: {
55
+ readonly social: "https://enbox.org/protocols/social-graph";
56
+ };
57
+ readonly types: {
58
+ readonly list: {
59
+ readonly schema: "https://enbox.org/schemas/lists/list";
60
+ readonly dataFormats: ["application/json"];
61
+ };
62
+ readonly item: {
63
+ readonly schema: "https://enbox.org/schemas/lists/item";
64
+ readonly dataFormats: ["application/json"];
65
+ };
66
+ readonly folder: {
67
+ readonly schema: "https://enbox.org/schemas/lists/folder";
68
+ readonly dataFormats: ["application/json"];
69
+ };
70
+ readonly collaborator: {
71
+ readonly schema: "https://enbox.org/schemas/lists/collaborator";
72
+ readonly dataFormats: ["application/json"];
73
+ };
74
+ readonly comment: {
75
+ readonly schema: "https://enbox.org/schemas/lists/comment";
76
+ readonly dataFormats: ["application/json"];
77
+ };
78
+ };
79
+ readonly structure: {
80
+ readonly list: {
81
+ readonly $actions: [{
82
+ readonly role: "social:friend";
83
+ readonly can: ["read"];
84
+ }];
85
+ readonly $tags: {
86
+ readonly $requiredTags: ["listType"];
87
+ readonly $allowUndefinedTags: false;
88
+ readonly listType: {
89
+ readonly type: "string";
90
+ readonly enum: ["todo", "bookmarks", "reading", "custom"];
91
+ };
92
+ };
93
+ readonly item: {
94
+ readonly $actions: [{
95
+ readonly role: "social:friend";
96
+ readonly can: ["read"];
97
+ }, {
98
+ readonly role: "list/collaborator";
99
+ readonly can: ["create", "read", "update", "delete"];
100
+ }];
101
+ readonly $tags: {
102
+ readonly $allowUndefinedTags: true;
103
+ readonly parentItemId: {
104
+ readonly type: "string";
105
+ };
106
+ };
107
+ readonly comment: {
108
+ readonly $actions: [{
109
+ readonly role: "list/collaborator";
110
+ readonly can: ["create", "read"];
111
+ }];
112
+ };
113
+ };
114
+ readonly collaborator: {
115
+ readonly $role: true;
116
+ readonly $actions: [{
117
+ readonly who: "anyone";
118
+ readonly can: ["read"];
119
+ }];
120
+ readonly $tags: {
121
+ readonly $requiredTags: ["did"];
122
+ readonly $allowUndefinedTags: false;
123
+ readonly did: {
124
+ readonly type: "string";
125
+ };
126
+ };
127
+ };
128
+ };
129
+ readonly folder: {
130
+ readonly $actions: [];
131
+ readonly $tags: {
132
+ readonly $allowUndefinedTags: true;
133
+ readonly sortOrder: {
134
+ readonly type: "number";
135
+ };
136
+ };
137
+ readonly folder: {
138
+ readonly $actions: [];
139
+ readonly folder: {
140
+ readonly $actions: [];
141
+ };
142
+ };
143
+ };
144
+ };
145
+ };
146
+ /** Typed Lists protocol for use with `dwn.using()`. */
147
+ export declare const ListsProtocol: import("@enbox/api").TypedProtocol<{
148
+ readonly protocol: "https://enbox.org/protocols/lists";
149
+ readonly published: false;
150
+ readonly uses: {
151
+ readonly social: "https://enbox.org/protocols/social-graph";
152
+ };
153
+ readonly types: {
154
+ readonly list: {
155
+ readonly schema: "https://enbox.org/schemas/lists/list";
156
+ readonly dataFormats: ["application/json"];
157
+ };
158
+ readonly item: {
159
+ readonly schema: "https://enbox.org/schemas/lists/item";
160
+ readonly dataFormats: ["application/json"];
161
+ };
162
+ readonly folder: {
163
+ readonly schema: "https://enbox.org/schemas/lists/folder";
164
+ readonly dataFormats: ["application/json"];
165
+ };
166
+ readonly collaborator: {
167
+ readonly schema: "https://enbox.org/schemas/lists/collaborator";
168
+ readonly dataFormats: ["application/json"];
169
+ };
170
+ readonly comment: {
171
+ readonly schema: "https://enbox.org/schemas/lists/comment";
172
+ readonly dataFormats: ["application/json"];
173
+ };
174
+ };
175
+ readonly structure: {
176
+ readonly list: {
177
+ readonly $actions: [{
178
+ readonly role: "social:friend";
179
+ readonly can: ["read"];
180
+ }];
181
+ readonly $tags: {
182
+ readonly $requiredTags: ["listType"];
183
+ readonly $allowUndefinedTags: false;
184
+ readonly listType: {
185
+ readonly type: "string";
186
+ readonly enum: ["todo", "bookmarks", "reading", "custom"];
187
+ };
188
+ };
189
+ readonly item: {
190
+ readonly $actions: [{
191
+ readonly role: "social:friend";
192
+ readonly can: ["read"];
193
+ }, {
194
+ readonly role: "list/collaborator";
195
+ readonly can: ["create", "read", "update", "delete"];
196
+ }];
197
+ readonly $tags: {
198
+ readonly $allowUndefinedTags: true;
199
+ readonly parentItemId: {
200
+ readonly type: "string";
201
+ };
202
+ };
203
+ readonly comment: {
204
+ readonly $actions: [{
205
+ readonly role: "list/collaborator";
206
+ readonly can: ["create", "read"];
207
+ }];
208
+ };
209
+ };
210
+ readonly collaborator: {
211
+ readonly $role: true;
212
+ readonly $actions: [{
213
+ readonly who: "anyone";
214
+ readonly can: ["read"];
215
+ }];
216
+ readonly $tags: {
217
+ readonly $requiredTags: ["did"];
218
+ readonly $allowUndefinedTags: false;
219
+ readonly did: {
220
+ readonly type: "string";
221
+ };
222
+ };
223
+ };
224
+ };
225
+ readonly folder: {
226
+ readonly $actions: [];
227
+ readonly $tags: {
228
+ readonly $allowUndefinedTags: true;
229
+ readonly sortOrder: {
230
+ readonly type: "number";
231
+ };
232
+ };
233
+ readonly folder: {
234
+ readonly $actions: [];
235
+ readonly folder: {
236
+ readonly $actions: [];
237
+ };
238
+ };
239
+ };
240
+ };
241
+ }, ListsSchemaMap>;
242
+ //# sourceMappingURL=lists.d.ts.map