@schematichq/schematic-js 1.5.0 → 1.6.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.
- package/README.md +1 -1
- package/dist/schematic.browser.js +2 -2
- package/dist/schematic.cjs.js +619 -8
- package/dist/schematic.d.ts +601 -0
- package/dist/schematic.esm.js +623 -8
- package/package.json +25 -26
package/dist/schematic.d.ts
CHANGED
|
@@ -1,3 +1,158 @@
|
|
|
1
|
+
export declare type AccessToken = string | AccessTokenProvider;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The machinery every temporary-access-token surface shares: which session is
|
|
5
|
+
* being read, the credential for it, and the request that carries it. It
|
|
6
|
+
* knows nothing about invoices, subscriptions, or checkout — a domain client
|
|
7
|
+
* (see `SchematicBillingClient`) is constructed over it, and several may
|
|
8
|
+
* share one session rather than each minting tokens of its own.
|
|
9
|
+
*/
|
|
10
|
+
/** Called once per session, and again when a request comes back 401. */
|
|
11
|
+
export declare type AccessTokenProvider = () => Promise<string | AccessTokenResult>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A bare token, or one that says when it expires and who it was minted for.
|
|
15
|
+
* `company`/`user` are the host restating the pair it asked for; stated, they
|
|
16
|
+
* are checked against the session the resolution was started for.
|
|
17
|
+
*/
|
|
18
|
+
export declare interface AccessTokenResult {
|
|
19
|
+
token: string;
|
|
20
|
+
expiresAt?: Date | string | null;
|
|
21
|
+
company?: string;
|
|
22
|
+
user?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Schematic API
|
|
27
|
+
* Schematic API
|
|
28
|
+
*
|
|
29
|
+
* The version of the OpenAPI document: 0.1
|
|
30
|
+
*
|
|
31
|
+
*
|
|
32
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
33
|
+
* https://openapi-generator.tech
|
|
34
|
+
* Do not edit the class manually.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @interface ApiError
|
|
40
|
+
*/
|
|
41
|
+
declare interface ApiError {
|
|
42
|
+
/**
|
|
43
|
+
* Error message
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof ApiError
|
|
46
|
+
*/
|
|
47
|
+
error: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare function ApiErrorFromJSON(json: any): ApiError;
|
|
51
|
+
|
|
52
|
+
declare function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiError;
|
|
53
|
+
|
|
54
|
+
declare function ApiErrorToJSON(json: any): ApiError;
|
|
55
|
+
|
|
56
|
+
declare function ApiErrorToJSONTyped(value?: ApiError | null, ignoreDiscriminator?: boolean): any;
|
|
57
|
+
|
|
58
|
+
export declare namespace billingApi {
|
|
59
|
+
export {
|
|
60
|
+
instanceOfApiError,
|
|
61
|
+
ApiErrorFromJSON,
|
|
62
|
+
ApiErrorFromJSONTyped,
|
|
63
|
+
ApiErrorToJSON,
|
|
64
|
+
ApiErrorToJSONTyped,
|
|
65
|
+
ApiError,
|
|
66
|
+
instanceOfCompanyInvoiceResponseData,
|
|
67
|
+
CompanyInvoiceResponseDataFromJSON,
|
|
68
|
+
CompanyInvoiceResponseDataFromJSONTyped,
|
|
69
|
+
CompanyInvoiceResponseDataToJSON,
|
|
70
|
+
CompanyInvoiceResponseDataToJSONTyped,
|
|
71
|
+
CompanyInvoiceResponseData,
|
|
72
|
+
instanceOfCompanyInvoicesResponseData,
|
|
73
|
+
CompanyInvoicesResponseDataFromJSON,
|
|
74
|
+
CompanyInvoicesResponseDataFromJSONTyped,
|
|
75
|
+
CompanyInvoicesResponseDataToJSON,
|
|
76
|
+
CompanyInvoicesResponseDataToJSONTyped,
|
|
77
|
+
CompanyInvoicesResponseData,
|
|
78
|
+
instanceOfGetCompanyInvoicesParams,
|
|
79
|
+
GetCompanyInvoicesParamsFromJSON,
|
|
80
|
+
GetCompanyInvoicesParamsFromJSONTyped,
|
|
81
|
+
GetCompanyInvoicesParamsToJSON,
|
|
82
|
+
GetCompanyInvoicesParamsToJSONTyped,
|
|
83
|
+
GetCompanyInvoicesParams,
|
|
84
|
+
instanceOfGetCompanyInvoicesResponse,
|
|
85
|
+
GetCompanyInvoicesResponseFromJSON,
|
|
86
|
+
GetCompanyInvoicesResponseFromJSONTyped,
|
|
87
|
+
GetCompanyInvoicesResponseToJSON,
|
|
88
|
+
GetCompanyInvoicesResponseToJSONTyped,
|
|
89
|
+
GetCompanyInvoicesResponse,
|
|
90
|
+
instanceOfInvoiceStatus,
|
|
91
|
+
InvoiceStatusFromJSON,
|
|
92
|
+
InvoiceStatusFromJSONTyped,
|
|
93
|
+
InvoiceStatusToJSON,
|
|
94
|
+
InvoiceStatusToJSONTyped,
|
|
95
|
+
InvoiceStatus
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* What a reader of billing data can ask for. Subscription and usage — the
|
|
101
|
+
* rest of what `hydrate` serves — and the checkout calls that change them
|
|
102
|
+
* join this interface as their endpoints ship.
|
|
103
|
+
*/
|
|
104
|
+
export declare interface BillingClient {
|
|
105
|
+
fetchInvoices(params: InvoicesRequest): Promise<InvoicesResult>;
|
|
106
|
+
readonly sessionStatus: SessionStatus;
|
|
107
|
+
readonly sessionKey: string | undefined;
|
|
108
|
+
setSession(session: SessionInput): void;
|
|
109
|
+
onSessionChange(listener: (event: SessionEvent) => void): () => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare type BillingClientOptions = SessionOptions;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A prefetch or fixture. An omitted key reports as pending; a keyed resource
|
|
116
|
+
* seeds under `params`, or its defaults when absent, so a prefetch for a
|
|
117
|
+
* non-default query is claimed rather than refetched by the element.
|
|
118
|
+
*/
|
|
119
|
+
export declare type BillingData = {
|
|
120
|
+
[K in BillingResourceName]?: BillingResources[K];
|
|
121
|
+
} & {
|
|
122
|
+
params?: Partial<BillingResourceParams>;
|
|
123
|
+
/**
|
|
124
|
+
* A prefetch outlives the render that made it — a cached page, a session
|
|
125
|
+
* resolving to somebody else — so a store adopts it only for the session
|
|
126
|
+
* it names. `fetchBillingData` fills it in; a fixture need not.
|
|
127
|
+
*/
|
|
128
|
+
sessionKey?: string;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export declare interface BillingPrefetchOptions {
|
|
132
|
+
names?: BillingResourceName[];
|
|
133
|
+
/** The invoice query to prefetch for; the element must ask the same one. */
|
|
134
|
+
invoices?: InvoiceQuery;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare type BillingResourceName = keyof BillingResources;
|
|
138
|
+
|
|
139
|
+
/** `Record<string, never>` marks a singleton; anything else is keyed. */
|
|
140
|
+
export declare interface BillingResourceParams {
|
|
141
|
+
invoices: InvoiceQuery;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Nothing in the store, the hooks, or the resource keys may be addressed by
|
|
146
|
+
* company or user id: users and companies are many-to-many, and a token names
|
|
147
|
+
* the pair. What is loaded belongs to the session it was read under — the
|
|
148
|
+
* pair, as `sessionKey` writes it — and a store that keeps more than one
|
|
149
|
+
* session's data keys it by that and serves only the active one.
|
|
150
|
+
*/
|
|
151
|
+
export declare interface BillingResources {
|
|
152
|
+
/** `GET /company/invoices?limit&offset&include_pending`. */
|
|
153
|
+
invoices: InvoicePage;
|
|
154
|
+
}
|
|
155
|
+
|
|
1
156
|
export declare type BooleanListenerFn = (value: boolean) => void;
|
|
2
157
|
|
|
3
158
|
/**
|
|
@@ -276,6 +431,92 @@ export declare interface CompanyCreditBalance {
|
|
|
276
431
|
settled: number;
|
|
277
432
|
}
|
|
278
433
|
|
|
434
|
+
/**
|
|
435
|
+
*
|
|
436
|
+
* @export
|
|
437
|
+
* @interface CompanyInvoiceResponseData
|
|
438
|
+
*/
|
|
439
|
+
export declare interface CompanyInvoiceResponseData {
|
|
440
|
+
/**
|
|
441
|
+
*
|
|
442
|
+
* @type {number}
|
|
443
|
+
* @memberof CompanyInvoiceResponseData
|
|
444
|
+
*/
|
|
445
|
+
amountDue: number;
|
|
446
|
+
/**
|
|
447
|
+
*
|
|
448
|
+
* @type {Date}
|
|
449
|
+
* @memberof CompanyInvoiceResponseData
|
|
450
|
+
*/
|
|
451
|
+
createdAt: Date;
|
|
452
|
+
/**
|
|
453
|
+
*
|
|
454
|
+
* @type {string}
|
|
455
|
+
* @memberof CompanyInvoiceResponseData
|
|
456
|
+
*/
|
|
457
|
+
currency: string;
|
|
458
|
+
/**
|
|
459
|
+
*
|
|
460
|
+
* @type {Date}
|
|
461
|
+
* @memberof CompanyInvoiceResponseData
|
|
462
|
+
*/
|
|
463
|
+
dueDate?: Date | null;
|
|
464
|
+
/**
|
|
465
|
+
*
|
|
466
|
+
* @type {string}
|
|
467
|
+
* @memberof CompanyInvoiceResponseData
|
|
468
|
+
*/
|
|
469
|
+
id: string;
|
|
470
|
+
/**
|
|
471
|
+
*
|
|
472
|
+
* @type {InvoiceStatus}
|
|
473
|
+
* @memberof CompanyInvoiceResponseData
|
|
474
|
+
*/
|
|
475
|
+
status?: InvoiceStatus | null;
|
|
476
|
+
/**
|
|
477
|
+
*
|
|
478
|
+
* @type {string}
|
|
479
|
+
* @memberof CompanyInvoiceResponseData
|
|
480
|
+
*/
|
|
481
|
+
url?: string | null;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
declare function CompanyInvoiceResponseDataFromJSON(json: any): CompanyInvoiceResponseData;
|
|
485
|
+
|
|
486
|
+
declare function CompanyInvoiceResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): CompanyInvoiceResponseData;
|
|
487
|
+
|
|
488
|
+
declare function CompanyInvoiceResponseDataToJSON(json: any): CompanyInvoiceResponseData;
|
|
489
|
+
|
|
490
|
+
declare function CompanyInvoiceResponseDataToJSONTyped(value?: CompanyInvoiceResponseData | null, ignoreDiscriminator?: boolean): any;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
*
|
|
494
|
+
* @export
|
|
495
|
+
* @interface CompanyInvoicesResponseData
|
|
496
|
+
*/
|
|
497
|
+
declare interface CompanyInvoicesResponseData {
|
|
498
|
+
/**
|
|
499
|
+
*
|
|
500
|
+
* @type {number}
|
|
501
|
+
* @memberof CompanyInvoicesResponseData
|
|
502
|
+
*/
|
|
503
|
+
count: number;
|
|
504
|
+
/**
|
|
505
|
+
*
|
|
506
|
+
* @type {Array<CompanyInvoiceResponseData>}
|
|
507
|
+
* @memberof CompanyInvoicesResponseData
|
|
508
|
+
*/
|
|
509
|
+
invoices: Array<CompanyInvoiceResponseData>;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
declare function CompanyInvoicesResponseDataFromJSON(json: any): CompanyInvoicesResponseData;
|
|
513
|
+
|
|
514
|
+
declare function CompanyInvoicesResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): CompanyInvoicesResponseData;
|
|
515
|
+
|
|
516
|
+
declare function CompanyInvoicesResponseDataToJSON(json: any): CompanyInvoicesResponseData;
|
|
517
|
+
|
|
518
|
+
declare function CompanyInvoicesResponseDataToJSONTyped(value?: CompanyInvoicesResponseData | null, ignoreDiscriminator?: boolean): any;
|
|
519
|
+
|
|
279
520
|
/** A company's lease-aware balance for a single credit type */
|
|
280
521
|
export declare type CreditBalance = {
|
|
281
522
|
/** Spendable balance including any open lease hold (remaining + reserved); the number to display to end users */
|
|
@@ -329,6 +570,8 @@ declare interface DatastreamCompanyPlan {
|
|
|
329
570
|
|
|
330
571
|
export declare function DatastreamCompanyPlanFromJSON(json: any): DatastreamCompanyPlan;
|
|
331
572
|
|
|
573
|
+
export declare const DEFAULT_INVOICE_QUERY: InvoiceQuery;
|
|
574
|
+
|
|
332
575
|
export declare type EmptyListenerFn = () => void;
|
|
333
576
|
|
|
334
577
|
/**
|
|
@@ -401,6 +644,12 @@ export declare interface EventBodyFlagCheck {
|
|
|
401
644
|
* @memberof EventBodyFlagCheck
|
|
402
645
|
*/
|
|
403
646
|
flagKey: string;
|
|
647
|
+
/**
|
|
648
|
+
* Whether the check was a preflight, asking whether an action would be allowed rather than reporting one that happened. Absent on ordinary checks
|
|
649
|
+
* @type {boolean}
|
|
650
|
+
* @memberof EventBodyFlagCheck
|
|
651
|
+
*/
|
|
652
|
+
preflight?: boolean;
|
|
404
653
|
/**
|
|
405
654
|
* The reason why the value was returned
|
|
406
655
|
* @type {string}
|
|
@@ -578,12 +827,177 @@ declare interface FeatureEntitlement {
|
|
|
578
827
|
* @memberof FeatureEntitlement
|
|
579
828
|
*/
|
|
580
829
|
valueType: EntitlementValueType;
|
|
830
|
+
/**
|
|
831
|
+
* Customer-defined usage warning thresholds configured on this entitlement
|
|
832
|
+
* @type {Array<WarningTier>}
|
|
833
|
+
* @memberof FeatureEntitlement
|
|
834
|
+
*/
|
|
835
|
+
warningTiers?: Array<WarningTier>;
|
|
581
836
|
}
|
|
582
837
|
|
|
838
|
+
/**
|
|
839
|
+
* Server prefetch for a provider's `initialData`. A resource that fails is
|
|
840
|
+
* left out rather than thrown, so one of them cannot block a page.
|
|
841
|
+
*/
|
|
842
|
+
export declare function fetchBillingData(client: BillingClient, options?: BillingPrefetchOptions): Promise<BillingData>;
|
|
843
|
+
|
|
583
844
|
export declare type FlagCheckListenerFn = CheckFlagReturnListenerFn | EmptyListenerFn;
|
|
584
845
|
|
|
585
846
|
export declare type FlagValueListenerFn = BooleanListenerFn | EmptyListenerFn;
|
|
586
847
|
|
|
848
|
+
/**
|
|
849
|
+
* Schematic API
|
|
850
|
+
* Schematic API
|
|
851
|
+
*
|
|
852
|
+
* The version of the OpenAPI document: 0.1
|
|
853
|
+
*
|
|
854
|
+
*
|
|
855
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
856
|
+
* https://openapi-generator.tech
|
|
857
|
+
* Do not edit the class manually.
|
|
858
|
+
*/
|
|
859
|
+
/**
|
|
860
|
+
* Input parameters
|
|
861
|
+
* @export
|
|
862
|
+
* @interface GetCompanyInvoicesParams
|
|
863
|
+
*/
|
|
864
|
+
declare interface GetCompanyInvoicesParams {
|
|
865
|
+
/**
|
|
866
|
+
* Include unpaid invoices that are not yet due. The default set is time-varying — an invoice passing its due date enters it and shifts later offsets — so page from the response count and stop on an empty page.
|
|
867
|
+
* @type {boolean}
|
|
868
|
+
* @memberof GetCompanyInvoicesParams
|
|
869
|
+
*/
|
|
870
|
+
includePending?: boolean;
|
|
871
|
+
/**
|
|
872
|
+
* Page limit (default 100)
|
|
873
|
+
* @type {number}
|
|
874
|
+
* @memberof GetCompanyInvoicesParams
|
|
875
|
+
*/
|
|
876
|
+
limit?: number;
|
|
877
|
+
/**
|
|
878
|
+
* Page offset (default 0)
|
|
879
|
+
* @type {number}
|
|
880
|
+
* @memberof GetCompanyInvoicesParams
|
|
881
|
+
*/
|
|
882
|
+
offset?: number;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
declare function GetCompanyInvoicesParamsFromJSON(json: any): GetCompanyInvoicesParams;
|
|
886
|
+
|
|
887
|
+
declare function GetCompanyInvoicesParamsFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetCompanyInvoicesParams;
|
|
888
|
+
|
|
889
|
+
declare function GetCompanyInvoicesParamsToJSON(json: any): GetCompanyInvoicesParams;
|
|
890
|
+
|
|
891
|
+
declare function GetCompanyInvoicesParamsToJSONTyped(value?: GetCompanyInvoicesParams | null, ignoreDiscriminator?: boolean): any;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
*
|
|
895
|
+
* @export
|
|
896
|
+
* @interface GetCompanyInvoicesResponse
|
|
897
|
+
*/
|
|
898
|
+
declare interface GetCompanyInvoicesResponse {
|
|
899
|
+
/**
|
|
900
|
+
*
|
|
901
|
+
* @type {CompanyInvoicesResponseData}
|
|
902
|
+
* @memberof GetCompanyInvoicesResponse
|
|
903
|
+
*/
|
|
904
|
+
data: CompanyInvoicesResponseData;
|
|
905
|
+
/**
|
|
906
|
+
*
|
|
907
|
+
* @type {GetCompanyInvoicesParams}
|
|
908
|
+
* @memberof GetCompanyInvoicesResponse
|
|
909
|
+
*/
|
|
910
|
+
params: GetCompanyInvoicesParams;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
declare function GetCompanyInvoicesResponseFromJSON(json: any): GetCompanyInvoicesResponse;
|
|
914
|
+
|
|
915
|
+
declare function GetCompanyInvoicesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetCompanyInvoicesResponse;
|
|
916
|
+
|
|
917
|
+
declare function GetCompanyInvoicesResponseToJSON(json: any): GetCompanyInvoicesResponse;
|
|
918
|
+
|
|
919
|
+
declare function GetCompanyInvoicesResponseToJSONTyped(value?: GetCompanyInvoicesResponse | null, ignoreDiscriminator?: boolean): any;
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Check if a given object implements the ApiError interface.
|
|
923
|
+
*/
|
|
924
|
+
declare function instanceOfApiError(value: object): value is ApiError;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Check if a given object implements the CompanyInvoiceResponseData interface.
|
|
928
|
+
*/
|
|
929
|
+
declare function instanceOfCompanyInvoiceResponseData(value: object): value is CompanyInvoiceResponseData;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Check if a given object implements the CompanyInvoicesResponseData interface.
|
|
933
|
+
*/
|
|
934
|
+
declare function instanceOfCompanyInvoicesResponseData(value: object): value is CompanyInvoicesResponseData;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Check if a given object implements the GetCompanyInvoicesParams interface.
|
|
938
|
+
*/
|
|
939
|
+
declare function instanceOfGetCompanyInvoicesParams(value: object): value is GetCompanyInvoicesParams;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Check if a given object implements the GetCompanyInvoicesResponse interface.
|
|
943
|
+
*/
|
|
944
|
+
declare function instanceOfGetCompanyInvoicesResponse(value: object): value is GetCompanyInvoicesResponse;
|
|
945
|
+
|
|
946
|
+
declare function instanceOfInvoiceStatus(value: any): boolean;
|
|
947
|
+
|
|
948
|
+
export declare type Invoice = CompanyInvoiceResponseData;
|
|
949
|
+
|
|
950
|
+
/** A `limit` above this is a 400 (PaginationFilter in schematic-api). */
|
|
951
|
+
export declare const INVOICE_MAX_PAGE_SIZE = 250;
|
|
952
|
+
|
|
953
|
+
export declare const INVOICE_PAGE_SIZE = 12;
|
|
954
|
+
|
|
955
|
+
export declare interface InvoicePage {
|
|
956
|
+
invoices: Invoice[];
|
|
957
|
+
/** Matching the query on the server, not the number loaded here. */
|
|
958
|
+
count: number;
|
|
959
|
+
hasMore: boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** Each distinct query is its own row set with its own paging. */
|
|
963
|
+
export declare interface InvoiceQuery {
|
|
964
|
+
/** Include unpaid invoices that are not yet due. Default false. */
|
|
965
|
+
includePending?: boolean;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
export declare interface InvoicesRequest extends InvoiceQuery {
|
|
969
|
+
limit: number;
|
|
970
|
+
offset: number;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* The rows asked for, and how many the query matches in total. `hasMore` is
|
|
975
|
+
* the page's, and only the caller knows its offset.
|
|
976
|
+
*/
|
|
977
|
+
export declare type InvoicesResult = Omit<InvoicePage, "hasMore">;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
*
|
|
981
|
+
* @export
|
|
982
|
+
*/
|
|
983
|
+
export declare const InvoiceStatus: {
|
|
984
|
+
readonly Draft: "draft";
|
|
985
|
+
readonly Open: "open";
|
|
986
|
+
readonly Paid: "paid";
|
|
987
|
+
readonly Uncollectible: "uncollectible";
|
|
988
|
+
readonly Void: "void";
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
export declare type InvoiceStatus = (typeof InvoiceStatus)[keyof typeof InvoiceStatus];
|
|
992
|
+
|
|
993
|
+
declare function InvoiceStatusFromJSON(json: any): InvoiceStatus;
|
|
994
|
+
|
|
995
|
+
declare function InvoiceStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvoiceStatus;
|
|
996
|
+
|
|
997
|
+
declare function InvoiceStatusToJSON(value?: InvoiceStatus | null): any;
|
|
998
|
+
|
|
999
|
+
declare function InvoiceStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): InvoiceStatus;
|
|
1000
|
+
|
|
587
1001
|
/** A record of unique key-value pairs used for identifying a company or user */
|
|
588
1002
|
export declare type Keys = Record<string, string>;
|
|
589
1003
|
|
|
@@ -611,10 +1025,31 @@ declare const MetricPeriodMonthReset: {
|
|
|
611
1025
|
|
|
612
1026
|
declare type MetricPeriodMonthReset = (typeof MetricPeriodMonthReset)[keyof typeof MetricPeriodMonthReset];
|
|
613
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* The store keys a resource by the query's shape, so without this
|
|
1030
|
+
* `{ includePending: false }` is a different row set from `{}` — it would
|
|
1031
|
+
* miss the seed and refetch rows identical to those already on screen.
|
|
1032
|
+
*/
|
|
1033
|
+
export declare function normalizeInvoiceQuery(query: InvoiceQuery): InvoiceQuery;
|
|
1034
|
+
|
|
614
1035
|
export declare type PendingListenerFn = BooleanListenerFn | EmptyListenerFn;
|
|
615
1036
|
|
|
616
1037
|
export declare type PlanListenerFn = CheckPlanReturnListenerFn | EmptyListenerFn;
|
|
617
1038
|
|
|
1039
|
+
export declare interface RequestOptions {
|
|
1040
|
+
method?: string;
|
|
1041
|
+
body?: unknown;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
export declare interface ResourceState<T> {
|
|
1045
|
+
/** `undefined` until the first successful load; retained across later errors. */
|
|
1046
|
+
data: T | undefined;
|
|
1047
|
+
/** The latest failure; cleared by the next success. */
|
|
1048
|
+
error: Error | undefined;
|
|
1049
|
+
/** A request is in flight and no data has arrived yet, or a refetch is running. */
|
|
1050
|
+
isPending: boolean;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
618
1053
|
export declare enum RuleType {
|
|
619
1054
|
/** A global rule that, if present, will override all other rules for a flag */
|
|
620
1055
|
GLOBAL_OVERRIDE = "global_override",
|
|
@@ -908,6 +1343,27 @@ export declare class Schematic {
|
|
|
908
1343
|
private notifyCreditBalanceListeners;
|
|
909
1344
|
}
|
|
910
1345
|
|
|
1346
|
+
export declare class SchematicApiError extends Error {
|
|
1347
|
+
readonly status: number;
|
|
1348
|
+
readonly path: string;
|
|
1349
|
+
readonly body: unknown;
|
|
1350
|
+
constructor(status: number, path: string, body: unknown);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
export declare class SchematicBillingClient implements BillingClient {
|
|
1354
|
+
/**
|
|
1355
|
+
* Public so a second client over the same surface can be constructed on
|
|
1356
|
+
* this one rather than minting tokens of its own.
|
|
1357
|
+
*/
|
|
1358
|
+
readonly session: SchematicSession;
|
|
1359
|
+
constructor(options?: BillingClientOptions | SchematicSession);
|
|
1360
|
+
get sessionKey(): string | undefined;
|
|
1361
|
+
get sessionStatus(): SessionStatus;
|
|
1362
|
+
setSession(session: SessionInput): void;
|
|
1363
|
+
onSessionChange(listener: (event: SessionEvent) => void): () => void;
|
|
1364
|
+
fetchInvoices(params: InvoicesRequest): Promise<InvoicesResult>;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
911
1367
|
/** Context for checking flags and sending events */
|
|
912
1368
|
export declare type SchematicContext = {
|
|
913
1369
|
company?: Keys;
|
|
@@ -964,6 +1420,111 @@ export declare type SchematicOptions = {
|
|
|
964
1420
|
flagCheckDefaults?: Record<string, CheckFlagReturn>;
|
|
965
1421
|
};
|
|
966
1422
|
|
|
1423
|
+
/**
|
|
1424
|
+
* Session identity is the (company, user) pair alone: a freshly minted token,
|
|
1425
|
+
* a rebuilt provider closure, and a refresh this session asked for itself are
|
|
1426
|
+
* all the same session. Nothing in a token says who it was minted for, so
|
|
1427
|
+
* that question is the host's to answer.
|
|
1428
|
+
*
|
|
1429
|
+
* Credentials survive a change of session, keyed by pair — switching back to
|
|
1430
|
+
* a company reads with the token already in hand. They do not survive the
|
|
1431
|
+
* session ending: after a sign-out the next person at this page is somebody
|
|
1432
|
+
* else, and nothing minted for the last one is theirs to send.
|
|
1433
|
+
*/
|
|
1434
|
+
export declare class SchematicSession {
|
|
1435
|
+
private readonly _apiUrl;
|
|
1436
|
+
private readonly _headers;
|
|
1437
|
+
private readonly _fetch;
|
|
1438
|
+
private _session;
|
|
1439
|
+
private readonly _tokens;
|
|
1440
|
+
private readonly _resolving;
|
|
1441
|
+
/**
|
|
1442
|
+
* Bumped when the session's identity changes, and only then — the object
|
|
1443
|
+
* itself is replaced on every render. Anything asking "is this still the
|
|
1444
|
+
* session I started under?" counts generations rather than comparing.
|
|
1445
|
+
*/
|
|
1446
|
+
private _generation;
|
|
1447
|
+
private readonly _listeners;
|
|
1448
|
+
constructor(options?: SessionOptions);
|
|
1449
|
+
get key(): string | undefined;
|
|
1450
|
+
get status(): SessionStatus;
|
|
1451
|
+
/** Only a statement that changes which pair is read counts as a change. */
|
|
1452
|
+
set(session: SessionInput): void;
|
|
1453
|
+
onChange(listener: (event: SessionEvent) => void): () => void;
|
|
1454
|
+
private _emit;
|
|
1455
|
+
private _cached;
|
|
1456
|
+
private _cache;
|
|
1457
|
+
/**
|
|
1458
|
+
* The credential for a session, minted if this one is not held. `force`
|
|
1459
|
+
* retires what is held first: the caller is a request the API has just
|
|
1460
|
+
* rejected.
|
|
1461
|
+
*/
|
|
1462
|
+
resolveToken(session: Session, force: boolean): Promise<string>;
|
|
1463
|
+
/**
|
|
1464
|
+
* Sends a request under the active session's credential, refreshing once
|
|
1465
|
+
* and retrying if the API rejects it. Rejects rather than answering when
|
|
1466
|
+
* the session changes while the request is in flight: the rows would
|
|
1467
|
+
* otherwise come back as the answer to a question asked for another pair.
|
|
1468
|
+
*/
|
|
1469
|
+
request(path: string, options?: RequestOptions): Promise<unknown>;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Who is being read. Users and companies are many-to-many: the same person
|
|
1474
|
+
* reads one company's billing and then another's, and the same company is
|
|
1475
|
+
* read by several people. A token is minted for the pair, so the pair — not
|
|
1476
|
+
* the company alone — is the session's identity.
|
|
1477
|
+
*/
|
|
1478
|
+
export declare interface Session {
|
|
1479
|
+
/** The host's name for the company, its id in their own system say. */
|
|
1480
|
+
company: string;
|
|
1481
|
+
/**
|
|
1482
|
+
* The user, where the host mints per (company, user). Left out by a host
|
|
1483
|
+
* whose tokens are company-wide, and then every reader of that company
|
|
1484
|
+
* shares one session.
|
|
1485
|
+
*/
|
|
1486
|
+
user?: string;
|
|
1487
|
+
token: AccessToken;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* What happened to the session, for anything holding data that belongs to
|
|
1492
|
+
* one. `started`: whatever is loaded belongs to the new session — a prefetch
|
|
1493
|
+
* the host seeded before its auth resolved. `changed`: another pair is being
|
|
1494
|
+
* read, and what is loaded belongs to the pair being left. `ended`: nobody is
|
|
1495
|
+
* signed in, and what is loaded belongs to nobody.
|
|
1496
|
+
*/
|
|
1497
|
+
export declare type SessionEvent = {
|
|
1498
|
+
type: "started" | "changed" | "ended";
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Three states that are not interchangeable:
|
|
1503
|
+
*
|
|
1504
|
+
* * `Session` — active: this pair, read with this credential.
|
|
1505
|
+
* * `null` — ended: nobody is signed in; what is loaded is dropped.
|
|
1506
|
+
* * `undefined` — pending: the host's auth has not resolved. It states
|
|
1507
|
+
* nothing, so the session in hand stands.
|
|
1508
|
+
*/
|
|
1509
|
+
export declare type SessionInput = Session | null | undefined;
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* The pair as one string, for anything that has to compare sessions or key
|
|
1513
|
+
* something by one — a prefetch stating which session it was fetched for, a
|
|
1514
|
+
* store keeping a page per session. Opaque: read it only by equality.
|
|
1515
|
+
*/
|
|
1516
|
+
export declare function sessionKey(session: Session): string;
|
|
1517
|
+
|
|
1518
|
+
export declare interface SessionOptions {
|
|
1519
|
+
session?: SessionInput;
|
|
1520
|
+
apiUrl?: string;
|
|
1521
|
+
additionalHeaders?: Record<string, string>;
|
|
1522
|
+
/** Override for tests and non-browser runtimes. */
|
|
1523
|
+
fetch?: typeof fetch;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
export declare type SessionStatus = "pending" | "active" | "ended";
|
|
1527
|
+
|
|
967
1528
|
/** Optional type for implementing custom client-side storage */
|
|
968
1529
|
export declare type StoragePersister = {
|
|
969
1530
|
setItem(key: string, value: any): void;
|
|
@@ -971,6 +1532,15 @@ export declare type StoragePersister = {
|
|
|
971
1532
|
removeItem(key: string): void;
|
|
972
1533
|
};
|
|
973
1534
|
|
|
1535
|
+
/**
|
|
1536
|
+
* Sessions whose credentials are kept. A reader switching between the
|
|
1537
|
+
* organizations they belong to walks a handful of them and comes back, and
|
|
1538
|
+
* re-minting on every step is a round trip to the host's token endpoint for
|
|
1539
|
+
* a token this client already holds and has not seen expire. The same
|
|
1540
|
+
* handful the flag cache bounds its contexts at.
|
|
1541
|
+
*/
|
|
1542
|
+
export declare const TOKEN_CACHE_SIZE = 10;
|
|
1543
|
+
|
|
974
1544
|
/**
|
|
975
1545
|
* A flexible key/value type that can store any type of value on a company or user.
|
|
976
1546
|
*/
|
|
@@ -995,4 +1565,35 @@ export declare enum UsagePeriod {
|
|
|
995
1565
|
CURRENT_WEEK = "current_week"
|
|
996
1566
|
}
|
|
997
1567
|
|
|
1568
|
+
/**
|
|
1569
|
+
* Schematic API
|
|
1570
|
+
* Schematic API
|
|
1571
|
+
*
|
|
1572
|
+
* The version of the OpenAPI document: 0.1
|
|
1573
|
+
*
|
|
1574
|
+
*
|
|
1575
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
1576
|
+
* https://openapi-generator.tech
|
|
1577
|
+
* Do not edit the class manually.
|
|
1578
|
+
*/
|
|
1579
|
+
/**
|
|
1580
|
+
*
|
|
1581
|
+
* @export
|
|
1582
|
+
* @interface WarningTier
|
|
1583
|
+
*/
|
|
1584
|
+
declare interface WarningTier {
|
|
1585
|
+
/**
|
|
1586
|
+
* A customer-defined identifier for the warning tier
|
|
1587
|
+
* @type {string}
|
|
1588
|
+
* @memberof WarningTier
|
|
1589
|
+
*/
|
|
1590
|
+
key: string;
|
|
1591
|
+
/**
|
|
1592
|
+
* The warning threshold, in the entitlement's usage units
|
|
1593
|
+
* @type {number}
|
|
1594
|
+
* @memberof WarningTier
|
|
1595
|
+
*/
|
|
1596
|
+
value: number;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
998
1599
|
export { }
|