@shware/http 0.4.2 → 0.4.3

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.
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/google-one-tap/index.ts
17
+ var google_one_tap_exports = {};
18
+ module.exports = __toCommonJS(google_one_tap_exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/google-one-tap/index.ts"],"sourcesContent":["export type { GoogleAccounts, IdConfiguration } from './types';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ export { GoogleAccounts, IdConfiguration } from './types.cjs';
@@ -0,0 +1 @@
1
+ export { GoogleAccounts, IdConfiguration } from './types.js';
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/google-one-tap/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/google-one-tap/types.ts"],"sourcesContent":["interface ClientConfigError extends Error {\n message: string;\n stack?: string;\n type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';\n}\n\ninterface OverridableTokenClientConfig {\n scope?: string;\n include_granted_scopes?: boolean;\n prompt?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n state?: string;\n}\n\ninterface TokenClient {\n requestAccessToken: (overrideConfig?: OverridableTokenClientConfig) => void;\n}\n\ninterface CodeClient {\n requestCode: () => void;\n}\n\ninterface TokenResponse {\n access_token: string;\n expires_in: string;\n hd: string;\n prompt: string;\n token_type: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface CodeResponse {\n code: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface TokenClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n prompt?: '' | 'none' | 'consent' | 'select_account';\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n state?: string;\n callback: (tokenResponse: TokenResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface CodeClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n redirect_uri?: string;\n state?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n select_account?: boolean;\n callback?: (response: CodeResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface RevocationResponse {\n successful: boolean;\n error?: string;\n}\n\ninterface Credential {\n id: string;\n password: string;\n}\n\ninterface CredentialResponse {\n credential: string;\n select_by: string;\n}\n\nexport interface IdConfiguration {\n client_id: string;\n auto_select?: boolean;\n login_uri?: string;\n cancel_on_tap_outside?: boolean;\n prompt_parent_id?: string;\n nonce?: string;\n context?: 'signin' | 'signup' | 'use';\n state_cookie_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n allowed_parent_origin?: string | string[];\n itp_support?: boolean;\n login_hint?: string;\n hd?: string;\n use_fedcm_for_prompt?: boolean;\n callback?: (response: CredentialResponse) => void;\n native_callback?: (response: CredentialResponse) => void;\n intermediate_iframe_close_callback?: () => void;\n}\n\ninterface PromptMomentNotification {\n isDisplayMoment(): boolean;\n isDisplayed(): boolean;\n isNotDisplayed(): boolean;\n getNotDisplayedReason():\n | 'browser_not_supported'\n | 'invalid_client'\n | 'missing_client_id'\n | 'opt_out_or_no_session'\n | 'secure_http_required'\n | 'suppressed_by_user'\n | 'unregistered_origin'\n | 'unknown_reason';\n\n isSkippedMoment(): boolean;\n getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';\n isDismissedMoment(): boolean;\n getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';\n getMomentType(): 'display' | 'skipped' | 'dismissed';\n}\n\ninterface GsiButtonConfiguration {\n type: 'standard' | 'icon';\n theme?: 'outline' | 'filled_blue' | 'filled_black';\n size?: 'small' | 'medium' | 'large';\n text?: 'signin_with' | 'signup_with' | 'continue_with' | 'signin';\n shape?: 'rectangular' | 'pill' | 'circle' | 'square';\n logo_alignment?: 'left' | 'center';\n width?: number;\n locale?: string;\n state?: string;\n click_listener?: () => void;\n}\n\nexport interface GoogleAccounts {\n oauth2: {\n initCodeClient(config: CodeClientConfig): CodeClient;\n initTokenClient(config: TokenClientConfig): TokenClient;\n hasGrantedAllScopes(\n tokenResponse: TokenResponse,\n firstScope: string,\n ...restScopes: string[]\n ): boolean;\n hasGrantedAnyScope(\n tokenResponse: TokenResponse,\n firstScope: string,\n ...restScopes: string[]\n ): boolean;\n revoke(accessToken: string, done: () => void): void;\n };\n id: {\n initialize(idConfig: IdConfiguration): void;\n prompt(momentListener?: (promptMomentNotification: PromptMomentNotification) => void): void;\n renderButton(parent: HTMLElement, options: GsiButtonConfiguration): void;\n disableAutoSelect(): void;\n storeCredential(credential: Credential, callback?: () => void): void;\n cancel(): void;\n revoke(hint: string, callback?: (response: RevocationResponse) => void): void;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,147 @@
1
+ interface ClientConfigError extends Error {
2
+ message: string;
3
+ stack?: string;
4
+ type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';
5
+ }
6
+ interface OverridableTokenClientConfig {
7
+ scope?: string;
8
+ include_granted_scopes?: boolean;
9
+ prompt?: string;
10
+ enable_granular_consent?: boolean;
11
+ enable_serial_consent?: boolean;
12
+ login_hint?: string;
13
+ hint?: string;
14
+ state?: string;
15
+ }
16
+ interface TokenClient {
17
+ requestAccessToken: (overrideConfig?: OverridableTokenClientConfig) => void;
18
+ }
19
+ interface CodeClient {
20
+ requestCode: () => void;
21
+ }
22
+ interface TokenResponse {
23
+ access_token: string;
24
+ expires_in: string;
25
+ hd: string;
26
+ prompt: string;
27
+ token_type: string;
28
+ scope: string;
29
+ state: string;
30
+ error: string;
31
+ error_description: string;
32
+ error_uri: string;
33
+ }
34
+ interface CodeResponse {
35
+ code: string;
36
+ scope: string;
37
+ state: string;
38
+ error: string;
39
+ error_description: string;
40
+ error_uri: string;
41
+ }
42
+ interface TokenClientConfig {
43
+ client_id: string;
44
+ scope: string;
45
+ include_granted_scopes?: boolean;
46
+ prompt?: '' | 'none' | 'consent' | 'select_account';
47
+ enable_granular_consent?: boolean;
48
+ enable_serial_consent?: boolean;
49
+ login_hint?: string;
50
+ hint?: string;
51
+ hd?: string;
52
+ hosted_domain?: string;
53
+ state?: string;
54
+ callback: (tokenResponse: TokenResponse) => void;
55
+ error_callback?: (error: ClientConfigError) => void;
56
+ }
57
+ interface CodeClientConfig {
58
+ client_id: string;
59
+ scope: string;
60
+ include_granted_scopes?: boolean;
61
+ redirect_uri?: string;
62
+ state?: string;
63
+ enable_granular_consent?: boolean;
64
+ enable_serial_consent?: boolean;
65
+ login_hint?: string;
66
+ hint?: string;
67
+ hd?: string;
68
+ hosted_domain?: string;
69
+ ux_mode?: 'popup' | 'redirect';
70
+ select_account?: boolean;
71
+ callback?: (response: CodeResponse) => void;
72
+ error_callback?: (error: ClientConfigError) => void;
73
+ }
74
+ interface RevocationResponse {
75
+ successful: boolean;
76
+ error?: string;
77
+ }
78
+ interface Credential {
79
+ id: string;
80
+ password: string;
81
+ }
82
+ interface CredentialResponse {
83
+ credential: string;
84
+ select_by: string;
85
+ }
86
+ interface IdConfiguration {
87
+ client_id: string;
88
+ auto_select?: boolean;
89
+ login_uri?: string;
90
+ cancel_on_tap_outside?: boolean;
91
+ prompt_parent_id?: string;
92
+ nonce?: string;
93
+ context?: 'signin' | 'signup' | 'use';
94
+ state_cookie_domain?: string;
95
+ ux_mode?: 'popup' | 'redirect';
96
+ allowed_parent_origin?: string | string[];
97
+ itp_support?: boolean;
98
+ login_hint?: string;
99
+ hd?: string;
100
+ use_fedcm_for_prompt?: boolean;
101
+ callback?: (response: CredentialResponse) => void;
102
+ native_callback?: (response: CredentialResponse) => void;
103
+ intermediate_iframe_close_callback?: () => void;
104
+ }
105
+ interface PromptMomentNotification {
106
+ isDisplayMoment(): boolean;
107
+ isDisplayed(): boolean;
108
+ isNotDisplayed(): boolean;
109
+ getNotDisplayedReason(): 'browser_not_supported' | 'invalid_client' | 'missing_client_id' | 'opt_out_or_no_session' | 'secure_http_required' | 'suppressed_by_user' | 'unregistered_origin' | 'unknown_reason';
110
+ isSkippedMoment(): boolean;
111
+ getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';
112
+ isDismissedMoment(): boolean;
113
+ getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';
114
+ getMomentType(): 'display' | 'skipped' | 'dismissed';
115
+ }
116
+ interface GsiButtonConfiguration {
117
+ type: 'standard' | 'icon';
118
+ theme?: 'outline' | 'filled_blue' | 'filled_black';
119
+ size?: 'small' | 'medium' | 'large';
120
+ text?: 'signin_with' | 'signup_with' | 'continue_with' | 'signin';
121
+ shape?: 'rectangular' | 'pill' | 'circle' | 'square';
122
+ logo_alignment?: 'left' | 'center';
123
+ width?: number;
124
+ locale?: string;
125
+ state?: string;
126
+ click_listener?: () => void;
127
+ }
128
+ interface GoogleAccounts {
129
+ oauth2: {
130
+ initCodeClient(config: CodeClientConfig): CodeClient;
131
+ initTokenClient(config: TokenClientConfig): TokenClient;
132
+ hasGrantedAllScopes(tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;
133
+ hasGrantedAnyScope(tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;
134
+ revoke(accessToken: string, done: () => void): void;
135
+ };
136
+ id: {
137
+ initialize(idConfig: IdConfiguration): void;
138
+ prompt(momentListener?: (promptMomentNotification: PromptMomentNotification) => void): void;
139
+ renderButton(parent: HTMLElement, options: GsiButtonConfiguration): void;
140
+ disableAutoSelect(): void;
141
+ storeCredential(credential: Credential, callback?: () => void): void;
142
+ cancel(): void;
143
+ revoke(hint: string, callback?: (response: RevocationResponse) => void): void;
144
+ };
145
+ }
146
+
147
+ export type { GoogleAccounts, IdConfiguration };
@@ -0,0 +1,147 @@
1
+ interface ClientConfigError extends Error {
2
+ message: string;
3
+ stack?: string;
4
+ type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';
5
+ }
6
+ interface OverridableTokenClientConfig {
7
+ scope?: string;
8
+ include_granted_scopes?: boolean;
9
+ prompt?: string;
10
+ enable_granular_consent?: boolean;
11
+ enable_serial_consent?: boolean;
12
+ login_hint?: string;
13
+ hint?: string;
14
+ state?: string;
15
+ }
16
+ interface TokenClient {
17
+ requestAccessToken: (overrideConfig?: OverridableTokenClientConfig) => void;
18
+ }
19
+ interface CodeClient {
20
+ requestCode: () => void;
21
+ }
22
+ interface TokenResponse {
23
+ access_token: string;
24
+ expires_in: string;
25
+ hd: string;
26
+ prompt: string;
27
+ token_type: string;
28
+ scope: string;
29
+ state: string;
30
+ error: string;
31
+ error_description: string;
32
+ error_uri: string;
33
+ }
34
+ interface CodeResponse {
35
+ code: string;
36
+ scope: string;
37
+ state: string;
38
+ error: string;
39
+ error_description: string;
40
+ error_uri: string;
41
+ }
42
+ interface TokenClientConfig {
43
+ client_id: string;
44
+ scope: string;
45
+ include_granted_scopes?: boolean;
46
+ prompt?: '' | 'none' | 'consent' | 'select_account';
47
+ enable_granular_consent?: boolean;
48
+ enable_serial_consent?: boolean;
49
+ login_hint?: string;
50
+ hint?: string;
51
+ hd?: string;
52
+ hosted_domain?: string;
53
+ state?: string;
54
+ callback: (tokenResponse: TokenResponse) => void;
55
+ error_callback?: (error: ClientConfigError) => void;
56
+ }
57
+ interface CodeClientConfig {
58
+ client_id: string;
59
+ scope: string;
60
+ include_granted_scopes?: boolean;
61
+ redirect_uri?: string;
62
+ state?: string;
63
+ enable_granular_consent?: boolean;
64
+ enable_serial_consent?: boolean;
65
+ login_hint?: string;
66
+ hint?: string;
67
+ hd?: string;
68
+ hosted_domain?: string;
69
+ ux_mode?: 'popup' | 'redirect';
70
+ select_account?: boolean;
71
+ callback?: (response: CodeResponse) => void;
72
+ error_callback?: (error: ClientConfigError) => void;
73
+ }
74
+ interface RevocationResponse {
75
+ successful: boolean;
76
+ error?: string;
77
+ }
78
+ interface Credential {
79
+ id: string;
80
+ password: string;
81
+ }
82
+ interface CredentialResponse {
83
+ credential: string;
84
+ select_by: string;
85
+ }
86
+ interface IdConfiguration {
87
+ client_id: string;
88
+ auto_select?: boolean;
89
+ login_uri?: string;
90
+ cancel_on_tap_outside?: boolean;
91
+ prompt_parent_id?: string;
92
+ nonce?: string;
93
+ context?: 'signin' | 'signup' | 'use';
94
+ state_cookie_domain?: string;
95
+ ux_mode?: 'popup' | 'redirect';
96
+ allowed_parent_origin?: string | string[];
97
+ itp_support?: boolean;
98
+ login_hint?: string;
99
+ hd?: string;
100
+ use_fedcm_for_prompt?: boolean;
101
+ callback?: (response: CredentialResponse) => void;
102
+ native_callback?: (response: CredentialResponse) => void;
103
+ intermediate_iframe_close_callback?: () => void;
104
+ }
105
+ interface PromptMomentNotification {
106
+ isDisplayMoment(): boolean;
107
+ isDisplayed(): boolean;
108
+ isNotDisplayed(): boolean;
109
+ getNotDisplayedReason(): 'browser_not_supported' | 'invalid_client' | 'missing_client_id' | 'opt_out_or_no_session' | 'secure_http_required' | 'suppressed_by_user' | 'unregistered_origin' | 'unknown_reason';
110
+ isSkippedMoment(): boolean;
111
+ getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';
112
+ isDismissedMoment(): boolean;
113
+ getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';
114
+ getMomentType(): 'display' | 'skipped' | 'dismissed';
115
+ }
116
+ interface GsiButtonConfiguration {
117
+ type: 'standard' | 'icon';
118
+ theme?: 'outline' | 'filled_blue' | 'filled_black';
119
+ size?: 'small' | 'medium' | 'large';
120
+ text?: 'signin_with' | 'signup_with' | 'continue_with' | 'signin';
121
+ shape?: 'rectangular' | 'pill' | 'circle' | 'square';
122
+ logo_alignment?: 'left' | 'center';
123
+ width?: number;
124
+ locale?: string;
125
+ state?: string;
126
+ click_listener?: () => void;
127
+ }
128
+ interface GoogleAccounts {
129
+ oauth2: {
130
+ initCodeClient(config: CodeClientConfig): CodeClient;
131
+ initTokenClient(config: TokenClientConfig): TokenClient;
132
+ hasGrantedAllScopes(tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;
133
+ hasGrantedAnyScope(tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;
134
+ revoke(accessToken: string, done: () => void): void;
135
+ };
136
+ id: {
137
+ initialize(idConfig: IdConfiguration): void;
138
+ prompt(momentListener?: (promptMomentNotification: PromptMomentNotification) => void): void;
139
+ renderButton(parent: HTMLElement, options: GsiButtonConfiguration): void;
140
+ disableAutoSelect(): void;
141
+ storeCredential(credential: Credential, callback?: () => void): void;
142
+ cancel(): void;
143
+ revoke(hint: string, callback?: (response: RevocationResponse) => void): void;
144
+ };
145
+ }
146
+
147
+ export type { GoogleAccounts, IdConfiguration };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shware/http",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/hono/index.d.ts",
28
28
  "import": "./dist/hono/index.mjs",
29
29
  "require": "./dist/hono/index.cjs"
30
+ },
31
+ "./google-one-tap": {
32
+ "types": "./dist/google-one-tap/index.d.ts",
33
+ "import": "./dist/google-one-tap/index.mjs",
34
+ "require": "./dist/google-one-tap/index.cjs"
30
35
  }
31
36
  },
32
37
  "files": [