@mieweb/pulsevault 0.3.0 → 0.4.1

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +113 -1
  2. package/OPERATIONS.md +24 -8
  3. package/PROTOCOL.md +187 -105
  4. package/README.md +102 -41
  5. package/dist/app.d.ts +28 -12
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +17 -4
  8. package/dist/app.js.map +1 -1
  9. package/dist/core.d.ts +18 -8
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +91 -23
  12. package/dist/core.js.map +1 -1
  13. package/dist/lib/authorize.d.ts +7 -1
  14. package/dist/lib/authorize.d.ts.map +1 -1
  15. package/dist/lib/capabilities.d.ts +30 -0
  16. package/dist/lib/capabilities.d.ts.map +1 -0
  17. package/dist/lib/capabilities.js +23 -0
  18. package/dist/lib/capabilities.js.map +1 -0
  19. package/dist/lib/capability-token.d.ts +41 -7
  20. package/dist/lib/capability-token.d.ts.map +1 -1
  21. package/dist/lib/capability-token.js +68 -13
  22. package/dist/lib/capability-token.js.map +1 -1
  23. package/dist/lib/deeplinks.d.ts +0 -13
  24. package/dist/lib/deeplinks.d.ts.map +1 -1
  25. package/dist/lib/deeplinks.js +0 -5
  26. package/dist/lib/deeplinks.js.map +1 -1
  27. package/dist/lib/options.d.ts +6 -1
  28. package/dist/lib/options.d.ts.map +1 -1
  29. package/dist/lib/options.js +9 -4
  30. package/dist/lib/options.js.map +1 -1
  31. package/dist/lib/protocol-version.gen.d.ts +6 -0
  32. package/dist/lib/protocol-version.gen.d.ts.map +1 -0
  33. package/dist/lib/protocol-version.gen.js +8 -0
  34. package/dist/lib/protocol-version.gen.js.map +1 -0
  35. package/dist/lib/protocol.d.ts +31 -0
  36. package/dist/lib/protocol.d.ts.map +1 -0
  37. package/dist/lib/protocol.js +64 -0
  38. package/dist/lib/protocol.js.map +1 -0
  39. package/dist/lib/pulsevaultTus.d.ts +7 -2
  40. package/dist/lib/pulsevaultTus.d.ts.map +1 -1
  41. package/dist/lib/pulsevaultTus.js +80 -6
  42. package/dist/lib/pulsevaultTus.js.map +1 -1
  43. package/dist/lib/retention.d.ts +54 -0
  44. package/dist/lib/retention.d.ts.map +1 -0
  45. package/dist/lib/retention.js +119 -0
  46. package/dist/lib/retention.js.map +1 -0
  47. package/dist/lib/view-links.d.ts +49 -0
  48. package/dist/lib/view-links.d.ts.map +1 -0
  49. package/dist/lib/view-links.js +35 -0
  50. package/dist/lib/view-links.js.map +1 -0
  51. package/dist/routes/pulsevault.d.ts +2 -2
  52. package/dist/routes/pulsevault.d.ts.map +1 -1
  53. package/dist/routes/pulsevault.js +51 -30
  54. package/dist/routes/pulsevault.js.map +1 -1
  55. package/dist/storage/local.d.ts +5 -1
  56. package/dist/storage/local.d.ts.map +1 -1
  57. package/dist/storage/local.js +55 -1
  58. package/dist/storage/local.js.map +1 -1
  59. package/dist/storage/s3.d.ts +5 -1
  60. package/dist/storage/s3.d.ts.map +1 -1
  61. package/dist/storage/s3.js +52 -5
  62. package/dist/storage/s3.js.map +1 -1
  63. package/dist/storage/types.d.ts +34 -6
  64. package/dist/storage/types.d.ts.map +1 -1
  65. package/package.json +16 -4
  66. package/protocol/openapi.json +1058 -0
  67. package/protocol/schemas/beat-manifest.schema.json +54 -0
  68. package/protocol/schemas/capabilities.schema.json +65 -0
  69. package/protocol/schemas/capability-token.schema.json +36 -0
  70. package/protocol/schemas/deep-link.schema.json +29 -0
  71. package/protocol/schemas/pulse-client.schema.json +8 -0
  72. package/protocol/schemas/upload-metadata.schema.json +45 -0
  73. package/protocol/schemas/view-link.schema.json +23 -0
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/beat-manifest.schema.json",
4
+ "title": "Beat manifest",
5
+ "description": "The `kind: project` artifact (e.g. `<draftId>-beats.pulse`) related to a pulse's video (PROTOCOL.md §8). A beat is a timestamp range inside the video: where one recorded clip starts and ends. Beats are contiguous and sum to `durationMs`.",
6
+ "type": "object",
7
+ "required": ["version", "type", "durationMs", "beats"],
8
+ "properties": {
9
+ "version": {
10
+ "type": "integer",
11
+ "const": 1,
12
+ "description": "Manifest format version."
13
+ },
14
+ "type": {
15
+ "type": "string",
16
+ "const": "beat-manifest",
17
+ "description": "Identifies the document."
18
+ },
19
+ "durationMs": {
20
+ "type": "number",
21
+ "minimum": 0,
22
+ "description": "True duration of the video, in milliseconds."
23
+ },
24
+ "beats": {
25
+ "type": "array",
26
+ "description": "One entry per recorded clip, in play order.",
27
+ "items": {
28
+ "type": "object",
29
+ "required": ["segmentId", "order", "startMs", "endMs"],
30
+ "properties": {
31
+ "segmentId": {
32
+ "type": "string",
33
+ "description": "The recorded clip's local id on the capturing device."
34
+ },
35
+ "order": {
36
+ "type": "integer",
37
+ "minimum": 0,
38
+ "description": "0-based position of the clip in the video."
39
+ },
40
+ "startMs": {
41
+ "type": "number",
42
+ "minimum": 0,
43
+ "description": "Where the clip starts in the video, in milliseconds."
44
+ },
45
+ "endMs": {
46
+ "type": "number",
47
+ "minimum": 0,
48
+ "description": "Where the clip ends; equals the next beat's `startMs`."
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/capabilities.schema.json",
4
+ "title": "GET /capabilities response",
5
+ "description": "Unauthenticated discovery (PROTOCOL.md §2). A client reads it before pairing and pairs only if its protocol range overlaps [minSupportedVersion, maxSupportedVersion]. Clients must ignore fields they don't recognize.",
6
+ "type": "object",
7
+ "required": [
8
+ "protocolVersion",
9
+ "protocolRevision",
10
+ "minSupportedVersion",
11
+ "maxSupportedVersion",
12
+ "kinds",
13
+ "allowedExtensions",
14
+ "maxUploadSize",
15
+ "checksum"
16
+ ],
17
+ "properties": {
18
+ "protocolVersion": {
19
+ "type": "integer",
20
+ "minimum": 1,
21
+ "description": "Protocol major this server implements. Also sent as the `Protocol-Version` header on every response."
22
+ },
23
+ "protocolRevision": {
24
+ "type": "string",
25
+ "pattern": "^[0-9]+\\.[0-9]+$",
26
+ "description": "Spec revision this server implements, `major.minor`. The minor counts additions older clients can ignore."
27
+ },
28
+ "minSupportedVersion": {
29
+ "type": "integer",
30
+ "minimum": 1,
31
+ "description": "Oldest protocol major this server accepts. Clients whose newest protocol is older get 426 Upgrade Required."
32
+ },
33
+ "maxSupportedVersion": {
34
+ "type": "integer",
35
+ "minimum": 1,
36
+ "description": "Newest protocol major this server accepts."
37
+ },
38
+ "kinds": {
39
+ "type": "array",
40
+ "items": { "type": "string", "enum": ["video", "project", "captions", "thumbnail"] },
41
+ "description": "Artifact kinds this server accepts."
42
+ },
43
+ "allowedExtensions": {
44
+ "type": "object",
45
+ "additionalProperties": { "type": "array", "items": { "type": "string" } },
46
+ "description": "Allowed file extensions per kind, lowercase with the leading dot."
47
+ },
48
+ "maxUploadSize": {
49
+ "type": "number",
50
+ "description": "Largest artifact the server accepts, in bytes."
51
+ },
52
+ "checksum": {
53
+ "type": "object",
54
+ "required": ["algorithms"],
55
+ "properties": {
56
+ "algorithms": { "type": "array", "items": { "type": "string" } }
57
+ },
58
+ "description": "Checksum algorithms accepted in `Upload-Metadata.checksum`."
59
+ },
60
+ "viewLinks": {
61
+ "type": "boolean",
62
+ "description": "Whether `POST {prefix}/artifacts/<id>/view-link` mints read-only view links (§6.4). Absent before protocol 2.2, which a client treats as false."
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/capability-token.schema.json",
4
+ "title": "Capability token claims",
5
+ "description": "The claims inside a capability token (PROTOCOL.md §5.4). The token is `base64url(JSON claims).signature`, HMAC-signed by the issuing deployment. It authorizes the artifact it names and any artifact whose `relatedTo` is that artifact.",
6
+ "type": "object",
7
+ "required": ["artifactId", "iat", "exp", "kid", "issuer"],
8
+ "properties": {
9
+ "artifactId": {
10
+ "type": "string",
11
+ "format": "uuid",
12
+ "description": "The artifact the token is for (the pulse's video)."
13
+ },
14
+ "iat": {
15
+ "type": "integer",
16
+ "description": "Issued at, in seconds since the Unix epoch."
17
+ },
18
+ "exp": {
19
+ "type": "integer",
20
+ "description": "Expires at, in seconds since the Unix epoch."
21
+ },
22
+ "kid": {
23
+ "type": "string",
24
+ "description": "Id of the signing key, so a deployment can rotate secrets."
25
+ },
26
+ "issuer": {
27
+ "type": "string",
28
+ "description": "The issuing deployment. A token from another issuer is rejected."
29
+ },
30
+ "use": {
31
+ "type": "string",
32
+ "enum": ["view"],
33
+ "description": "`view` on a read-only view token (§5.5), which only opens artifacts and is signed with a key derived from the secret. Absent on the capability token an upload uses."
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/deep-link.schema.json",
4
+ "title": "Pairing link query parameters",
5
+ "description": "The query parameters of a `pulsecam://?…` pairing link (PROTOCOL.md §3), as built by `buildUploadLink`. Clients must ignore parameters they don't recognize.",
6
+ "type": "object",
7
+ "required": ["v", "artifactId", "server"],
8
+ "properties": {
9
+ "v": {
10
+ "type": "string",
11
+ "const": "1",
12
+ "description": "Link format version. A client refuses a link whose `v` it doesn't know."
13
+ },
14
+ "artifactId": {
15
+ "type": "string",
16
+ "format": "uuid",
17
+ "description": "The artifact the pairing is for: the video's id. Related artifacts declare it as `relatedTo`."
18
+ },
19
+ "server": {
20
+ "type": "string",
21
+ "format": "uri",
22
+ "description": "Base URL of the server, including its path prefix (e.g. `https://vault.example.org/pulsevault`). The client builds every request as `${server}/<path>`."
23
+ },
24
+ "token": {
25
+ "type": "string",
26
+ "description": "Optional credential the client sends as `Authorization: Bearer`. Typically a capability token (capability-token.schema.json)."
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/pulse-client.schema.json",
4
+ "title": "Pulse-Client request header",
5
+ "description": "Since 2.1. Optional header a client sends on every request to say what it is and which protocol majors it speaks (PROTOCOL.md §7), e.g. `Pulse/2.1.0 (45; ios); protocol=1-2`. A server answers 426 Upgrade Required on uploads and artifacts when the client's newest protocol is older than its oldest. Without the header, nothing changes.",
6
+ "type": "string",
7
+ "pattern": "^[^;]+(;.*)?;\\s*protocol=[0-9]+(-[0-9]+)?\\s*$"
8
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/upload-metadata.schema.json",
4
+ "title": "TUS Upload-Metadata keys",
5
+ "description": "The decoded `Upload-Metadata` keys a client sends when it creates an upload (PROTOCOL.md §4). Values are strings, base64-encoded on the wire. Servers ignore keys they don't recognize.",
6
+ "type": "object",
7
+ "required": ["artifactId", "filename"],
8
+ "properties": {
9
+ "artifactId": {
10
+ "type": "string",
11
+ "format": "uuid",
12
+ "description": "The artifact's id. For the video it's the pairing link's `artifactId`; related artifacts use a fresh UUID. Legacy aliases `videoid` and `projectid` are still accepted."
13
+ },
14
+ "filename": {
15
+ "type": "string",
16
+ "description": "Original file name. Its extension must be allowed for `kind` (see `/capabilities`)."
17
+ },
18
+ "kind": {
19
+ "type": "string",
20
+ "enum": ["video", "project", "captions", "thumbnail"],
21
+ "default": "video",
22
+ "description": "Artifact kind. Defaults to `video`."
23
+ },
24
+ "relatedTo": {
25
+ "type": "string",
26
+ "format": "uuid",
27
+ "description": "The artifact this one belongs to: the video, for its captions, beat manifest and thumbnail. A capability token for the video also authorizes artifacts related to it."
28
+ },
29
+ "checksum": {
30
+ "type": "string",
31
+ "pattern": "^(sha256|sha1|md5):[0-9a-fA-F]+$",
32
+ "description": "`<algorithm>:<hex digest>` of the finished file, verified by servers that check checksums."
33
+ },
34
+ "name": {
35
+ "type": "string",
36
+ "maxLength": 512,
37
+ "description": "Display title (the draft name), sent on the video. Display-only; servers trim and cap it."
38
+ },
39
+ "appVersion": {
40
+ "type": "string",
41
+ "maxLength": 64,
42
+ "description": "Since 2.1. Version of the app that uploaded it, e.g. `2.1.0 (45)`. Stored with the artifact. Display-only; servers trim and cap it."
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mieweb/pulsevault/blob/main/protocol/schemas/view-link.schema.json",
4
+ "title": "POST /artifacts/<id>/view-link response",
5
+ "description": "A read-only view link to a finished artifact (PROTOCOL.md §6.4, protocol 2.2). The token opens the artifact, and the artifacts `relatedTo` it, as `GET {prefix}/artifacts/<id>?token=<token>` — nothing more, so it is safe to share. The server decides how long it works.",
6
+ "type": "object",
7
+ "required": [
8
+ "token",
9
+ "expiresAt"
10
+ ],
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "token": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "description": "The view token. Opaque to clients."
17
+ },
18
+ "expiresAt": {
19
+ "type": "integer",
20
+ "description": "When the link stops working, in seconds since the Unix epoch."
21
+ }
22
+ }
23
+ }