@farthershore/client 0.3.0 → 0.5.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +10 -2
  3. package/dist/index.js +221 -111
  4. package/dist/types/api.generated.d.ts +18 -38
  5. package/dist/types/credentials.d.ts +6 -2
  6. package/dist/types/envelope.d.ts +2 -0
  7. package/dist/types/errors.d.ts +13 -0
  8. package/dist/types/generated/schemas.d.ts +71 -28
  9. package/dist/types/helpers/refs.d.ts +2 -2
  10. package/dist/types/index.d.ts +1 -1
  11. package/dist/types/operations/agents.d.ts +9 -9
  12. package/dist/types/operations/agreements.d.ts +7 -7
  13. package/dist/types/operations/analytics.d.ts +5 -5
  14. package/dist/types/operations/audit-notifications.d.ts +6 -6
  15. package/dist/types/operations/auth.d.ts +4 -4
  16. package/dist/types/operations/backends.d.ts +8 -11
  17. package/dist/types/operations/billing.d.ts +3 -10
  18. package/dist/types/operations/businesses.d.ts +29 -30
  19. package/dist/types/operations/change-sets.d.ts +6 -6
  20. package/dist/types/operations/consumers.d.ts +13 -13
  21. package/dist/types/operations/define.d.ts +13 -3
  22. package/dist/types/operations/environments.d.ts +5 -4
  23. package/dist/types/operations/frontend.d.ts +2 -2
  24. package/dist/types/operations/index.d.ts +307 -220
  25. package/dist/types/operations/maker-tokens.d.ts +9 -9
  26. package/dist/types/operations/organizations.d.ts +19 -31
  27. package/dist/types/operations/personas.d.ts +8 -8
  28. package/dist/types/operations/plans-usage.d.ts +3 -3
  29. package/dist/types/operations/platform.d.ts +18 -18
  30. package/dist/types/operations/portal.d.ts +11 -11
  31. package/dist/types/operations/promo-codes.d.ts +15 -5
  32. package/dist/types/operations/variables.d.ts +22 -8
  33. package/dist/types/operations/webhooks.d.ts +107 -14
  34. package/dist/types/surface-types.d.ts +16 -10
  35. package/dist/types/types.d.ts +4 -1
  36. package/dist/types/version.d.ts +2 -2
  37. package/package.json +1 -1
