@metalabel/dfos-protocol 0.0.1 → 0.0.3

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.
@@ -75,26 +75,26 @@ declare const SubmitContentChainRequest: z.ZodObject<{
75
75
  }, z.core.$strict>;
76
76
  type SubmitContentChainRequest = z.infer<typeof SubmitContentChainRequest>;
77
77
  declare const SubmitContentChainResponse: z.ZodObject<{
78
- entityId: z.ZodString;
78
+ contentId: z.ZodString;
79
79
  isDeleted: z.ZodBoolean;
80
80
  currentDocumentCID: z.ZodNullable<z.ZodString>;
81
81
  genesisCID: z.ZodString;
82
82
  headCID: z.ZodString;
83
83
  }, z.core.$strict>;
84
84
  type SubmitContentChainResponse = z.infer<typeof SubmitContentChainResponse>;
85
- declare const ResolveEntityResponse: z.ZodObject<{
86
- entityId: z.ZodString;
85
+ declare const ResolveContentResponse: z.ZodObject<{
86
+ contentId: z.ZodString;
87
87
  isDeleted: z.ZodBoolean;
88
88
  currentDocumentCID: z.ZodNullable<z.ZodString>;
89
89
  genesisCID: z.ZodString;
90
90
  headCID: z.ZodString;
91
91
  }, z.core.$strict>;
92
- type ResolveEntityResponse = SubmitContentChainResponse;
93
- declare const EntityOperationsParams: z.ZodObject<{
92
+ type ResolveContentResponse = SubmitContentChainResponse;
93
+ declare const ContentOperationsParams: z.ZodObject<{
94
94
  cursor: z.ZodOptional<z.ZodString>;
95
95
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
96
96
  }, z.core.$strip>;
97
- declare const EntityOperationsResponse: z.ZodObject<{
97
+ declare const ContentOperationsResponse: z.ZodObject<{
98
98
  operations: z.ZodArray<z.ZodObject<{
99
99
  cid: z.ZodString;
100
100
  jwsToken: z.ZodString;
@@ -102,17 +102,12 @@ declare const EntityOperationsResponse: z.ZodObject<{
102
102
  }, z.core.$strict>>;
103
103
  nextCursor: z.ZodNullable<z.ZodString>;
104
104
  }, z.core.$strict>;
105
- type EntityOperationsResponse = z.infer<typeof EntityOperationsResponse>;
105
+ type ContentOperationsResponse = z.infer<typeof ContentOperationsResponse>;
106
106
  declare const ResolveOperationResponse: z.ZodObject<{
107
107
  cid: z.ZodString;
108
108
  jwsToken: z.ZodString;
109
109
  }, z.core.$strict>;
110
110
  type ResolveOperationResponse = z.infer<typeof ResolveOperationResponse>;
111
- declare const ResolveDocumentResponse: z.ZodObject<{
112
- cid: z.ZodString;
113
- content: z.ZodUnknown;
114
- }, z.core.$strict>;
115
- type ResolveDocumentResponse = z.infer<typeof ResolveDocumentResponse>;
116
111
  declare const RegistryError: z.ZodObject<{
117
112
  error: z.ZodString;
118
113
  message: z.ZodString;
@@ -124,9 +119,8 @@ interface StoredChain {
124
119
  operations: OperationEntry[];
125
120
  }
126
121
  declare class ChainStore {
127
- private identities;
128
- private entities;
129
- private documents;
122
+ private identityChains;
123
+ private contentChains;
130
124
  getIdentityChain(did: string): StoredChain | undefined;
131
125
  /**
132
126
  * Submit an identity chain. Returns 'accepted' | 'noop' | 'conflict'.
@@ -135,10 +129,8 @@ declare class ChainStore {
135
129
  * - conflict: submitted chain diverges from stored chain (fork)
136
130
  */
137
131
  submitIdentityChain(did: string, operations: OperationEntry[]): 'accepted' | 'noop' | 'conflict';
138
- getEntityChain(entityId: string): StoredChain | undefined;
139
- submitEntityChain(entityId: string, operations: OperationEntry[]): 'accepted' | 'noop' | 'conflict';
140
- getDocument(cid: string): unknown | undefined;
141
- setDocument(cid: string, content: unknown): void;
132
+ getContentChain(contentId: string): StoredChain | undefined;
133
+ submitContentChain(contentId: string, operations: OperationEntry[]): 'accepted' | 'noop' | 'conflict';
142
134
  getOperation(cid: string): OperationEntry | undefined;
143
135
  private submitChain;
144
136
  }
@@ -148,4 +140,4 @@ declare const createRegistryServer: (store?: ChainStore) => {
148
140
  store: ChainStore;
149
141
  };
150
142
 
151
- export { ChainStore, EntityOperationsParams, EntityOperationsResponse, IdentityOperationsParams, IdentityOperationsResponse, OperationEntry, PaginationParams, RegistryError, ResolveDocumentResponse, ResolveEntityResponse, ResolveIdentityResponse, ResolveOperationResponse, type StoredChain, SubmitContentChainRequest, SubmitContentChainResponse, SubmitIdentityChainRequest, SubmitIdentityChainResponse, createRegistryServer };
143
+ export { ChainStore, ContentOperationsParams, ContentOperationsResponse, IdentityOperationsParams, IdentityOperationsResponse, OperationEntry, PaginationParams, RegistryError, ResolveContentResponse, ResolveIdentityResponse, ResolveOperationResponse, type StoredChain, SubmitContentChainRequest, SubmitContentChainResponse, SubmitIdentityChainRequest, SubmitIdentityChainResponse, createRegistryServer };
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  ChainStore,
3
- EntityOperationsParams,
4
- EntityOperationsResponse,
3
+ ContentOperationsParams,
4
+ ContentOperationsResponse,
5
5
  IdentityOperationsParams,
6
6
  IdentityOperationsResponse,
7
7
  RegistryError,
8
- ResolveDocumentResponse,
9
- ResolveEntityResponse,
8
+ ResolveContentResponse,
10
9
  ResolveIdentityResponse,
11
10
  ResolveOperationResponse,
12
11
  SubmitContentChainRequest,
@@ -14,18 +13,17 @@ import {
14
13
  SubmitIdentityChainRequest,
15
14
  SubmitIdentityChainResponse,
16
15
  createRegistryServer
17
- } from "../chunk-3PB644X2.js";
18
- import "../chunk-LWC4PWGZ.js";
16
+ } from "../chunk-U6DANYPT.js";
17
+ import "../chunk-VEBMLR37.js";
19
18
  import "../chunk-ZXXP5W5N.js";
20
19
  export {
21
20
  ChainStore,
22
- EntityOperationsParams,
23
- EntityOperationsResponse,
21
+ ContentOperationsParams,
22
+ ContentOperationsResponse,
24
23
  IdentityOperationsParams,
25
24
  IdentityOperationsResponse,
26
25
  RegistryError,
27
- ResolveDocumentResponse,
28
- ResolveEntityResponse,
26
+ ResolveContentResponse,
29
27
  ResolveIdentityResponse,
30
28
  ResolveOperationResponse,
31
29
  SubmitContentChainRequest,
@@ -20,7 +20,7 @@
20
20
  }
21
21
  ],
22
22
  "expected": {
23
- "entityId": "67t27rzc83v7c22n9t6z7c",
23
+ "contentId": "67t27rzc83v7c22n9t6z7c",
24
24
  "isDeleted": true,
25
25
  "currentDocumentCID": null,
26
26
  "length": 2
@@ -31,7 +31,7 @@
31
31
  }
32
32
  ],
33
33
  "expected": {
34
- "entityId": "67t27rzc83v7c22n9t6z7c",
34
+ "contentId": "67t27rzc83v7c22n9t6z7c",
35
35
  "isDeleted": false,
36
36
  "currentDocumentCID": "bafyreieuo26zfmjxwpmw5jk6bqzqhvivxcbckgxtyeuc7ypf3p4sihgq4q",
37
37
  "length": 2
package/openapi.yaml CHANGED
@@ -101,13 +101,13 @@ paths:
101
101
  schema:
102
102
  $ref: '#/components/schemas/Error'
103
103
 
104
- /entities:
104
+ /content:
105
105
  post:
106
106
  operationId: submitContentChain
107
107
  summary: Submit or extend a content chain
108
108
  description: |
109
109
  Verifies the chain (resolving signing keys from stored identity chains),
110
- derives the entity ID from the genesis CID, and stores it.
110
+ derives the content ID from the genesis CID, and stores it.
111
111
  Same status code semantics as identity submission.
112
112
  requestBody:
113
113
  required: true
@@ -121,13 +121,13 @@ paths:
121
121
  content:
122
122
  application/json:
123
123
  schema:
124
- $ref: '#/components/schemas/EntityState'
124
+ $ref: '#/components/schemas/ContentState'
125
125
  '200':
126
126
  description: Chain already stored (noop)
127
127
  content:
128
128
  application/json:
129
129
  schema:
130
- $ref: '#/components/schemas/EntityState'
130
+ $ref: '#/components/schemas/ContentState'
131
131
  '400':
132
132
  description: Invalid chain
133
133
  content:
@@ -141,32 +141,32 @@ paths:
141
141
  schema:
142
142
  $ref: '#/components/schemas/Error'
143
143
 
144
- /entities/{entityId}:
144
+ /content/{contentId}:
145
145
  get:
146
- operationId: resolveEntity
147
- summary: Resolve current entity state
146
+ operationId: resolveContent
147
+ summary: Resolve current content state
148
148
  parameters:
149
- - $ref: '#/components/parameters/entityId'
149
+ - $ref: '#/components/parameters/contentId'
150
150
  responses:
151
151
  '200':
152
- description: Entity state
152
+ description: Content state
153
153
  content:
154
154
  application/json:
155
155
  schema:
156
- $ref: '#/components/schemas/EntityState'
156
+ $ref: '#/components/schemas/ContentState'
157
157
  '404':
158
- description: Entity not found
158
+ description: Content not found
159
159
  content:
160
160
  application/json:
161
161
  schema:
162
162
  $ref: '#/components/schemas/Error'
163
163
 
164
- /entities/{entityId}/operations:
164
+ /content/{contentId}/operations:
165
165
  get:
166
- operationId: listEntityOperations
166
+ operationId: listContentOperations
167
167
  summary: List content chain operations (newest-first, paginated)
168
168
  parameters:
169
- - $ref: '#/components/parameters/entityId'
169
+ - $ref: '#/components/parameters/contentId'
170
170
  - $ref: '#/components/parameters/cursor'
171
171
  - $ref: '#/components/parameters/limit'
172
172
  responses:
@@ -177,7 +177,7 @@ paths:
177
177
  schema:
178
178
  $ref: '#/components/schemas/PaginatedOperations'
179
179
  '404':
180
- description: Entity not found
180
+ description: Content not found
181
181
  content:
182
182
  application/json:
183
183
  schema:
@@ -203,29 +203,6 @@ paths:
203
203
  schema:
204
204
  $ref: '#/components/schemas/Error'
205
205
 
206
- /documents/{cid}:
207
- get:
208
- operationId: resolveDocument
209
- summary: Resolve a document by CID
210
- description: |
211
- This is the only endpoint that touches actual content.
212
- All other endpoints deal purely in chain mechanics.
213
- parameters:
214
- - $ref: '#/components/parameters/cid'
215
- responses:
216
- '200':
217
- description: Document found
218
- content:
219
- application/json:
220
- schema:
221
- $ref: '#/components/schemas/Document'
222
- '404':
223
- description: Document not found
224
- content:
225
- application/json:
226
- schema:
227
- $ref: '#/components/schemas/Error'
228
-
229
206
  # ---------------------------------------------------------------------------
230
207
 
231
208
  components:
@@ -239,8 +216,8 @@ components:
239
216
  pattern: '^did:dfos:[2346789acdefhknrtvz]{22}$'
240
217
  example: 'did:dfos:e3vvtck42d4eacdnzvtrn6'
241
218
 
242
- entityId:
243
- name: entityId
219
+ contentId:
220
+ name: contentId
244
221
  in: path
245
222
  required: true
246
223
  schema:
@@ -328,11 +305,11 @@ components:
328
305
  items:
329
306
  $ref: '#/components/schemas/MultikeyPublicKey'
330
307
 
331
- EntityState:
308
+ ContentState:
332
309
  type: object
333
- required: [entityId, isDeleted, currentDocumentCID, genesisCID, headCID]
310
+ required: [contentId, isDeleted, currentDocumentCID, genesisCID, headCID]
334
311
  properties:
335
- entityId:
312
+ contentId:
336
313
  type: string
337
314
  example: '67t27rzc83v7c22n9t6z7c'
338
315
  isDeleted:
@@ -388,15 +365,6 @@ components:
388
365
  jwsToken:
389
366
  type: string
390
367
 
391
- Document:
392
- type: object
393
- required: [cid, content]
394
- properties:
395
- cid:
396
- type: string
397
- content:
398
- description: Opaque document content (application-defined)
399
-
400
368
  Error:
401
369
  type: object
402
370
  required: [error, message]
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@metalabel/dfos-protocol",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
+ "type": "module",
4
5
  "description": "DFOS Protocol — Ed25519 signed chain primitives, registry, and verification",
5
6
  "license": "MIT",
6
7
  "author": "Metalabel <hello@metalabel.com> (https://metalabel.com)",
7
8
  "repository": {
8
9
  "type": "git",
9
- "url": "https://github.com/metalabel/metalabel-dfos.git",
10
+ "url": "https://github.com/metalabel/dfos.git",
10
11
  "directory": "packages/dfos-protocol"
11
12
  },
12
- "homepage": "https://github.com/metalabel/metalabel-dfos/tree/main/packages/dfos-protocol",
13
+ "homepage": "https://protocol.dfos.com",
13
14
  "keywords": [
14
15
  "dfos",
15
16
  "protocol",
@@ -23,7 +24,6 @@
23
24
  "cid",
24
25
  "metalabel"
25
26
  ],
26
- "type": "module",
27
27
  "exports": {
28
28
  ".": {
29
29
  "import": "./dist/index.js",
@@ -47,6 +47,9 @@
47
47
  "schemas",
48
48
  "examples",
49
49
  "PROTOCOL.md",
50
+ "DID-METHOD.md",
51
+ "CONTENT-MODEL.md",
52
+ "REGISTRY-API.md",
50
53
  "openapi.yaml",
51
54
  "LICENSE",
52
55
  "README.md"
@@ -68,8 +71,10 @@
68
71
  "vitest": "^4.0.18"
69
72
  },
70
73
  "scripts": {
74
+ "build": "tsup",
75
+ "clean": "rm -rf dist",
76
+ "typecheck": "tsc --noEmit",
71
77
  "test": "vitest run",
72
- "generate-examples": "vitest run --config vitest.scripts.config.ts",
73
- "build": "tsup"
78
+ "generate-examples": "vitest run --config vitest.scripts.config.ts"
74
79
  }
75
80
  }