Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions clients/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions clients/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
},
"devDependencies": {
"@types/node": "24.10.1",
"ajv": "8.20.0",
"ajv-formats": "3.0.1",
"playwright-core": "1.63.0",
"typescript": "5.9.3"
},
Expand Down
7 changes: 4 additions & 3 deletions clients/typescript/tests/acceptance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ for (const { answer, reason, requestInput, options, extra } of [
test('service Proposal start and attach keep the existing HTTP exchange', async () => {
const draft = JSON.parse(readFileSync(new URL('./fixtures/tasks/proposal-draft-optional.json', import.meta.url), 'utf8'))
const attached = JSON.parse(readFileSync(new URL('./fixtures/tasks/proposal-draft-attached.json', import.meta.url), 'utf8'))
const proposalPath = `/v1/proposals/${draft.id}`
const requests: Array<{ method: string; path: string; query: string; headers: Headers; body: RequestInit['body'] }> = []
let view = draft
const client = facility({ baseUrl, fetch: async (url, init) => {
Expand All @@ -80,9 +81,9 @@ test('service Proposal start and attach keep the existing HTTP exchange', async
await client.facility.proposals.attach(proposal, 'supporting-document', file)
assert.deepEqual(requests.map(({ method, path }) => [method, path]), [
['POST', '/v1/actions/correct-address/proposals'],
['GET', '/v1/proposals/prop-1'],
['PATCH', '/v1/proposals/prop-1/attachments/supporting-document'],
['GET', '/v1/proposals/prop-1'],
['GET', proposalPath],
['PATCH', `${proposalPath}/attachments/supporting-document`],
['GET', proposalPath],
])
assert.ok(requests.every(({ query }) => query === '?accessProfile=facility-correction-author'))
assert.deepEqual(JSON.parse(String(requests[0]?.body)), { input: { city: 'Springfield' } })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"id": "prop-1",
"id": "9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"actionId": "correct-address",
"actionRevision": "rev-a",
"state": "submitted",
"status": "awaiting-party",
"turn": "party",
"submissionVersion": 1,
"revision": 5,
Expand All @@ -26,7 +27,7 @@
"accessProfile": "facility-correction-author",
"method": "GET",
"operation": "download",
"path": "/v1/proposals/prop-1/attachments/supporting-document?submissionVersion=1",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/attachments/supporting-document?submissionVersion=1",
"availability": {
"observedRevision": 3,
"available": true
Expand All @@ -47,7 +48,7 @@
"accessProfile": "facility-correction-author",
"method": "GET",
"operation": "get",
"path": "/v1/proposals/prop-1",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"availability": {
"observedRevision": 5,
"available": true
Expand All @@ -57,7 +58,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "edit",
"path": "/v1/proposals/prop-1/edit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/edit",
"ifMatch": "\"etag-5\"",
"availability": {
"observedRevision": 5,
Expand All @@ -70,7 +71,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "submit",
"path": "/v1/proposals/prop-1/submit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/submit",
"ifMatch": "\"etag-5\"",
"availability": {
"observedRevision": 5,
Expand All @@ -83,7 +84,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "revise",
"path": "/v1/proposals/prop-1/revise",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/revise",
"ifMatch": "\"etag-5\"",
"availability": {
"observedRevision": 5,
Expand All @@ -96,7 +97,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "cancel",
"path": "/v1/proposals/prop-1/cancel",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/cancel",
"ifMatch": "\"etag-5\"",
"availability": {
"observedRevision": 5,
Expand All @@ -107,7 +108,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "rebase",
"path": "/v1/proposals/prop-1/rebase",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/rebase",
"ifMatch": "\"etag-5\"",
"availability": {
"observedRevision": 5,
Expand Down
15 changes: 8 additions & 7 deletions clients/typescript/tests/fixtures/tasks/proposal-applied.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"id": "prop-1",
"id": "9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"actionId": "correct-address",
"actionRevision": "rev-a",
"state": "applied",
"status": "applied",
"turn": "nobody",
"submissionVersion": 1,
"revision": 8,
Expand All @@ -18,7 +19,7 @@
"accessProfile": "facility-correction-author",
"method": "GET",
"operation": "get",
"path": "/v1/proposals/prop-1",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"availability": {
"observedRevision": 8,
"available": true
Expand All @@ -28,7 +29,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "edit",
"path": "/v1/proposals/prop-1/edit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/edit",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -41,7 +42,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "submit",
"path": "/v1/proposals/prop-1/submit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/submit",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -54,7 +55,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "revise",
"path": "/v1/proposals/prop-1/revise",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/revise",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -67,7 +68,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "cancel",
"path": "/v1/proposals/prop-1/cancel",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/cancel",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -80,7 +81,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "rebase",
"path": "/v1/proposals/prop-1/rebase",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/rebase",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand Down
15 changes: 8 additions & 7 deletions clients/typescript/tests/fixtures/tasks/proposal-approved.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"id": "prop-1",
"id": "9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"actionId": "correct-address",
"actionRevision": "rev-a",
"state": "submitted",
"status": "approved",
"turn": "nobody",
"submissionVersion": 1,
"revision": 7,
Expand All @@ -18,7 +19,7 @@
"accessProfile": "facility-correction-author",
"method": "GET",
"operation": "get",
"path": "/v1/proposals/prop-1",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"availability": {
"observedRevision": 7,
"available": true
Expand All @@ -28,7 +29,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "edit",
"path": "/v1/proposals/prop-1/edit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/edit",
"ifMatch": "\"etag-7\"",
"availability": {
"observedRevision": 7,
Expand All @@ -41,7 +42,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "submit",
"path": "/v1/proposals/prop-1/submit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/submit",
"ifMatch": "\"etag-7\"",
"availability": {
"observedRevision": 7,
Expand All @@ -54,7 +55,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "revise",
"path": "/v1/proposals/prop-1/revise",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/revise",
"ifMatch": "\"etag-7\"",
"availability": {
"observedRevision": 7,
Expand All @@ -65,7 +66,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "cancel",
"path": "/v1/proposals/prop-1/cancel",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/cancel",
"ifMatch": "\"etag-7\"",
"availability": {
"observedRevision": 7,
Expand All @@ -76,7 +77,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "rebase",
"path": "/v1/proposals/prop-1/rebase",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/rebase",
"ifMatch": "\"etag-7\"",
"availability": {
"observedRevision": 7,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"id": "prop-1",
"id": "9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"actionId": "correct-address",
"actionRevision": "rev-a",
"state": "cancelled",
"status": "cancelled",
"turn": "nobody",
"submissionVersion": 1,
"revision": 8,
Expand All @@ -18,7 +19,7 @@
"accessProfile": "facility-correction-author",
"method": "GET",
"operation": "get",
"path": "/v1/proposals/prop-1",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44",
"availability": {
"observedRevision": 8,
"available": true
Expand All @@ -28,7 +29,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "edit",
"path": "/v1/proposals/prop-1/edit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/edit",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -41,7 +42,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "submit",
"path": "/v1/proposals/prop-1/submit",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/submit",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -54,7 +55,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "revise",
"path": "/v1/proposals/prop-1/revise",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/revise",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -67,7 +68,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "cancel",
"path": "/v1/proposals/prop-1/cancel",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/cancel",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand All @@ -80,7 +81,7 @@
"accessProfile": "facility-correction-author",
"method": "POST",
"operation": "rebase",
"path": "/v1/proposals/prop-1/rebase",
"path": "/v1/proposals/9a7ce3fb-c931-4d60-8991-7f6d395f0c44/rebase",
"ifMatch": "\"etag-8\"",
"availability": {
"observedRevision": 8,
Expand Down
Loading