@@ -8,6 +8,7 @@ type PromoCodeRef = BusinessRef & {
8
8
  export declare const promoCodeOperations: {
9
9
  "promoCodes.read": import("./define.js").OperationEntry<BusinessRef, {
10
10
  id: string;
11
+ unreadable: boolean;
11
12
  code: string;
12
13
  kind: ("percent_off" | "amount_off" | "free_months") | null;
13
14
  amount: number | null;
@@ -20,6 +21,7 @@ export declare const promoCodeOperations: {
20
21
  createdAt: string;
21
22
  }[], {
22
23
  id: string;
24
+ unreadable: boolean;
23
25
  code: string;
24
26
  kind: ("percent_off" | "amount_off" | "free_months") | null;
25
27
  amount: number | null;
@@ -30,9 +32,10 @@ export declare const promoCodeOperations: {
30
32
  activeUntil: string | null;
31
33
  status: "ACTIVE" | "ARCHIVED";
32
34
  createdAt: string;
33
- }[]>;
35
+ }[], false>;
34
36
  "promoCodes.create": import("./define.js").OperationEntry<BusinessRef & CreatePromoCodeInput, {
35
37
  id: string;
38
+ unreadable: boolean;
36
39
  code: string;
37
40
  kind: ("percent_off" | "amount_off" | "free_months") | null;
38
41
  amount: number | null;
@@ -45,6 +48,7 @@ export declare const promoCodeOperations: {
45
48
  createdAt: string;
46
49
  }, {
47
50
  id: string;
51
+ unreadable: boolean;
48
52
  code: string;
49
53
  kind: ("percent_off" | "amount_off" | "free_months") | null;
50
54
  amount: number | null;
@@ -55,13 +59,14 @@ export declare const promoCodeOperations: {
55
59
  activeUntil: string | null;
56
60
  status: "ACTIVE" | "ARCHIVED";
57
61
  createdAt: string;
58
- }>;
62
+ }, false>;
59
63
  "promoCodes.update": import("./define.js").OperationEntry<BusinessRef & {
60
64
  promoCodeId: string;
61
65
  } & Partial<CreatePromoCodeInput> & {
62
66
  status?: PromoCodeStatus;
63
67
  }, {
64
68
  id: string;
69
+ unreadable: boolean;
65
70
  code: string;
66
71
  kind: ("percent_off" | "amount_off" | "free_months") | null;
67
72
  amount: number | null;
@@ -74,6 +79,7 @@ export declare const promoCodeOperations: {
74
79
  createdAt: string;
75
80
  }, {
76
81
  id: string;
82
+ unreadable: boolean;
77
83
  code: string;
78
84
  kind: ("percent_off" | "amount_off" | "free_months") | null;
79
85
  amount: number | null;
@@ -84,9 +90,10 @@ export declare const promoCodeOperations: {
84
90
  activeUntil: string | null;
85
91
  status: "ACTIVE" | "ARCHIVED";
86
92
  createdAt: string;
87
- }>;
93
+ }, false>;
88
94
  "promoCodes.archive": import("./define.js").OperationEntry<PromoCodeRef, {
89
95
  id: string;
96
+ unreadable: boolean;
90
97
  code: string;
91
98
  kind: ("percent_off" | "amount_off" | "free_months") | null;
92
99
  amount: number | null;
@@ -99,6 +106,7 @@ export declare const promoCodeOperations: {
99
106
  createdAt: string;
100
107
  }, {
101
108
  id: string;
109
+ unreadable: boolean;
102
110
  code: string;
103
111
  kind: ("percent_off" | "amount_off" | "free_months") | null;
104
112
  amount: number | null;
@@ -109,9 +117,10 @@ export declare const promoCodeOperations: {
109
117
  activeUntil: string | null;
110
118
  status: "ACTIVE" | "ARCHIVED";
111
119
  createdAt: string;
112
- }>;
120
+ }, false>;
113
121
  "promoCodes.reactivate": import("./define.js").OperationEntry<PromoCodeRef, {
114
122
  id: string;
123
+ unreadable: boolean;
115
124
  code: string;
116
125
  kind: ("percent_off" | "amount_off" | "free_months") | null;
117
126
  amount: number | null;
@@ -124,6 +133,7 @@ export declare const promoCodeOperations: {
124
133
  createdAt: string;
125
134
  }, {
126
135
  id: string;
136
+ unreadable: boolean;
127
137
  code: string;
128
138
  kind: ("percent_off" | "amount_off" | "free_months") | null;
129
139
  amount: number | null;
@@ -134,6 +144,6 @@ export declare const promoCodeOperations: {
134
144
  activeUntil: string | null;
135
145
  status: "ACTIVE" | "ARCHIVED";
136
146
  createdAt: string;
137
- }>;
147
+ }, false>;
138
148
  };
139
149
  export {};
@@ -1,18 +1,27 @@
1
1
  type VariableRef = {
2
2
  businessId: string;
3
3
  name: string;
4
- /** Omit for the production scope. */
4
+ /** Omit for a business-wide binding. */
5
5
  environmentId?: string;
6
6
  };
7
7
  type WriteInput = VariableRef & {
8
8
  value: string;
9
9
  };
10
+ type CreateInput = WriteInput & {
11
+ /** Exclude this business-wide secret from previews. Fixed at creation. */
12
+ productionOnly?: boolean;
13
+ };
10
14
  export declare const variableOperations: {
11
15
  "variables.read": import("./define.js").OperationEntry<{
12
16
  businessId: string;
13
17
  environmentId?: string;
14
18
  }, {
15
19
  name: string;
20
+ scope: "business-wide" | "environment" | "production-only" | "inherited";
21
+ environmentId: string | null;
22
+ productionOnly: boolean;
23
+ inheritedFrom: "main" | null;
24
+ unavailableReason: string | null;
16
25
  visibility: "public" | "secret";
17
26
  value: string | null;
18
27
  hasValue: boolean;
@@ -20,13 +29,18 @@ export declare const variableOperations: {
20
29
  version: number | null;
21
30
  }[], {
22
31
  name: string;
32
+ scope: "business-wide" | "environment" | "production-only" | "inherited";
33
+ environmentId: string | null;
34
+ productionOnly: boolean;
35
+ inheritedFrom: "main" | null;
36
+ unavailableReason: string | null;
23
37
  visibility: "public" | "secret";
24
38
  value: string | null;
25
39
  hasValue: boolean;
26
40
  lifecycleStatus: "PENDING" | "ACTIVE" | "REVOKING" | "REVOKED" | "DELETE_PENDING" | "DELETED";
27
41
  version: number | null;
28
- }[]>;
29
- "variables.create": import("./define.js").OperationEntry<WriteInput, {
42
+ }[], false>;
43
+ "variables.create": import("./define.js").OperationEntry<CreateInput, {
30
44
  operationId: string;
31
45
  kind: "CREATE" | "ROTATE" | "REVOKE" | "DELETE";
32
46
  status: "PENDING" | "PROCESSING" | "WAITING_RETRY" | "SUCCEEDED" | "ABORTED";
@@ -56,7 +70,7 @@ export declare const variableOperations: {
56
70
  } | null;
57
71
  completedAt: string | null;
58
72
  impact: import("../generated/schemas.js").components["schemas"]["SecretMutationImpact"];
59
- }>;
73
+ }, false>;
60
74
  "variables.rotate": import("./define.js").OperationEntry<WriteInput, {
61
75
  operationId: string;
62
76
  kind: "CREATE" | "ROTATE" | "REVOKE" | "DELETE";
@@ -87,7 +101,7 @@ export declare const variableOperations: {
87
101
  } | null;
88
102
  completedAt: string | null;
89
103
  impact: import("../generated/schemas.js").components["schemas"]["SecretMutationImpact"];
90
- }>;
104
+ }, false>;
91
105
  "variables.revoke": import("./define.js").OperationEntry<VariableRef, {
92
106
  operationId: string;
93
107
  kind: "CREATE" | "ROTATE" | "REVOKE" | "DELETE";
@@ -118,7 +132,7 @@ export declare const variableOperations: {
118
132
  } | null;
119
133
  completedAt: string | null;
120
134
  impact: import("../generated/schemas.js").components["schemas"]["SecretMutationImpact"];
121
- }>;
135
+ }, false>;
122
136
  "variables.delete": import("./define.js").OperationEntry<VariableRef, {
123
137
  operationId: string;
124
138
  kind: "CREATE" | "ROTATE" | "REVOKE" | "DELETE";
@@ -149,7 +163,7 @@ export declare const variableOperations: {
149
163
  } | null;
150
164
  completedAt: string | null;
151
165
  impact: import("../generated/schemas.js").components["schemas"]["SecretMutationImpact"];
152
- }>;
166
+ }, false>;
153
167
  "variables.operation.read": import("./define.js").OperationEntry<{
154
168
  businessId: string;
155
169
  operationId: string;
@@ -183,6 +197,6 @@ export declare const variableOperations: {
183
197
  } | null;
184
198
  completedAt: string | null;
185
199
  impact: import("../generated/schemas.js").components["schemas"]["SecretMutationImpact"];
186
- }>;
200
+ }, false>;
187
201
  };
188
202
  export {};
@@ -28,7 +28,7 @@ export declare const webhookOperations: {
28
28
  offset: number;
29
29
  hasMore: boolean;
30
30
  };
31
- }>;
31
+ }, false>;
32
32
  "webhooks.create": import("./define.js").OperationEntry<BusinessRef & {
33
33
  url: string;
34
34
  events: string[];
@@ -38,7 +38,7 @@ export declare const webhookOperations: {
38
38
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpointIssuance"];
39
39
  }, {
40
40
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpointIssuance"];
41
- }>;
41
+ }, false>;
42
42
  "webhooks.update": import("./define.js").OperationEntry<BusinessRef & {
43
43
  webhookId: string;
44
44
  } & {
@@ -50,7 +50,7 @@ export declare const webhookOperations: {
50
50
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpoint"];
51
51
  }, {
52
52
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpoint"];
53
- }>;
53
+ }, false>;
54
54
  "webhooks.delete": import("./define.js").OperationEntry<WebhookRef, {
55
55
  data: {
56
56
  deleted: true;
@@ -59,12 +59,12 @@ export declare const webhookOperations: {
59
59
  data: {
60
60
  deleted: true;
61
61
  };
62
- }>;
62
+ }, false>;
63
63
  "webhooks.test": import("./define.js").OperationEntry<TestInput, {
64
64
  data: import("../generated/schemas.js").components["schemas"]["WebhookTestResult"];
65
65
  }, {
66
66
  data: import("../generated/schemas.js").components["schemas"]["WebhookTestResult"];
67
- }>;
67
+ }, false>;
68
68
  "webhooks.trigger": import("./define.js").OperationEntry<BusinessRef & {
69
69
  webhookId: string;
70
70
  } & {
@@ -74,27 +74,27 @@ export declare const webhookOperations: {
74
74
  data: import("../generated/schemas.js").components["schemas"]["WebhookTestResult"];
75
75
  }, {
76
76
  data: import("../generated/schemas.js").components["schemas"]["WebhookTestResult"];
77
- }>;
77
+ }, false>;
78
78
  "webhooks.rotateSecret": import("./define.js").OperationEntry<WebhookRef, {
79
79
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpointRotation"];
80
80
  }, {
81
81
  data: import("../generated/schemas.js").components["schemas"]["WebhookEndpointRotation"];
82
- }>;
82
+ }, false>;
83
83
  "webhooks.eventType.read": import("./define.js").OperationEntry<BusinessRef, {
84
84
  data: {
85
85
  events: {
86
- name: "subscription.created" | "subscription.updated" | "subscription.canceled" | "payment.succeeded" | "payment.failed" | "entitlement.changed" | "usage.threshold_reached";
86
+ name: "subscription.created" | "subscription.updated" | "subscription.canceled" | "payment.succeeded" | "payment.failed" | "entitlement.changed" | "usage.threshold_reached" | "customer.created" | "customer.deleted" | "customer.member.added" | "customer.member.updated" | "customer.member.removed";
87
87
  description: string;
88
88
  }[];
89
89
  };
90
90
  }, {
91
91
  data: {
92
92
  events: {
93
- name: "subscription.created" | "subscription.updated" | "subscription.canceled" | "payment.succeeded" | "payment.failed" | "entitlement.changed" | "usage.threshold_reached";
93
+ name: "subscription.created" | "subscription.updated" | "subscription.canceled" | "payment.succeeded" | "payment.failed" | "entitlement.changed" | "usage.threshold_reached" | "customer.created" | "customer.deleted" | "customer.member.added" | "customer.member.updated" | "customer.member.removed";
94
94
  description: string;
95
95
  }[];
96
96
  };
97
- }>;
97
+ }, false>;
98
98
  "webhooks.delivery.read": import("./define.js").OperationEntry<BusinessRef & {
99
99
  webhookId: string;
100
100
  } & {
@@ -116,15 +116,108 @@ export declare const webhookOperations: {
116
116
  offset: number;
117
117
  hasMore: boolean;
118
118
  };
119
- }>;
119
+ }, false>;
120
120
  "webhooks.delivery.get": import("./define.js").OperationEntry<BusinessRef & {
121
121
  webhookId: string;
122
122
  } & {
123
123
  deliveryId: string;
124
124
  }, {
125
- data: import("../generated/schemas.js").components["schemas"]["WebhookDelivery"];
125
+ data: {
126
+ id: string;
127
+ eventType: string;
128
+ status: "pending" | "success" | "failed" | "dead";
129
+ attempts: number;
130
+ lastAttemptAt: string | null;
131
+ nextAttemptAt: string | null;
132
+ responseStatus: number | null;
133
+ environmentId: string | null;
134
+ createdAt: string;
135
+ payload?: {
136
+ id: string;
137
+ type: string;
138
+ createdAt: string;
139
+ businessId: string;
140
+ environmentId: string | null;
141
+ data: {
142
+ [key: string]: unknown;
143
+ };
144
+ };
145
+ responseBody?: string | null;
146
+ };
126
147
  }, {
127
- data: import("../generated/schemas.js").components["schemas"]["WebhookDelivery"];
128
- }>;
148
+ data: {
149
+ id: string;
150
+ eventType: string;
151
+ status: "pending" | "success" | "failed" | "dead";
152
+ attempts: number;
153
+ lastAttemptAt: string | null;
154
+ nextAttemptAt: string | null;
155
+ responseStatus: number | null;
156
+ environmentId: string | null;
157
+ createdAt: string;
158
+ payload?: {
159
+ id: string;
160
+ type: string;
161
+ createdAt: string;
162
+ businessId: string;
163
+ environmentId: string | null;
164
+ data: {
165
+ [key: string]: unknown;
166
+ };
167
+ };
168
+ responseBody?: string | null;
169
+ };
170
+ }, false>;
171
+ "webhooks.delivery.payload.read": import("./define.js").OperationEntry<BusinessRef & {
172
+ webhookId: string;
173
+ } & {
174
+ deliveryId: string;
175
+ }, {
176
+ data: {
177
+ id: string;
178
+ eventType: string;
179
+ status: "pending" | "success" | "failed" | "dead";
180
+ attempts: number;
181
+ lastAttemptAt: string | null;
182
+ nextAttemptAt: string | null;
183
+ responseStatus: number | null;
184
+ environmentId: string | null;
185
+ createdAt: string;
186
+ payload?: {
187
+ id: string;
188
+ type: string;
189
+ createdAt: string;
190
+ businessId: string;
191
+ environmentId: string | null;
192
+ data: {
193
+ [key: string]: unknown;
194
+ };
195
+ };
196
+ responseBody?: string | null;
197
+ };
198
+ }, {
199
+ data: {
200
+ id: string;
201
+ eventType: string;
202
+ status: "pending" | "success" | "failed" | "dead";
203
+ attempts: number;
204
+ lastAttemptAt: string | null;
205
+ nextAttemptAt: string | null;
206
+ responseStatus: number | null;
207
+ environmentId: string | null;
208
+ createdAt: string;
209
+ payload?: {
210
+ id: string;
211
+ type: string;
212
+ createdAt: string;
213
+ businessId: string;
214
+ environmentId: string | null;
215
+ data: {
216
+ [key: string]: unknown;
217
+ };
218
+ };
219
+ responseBody?: string | null;
220
+ };
221
+ }, false>;
129
222
  };
