@mshindi-labs/google 1.1.0 → 1.3.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 +9 -4
- package/dist/calendar.cjs +1593 -0
- package/dist/calendar.cjs.map +1 -0
- package/dist/calendar.d.cts +161 -0
- package/dist/calendar.d.ts +161 -0
- package/dist/calendar.js +1593 -0
- package/dist/calendar.js.map +1 -0
- package/dist/chunk-2MJE3WQ5.js +63 -0
- package/dist/chunk-2MJE3WQ5.js.map +1 -0
- package/dist/chunk-4UEM6VO4.cjs +119 -0
- package/dist/chunk-4UEM6VO4.cjs.map +1 -0
- package/dist/{chunk-RWT25QHA.js → chunk-6VGR73PY.js} +87 -2
- package/dist/chunk-6VGR73PY.js.map +1 -0
- package/dist/{chunk-SIDO26T7.js → chunk-7YVRJ3GY.js} +12 -4
- package/dist/chunk-7YVRJ3GY.js.map +1 -0
- package/dist/chunk-7ZLAL7UY.cjs +63 -0
- package/dist/chunk-7ZLAL7UY.cjs.map +1 -0
- package/dist/chunk-BYHOVCN3.cjs +20 -0
- package/dist/chunk-BYHOVCN3.cjs.map +1 -0
- package/dist/chunk-FPEP5FL5.js +87 -0
- package/dist/chunk-FPEP5FL5.js.map +1 -0
- package/dist/chunk-JA2JLBNN.js +119 -0
- package/dist/chunk-JA2JLBNN.js.map +1 -0
- package/dist/{chunk-VN5VWVCT.cjs → chunk-KFQ4O6MT.cjs} +64 -56
- package/dist/chunk-KFQ4O6MT.cjs.map +1 -0
- package/dist/chunk-LWCB3V7V.js +20 -0
- package/dist/chunk-LWCB3V7V.js.map +1 -0
- package/dist/{chunk-KJPQ3DMR.cjs → chunk-RWRVNSQG.cjs} +6 -6
- package/dist/{chunk-KJPQ3DMR.cjs.map → chunk-RWRVNSQG.cjs.map} +1 -1
- package/dist/{chunk-Z7O6GO3C.js → chunk-UR3KSPDZ.js} +2 -2
- package/dist/{chunk-SHDP4A3A.cjs → chunk-UUXXCUIB.cjs} +87 -2
- package/dist/chunk-UUXXCUIB.cjs.map +1 -0
- package/dist/{chunk-V22QP2AM.cjs → chunk-V5Q6XSYZ.cjs} +3 -3
- package/dist/{chunk-V22QP2AM.cjs.map → chunk-V5Q6XSYZ.cjs.map} +1 -1
- package/dist/chunk-X7QL7AQ6.cjs +87 -0
- package/dist/chunk-X7QL7AQ6.cjs.map +1 -0
- package/dist/{chunk-JVP7HHFU.js → chunk-ZPDFK5VR.js} +2 -2
- package/dist/core.cjs +40 -18
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +40 -4
- package/dist/core.d.ts +40 -4
- package/dist/core.js +26 -4
- package/dist/core.js.map +1 -1
- package/dist/{create-google-CPGcK-3G.d.cts → create-google-B0fX1ixG.d.cts} +3 -1
- package/dist/{create-google-nP9f9jd9.d.ts → create-google-CjsKhktN.d.ts} +3 -1
- package/dist/{events-BsWOMtza.d.ts → events-BlC10ISp.d.cts} +31 -0
- package/dist/{events-BsWOMtza.d.cts → events-BlC10ISp.d.ts} +31 -0
- package/dist/gmail.cjs +54 -79
- package/dist/gmail.cjs.map +1 -1
- package/dist/gmail.d.cts +2 -2
- package/dist/gmail.d.ts +2 -2
- package/dist/gmail.js +19 -44
- package/dist/gmail.js.map +1 -1
- package/dist/postgres.cjs +8 -8
- package/dist/postgres.d.cts +1 -1
- package/dist/postgres.d.ts +1 -1
- package/dist/postgres.js +1 -1
- package/dist/sheets.cjs +1317 -0
- package/dist/sheets.cjs.map +1 -0
- package/dist/sheets.d.cts +292 -0
- package/dist/sheets.d.ts +292 -0
- package/dist/sheets.js +1317 -0
- package/dist/sheets.js.map +1 -0
- package/dist/testing.cjs +1119 -39
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +223 -2
- package/dist/testing.d.ts +223 -2
- package/dist/testing.js +1110 -30
- package/dist/testing.js.map +1 -1
- package/dist/transport-DHApc5oq.d.cts +103 -0
- package/dist/transport-DHApc5oq.d.ts +103 -0
- package/dist/transport-uuotQ13Y.d.cts +137 -0
- package/dist/transport-uuotQ13Y.d.ts +137 -0
- package/package.json +35 -4
- package/dist/chunk-RWT25QHA.js.map +0 -1
- package/dist/chunk-SHDP4A3A.cjs.map +0 -1
- package/dist/chunk-SIDO26T7.js.map +0 -1
- package/dist/chunk-VN5VWVCT.cjs.map +0 -1
- /package/dist/{chunk-Z7O6GO3C.js.map → chunk-UR3KSPDZ.js.map} +0 -0
- /package/dist/{chunk-JVP7HHFU.js.map → chunk-ZPDFK5VR.js.map} +0 -0
package/dist/core.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { B as BASE_SCOPES, C as ClientsApi, a as ConnectionsApi, b as CreateGoogleOptions, G as GoogleCore, c as GoogleService, O as OAuthApi, S as SERVICE_SCOPES, d as createGoogle, s as scopesFor } from './create-google-
|
|
1
|
+
export { B as BASE_SCOPES, C as ClientsApi, a as ConnectionsApi, b as CreateGoogleOptions, G as GoogleCore, c as GoogleService, O as OAuthApi, S as SERVICE_SCOPES, d as createGoogle, s as scopesFor } from './create-google-B0fX1ixG.cjs';
|
|
2
2
|
export { S as StaticKeyProvider } from './static-key-provider-CPNt4YvF.cjs';
|
|
3
3
|
import { K as KeyProvider } from './key-provider-Cq_14Bh6.cjs';
|
|
4
4
|
export { I as InvalidGrantError, O as OAuthGateway } from './key-provider-Cq_14Bh6.cjs';
|
|
5
|
-
import { C as CredentialStore } from './events-
|
|
6
|
-
export { A as AadRecord, a as ConnectionRecord, b as ConnectionStatus, c as ConnectionView, E as EncryptedValue, d as EncryptedValueRef, G as GoogleEvent, L as Logger, O as OAuthClientRecord, e as OAuthStateRecord } from './events-
|
|
5
|
+
import { C as CredentialStore } from './events-BlC10ISp.cjs';
|
|
6
|
+
export { A as AadRecord, a as ConnectionRecord, b as ConnectionStatus, c as ConnectionView, E as EncryptedValue, d as EncryptedValueRef, G as GoogleEvent, L as Logger, O as OAuthClientRecord, e as OAuthStateRecord } from './events-BlC10ISp.cjs';
|
|
7
7
|
|
|
8
8
|
interface GoogleErrorOptions {
|
|
9
9
|
tenantId?: string;
|
|
@@ -79,6 +79,42 @@ declare class MissingPeerDependencyError extends GoogleLibError {
|
|
|
79
79
|
declare class InvalidConfigError extends GoogleLibError {
|
|
80
80
|
constructor(message: string, opts?: GoogleErrorOptions);
|
|
81
81
|
}
|
|
82
|
+
declare class InvalidEventError extends GoogleLibError {
|
|
83
|
+
readonly field: string;
|
|
84
|
+
constructor(field: string, message?: string, opts?: GoogleErrorOptions);
|
|
85
|
+
}
|
|
86
|
+
declare class EventNotFoundError extends GoogleLibError {
|
|
87
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
88
|
+
}
|
|
89
|
+
declare class EventNotManagedError extends GoogleLibError {
|
|
90
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
91
|
+
}
|
|
92
|
+
declare class EventCancelledError extends GoogleLibError {
|
|
93
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
94
|
+
}
|
|
95
|
+
declare class EventConflictError extends GoogleLibError {
|
|
96
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
97
|
+
}
|
|
98
|
+
declare class ConferencingUnavailableError extends GoogleLibError {
|
|
99
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
100
|
+
}
|
|
101
|
+
declare class SpreadsheetNotFoundError extends GoogleLibError {
|
|
102
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
103
|
+
}
|
|
104
|
+
declare class SpreadsheetAccessDeniedError extends GoogleLibError {
|
|
105
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
106
|
+
}
|
|
107
|
+
declare class SheetTabNotFoundError extends GoogleLibError {
|
|
108
|
+
readonly tab: string;
|
|
109
|
+
constructor(tab: string, message?: string, opts?: GoogleErrorOptions);
|
|
110
|
+
}
|
|
111
|
+
declare class InvalidSheetsInputError extends GoogleLibError {
|
|
112
|
+
readonly field: string;
|
|
113
|
+
constructor(field: string, message?: string, opts?: GoogleErrorOptions);
|
|
114
|
+
}
|
|
115
|
+
declare class SheetsWriteOutcomeUnknownError extends GoogleLibError {
|
|
116
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
117
|
+
}
|
|
82
118
|
|
|
83
119
|
type GcpKmsClientLike = {
|
|
84
120
|
encrypt(req: {
|
|
@@ -170,4 +206,4 @@ declare function verifyAll(opts: {
|
|
|
170
206
|
failed: OpsFailure[];
|
|
171
207
|
}>;
|
|
172
208
|
|
|
173
|
-
export { type AwsKmsClientLike, type AwsKmsCommands, AwsKmsKeyProvider, ConnectionNotFoundError, ConnectionRevokedError, CredentialIntegrityError, CredentialStore, DailyQuotaExceededError, type GcpKmsClientLike, GcpKmsKeyProvider, GoogleApiError, type GoogleErrorOptions, GoogleLibError, InvalidConfigError, InvalidMessageError, InvalidOAuthStateError, KeyProvider, KeyProviderUnavailableError, MessageTooLargeError, MissingPeerDependencyError, MissingScopeError, NoRefreshTokenError, OAuthClientNotConfiguredError, OAuthConsentDeniedError, type OpsFailure, RateLimitedError, SendOutcomeUnknownError, UnexpectedAccountError, rewrapAll, verifyAll };
|
|
209
|
+
export { type AwsKmsClientLike, type AwsKmsCommands, AwsKmsKeyProvider, ConferencingUnavailableError, ConnectionNotFoundError, ConnectionRevokedError, CredentialIntegrityError, CredentialStore, DailyQuotaExceededError, EventCancelledError, EventConflictError, EventNotFoundError, EventNotManagedError, type GcpKmsClientLike, GcpKmsKeyProvider, GoogleApiError, type GoogleErrorOptions, GoogleLibError, InvalidConfigError, InvalidEventError, InvalidMessageError, InvalidOAuthStateError, InvalidSheetsInputError, KeyProvider, KeyProviderUnavailableError, MessageTooLargeError, MissingPeerDependencyError, MissingScopeError, NoRefreshTokenError, OAuthClientNotConfiguredError, OAuthConsentDeniedError, type OpsFailure, RateLimitedError, SendOutcomeUnknownError, SheetTabNotFoundError, SheetsWriteOutcomeUnknownError, SpreadsheetAccessDeniedError, SpreadsheetNotFoundError, UnexpectedAccountError, rewrapAll, verifyAll };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { B as BASE_SCOPES, C as ClientsApi, a as ConnectionsApi, b as CreateGoogleOptions, G as GoogleCore, c as GoogleService, O as OAuthApi, S as SERVICE_SCOPES, d as createGoogle, s as scopesFor } from './create-google-
|
|
1
|
+
export { B as BASE_SCOPES, C as ClientsApi, a as ConnectionsApi, b as CreateGoogleOptions, G as GoogleCore, c as GoogleService, O as OAuthApi, S as SERVICE_SCOPES, d as createGoogle, s as scopesFor } from './create-google-CjsKhktN.js';
|
|
2
2
|
export { S as StaticKeyProvider } from './static-key-provider-BhyRhY6-.js';
|
|
3
3
|
import { K as KeyProvider } from './key-provider-Cq_14Bh6.js';
|
|
4
4
|
export { I as InvalidGrantError, O as OAuthGateway } from './key-provider-Cq_14Bh6.js';
|
|
5
|
-
import { C as CredentialStore } from './events-
|
|
6
|
-
export { A as AadRecord, a as ConnectionRecord, b as ConnectionStatus, c as ConnectionView, E as EncryptedValue, d as EncryptedValueRef, G as GoogleEvent, L as Logger, O as OAuthClientRecord, e as OAuthStateRecord } from './events-
|
|
5
|
+
import { C as CredentialStore } from './events-BlC10ISp.js';
|
|
6
|
+
export { A as AadRecord, a as ConnectionRecord, b as ConnectionStatus, c as ConnectionView, E as EncryptedValue, d as EncryptedValueRef, G as GoogleEvent, L as Logger, O as OAuthClientRecord, e as OAuthStateRecord } from './events-BlC10ISp.js';
|
|
7
7
|
|
|
8
8
|
interface GoogleErrorOptions {
|
|
9
9
|
tenantId?: string;
|
|
@@ -79,6 +79,42 @@ declare class MissingPeerDependencyError extends GoogleLibError {
|
|
|
79
79
|
declare class InvalidConfigError extends GoogleLibError {
|
|
80
80
|
constructor(message: string, opts?: GoogleErrorOptions);
|
|
81
81
|
}
|
|
82
|
+
declare class InvalidEventError extends GoogleLibError {
|
|
83
|
+
readonly field: string;
|
|
84
|
+
constructor(field: string, message?: string, opts?: GoogleErrorOptions);
|
|
85
|
+
}
|
|
86
|
+
declare class EventNotFoundError extends GoogleLibError {
|
|
87
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
88
|
+
}
|
|
89
|
+
declare class EventNotManagedError extends GoogleLibError {
|
|
90
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
91
|
+
}
|
|
92
|
+
declare class EventCancelledError extends GoogleLibError {
|
|
93
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
94
|
+
}
|
|
95
|
+
declare class EventConflictError extends GoogleLibError {
|
|
96
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
97
|
+
}
|
|
98
|
+
declare class ConferencingUnavailableError extends GoogleLibError {
|
|
99
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
100
|
+
}
|
|
101
|
+
declare class SpreadsheetNotFoundError extends GoogleLibError {
|
|
102
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
103
|
+
}
|
|
104
|
+
declare class SpreadsheetAccessDeniedError extends GoogleLibError {
|
|
105
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
106
|
+
}
|
|
107
|
+
declare class SheetTabNotFoundError extends GoogleLibError {
|
|
108
|
+
readonly tab: string;
|
|
109
|
+
constructor(tab: string, message?: string, opts?: GoogleErrorOptions);
|
|
110
|
+
}
|
|
111
|
+
declare class InvalidSheetsInputError extends GoogleLibError {
|
|
112
|
+
readonly field: string;
|
|
113
|
+
constructor(field: string, message?: string, opts?: GoogleErrorOptions);
|
|
114
|
+
}
|
|
115
|
+
declare class SheetsWriteOutcomeUnknownError extends GoogleLibError {
|
|
116
|
+
constructor(message?: string, opts?: GoogleErrorOptions);
|
|
117
|
+
}
|
|
82
118
|
|
|
83
119
|
type GcpKmsClientLike = {
|
|
84
120
|
encrypt(req: {
|
|
@@ -170,4 +206,4 @@ declare function verifyAll(opts: {
|
|
|
170
206
|
failed: OpsFailure[];
|
|
171
207
|
}>;
|
|
172
208
|
|
|
173
|
-
export { type AwsKmsClientLike, type AwsKmsCommands, AwsKmsKeyProvider, ConnectionNotFoundError, ConnectionRevokedError, CredentialIntegrityError, CredentialStore, DailyQuotaExceededError, type GcpKmsClientLike, GcpKmsKeyProvider, GoogleApiError, type GoogleErrorOptions, GoogleLibError, InvalidConfigError, InvalidMessageError, InvalidOAuthStateError, KeyProvider, KeyProviderUnavailableError, MessageTooLargeError, MissingPeerDependencyError, MissingScopeError, NoRefreshTokenError, OAuthClientNotConfiguredError, OAuthConsentDeniedError, type OpsFailure, RateLimitedError, SendOutcomeUnknownError, UnexpectedAccountError, rewrapAll, verifyAll };
|
|
209
|
+
export { type AwsKmsClientLike, type AwsKmsCommands, AwsKmsKeyProvider, ConferencingUnavailableError, ConnectionNotFoundError, ConnectionRevokedError, CredentialIntegrityError, CredentialStore, DailyQuotaExceededError, EventCancelledError, EventConflictError, EventNotFoundError, EventNotManagedError, type GcpKmsClientLike, GcpKmsKeyProvider, GoogleApiError, type GoogleErrorOptions, GoogleLibError, InvalidConfigError, InvalidEventError, InvalidMessageError, InvalidOAuthStateError, InvalidSheetsInputError, KeyProvider, KeyProviderUnavailableError, MessageTooLargeError, MissingPeerDependencyError, MissingScopeError, NoRefreshTokenError, OAuthClientNotConfiguredError, OAuthConsentDeniedError, type OpsFailure, RateLimitedError, SendOutcomeUnknownError, SheetTabNotFoundError, SheetsWriteOutcomeUnknownError, SpreadsheetAccessDeniedError, SpreadsheetNotFoundError, UnexpectedAccountError, rewrapAll, verifyAll };
|
package/dist/core.js
CHANGED
|
@@ -6,24 +6,31 @@ import {
|
|
|
6
6
|
decryptValue,
|
|
7
7
|
rewrapValue,
|
|
8
8
|
scopesFor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7YVRJ3GY.js";
|
|
10
10
|
import {
|
|
11
11
|
StaticKeyProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZPDFK5VR.js";
|
|
13
13
|
import {
|
|
14
14
|
InvalidGrantError,
|
|
15
15
|
loadPeer
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UR3KSPDZ.js";
|
|
17
17
|
import {
|
|
18
|
+
ConferencingUnavailableError,
|
|
18
19
|
ConnectionNotFoundError,
|
|
19
20
|
ConnectionRevokedError,
|
|
20
21
|
CredentialIntegrityError,
|
|
21
22
|
DailyQuotaExceededError,
|
|
23
|
+
EventCancelledError,
|
|
24
|
+
EventConflictError,
|
|
25
|
+
EventNotFoundError,
|
|
26
|
+
EventNotManagedError,
|
|
22
27
|
GoogleApiError,
|
|
23
28
|
GoogleLibError,
|
|
24
29
|
InvalidConfigError,
|
|
30
|
+
InvalidEventError,
|
|
25
31
|
InvalidMessageError,
|
|
26
32
|
InvalidOAuthStateError,
|
|
33
|
+
InvalidSheetsInputError,
|
|
27
34
|
KeyProviderUnavailableError,
|
|
28
35
|
MessageTooLargeError,
|
|
29
36
|
MissingPeerDependencyError,
|
|
@@ -33,8 +40,12 @@ import {
|
|
|
33
40
|
OAuthConsentDeniedError,
|
|
34
41
|
RateLimitedError,
|
|
35
42
|
SendOutcomeUnknownError,
|
|
43
|
+
SheetTabNotFoundError,
|
|
44
|
+
SheetsWriteOutcomeUnknownError,
|
|
45
|
+
SpreadsheetAccessDeniedError,
|
|
46
|
+
SpreadsheetNotFoundError,
|
|
36
47
|
UnexpectedAccountError
|
|
37
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-6VGR73PY.js";
|
|
38
49
|
|
|
39
50
|
// src/core/crypto/kms-errors.ts
|
|
40
51
|
var NET_CODES = /* @__PURE__ */ new Set([
|
|
@@ -258,17 +269,24 @@ async function verifyAll(opts) {
|
|
|
258
269
|
export {
|
|
259
270
|
AwsKmsKeyProvider,
|
|
260
271
|
BASE_SCOPES,
|
|
272
|
+
ConferencingUnavailableError,
|
|
261
273
|
ConnectionNotFoundError,
|
|
262
274
|
ConnectionRevokedError,
|
|
263
275
|
CredentialIntegrityError,
|
|
264
276
|
DailyQuotaExceededError,
|
|
277
|
+
EventCancelledError,
|
|
278
|
+
EventConflictError,
|
|
279
|
+
EventNotFoundError,
|
|
280
|
+
EventNotManagedError,
|
|
265
281
|
GcpKmsKeyProvider,
|
|
266
282
|
GoogleApiError,
|
|
267
283
|
GoogleLibError,
|
|
268
284
|
InvalidConfigError,
|
|
285
|
+
InvalidEventError,
|
|
269
286
|
InvalidGrantError,
|
|
270
287
|
InvalidMessageError,
|
|
271
288
|
InvalidOAuthStateError,
|
|
289
|
+
InvalidSheetsInputError,
|
|
272
290
|
KeyProviderUnavailableError,
|
|
273
291
|
MessageTooLargeError,
|
|
274
292
|
MissingPeerDependencyError,
|
|
@@ -279,6 +297,10 @@ export {
|
|
|
279
297
|
RateLimitedError,
|
|
280
298
|
SERVICE_SCOPES,
|
|
281
299
|
SendOutcomeUnknownError,
|
|
300
|
+
SheetTabNotFoundError,
|
|
301
|
+
SheetsWriteOutcomeUnknownError,
|
|
302
|
+
SpreadsheetAccessDeniedError,
|
|
303
|
+
SpreadsheetNotFoundError,
|
|
282
304
|
StaticKeyProvider,
|
|
283
305
|
UnexpectedAccountError,
|
|
284
306
|
createGoogle,
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/crypto/kms-errors.ts","../src/core/crypto/gcp-kms.ts","../src/core/crypto/aws-kms.ts","../src/core/ops.ts"],"sourcesContent":["import {\n CredentialIntegrityError,\n KeyProviderUnavailableError,\n} from \"../errors.js\";\n\nconst NET_CODES = new Set([\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ETIMEDOUT\",\n \"ENOTFOUND\",\n \"EAI_AGAIN\",\n]);\n// gRPC: DEADLINE_EXCEEDED, RESOURCE_EXHAUSTED, UNAVAILABLE.\nconst GRPC_CODES = new Set([4, 8, 14]);\n\n/** True for transport/availability failures (retryable), false otherwise. */\nexport function isKmsAvailabilityError(err: unknown): boolean {\n if (typeof err !== \"object\" || err === null) return false;\n const e = err as {\n code?: unknown;\n name?: unknown;\n $metadata?: { httpStatusCode?: unknown };\n };\n if (typeof e.code === \"string\" && NET_CODES.has(e.code)) return true;\n if (typeof e.code === \"number\" && GRPC_CODES.has(e.code)) return true;\n if (e.name === \"ThrottlingException\" || e.name === \"TimeoutError\") {\n return true;\n }\n const status = e.$metadata?.httpStatusCode;\n return typeof status === \"number\" && status >= 500;\n}\n\n/** Maps a KMS client failure to the library error; the cause is redacted. */\nexport function mapKmsError(err: unknown): Error {\n return isKmsAvailabilityError(err)\n ? new KeyProviderUnavailableError(undefined, { cause: err })\n : new CredentialIntegrityError(undefined, { cause: err });\n}\n","import { CredentialIntegrityError } from \"../errors.js\";\nimport { loadPeer } from \"../peer.js\";\nimport { mapKmsError } from \"./kms-errors.js\";\nimport type { KeyProvider } from \"./key-provider.js\";\n\nconst PREFIX = \"gcp-kms:\";\n\nexport type GcpKmsClientLike = {\n encrypt(req: {\n name: string;\n plaintext: Uint8Array;\n additionalAuthenticatedData: Uint8Array;\n }): Promise<[{ ciphertext?: Uint8Array | string | null }]>;\n decrypt(req: {\n name: string;\n ciphertext: Uint8Array;\n additionalAuthenticatedData: Uint8Array;\n }): Promise<[{ plaintext?: Uint8Array | string | null }]>;\n};\n\n/** Wraps DEKs with a Cloud KMS symmetric key. kid is `gcp-kms:<keyName>`. */\nexport class GcpKmsKeyProvider implements KeyProvider {\n readonly currentKeyId: string;\n readonly #keyName: string;\n #client: GcpKmsClientLike | undefined;\n #loading: Promise<GcpKmsClientLike> | undefined;\n\n constructor(opts: { keyName: string; client?: GcpKmsClientLike }) {\n this.#keyName = opts.keyName;\n this.currentKeyId = PREFIX + opts.keyName;\n this.#client = opts.client;\n }\n\n async #getClient(): Promise<GcpKmsClientLike> {\n if (this.#client) return this.#client;\n this.#loading ??= loadPeer<{\n KeyManagementServiceClient: new () => GcpKmsClientLike;\n }>(\"@google-cloud/kms\", \"@google-cloud/kms\").then(\n (m) => (this.#client = new m.KeyManagementServiceClient()),\n (err) => {\n this.#loading = undefined;\n throw err;\n },\n );\n return this.#loading;\n }\n\n async wrap(\n dek: Uint8Array,\n aad: string,\n ): Promise<{ kid: string; wdek: Uint8Array }> {\n const client = await this.#getClient();\n let res: [{ ciphertext?: Uint8Array | string | null }];\n try {\n res = await client.encrypt({\n name: this.#keyName,\n plaintext: dek,\n additionalAuthenticatedData: Buffer.from(aad, \"utf8\"),\n });\n } catch (err) {\n throw mapKmsError(err);\n }\n const ciphertext = res?.[0]?.ciphertext;\n if (ciphertext == null || ciphertext.length === 0) {\n throw new CredentialIntegrityError();\n }\n return { kid: this.currentKeyId, wdek: toBytes(ciphertext) };\n }\n\n async unwrap(\n kid: string,\n wdek: Uint8Array,\n aad: string,\n ): Promise<Uint8Array> {\n if (!kid.startsWith(PREFIX) || kid.length === PREFIX.length) {\n throw new CredentialIntegrityError();\n }\n const client = await this.#getClient();\n let res: [{ plaintext?: Uint8Array | string | null }];\n try {\n res = await client.decrypt({\n name: kid.slice(PREFIX.length),\n ciphertext: wdek,\n additionalAuthenticatedData: Buffer.from(aad, \"utf8\"),\n });\n } catch (err) {\n throw mapKmsError(err);\n }\n const plaintext = res?.[0]?.plaintext;\n if (plaintext == null || plaintext.length === 0) {\n throw new CredentialIntegrityError();\n }\n // Return the response buffer itself: the caller zeroes what it receives.\n return toBytes(plaintext);\n }\n}\n\nfunction toBytes(v: Uint8Array | string): Uint8Array {\n return typeof v === \"string\" ? Buffer.from(v, \"base64\") : v;\n}\n","import { CredentialIntegrityError } from \"../errors.js\";\nimport { loadPeer } from \"../peer.js\";\nimport { mapKmsError } from \"./kms-errors.js\";\nimport type { KeyProvider } from \"./key-provider.js\";\n\nconst PREFIX = \"aws-kms:\";\nconst CONTEXT_KEY = \"mshindi-google\";\n\nexport type AwsKmsClientLike = {\n send(\n cmd: unknown,\n ): Promise<{ CiphertextBlob?: Uint8Array; Plaintext?: Uint8Array }>;\n};\n\nexport type AwsKmsCommands = {\n EncryptCommand: new (input: any) => unknown;\n DecryptCommand: new (input: any) => unknown;\n};\n\ntype AwsKmsModule = AwsKmsCommands & { KMSClient: new () => AwsKmsClientLike };\n\n/** Wraps DEKs with an AWS KMS symmetric key. kid is `aws-kms:<keyId>`. */\nexport class AwsKmsKeyProvider implements KeyProvider {\n readonly currentKeyId: string;\n readonly #keyId: string;\n #client: AwsKmsClientLike | undefined;\n #commands: AwsKmsCommands | undefined;\n #sdk: Promise<AwsKmsModule> | undefined;\n\n /**\n * AWS SDK v3 `send` needs real Command instances, so the SDK is loaded\n * lazily via loadPeer only when `client` or `commands` is not injected.\n * Inject both (e.g. in tests) to avoid loading it at all.\n */\n constructor(opts: {\n keyId: string;\n client?: AwsKmsClientLike;\n commands?: AwsKmsCommands;\n }) {\n this.#keyId = opts.keyId;\n this.currentKeyId = PREFIX + opts.keyId;\n this.#client = opts.client;\n this.#commands = opts.commands;\n }\n\n async #load(): Promise<{\n sdk: AwsKmsCommands;\n client: AwsKmsClientLike;\n }> {\n if (this.#client && this.#commands) {\n return { sdk: this.#commands, client: this.#client };\n }\n this.#sdk ??= loadPeer<AwsKmsModule>(\n \"@aws-sdk/client-kms\",\n \"@aws-sdk/client-kms\",\n ).catch((err) => {\n this.#sdk = undefined;\n throw err;\n });\n const sdk = await this.#sdk;\n this.#commands ??= sdk;\n this.#client ??= new sdk.KMSClient();\n return { sdk: this.#commands, client: this.#client };\n }\n\n async wrap(\n dek: Uint8Array,\n aad: string,\n ): Promise<{ kid: string; wdek: Uint8Array }> {\n const { sdk, client } = await this.#load();\n let res: { CiphertextBlob?: Uint8Array };\n try {\n res = await client.send(\n new sdk.EncryptCommand({\n KeyId: this.#keyId,\n Plaintext: dek,\n EncryptionContext: { [CONTEXT_KEY]: aad },\n }),\n );\n } catch (err) {\n throw mapKmsError(err);\n }\n if (!res?.CiphertextBlob || res.CiphertextBlob.length === 0) {\n throw new CredentialIntegrityError();\n }\n return { kid: this.currentKeyId, wdek: res.CiphertextBlob };\n }\n\n async unwrap(\n kid: string,\n wdek: Uint8Array,\n aad: string,\n ): Promise<Uint8Array> {\n if (!kid.startsWith(PREFIX) || kid.length === PREFIX.length) {\n throw new CredentialIntegrityError();\n }\n const { sdk, client } = await this.#load();\n let res: { Plaintext?: Uint8Array };\n try {\n res = await client.send(\n new sdk.DecryptCommand({\n // KeyId makes a wrong-key ciphertext fail closed.\n KeyId: kid.slice(PREFIX.length),\n CiphertextBlob: wdek,\n EncryptionContext: { [CONTEXT_KEY]: aad },\n }),\n );\n } catch (err) {\n throw mapKmsError(err);\n }\n if (!res?.Plaintext || res.Plaintext.length === 0) {\n throw new CredentialIntegrityError();\n }\n // Return the response buffer itself: the caller zeroes what it receives.\n return res.Plaintext;\n }\n}\n","import { buildAad, decryptValue, rewrapValue } from \"./crypto/envelope.js\";\nimport type { KeyProvider } from \"./crypto/key-provider.js\";\nimport { GoogleLibError } from \"./errors.js\";\nimport type { CredentialStore } from \"./store.js\";\nimport type { EncryptedValueRef } from \"./types.js\";\n\nconst DEFAULT_BATCH_SIZE = 100;\n\nexport type OpsFailure = { record: string; error: string };\n\nconst label = (ref: EncryptedValueRef): string =>\n `${ref.record}:${ref.recordId}.${ref.field}`;\n\nconst aadOf = (ref: EncryptedValueRef): string =>\n buildAad({\n tenantId: ref.tenantId,\n record: ref.record,\n recordId: ref.recordId,\n field: ref.field,\n });\n\n/** Error code only: never a message, cause, or plaintext. */\nconst codeOf = (err: unknown): string =>\n err instanceof GoogleLibError ? err.code : \"unknown\";\n\n/**\n * Re-wraps every stored DEK under the provider's current key. Idempotent and\n * resumable: values already on the current key (or outside `fromKeyId`) are skipped.\n */\nexport async function rewrapAll(opts: {\n store: CredentialStore;\n keyProvider: KeyProvider;\n fromKeyId?: string;\n batchSize?: number;\n}): Promise<{ rewrapped: number; skipped: number; failed: OpsFailure[] }> {\n const { store, keyProvider, fromKeyId } = opts;\n const result = {\n rewrapped: 0,\n skipped: 0,\n failed: [] as OpsFailure[],\n };\n for await (const ref of store.iterateEncryptedValues(\n opts.batchSize ?? DEFAULT_BATCH_SIZE,\n )) {\n if (\n ref.value.kid === keyProvider.currentKeyId ||\n (fromKeyId !== undefined && ref.value.kid !== fromKeyId)\n ) {\n result.skipped++;\n continue;\n }\n try {\n const next = await rewrapValue(ref.value, aadOf(ref), keyProvider);\n // A CAS miss means a concurrent writer changed it; a rerun will pick it up.\n if (await store.replaceEncryptedValue(ref, next)) result.rewrapped++;\n else result.skipped++;\n } catch (err) {\n result.failed.push({ record: label(ref), error: codeOf(err) });\n }\n }\n return result;\n}\n\n/** Fully decrypts every stored value (plaintext discarded immediately) to prove integrity. */\nexport async function verifyAll(opts: {\n store: CredentialStore;\n keyProvider: KeyProvider;\n batchSize?: number;\n}): Promise<{ ok: number; failed: OpsFailure[] }> {\n const result = { ok: 0, failed: [] as OpsFailure[] };\n for await (const ref of opts.store.iterateEncryptedValues(\n opts.batchSize ?? DEFAULT_BATCH_SIZE,\n )) {\n try {\n await decryptValue(ref.value, aadOf(ref), opts.keyProvider);\n result.ok++;\n } catch (err) {\n result.failed.push({ record: label(ref), error: codeOf(err) });\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,YAAY,oBAAI,IAAI;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,aAAa,oBAAI,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;AAG9B,SAAS,uBAAuB,KAAuB;AAC5D,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI;AAKV,MAAI,OAAO,EAAE,SAAS,YAAY,UAAU,IAAI,EAAE,IAAI,EAAG,QAAO;AAChE,MAAI,OAAO,EAAE,SAAS,YAAY,WAAW,IAAI,EAAE,IAAI,EAAG,QAAO;AACjE,MAAI,EAAE,SAAS,yBAAyB,EAAE,SAAS,gBAAgB;AACjE,WAAO;AAAA,EACT;AACA,QAAM,SAAS,EAAE,WAAW;AAC5B,SAAO,OAAO,WAAW,YAAY,UAAU;AACjD;AAGO,SAAS,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AO;AACT;","names":["PREFIX"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/crypto/kms-errors.ts","../src/core/crypto/gcp-kms.ts","../src/core/crypto/aws-kms.ts","../src/core/ops.ts"],"sourcesContent":["import {\n CredentialIntegrityError,\n KeyProviderUnavailableError,\n} from \"../errors.js\";\n\nconst NET_CODES = new Set([\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ETIMEDOUT\",\n \"ENOTFOUND\",\n \"EAI_AGAIN\",\n]);\n// gRPC: DEADLINE_EXCEEDED, RESOURCE_EXHAUSTED, UNAVAILABLE.\nconst GRPC_CODES = new Set([4, 8, 14]);\n\n/** True for transport/availability failures (retryable), false otherwise. */\nexport function isKmsAvailabilityError(err: unknown): boolean {\n if (typeof err !== \"object\" || err === null) return false;\n const e = err as {\n code?: unknown;\n name?: unknown;\n $metadata?: { httpStatusCode?: unknown };\n };\n if (typeof e.code === \"string\" && NET_CODES.has(e.code)) return true;\n if (typeof e.code === \"number\" && GRPC_CODES.has(e.code)) return true;\n if (e.name === \"ThrottlingException\" || e.name === \"TimeoutError\") {\n return true;\n }\n const status = e.$metadata?.httpStatusCode;\n return typeof status === \"number\" && status >= 500;\n}\n\n/** Maps a KMS client failure to the library error; the cause is redacted. */\nexport function mapKmsError(err: unknown): Error {\n return isKmsAvailabilityError(err)\n ? new KeyProviderUnavailableError(undefined, { cause: err })\n : new CredentialIntegrityError(undefined, { cause: err });\n}\n","import { CredentialIntegrityError } from \"../errors.js\";\nimport { loadPeer } from \"../peer.js\";\nimport { mapKmsError } from \"./kms-errors.js\";\nimport type { KeyProvider } from \"./key-provider.js\";\n\nconst PREFIX = \"gcp-kms:\";\n\nexport type GcpKmsClientLike = {\n encrypt(req: {\n name: string;\n plaintext: Uint8Array;\n additionalAuthenticatedData: Uint8Array;\n }): Promise<[{ ciphertext?: Uint8Array | string | null }]>;\n decrypt(req: {\n name: string;\n ciphertext: Uint8Array;\n additionalAuthenticatedData: Uint8Array;\n }): Promise<[{ plaintext?: Uint8Array | string | null }]>;\n};\n\n/** Wraps DEKs with a Cloud KMS symmetric key. kid is `gcp-kms:<keyName>`. */\nexport class GcpKmsKeyProvider implements KeyProvider {\n readonly currentKeyId: string;\n readonly #keyName: string;\n #client: GcpKmsClientLike | undefined;\n #loading: Promise<GcpKmsClientLike> | undefined;\n\n constructor(opts: { keyName: string; client?: GcpKmsClientLike }) {\n this.#keyName = opts.keyName;\n this.currentKeyId = PREFIX + opts.keyName;\n this.#client = opts.client;\n }\n\n async #getClient(): Promise<GcpKmsClientLike> {\n if (this.#client) return this.#client;\n this.#loading ??= loadPeer<{\n KeyManagementServiceClient: new () => GcpKmsClientLike;\n }>(\"@google-cloud/kms\", \"@google-cloud/kms\").then(\n (m) => (this.#client = new m.KeyManagementServiceClient()),\n (err) => {\n this.#loading = undefined;\n throw err;\n },\n );\n return this.#loading;\n }\n\n async wrap(\n dek: Uint8Array,\n aad: string,\n ): Promise<{ kid: string; wdek: Uint8Array }> {\n const client = await this.#getClient();\n let res: [{ ciphertext?: Uint8Array | string | null }];\n try {\n res = await client.encrypt({\n name: this.#keyName,\n plaintext: dek,\n additionalAuthenticatedData: Buffer.from(aad, \"utf8\"),\n });\n } catch (err) {\n throw mapKmsError(err);\n }\n const ciphertext = res?.[0]?.ciphertext;\n if (ciphertext == null || ciphertext.length === 0) {\n throw new CredentialIntegrityError();\n }\n return { kid: this.currentKeyId, wdek: toBytes(ciphertext) };\n }\n\n async unwrap(\n kid: string,\n wdek: Uint8Array,\n aad: string,\n ): Promise<Uint8Array> {\n if (!kid.startsWith(PREFIX) || kid.length === PREFIX.length) {\n throw new CredentialIntegrityError();\n }\n const client = await this.#getClient();\n let res: [{ plaintext?: Uint8Array | string | null }];\n try {\n res = await client.decrypt({\n name: kid.slice(PREFIX.length),\n ciphertext: wdek,\n additionalAuthenticatedData: Buffer.from(aad, \"utf8\"),\n });\n } catch (err) {\n throw mapKmsError(err);\n }\n const plaintext = res?.[0]?.plaintext;\n if (plaintext == null || plaintext.length === 0) {\n throw new CredentialIntegrityError();\n }\n // Return the response buffer itself: the caller zeroes what it receives.\n return toBytes(plaintext);\n }\n}\n\nfunction toBytes(v: Uint8Array | string): Uint8Array {\n return typeof v === \"string\" ? Buffer.from(v, \"base64\") : v;\n}\n","import { CredentialIntegrityError } from \"../errors.js\";\nimport { loadPeer } from \"../peer.js\";\nimport { mapKmsError } from \"./kms-errors.js\";\nimport type { KeyProvider } from \"./key-provider.js\";\n\nconst PREFIX = \"aws-kms:\";\nconst CONTEXT_KEY = \"mshindi-google\";\n\nexport type AwsKmsClientLike = {\n send(\n cmd: unknown,\n ): Promise<{ CiphertextBlob?: Uint8Array; Plaintext?: Uint8Array }>;\n};\n\nexport type AwsKmsCommands = {\n EncryptCommand: new (input: any) => unknown;\n DecryptCommand: new (input: any) => unknown;\n};\n\ntype AwsKmsModule = AwsKmsCommands & { KMSClient: new () => AwsKmsClientLike };\n\n/** Wraps DEKs with an AWS KMS symmetric key. kid is `aws-kms:<keyId>`. */\nexport class AwsKmsKeyProvider implements KeyProvider {\n readonly currentKeyId: string;\n readonly #keyId: string;\n #client: AwsKmsClientLike | undefined;\n #commands: AwsKmsCommands | undefined;\n #sdk: Promise<AwsKmsModule> | undefined;\n\n /**\n * AWS SDK v3 `send` needs real Command instances, so the SDK is loaded\n * lazily via loadPeer only when `client` or `commands` is not injected.\n * Inject both (e.g. in tests) to avoid loading it at all.\n */\n constructor(opts: {\n keyId: string;\n client?: AwsKmsClientLike;\n commands?: AwsKmsCommands;\n }) {\n this.#keyId = opts.keyId;\n this.currentKeyId = PREFIX + opts.keyId;\n this.#client = opts.client;\n this.#commands = opts.commands;\n }\n\n async #load(): Promise<{\n sdk: AwsKmsCommands;\n client: AwsKmsClientLike;\n }> {\n if (this.#client && this.#commands) {\n return { sdk: this.#commands, client: this.#client };\n }\n this.#sdk ??= loadPeer<AwsKmsModule>(\n \"@aws-sdk/client-kms\",\n \"@aws-sdk/client-kms\",\n ).catch((err) => {\n this.#sdk = undefined;\n throw err;\n });\n const sdk = await this.#sdk;\n this.#commands ??= sdk;\n this.#client ??= new sdk.KMSClient();\n return { sdk: this.#commands, client: this.#client };\n }\n\n async wrap(\n dek: Uint8Array,\n aad: string,\n ): Promise<{ kid: string; wdek: Uint8Array }> {\n const { sdk, client } = await this.#load();\n let res: { CiphertextBlob?: Uint8Array };\n try {\n res = await client.send(\n new sdk.EncryptCommand({\n KeyId: this.#keyId,\n Plaintext: dek,\n EncryptionContext: { [CONTEXT_KEY]: aad },\n }),\n );\n } catch (err) {\n throw mapKmsError(err);\n }\n if (!res?.CiphertextBlob || res.CiphertextBlob.length === 0) {\n throw new CredentialIntegrityError();\n }\n return { kid: this.currentKeyId, wdek: res.CiphertextBlob };\n }\n\n async unwrap(\n kid: string,\n wdek: Uint8Array,\n aad: string,\n ): Promise<Uint8Array> {\n if (!kid.startsWith(PREFIX) || kid.length === PREFIX.length) {\n throw new CredentialIntegrityError();\n }\n const { sdk, client } = await this.#load();\n let res: { Plaintext?: Uint8Array };\n try {\n res = await client.send(\n new sdk.DecryptCommand({\n // KeyId makes a wrong-key ciphertext fail closed.\n KeyId: kid.slice(PREFIX.length),\n CiphertextBlob: wdek,\n EncryptionContext: { [CONTEXT_KEY]: aad },\n }),\n );\n } catch (err) {\n throw mapKmsError(err);\n }\n if (!res?.Plaintext || res.Plaintext.length === 0) {\n throw new CredentialIntegrityError();\n }\n // Return the response buffer itself: the caller zeroes what it receives.\n return res.Plaintext;\n }\n}\n","import { buildAad, decryptValue, rewrapValue } from \"./crypto/envelope.js\";\nimport type { KeyProvider } from \"./crypto/key-provider.js\";\nimport { GoogleLibError } from \"./errors.js\";\nimport type { CredentialStore } from \"./store.js\";\nimport type { EncryptedValueRef } from \"./types.js\";\n\nconst DEFAULT_BATCH_SIZE = 100;\n\nexport type OpsFailure = { record: string; error: string };\n\nconst label = (ref: EncryptedValueRef): string =>\n `${ref.record}:${ref.recordId}.${ref.field}`;\n\nconst aadOf = (ref: EncryptedValueRef): string =>\n buildAad({\n tenantId: ref.tenantId,\n record: ref.record,\n recordId: ref.recordId,\n field: ref.field,\n });\n\n/** Error code only: never a message, cause, or plaintext. */\nconst codeOf = (err: unknown): string =>\n err instanceof GoogleLibError ? err.code : \"unknown\";\n\n/**\n * Re-wraps every stored DEK under the provider's current key. Idempotent and\n * resumable: values already on the current key (or outside `fromKeyId`) are skipped.\n */\nexport async function rewrapAll(opts: {\n store: CredentialStore;\n keyProvider: KeyProvider;\n fromKeyId?: string;\n batchSize?: number;\n}): Promise<{ rewrapped: number; skipped: number; failed: OpsFailure[] }> {\n const { store, keyProvider, fromKeyId } = opts;\n const result = {\n rewrapped: 0,\n skipped: 0,\n failed: [] as OpsFailure[],\n };\n for await (const ref of store.iterateEncryptedValues(\n opts.batchSize ?? DEFAULT_BATCH_SIZE,\n )) {\n if (\n ref.value.kid === keyProvider.currentKeyId ||\n (fromKeyId !== undefined && ref.value.kid !== fromKeyId)\n ) {\n result.skipped++;\n continue;\n }\n try {\n const next = await rewrapValue(ref.value, aadOf(ref), keyProvider);\n // A CAS miss means a concurrent writer changed it; a rerun will pick it up.\n if (await store.replaceEncryptedValue(ref, next)) result.rewrapped++;\n else result.skipped++;\n } catch (err) {\n result.failed.push({ record: label(ref), error: codeOf(err) });\n }\n }\n return result;\n}\n\n/** Fully decrypts every stored value (plaintext discarded immediately) to prove integrity. */\nexport async function verifyAll(opts: {\n store: CredentialStore;\n keyProvider: KeyProvider;\n batchSize?: number;\n}): Promise<{ ok: number; failed: OpsFailure[] }> {\n const result = { ok: 0, failed: [] as OpsFailure[] };\n for await (const ref of opts.store.iterateEncryptedValues(\n opts.batchSize ?? DEFAULT_BATCH_SIZE,\n )) {\n try {\n await decryptValue(ref.value, aadOf(ref), opts.keyProvider);\n result.ok++;\n } catch (err) {\n result.failed.push({ record: label(ref), error: codeOf(err) });\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,EAAG,QAAO;AAAA,UACpD,QAAO;AAAA,IACd,SAAS,KAAK;AACZ,aAAO,OAAO,KAAK,EAAE,QAAQ,MAAM,GAAG,GAAG,OAAO,OAAO,GAAG,EAAE,CAAC;AAAA,IAC/D;AAAA,EACF;AACA,SAAO;AACT;AAGA,eAAsB,UAAU,MAIkB;AAChD,QAAM,SAAS,EAAE,IAAI,GAAG,QAAQ,CAAC,EAAkB;AACnD,mBAAiB,OAAO,KAAK,MAAM;AAAA,IACjC,KAAK,aAAa;AAAA,EACpB,GAAG;AACD,QAAI;AACF,YAAM,aAAa,IAAI,OAAO,MAAM,GAAG,GAAG,KAAK,WAAW;AAC1D,aAAO;AAAA,IACT,SAAS,KAAK;AACZ,aAAO,OAAO,KAAK,EAAE,QAAQ,MAAM,GAAG,GAAG,OAAO,OAAO,GAAG,EAAE,CAAC;AAAA,IAC/D;AAAA,EACF;AACA,SAAO;AACT;","names":["PREFIX"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { K as KeyProvider, O as OAuthGateway } from './key-provider-Cq_14Bh6.cjs';
|
|
2
|
-
import { a as ConnectionRecord, c as ConnectionView, C as CredentialStore,
|
|
2
|
+
import { a as ConnectionRecord, c as ConnectionView, C as CredentialStore, f as Emit, L as Logger, G as GoogleEvent } from './events-BlC10ISp.cjs';
|
|
3
3
|
|
|
4
4
|
type TokenManager = {
|
|
5
5
|
getAccessToken(tenantId: string, connectionId: string, opts?: {
|
|
@@ -32,6 +32,8 @@ type ClientsApi = {
|
|
|
32
32
|
declare const BASE_SCOPES: readonly string[];
|
|
33
33
|
declare const SERVICE_SCOPES: {
|
|
34
34
|
readonly gmail: readonly ["https://www.googleapis.com/auth/gmail.send"];
|
|
35
|
+
readonly calendar: readonly ["https://www.googleapis.com/auth/calendar.events.owned", "https://www.googleapis.com/auth/calendar.events.freebusy"];
|
|
36
|
+
readonly sheets: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
35
37
|
};
|
|
36
38
|
type GoogleService = keyof typeof SERVICE_SCOPES;
|
|
37
39
|
/** Base scopes plus every requested service's scopes, de-duplicated. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { K as KeyProvider, O as OAuthGateway } from './key-provider-Cq_14Bh6.js';
|
|
2
|
-
import { a as ConnectionRecord, c as ConnectionView, C as CredentialStore,
|
|
2
|
+
import { a as ConnectionRecord, c as ConnectionView, C as CredentialStore, f as Emit, L as Logger, G as GoogleEvent } from './events-BlC10ISp.js';
|
|
3
3
|
|
|
4
4
|
type TokenManager = {
|
|
5
5
|
getAccessToken(tenantId: string, connectionId: string, opts?: {
|
|
@@ -32,6 +32,8 @@ type ClientsApi = {
|
|
|
32
32
|
declare const BASE_SCOPES: readonly string[];
|
|
33
33
|
declare const SERVICE_SCOPES: {
|
|
34
34
|
readonly gmail: readonly ["https://www.googleapis.com/auth/gmail.send"];
|
|
35
|
+
readonly calendar: readonly ["https://www.googleapis.com/auth/calendar.events.owned", "https://www.googleapis.com/auth/calendar.events.freebusy"];
|
|
36
|
+
readonly sheets: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
35
37
|
};
|
|
36
38
|
type GoogleService = keyof typeof SERVICE_SCOPES;
|
|
37
39
|
/** Base scopes plus every requested service's scopes, de-duplicated. */
|
|
@@ -152,6 +152,37 @@ type GoogleEvent = {
|
|
|
152
152
|
bcc: string[];
|
|
153
153
|
subject: string;
|
|
154
154
|
at: Date;
|
|
155
|
+
} | {
|
|
156
|
+
type: "calendar_event.created" | "calendar_event.cancelled";
|
|
157
|
+
tenantId: string;
|
|
158
|
+
actorId: string;
|
|
159
|
+
connectionId: string;
|
|
160
|
+
eventId: string;
|
|
161
|
+
attendees: string[];
|
|
162
|
+
title: string;
|
|
163
|
+
start: Date;
|
|
164
|
+
end: Date;
|
|
165
|
+
at: Date;
|
|
166
|
+
} | {
|
|
167
|
+
type: "calendar_event.updated";
|
|
168
|
+
tenantId: string;
|
|
169
|
+
actorId: string;
|
|
170
|
+
connectionId: string;
|
|
171
|
+
eventId: string;
|
|
172
|
+
attendees: string[];
|
|
173
|
+
title: string;
|
|
174
|
+
start: Date;
|
|
175
|
+
end: Date;
|
|
176
|
+
changed: string[];
|
|
177
|
+
at: Date;
|
|
178
|
+
} | {
|
|
179
|
+
type: "calendar_event.failed";
|
|
180
|
+
tenantId: string;
|
|
181
|
+
actorId: string;
|
|
182
|
+
connectionId: string;
|
|
183
|
+
operation: "create" | "update" | "cancel";
|
|
184
|
+
errorCode: string;
|
|
185
|
+
at: Date;
|
|
155
186
|
};
|
|
156
187
|
type Emit = (e: GoogleEvent, perCall?: {
|
|
157
188
|
redactRecipients?: boolean;
|
|
@@ -152,6 +152,37 @@ type GoogleEvent = {
|
|
|
152
152
|
bcc: string[];
|
|
153
153
|
subject: string;
|
|
154
154
|
at: Date;
|
|
155
|
+
} | {
|
|
156
|
+
type: "calendar_event.created" | "calendar_event.cancelled";
|
|
157
|
+
tenantId: string;
|
|
158
|
+
actorId: string;
|
|
159
|
+
connectionId: string;
|
|
160
|
+
eventId: string;
|
|
161
|
+
attendees: string[];
|
|
162
|
+
title: string;
|
|
163
|
+
start: Date;
|
|
164
|
+
end: Date;
|
|
165
|
+
at: Date;
|
|
166
|
+
} | {
|
|
167
|
+
type: "calendar_event.updated";
|
|
168
|
+
tenantId: string;
|
|
169
|
+
actorId: string;
|
|
170
|
+
connectionId: string;
|
|
171
|
+
eventId: string;
|
|
172
|
+
attendees: string[];
|
|
173
|
+
title: string;
|
|
174
|
+
start: Date;
|
|
175
|
+
end: Date;
|
|
176
|
+
changed: string[];
|
|
177
|
+
at: Date;
|
|
178
|
+
} | {
|
|
179
|
+
type: "calendar_event.failed";
|
|
180
|
+
tenantId: string;
|
|
181
|
+
actorId: string;
|
|
182
|
+
connectionId: string;
|
|
183
|
+
operation: "create" | "update" | "cancel";
|
|
184
|
+
errorCode: string;
|
|
185
|
+
at: Date;
|
|
155
186
|
};
|
|
156
187
|
type Emit = (e: GoogleEvent, perCall?: {
|
|
157
188
|
redactRecipients?: boolean;
|