@andco/protocol 0.0.11 → 0.0.12

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 (120) hide show
  1. package/dist/api-errors.d.ts +5 -128
  2. package/dist/api-errors.d.ts.map +1 -1
  3. package/dist/api-errors.js +5 -131
  4. package/dist/authorization-preparation.d.ts +3 -3
  5. package/dist/authorization-preparation.d.ts.map +1 -1
  6. package/dist/authorization-preparation.js +4 -0
  7. package/dist/authorization.js +2 -2
  8. package/dist/errors.d.ts +52 -16
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +52 -12
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/intent-input.d.ts +1791 -725
  15. package/dist/intent-input.d.ts.map +1 -1
  16. package/dist/intent-input.js +325 -157
  17. package/dist/issues.d.ts +61 -0
  18. package/dist/issues.d.ts.map +1 -0
  19. package/dist/issues.js +61 -0
  20. package/dist/messages/index.d.ts +2 -2
  21. package/dist/messages/index.d.ts.map +1 -1
  22. package/dist/messages/index.js +10 -3
  23. package/dist/messages/set-preferences.d.ts +13 -1
  24. package/dist/messages/set-preferences.d.ts.map +1 -1
  25. package/dist/messages/set-preferences.js +31 -9
  26. package/dist/miniapp-manifest.d.ts +2 -2
  27. package/dist/miniapp-manifest.d.ts.map +1 -1
  28. package/dist/miniapp-manifest.js +1 -1
  29. package/dist/native-intent.d.ts +48 -28
  30. package/dist/native-intent.d.ts.map +1 -1
  31. package/dist/native-intent.js +76 -24
  32. package/dist/pagination.d.ts +37 -31
  33. package/dist/pagination.d.ts.map +1 -1
  34. package/dist/pagination.js +72 -24
  35. package/dist/rar/account-matchers.d.ts +47 -240
  36. package/dist/rar/account-matchers.d.ts.map +1 -1
  37. package/dist/rar/account-matchers.js +52 -131
  38. package/dist/rar/bank.d.ts +280 -392
  39. package/dist/rar/bank.d.ts.map +1 -1
  40. package/dist/rar/bank.js +68 -137
  41. package/dist/rar/catalog.d.ts +305 -288
  42. package/dist/rar/catalog.d.ts.map +1 -1
  43. package/dist/rar/catalog.js +69 -29
  44. package/dist/rar/detail.d.ts +15 -32
  45. package/dist/rar/detail.d.ts.map +1 -1
  46. package/dist/rar/detail.js +14 -34
  47. package/dist/rar/index.d.ts +2 -1
  48. package/dist/rar/index.d.ts.map +1 -1
  49. package/dist/rar/index.js +2 -1
  50. package/dist/rar/json-schemas.generated.d.ts +4 -0
  51. package/dist/rar/json-schemas.generated.d.ts.map +1 -0
  52. package/dist/rar/json-schemas.generated.js +3570 -0
  53. package/dist/rar/money.d.ts +5 -5
  54. package/dist/rar/money.d.ts.map +1 -1
  55. package/dist/rar/money.js +5 -5
  56. package/dist/rar/project-users.d.ts +40 -14
  57. package/dist/rar/project-users.d.ts.map +1 -1
  58. package/dist/rar/project-users.js +20 -23
  59. package/dist/rar/subject-data.d.ts +96 -48
  60. package/dist/rar/subject-data.d.ts.map +1 -1
  61. package/dist/rar/subject-data.js +61 -34
  62. package/dist/rar/subject.d.ts +18 -85
  63. package/dist/rar/subject.d.ts.map +1 -1
  64. package/dist/rar/subject.js +23 -51
  65. package/dist/rest/accounts.d.ts +347 -0
  66. package/dist/rest/accounts.d.ts.map +1 -0
  67. package/dist/rest/accounts.js +108 -0
  68. package/dist/rest/addresses.d.ts +581 -0
  69. package/dist/rest/addresses.d.ts.map +1 -0
  70. package/dist/rest/addresses.js +190 -0
  71. package/dist/rest/api-error.d.ts +104 -0
  72. package/dist/rest/api-error.d.ts.map +1 -0
  73. package/dist/rest/api-error.js +103 -0
  74. package/dist/rest/authorization.d.ts +123 -0
  75. package/dist/rest/authorization.d.ts.map +1 -0
  76. package/dist/rest/authorization.js +62 -0
  77. package/dist/rest/catalog.d.ts +199 -0
  78. package/dist/rest/catalog.d.ts.map +1 -0
  79. package/dist/rest/catalog.js +63 -0
  80. package/dist/rest/common.d.ts +637 -0
  81. package/dist/rest/common.d.ts.map +1 -0
  82. package/dist/rest/common.js +172 -0
  83. package/dist/rest/contract.d.ts +3480 -0
  84. package/dist/rest/contract.d.ts.map +1 -0
  85. package/dist/rest/contract.js +120 -0
  86. package/dist/rest/events.d.ts +145 -0
  87. package/dist/rest/events.d.ts.map +1 -0
  88. package/dist/rest/events.js +42 -0
  89. package/dist/rest/http.d.ts +49 -0
  90. package/dist/rest/http.d.ts.map +1 -0
  91. package/dist/rest/http.js +25 -0
  92. package/dist/rest/identity.d.ts +627 -0
  93. package/dist/rest/identity.d.ts.map +1 -0
  94. package/dist/rest/identity.js +128 -0
  95. package/dist/rest/index.d.ts +14 -0
  96. package/dist/rest/index.d.ts.map +1 -0
  97. package/dist/rest/index.js +13 -0
  98. package/dist/rest/intents.d.ts +4556 -0
  99. package/dist/rest/intents.d.ts.map +1 -0
  100. package/dist/rest/intents.js +551 -0
  101. package/dist/rest/signatures.d.ts +110 -0
  102. package/dist/rest/signatures.d.ts.map +1 -0
  103. package/dist/rest/signatures.js +113 -0
  104. package/dist/rest/subjects.d.ts +14 -0
  105. package/dist/rest/subjects.d.ts.map +1 -0
  106. package/dist/rest/subjects.js +22 -0
  107. package/dist/service-grants.d.ts +2 -2
  108. package/dist/service-grants.d.ts.map +1 -1
  109. package/dist/service-grants.js +1 -1
  110. package/dist/transport/generated/oauth-api.d.ts +5547 -1448
  111. package/dist/transport/generated/oauth-api.d.ts.map +1 -1
  112. package/dist/transport/intents.d.ts +9 -134
  113. package/dist/transport/intents.d.ts.map +1 -1
  114. package/dist/transport/intents.js +21 -405
  115. package/dist/transport/rest.d.ts +15 -5
  116. package/dist/transport/rest.d.ts.map +1 -1
  117. package/dist/userinfo.d.ts +22 -9
  118. package/dist/userinfo.d.ts.map +1 -1
  119. package/dist/userinfo.js +17 -12
  120. package/package.json +13 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/rest/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,aAAa,CAoEtD,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { AccountClosureIntentCreateSchema, AccountOpeningIntentCreateSchema, DepositIntentCreateSchema, IntentAccountExternalSchema, IntentAccountIdSchema, IntentAccountKeySchema, IntentAccountSchema, IntentAmountSchema, IntentCancellationSchema, IntentNoteSchema, IntentRejectionSchema, SignedAccountClosureIntentClaimsSchema, SignedAccountOpeningIntentClaimsSchema, SignedAmountSchema, SignedTransferIntentClaimsSchema, TransferAmountProposalSchema, TransferDestinationProposalSchema, TransferDestinationSchema, TransferIntentCreateSchema, } from "../intent-input.js";