130
223
  export {};
@@ -38,19 +38,23 @@ export type DryRunPreview<O> = {
38
38
  type PreviewCallOptions = CallOptions & {
39
39
  dryRun: true;
40
40
  };
41
- /** A method whose input may be omitted: a preview resolves to `DryRunPreview<O>`. */
42
- type OptionalInputFn<I, O, W = O> = {
43
- (input: I | undefined, options: PreviewCallOptions): Promise<DryRunPreview<W>>;
44
- (input?: I, options?: CallOptions): Promise<O>;
41
+ /** Options known to execute the operation rather than preview it. */
42
+ type WriteCallOptions = CallOptions & {
43
+ dryRun?: false;
45
44
  };
46
- /** A method that requires its input: a preview resolves to `DryRunPreview<O>`. */
47
- type RequiredInputFn<I, O, W = O> = {
45
+ type OptionalInputFn<I, O, W, P extends boolean> = P extends true ? {
46
+ (input: I | undefined, options: PreviewCallOptions): Promise<DryRunPreview<W>>;
47
+ (input?: I, options?: WriteCallOptions): Promise<O>;
48
+ (input: I | undefined, options?: CallOptions): Promise<O | DryRunPreview<W>>;
49
+ } : (input?: I, options?: CallOptions) => Promise<O>;
50
+ type RequiredInputFn<I, O, W, P extends boolean> = P extends true ? {
48
51
  (input: I, options: PreviewCallOptions): Promise<DryRunPreview<W>>;
49
- (input: I, options?: CallOptions): Promise<O>;
50
- };
51
- type MethodFn<I, O, W> = [I] extends [void] ? OptionalInputFn<undefined, O, W> : undefined extends I ? OptionalInputFn<I, O, W> : {} extends I ? OptionalInputFn<I, O, W> : RequiredInputFn<I, O, W>;
52
+ (input: I, options?: WriteCallOptions): Promise<O>;
53
+ (input: I, options?: CallOptions): Promise<O | DryRunPreview<W>>;
54
+ } : (input: I, options?: CallOptions) => Promise<O>;
55
+ type MethodFn<I, O, W, P extends boolean> = [I] extends [void] ? OptionalInputFn<undefined, O, W, P> : undefined extends I ? OptionalInputFn<I, O, W, P> : {} extends I ? OptionalInputFn<I, O, W, P> : RequiredInputFn<I, O, W, P>;
52
56
  /** A namespaced method: `(input, options?) => Promise<output>` plus `meta`. */
53
- export type MethodOf<E> = E extends OperationEntry<infer I, infer O, infer W> ? MethodFn<I, O, W> & {
57
+ export type MethodOf<E> = E extends OperationEntry<infer I, infer O, infer W, infer P> ? MethodFn<I, O, W, P> & {
54
58
  readonly meta: OperationMeta;
55
59
  } : never;
56
60
  /** The method at a dotted path. */
@@ -59,6 +63,8 @@ export type Method<P extends MethodPath> = MethodOf<OperationTable[P]>;
59
63
  export type MethodInput<P extends MethodPath> = OperationTable[P] extends OperationEntry<infer I, unknown> ? I : never;
60
64
  /** Output of the method at a dotted path. */
61
65
  export type MethodOutput<P extends MethodPath> = OperationTable[P] extends OperationEntry<never, infer O, any> ? O : never;
66
+ /** Payload inside a method's dry-run envelope. */
67
+ export type MethodPreviewOutput<P extends MethodPath> = OperationTable[P] extends OperationEntry<never, unknown, infer W, true> ? W : never;
62
68
  type Nest<Path extends string, V> = Path extends `${infer Head}.${infer Rest}` ? {
63
69
  readonly [K in Head]: Nest<Rest, V>;
64
70
  } : {
@@ -433,11 +433,14 @@ export type TestPersonaBootstrapResult = Schemas["TestPersonaBootstrapResponse"]
433
433
  export type TestPersonaRotateResult = Schemas["TestPersonaRotateResponse"];
434
434
  /** `DELETE …/test/personas/:id`: the deletion receipt. */
435
435
  export type TestPersonaDeleteResult = Schemas["TestPersonaDeleteResponse"];
436
- /** A persona handoff plus the CLI-process-only local-preview proxy lease. */
436
+ /** A persona handoff plus the CLI-only credential for a local signed-in preview. */
437
437
  export type PersonaLocalPreviewLease = {
438
438
  data: PersonaHandoff["data"] & {
439
439
  localProxyLease: string;
440
440
  localProxyLeaseExpiresAt: string;
441
441
  };
442
442
  };
443
+ /** Target and receipt for undoing a prior publish. */
444
+ export type RollbackBusinessBody = Schemas["ManagementRollbackRequest"];
445
+ export type RollbackBusinessResult = Schemas["ManagementRollbackResponse"];
443
446
  export {};
@@ -3,6 +3,6 @@
3
3
  * `package.json` by `version.test.ts` and checked in the built bundle by
4
4
  * `scripts/check-pack.mjs`.
5
5
  */
6
- export declare const CLIENT_VERSION = "0.3.0";
6
+ export declare const CLIENT_VERSION = "0.5.0";
7
7
  /** The `x-fs-client` product token for this package. */
8
- export declare const CLIENT_PRODUCT = "@farthershore/client/0.3.0";
8
+ export declare const CLIENT_PRODUCT = "@farthershore/client/0.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farthershore/client",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Farther Shore API client: the authenticated HTTP transport, credential sources, and typed errors shared by the CLI and agent tooling",
5
5
  "type": "module",
6
6
  "sideEffects": false,