2
+ import { UserInfo } from "../userinfo.js";
3
+ import { AccountPage, BankAccount, BankTransaction, BankTransactionPage, listAccounts, listAccountTransactions, } from "./accounts.js";
4
+ import { Address, AddressCreate, AddressMutationResult, AddressPage, AddressUpdate, createOrganizationAddress, createProfileAddress, deleteOrganizationAddress, deleteProfileAddress, listOrganizationAddresses, listProfileAddresses, updateOrganizationAddress, updateProfileAddress, } from "./addresses.js";
5
+ import { ApplicationGrantSubject, GrantActor, GrantAuthorization, GrantHolder, GrantSubject, getGrantAuthorization, OrganizationGrantHolder, ProfileGrantHolder, ProfileGrantSubject, } from "./authorization.js";
6
+ import { BankCatalogEntry, BankCatalogPage, getBankCatalog, getPermissionCatalog, PermissionCatalogEntry, PermissionCatalogPage, } from "./catalog.js";
7
+ import { PageInfo } from "./common.js";
8
+ import { FinancialEvent, FinancialEventPage, readAccountEvents, readOrganizationEvents } from "./events.js";
9
+ import { getUserInfo, IdentityValidation, listOrganizationIdentities, listProfileIdentities, listProfileOrganizations, listProjectProfiles, Organization, OrganizationIdentity, OrganizationIdentityPage, OrganizationPage, ProfileIdentity, ProfileIdentityPage, ProjectProfile, ProjectProfilePage, } from "./identity.js";
10
+ import { AccountClosureIntent, AccountOpeningIntent, approveIntent, cancelIntent, closeDeposit, createIntent, DepositCloseResult, DepositDestination, DepositIntent, DepositProgress, DepositTarget, DepositTransaction, getIntent, Intent, IntentStatus, readIntentEvents, rejectIntent, TransferAmount, TransferIntent, TransferSettlement, } from "./intents.js";
11
+ import { SignedInstructionVerification, verifySignature } from "./signatures.js";
12
+ /**
13
+ * The operations of the Andco OAuth Resource API, each under its `operationId`. `@andco/protocol`
14
+ * declares them once (ADR 0038): Platform implements them with `implement(contract)` and the
15
+ * OpenAPI document, `openapi/oauth-api.yaml`, is generated from them (`pnpm generate:openapi`).
16
+ */
17
+ export const contract = {
18
+ createOrganizationAddress,
19
+ createProfileAddress,
20
+ deleteOrganizationAddress,
21
+ deleteProfileAddress,
22
+ approveIntent,
23
+ cancelIntent,
24
+ closeDeposit,
25
+ createIntent,
26
+ getBankCatalog,
27
+ getIntent,
28
+ getGrantAuthorization,
29
+ getPermissionCatalog,
30
+ getUserInfo,
31
+ listAccounts,
32
+ listAccountTransactions,
33
+ listOrganizationAddresses,
34
+ listOrganizationIdentities,
35
+ listProfileAddresses,
36
+ listProfileIdentities,
37
+ listProfileOrganizations,
38
+ listProjectProfiles,
39
+ readAccountEvents,
40
+ readIntentEvents,
41
+ readOrganizationEvents,
42
+ updateOrganizationAddress,
43
+ updateProfileAddress,
44
+ rejectIntent,
45
+ verifySignature,
46
+ };
47
+ /**
48
+ * The Valibot schemas the OpenAPI document writes once under `components.schemas`, by name, and
49
+ * refers to wherever an operation uses them. A schema listed here keeps its name in the document;
50
+ * one that is not is written inline.
51
+ */
52
+ export const components = {
53
+ AccountClosureIntent,
54
+ AccountClosureIntentCreate: AccountClosureIntentCreateSchema,
55
+ AccountOpeningIntent,
56
+ AccountOpeningIntentCreate: AccountOpeningIntentCreateSchema,
57
+ AccountPage,
58
+ Address,
59
+ AddressCreate,
60
+ AddressMutationResult,
61
+ AddressPage,
62
+ AddressUpdate,
63
+ ApplicationGrantSubject,
64
+ BankAccount,
65
+ BankCatalogEntry,
66
+ BankCatalogPage,
67
+ BankTransaction,
68
+ BankTransactionPage,
69
+ DepositCloseResult,
70
+ DepositDestination,
71
+ DepositIntent,
72
+ DepositIntentCreate: DepositIntentCreateSchema,
73
+ DepositProgress,
74
+ DepositTarget,
75
+ DepositTransaction,
76
+ FinancialEvent,
77
+ FinancialEventPage,
78
+ GrantActor,
79
+ GrantAuthorization,
80
+ GrantHolder,
81
+ GrantSubject,
82
+ IdentityValidation,
83
+ Intent,
84
+ IntentAccount: IntentAccountSchema,
85
+ IntentAccountExternal: IntentAccountExternalSchema,
86
+ IntentAccountId: IntentAccountIdSchema,
87
+ IntentAccountKey: IntentAccountKeySchema,
88
+ IntentAmount: IntentAmountSchema,
89
+ IntentCancellation: IntentCancellationSchema,
90
+ IntentNote: IntentNoteSchema,
91
+ IntentRejection: IntentRejectionSchema,
92
+ IntentStatus,
93
+ Organization,
94
+ OrganizationGrantHolder,
95
+ OrganizationIdentity,
96
+ OrganizationIdentityPage,
97
+ OrganizationPage,
98
+ PageInfo,
99
+ PermissionCatalogEntry,
100
+ PermissionCatalogPage,
101
+ ProfileGrantHolder,
102
+ ProfileGrantSubject,
103
+ ProfileIdentity,
104
+ ProfileIdentityPage,
105
+ ProjectProfile,
106
+ ProjectProfilePage,
107
+ UserInfo,
108
+ SignedAccountClosureIntentClaims: SignedAccountClosureIntentClaimsSchema,
109
+ SignedAccountOpeningIntentClaims: SignedAccountOpeningIntentClaimsSchema,
110
+ SignedAmount: SignedAmountSchema,
111
+ SignedInstructionVerification,
112
+ SignedTransferIntentClaims: SignedTransferIntentClaimsSchema,
113
+ TransferAmount,
114
+ TransferAmountProposal: TransferAmountProposalSchema,
115
+ TransferDestination: TransferDestinationSchema,
116
+ TransferDestinationProposal: TransferDestinationProposalSchema,
117
+ TransferIntent,
118
+ TransferIntentCreate: TransferIntentCreateSchema,
119
+ TransferSettlement,
120
+ };
@@ -0,0 +1,145 @@
1
+ import * as v from "valibot";
2
+ import { InsufficientAuthorization, InvalidIdentifier, InvalidOrigin, InvalidRequest, InvalidToken, NotFound, ServerError, TemporarilyUnavailable, UnsupportedVersion } from "./common.js";
3
+ /**
4
+ * A durable financial fact. Presentation messages are never financial events. `type` names the fact
5
+ * (`deposit.closed`, `account_opening.succeeded`) and `payload` carries what it says.
6
+ */
7
+ export declare const FinancialEvent: v.ObjectSchema<{
8
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
9
+ readonly type: v.StringSchema<undefined>;
10
+ readonly payload: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
11
+ readonly version: v.LiteralSchema<1, undefined>;
12
+ readonly occurred_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
13
+ }, undefined>;
14
+ /** A durable financial fact. */
15
+ export type FinancialEvent = v.InferOutput<typeof FinancialEvent>;
16
+ /** A page of the facts an exact Grant covers, in publication order. */
17
+ export declare const FinancialEventPage: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
18
+ readonly edges: v.ArraySchema<v.StrictObjectSchema<{
19
+ readonly cursor: v.StringSchema<undefined>;
20
+ readonly node: v.ObjectSchema<{
21
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
22
+ readonly type: v.StringSchema<undefined>;
23
+ readonly payload: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
24
+ readonly version: v.LiteralSchema<1, undefined>;
25
+ readonly occurred_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
26
+ }, undefined>;
27
+ }, undefined>, undefined>;
28
+ readonly pageInfo: v.StrictObjectSchema<{
29
+ readonly startCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
30
+ readonly endCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
31
+ readonly hasPreviousPage: v.BooleanSchema<undefined>;
32
+ readonly hasNextPage: v.BooleanSchema<undefined>;
33
+ }, undefined>;
34
+ }, undefined>, v.DescriptionAction<{
35
+ edges: {
36
+ cursor: string;
37
+ node: {
38
+ id: string;
39
+ type: string;
40
+ payload: {
41
+ [x: string]: unknown;
42
+ };
43
+ version: 1;
44
+ occurred_at: string;
45
+ };
46
+ }[];
47
+ pageInfo: {
48
+ startCursor: string | null;
49
+ endCursor: string | null;
50
+ hasPreviousPage: boolean;
51
+ hasNextPage: boolean;
52
+ };
53
+ }, string>]>;
54
+ /** Replays every fact the exact Grant covers across the Organization. */
55
+ export declare const readOrganizationEvents: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.ObjectSchema<{
56
+ readonly offset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "Nonnegative position in live ordered results.">]>, undefined>;
57
+ readonly limit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Offset page size; do not combine with cursor arguments.">]>;
58
+ readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.DescriptionAction<string, "Opaque cursor previously returned by this collection.">]>, undefined>;
59
+ readonly last: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Cursor page size; forward and backward argument families are exclusive.">]>;
60
+ readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.DescriptionAction<string, "Opaque cursor previously returned by this collection.">]>, undefined>;
61
+ readonly first: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Cursor page size; forward and backward argument families are exclusive.">]>;
62
+ }, undefined>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
63
+ readonly edges: v.ArraySchema<v.StrictObjectSchema<{
64
+ readonly cursor: v.StringSchema<undefined>;
65
+ readonly node: v.ObjectSchema<{
66
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
67
+ readonly type: v.StringSchema<undefined>;
68
+ readonly payload: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
69
+ readonly version: v.LiteralSchema<1, undefined>;
70
+ readonly occurred_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
71
+ }, undefined>;
72
+ }, undefined>, undefined>;
73
+ readonly pageInfo: v.StrictObjectSchema<{
74
+ readonly startCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
75
+ readonly endCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
76
+ readonly hasPreviousPage: v.BooleanSchema<undefined>;
77
+ readonly hasNextPage: v.BooleanSchema<undefined>;
78
+ }, undefined>;
79
+ }, undefined>, v.DescriptionAction<{
80
+ edges: {
81
+ cursor: string;
82
+ node: {
83
+ id: string;
84
+ type: string;
85
+ payload: {
86
+ [x: string]: unknown;
87
+ };
88
+ version: 1;
89
+ occurred_at: string;
90
+ };
91
+ }[];
92
+ pageInfo: {
93
+ startCursor: string | null;
94
+ endCursor: string | null;
95
+ hasPreviousPage: boolean;
96
+ hasNextPage: boolean;
97
+ };
98
+ }, string>]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidRequest, typeof InvalidToken, typeof InvalidOrigin, typeof UnsupportedVersion, typeof ServerError, typeof TemporarilyUnavailable]>>;
99
+ /** Replays the bank facts of one account the Grant lets the application read. */
100
+ export declare const readAccountEvents: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.ObjectSchema<{
101
+ readonly offset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "Nonnegative position in live ordered results.">]>, undefined>;
102
+ readonly limit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Offset page size; do not combine with cursor arguments.">]>;
103
+ readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.DescriptionAction<string, "Opaque cursor previously returned by this collection.">]>, undefined>;
104
+ readonly last: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Cursor page size; forward and backward argument families are exclusive.">]>;
105
+ readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.DescriptionAction<string, "Opaque cursor previously returned by this collection.">]>, undefined>;
106
+ readonly first: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Cursor page size; forward and backward argument families are exclusive.">]>;
107
+ readonly bank_account_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
108
+ }, undefined>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
109
+ readonly edges: v.ArraySchema<v.StrictObjectSchema<{
110
+ readonly cursor: v.StringSchema<undefined>;
111
+ readonly node: v.ObjectSchema<{
112
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
113
+ readonly type: v.StringSchema<undefined>;
114
+ readonly payload: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
115
+ readonly version: v.LiteralSchema<1, undefined>;
116
+ readonly occurred_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
117
+ }, undefined>;
118
+ }, undefined>, undefined>;
119
+ readonly pageInfo: v.StrictObjectSchema<{
120
+ readonly startCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
121
+ readonly endCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
122
+ readonly hasPreviousPage: v.BooleanSchema<undefined>;
123
+ readonly hasNextPage: v.BooleanSchema<undefined>;
124
+ }, undefined>;
125
+ }, undefined>, v.DescriptionAction<{
126
+ edges: {
127
+ cursor: string;
128
+ node: {
129
+ id: string;
130
+ type: string;
131
+ payload: {
132
+ [x: string]: unknown;
133
+ };
134
+ version: 1;
135
+ occurred_at: string;
136
+ };
137
+ }[];
138
+ pageInfo: {
139
+ startCursor: string | null;
140
+ endCursor: string | null;
141
+ hasPreviousPage: boolean;
142
+ hasNextPage: boolean;
143
+ };
144
+ }, string>]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidRequest, typeof InvalidIdentifier, typeof InvalidToken, typeof InvalidOrigin, typeof InsufficientAuthorization, typeof NotFound, typeof UnsupportedVersion, typeof ServerError, typeof TemporarilyUnavailable]>>;
145
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/rest/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAEL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EAER,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;aAMzB,CAAC;AAEH,gCAAgC;AAChC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAElE,uEAAuE;AACvE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAG9B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mNAaN,CAAC;AAE9B,iFAAiF;AACjF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gSAwBD,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { oc } from "@orpc/contract";
2
+ import * as v from "valibot";
3
+ import { errors } from "./api-error.js";
4
+ import { connection, InsufficientAuthorization, InvalidIdentifier, InvalidOrigin, InvalidRequest, InvalidToken, NotFound, PageQuery, ServerError, TemporarilyUnavailable, UnsupportedVersion, } from "./common.js";
5
+ import { http } from "./http.js";
6
+ /**
7
+ * A durable financial fact. Presentation messages are never financial events. `type` names the fact
8
+ * (`deposit.closed`, `account_opening.succeeded`) and `payload` carries what it says.
9
+ */
10
+ export const FinancialEvent = /* @__PURE__ */ v.object({
11
+ id: v.pipe(v.string(), v.uuid()),
12
+ type: v.string(),
13
+ payload: v.record(v.string(), v.unknown()),
14
+ version: v.literal(1),
15
+ occurred_at: v.pipe(v.string(), v.isoTimestamp()),
16
+ });
17
+ /** A page of the facts an exact Grant covers, in publication order. */
18
+ export const FinancialEventPage = /* @__PURE__ */ connection(FinancialEvent, "A standard connection. Edge cursors remain present on nonempty terminal pages. Reads are live; offset positions can shift under concurrent changes.");
19
+ /** Replays every fact the exact Grant covers across the Organization. */
20
+ export const readOrganizationEvents = /* @__PURE__ */ oc
21
+ .meta(http({
22
+ method: "GET",
23
+ path: "/events",
24
+ summary: "Replay every fact the exact Grant covers across the Organization",
25
+ description: "One subscription for the whole Organization instead of one per account. Carries the same Intent facts as `/intents/{intent_id}/events` and the same account facts as `/accounts/{bank_account_id}/events`, re-evaluated as the Grant changes, so a Project never opens one subscription per account it may come to hold. Returns edges and camelCase pageInfo. Cursor and offset argument families cannot be mixed.",
26
+ successDescription: "Authorized event page in publication order",
27
+ }))
28
+ .errors(errors(InvalidRequest, InvalidToken, InvalidOrigin, UnsupportedVersion, ServerError, TemporarilyUnavailable))
29
+ .input(v.object({ ...PageQuery }))
30
+ .output(FinancialEventPage);
31
+ /** Replays the bank facts of one account the Grant lets the application read. */
32
+ export const readAccountEvents = /* @__PURE__ */ oc
33
+ .meta(http({
34
+ method: "GET",
35
+ path: "/accounts/{bank_account_id}/events",
36
+ summary: "Replay bank facts with account transaction read permission",
37
+ description: "Returns edges and camelCase pageInfo. Cursor and offset argument families cannot be mixed.",
38
+ successDescription: "Authorized event page in publication order",
39
+ }))
40
+ .errors(errors(InvalidRequest, InvalidIdentifier, InvalidToken, InvalidOrigin, InsufficientAuthorization, NotFound, UnsupportedVersion, ServerError, TemporarilyUnavailable))
41
+ .input(v.object({ bank_account_id: v.pipe(v.string(), v.uuid()), ...PageQuery }))
42
+ .output(FinancialEventPage);
@@ -0,0 +1,49 @@
1
+ import type { MetaPlugin } from "@orpc/contract";
2
+ /**
3
+ * How an operation of the contract is served over HTTP and described in the OpenAPI: the subset of
4
+ * `@orpc/openapi`'s `OpenAPIMeta` the contract uses, copied so that `@andco/protocol` depends on
5
+ * `@orpc/contract` alone (ADR 0038).
6
+ *
7
+ * The `operationId` is not here: an operation's key in the contract is its `operationId`.
8
+ */
9
+ export interface HttpMeta {
10
+ /** The HTTP method. */
11
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
12
+ /** The path relative to the server URL (`https://andco.com/oauth/api/versions/{version}`), with `{param}` segments. */
13
+ path: `/${string}`;
14
+ /** A one-line summary of the operation. */
15
+ summary?: string | undefined;
16
+ /** The operation's description, in Markdown. */
17
+ description?: string | undefined;
18
+ /** The tags that group the operation in the reference. */
19
+ tags?: string[] | undefined;
20
+ /** The status of a successful answer. Defaults to `200`. */
21
+ successStatus?: number | undefined;
22
+ /** The description of a successful answer. */
23
+ successDescription?: string | undefined;
24
+ /**
25
+ * `compact` (the default) reads the input as the body, or as the query of a `GET`, with path
26
+ * parameters merged in; `detailed` reads it as `{ params, query, headers, body }`.
27
+ */
28
+ inputStructure?: "compact" | "detailed" | undefined;
29
+ /** `compact` (the default) answers the output as the body; `detailed` as `{ status, headers, body }`. */
30
+ outputStructure?: "compact" | "detailed" | undefined;
31
+ /**
32
+ * Overrides the generated OpenAPI Operation Object, for what the meta cannot say: the function
33
+ * receives the generated operation and returns the one to write.
34
+ */
35
+ spec?: ((operation: Record<string, unknown>) => Record<string, unknown>) | undefined;
36
+ }
37
+ /**
38
+ * Declares how an operation of the contract is served over HTTP.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * export const getUserInfo = oc
43
+ * .meta(http({ method: "GET", path: "/userinfo", tags: ["identity"] }))
44
+ * .errors(errors(InvalidToken, TemporarilyUnavailable))
45
+ * .output(UserInfo);
46
+ * ```
47
+ */
48
+ export declare function http(meta: HttpMeta): MetaPlugin<any, any, any>;
49
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/rest/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,uBAAuB;IACvB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,uHAAuH;IACvH,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IACnB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5B,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACpD,yGAAyG;IACzG,eAAe,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACrD;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACtF;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAQ9D"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The name `@orpc/openapi` reads an operation's HTTP meta from. It is an internal of oRPC: if a new
3
+ * version renames it, the generated document loses its paths, and `tests/rest/openapi.test.ts` fails.
4
+ */
5
+ const OPENAPI_META_KEY = "~openapi";
6
+ /**
7
+ * Declares how an operation of the contract is served over HTTP.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * export const getUserInfo = oc
12
+ * .meta(http({ method: "GET", path: "/userinfo", tags: ["identity"] }))
13
+ * .errors(errors(InvalidToken, TemporarilyUnavailable))
14
+ * .output(UserInfo);
15
+ * ```
16
+ */
17
+ export function http(meta) {
18
+ return {
19
+ name: OPENAPI_META_KEY,
20
+ init(current) {
21
+ const previous = current[OPENAPI_META_KEY];
22
+ return { ...current, [OPENAPI_META_KEY]: { ...previous, ...meta } };
23
+ },
24
+ };
25
+ }