@project-ajax/sdk 0.0.66 → 0.0.68
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/dist/builder.d.ts +6 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +7 -0
- package/dist/capabilities/oauth.d.ts +145 -0
- package/dist/capabilities/oauth.d.ts.map +1 -0
- package/dist/capabilities/oauth.js +53 -0
- package/dist/capabilities/oauth.test.d.ts +2 -0
- package/dist/capabilities/oauth.test.d.ts.map +1 -0
- package/dist/capabilities/sync.d.ts +4 -2
- package/dist/capabilities/sync.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/schema.d.ts +14 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/builder.ts +12 -0
- package/src/capabilities/oauth.test.ts +51 -0
- package/src/capabilities/oauth.ts +181 -0
- package/src/capabilities/sync.ts +4 -1
- package/src/index.ts +8 -1
- package/src/schema.ts +18 -3
- package/src/types.ts +27 -0
package/dist/builder.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NoticonName } from "./icon-names.js";
|
|
2
|
-
import type { Icon, NoticonColor, PeopleValue, TextValue } from "./types.js";
|
|
2
|
+
import type { Icon, NoticonColor, PeopleValue, PlaceValue, TextValue } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a rich text value.
|
|
5
5
|
*/
|
|
@@ -78,6 +78,11 @@ export declare function status(value: string): TextValue;
|
|
|
78
78
|
* @param emails - Array of email addresses for people to include
|
|
79
79
|
*/
|
|
80
80
|
export declare function people(...emails: string[]): PeopleValue;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a place value for a geographic location.
|
|
83
|
+
* @param value - The place value with lat/lon coordinates and optional name/address
|
|
84
|
+
*/
|
|
85
|
+
export declare function place(value: PlaceValue): PlaceValue;
|
|
81
86
|
/**
|
|
82
87
|
* Creates an emoji icon.
|
|
83
88
|
* @param emoji - An emoji string (e.g., "🎯", "✨", "🚀")
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAEX,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAEnD;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAE1C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAEhD;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAE/C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAE9C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAEpD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAElE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAK/C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CASlD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE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AM,GAAG,SAAS,CAE/C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAK1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAE/C;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAEvD;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAKnD;AA4CD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAK7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,WAAW,EACjB,KAAK,GAAE,YAAqB,GAC1B,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAK3C"}
|
package/dist/builder.js
CHANGED
|
@@ -88,6 +88,12 @@ function status(value) {
|
|
|
88
88
|
function people(...emails) {
|
|
89
89
|
return emails.map((email2) => ({ email: email2 }));
|
|
90
90
|
}
|
|
91
|
+
function place(value) {
|
|
92
|
+
if (typeof value.lat !== "number" || typeof value.lon !== "number") {
|
|
93
|
+
throw new Error("Place value must have numeric lat and lon coordinates");
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
91
97
|
function validateDateString(dateString) {
|
|
92
98
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
|
|
93
99
|
throw new Error(
|
|
@@ -148,6 +154,7 @@ export {
|
|
|
148
154
|
number,
|
|
149
155
|
people,
|
|
150
156
|
phoneNumber,
|
|
157
|
+
place,
|
|
151
158
|
richText,
|
|
152
159
|
select,
|
|
153
160
|
status,
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a Notion-managed OAuth provider.
|
|
3
|
+
*
|
|
4
|
+
* Notion owns the OAuth app credentials (client ID/secret) and the backend has
|
|
5
|
+
* pre-configured provider settings.
|
|
6
|
+
*/
|
|
7
|
+
export interface NotionManagedOAuthConfiguration {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier for this OAuth provider instance.
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* The pre-configured provider to use (e.g., "google", "github", "salesforce").
|
|
14
|
+
* The backend will use this to look up the OAuth configuration.
|
|
15
|
+
*/
|
|
16
|
+
provider: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional default access token expiry (in milliseconds) to use when the OAuth provider
|
|
19
|
+
* does not return `expires_in` in token responses.
|
|
20
|
+
*
|
|
21
|
+
* Some providers (e.g. Salesforce in certain configurations) may omit expiry information.
|
|
22
|
+
*/
|
|
23
|
+
accessTokenExpireMs?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for a user-managed OAuth provider.
|
|
27
|
+
*
|
|
28
|
+
* You own the OAuth app credentials and must explicitly provide endpoints and
|
|
29
|
+
* other OAuth parameters.
|
|
30
|
+
*/
|
|
31
|
+
export interface UserManagedOAuthConfiguration {
|
|
32
|
+
/**
|
|
33
|
+
* The unique identifier for this OAuth provider instance.
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* The client ID for the OAuth app.
|
|
38
|
+
*/
|
|
39
|
+
clientId: string;
|
|
40
|
+
/**
|
|
41
|
+
* The client secret for the OAuth app.
|
|
42
|
+
*/
|
|
43
|
+
clientSecret: string;
|
|
44
|
+
/**
|
|
45
|
+
* The OAuth 2.0 authorization endpoint URL.
|
|
46
|
+
*/
|
|
47
|
+
authorizationEndpoint: string;
|
|
48
|
+
/**
|
|
49
|
+
* The OAuth 2.0 token endpoint URL.
|
|
50
|
+
*/
|
|
51
|
+
tokenEndpoint: string;
|
|
52
|
+
/**
|
|
53
|
+
* The OAuth scope(s) to request.
|
|
54
|
+
*/
|
|
55
|
+
scope: string;
|
|
56
|
+
/**
|
|
57
|
+
* Optional additional authorization parameters to include in the authorization request.
|
|
58
|
+
*/
|
|
59
|
+
authorizationParams?: Record<string, string>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional callback URL for OAuth redirect.
|
|
62
|
+
*/
|
|
63
|
+
callbackUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional default access token expiry (in milliseconds) to use when the OAuth provider
|
|
66
|
+
* does not return `expires_in` in token responses.
|
|
67
|
+
*
|
|
68
|
+
* Some providers (e.g. Salesforce in certain configurations) may omit expiry information.
|
|
69
|
+
*/
|
|
70
|
+
accessTokenExpireMs?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Union type representing either Notion-managed or user-managed OAuth configuration.
|
|
74
|
+
*/
|
|
75
|
+
export type OAuthConfiguration = NotionManagedOAuthConfiguration | UserManagedOAuthConfiguration;
|
|
76
|
+
/**
|
|
77
|
+
* Creates an OAuth provider configuration for authenticating with third-party services.
|
|
78
|
+
*
|
|
79
|
+
* There are two ways to configure OAuth:
|
|
80
|
+
*
|
|
81
|
+
* 1. Notion-managed providers:
|
|
82
|
+
* ```ts
|
|
83
|
+
* oauth({
|
|
84
|
+
* type: "notion_managed",
|
|
85
|
+
* name: "my-google-auth",
|
|
86
|
+
* provider: "google"
|
|
87
|
+
* })
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* 2. User-managed OAuth configuration:
|
|
91
|
+
* ```ts
|
|
92
|
+
* oauth({
|
|
93
|
+
* type: "user_managed",
|
|
94
|
+
* name: "my-custom-oauth",
|
|
95
|
+
* authorizationEndpoint: "https://provider.com/oauth/authorize",
|
|
96
|
+
* tokenEndpoint: "https://provider.com/oauth/token",
|
|
97
|
+
* scope: "read write",
|
|
98
|
+
* clientId: process.env.CLIENT_ID,
|
|
99
|
+
* clientSecret: process.env.CLIENT_SECRET,
|
|
100
|
+
* authorizationParams: {
|
|
101
|
+
* access_type: "offline",
|
|
102
|
+
* prompt: "consent"
|
|
103
|
+
* }
|
|
104
|
+
* })
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param config - The OAuth configuration (Notion-managed or user-managed).
|
|
108
|
+
* @returns An OAuth provider definition.
|
|
109
|
+
*/
|
|
110
|
+
export declare function oauth(config: OAuthConfiguration): {
|
|
111
|
+
_tag: string;
|
|
112
|
+
envKey: string;
|
|
113
|
+
accessToken(): Promise<string>;
|
|
114
|
+
config: {
|
|
115
|
+
type: "notion_managed";
|
|
116
|
+
name: string;
|
|
117
|
+
provider: string;
|
|
118
|
+
accessTokenExpireMs: number | undefined;
|
|
119
|
+
authorizationEndpoint?: never;
|
|
120
|
+
tokenEndpoint?: never;
|
|
121
|
+
scope?: never;
|
|
122
|
+
clientId?: never;
|
|
123
|
+
clientSecret?: never;
|
|
124
|
+
authorizationParams?: never;
|
|
125
|
+
callbackUrl?: never;
|
|
126
|
+
};
|
|
127
|
+
} | {
|
|
128
|
+
_tag: string;
|
|
129
|
+
envKey: string;
|
|
130
|
+
accessToken(): Promise<string>;
|
|
131
|
+
config: {
|
|
132
|
+
type: "user_managed";
|
|
133
|
+
name: string;
|
|
134
|
+
authorizationEndpoint: string;
|
|
135
|
+
tokenEndpoint: string;
|
|
136
|
+
scope: string;
|
|
137
|
+
clientId: string;
|
|
138
|
+
clientSecret: string;
|
|
139
|
+
authorizationParams: Record<string, string> | undefined;
|
|
140
|
+
callbackUrl: string | undefined;
|
|
141
|
+
accessTokenExpireMs: number | undefined;
|
|
142
|
+
provider?: never;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/capabilities/oauth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,+BAA+B,GAC/B,6BAA6B,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,kBAAkB;;;mBAOxB,OAAO,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;mBAehB,OAAO,CAAC,MAAM,CAAC;;;;;;;;;;;;;;EAgBrC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function oauth(config) {
|
|
2
|
+
const envKey = oauthNameToEnvKey(config.name);
|
|
3
|
+
if ("provider" in config) {
|
|
4
|
+
return {
|
|
5
|
+
_tag: "oauth",
|
|
6
|
+
envKey,
|
|
7
|
+
async accessToken() {
|
|
8
|
+
return readRequiredEnvVar(envKey, { name: config.name });
|
|
9
|
+
},
|
|
10
|
+
config: {
|
|
11
|
+
type: "notion_managed",
|
|
12
|
+
name: config.name,
|
|
13
|
+
provider: config.provider,
|
|
14
|
+
accessTokenExpireMs: config.accessTokenExpireMs
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
_tag: "oauth",
|
|
20
|
+
envKey,
|
|
21
|
+
async accessToken() {
|
|
22
|
+
return readRequiredEnvVar(envKey, { name: config.name });
|
|
23
|
+
},
|
|
24
|
+
config: {
|
|
25
|
+
type: "user_managed",
|
|
26
|
+
name: config.name,
|
|
27
|
+
authorizationEndpoint: config.authorizationEndpoint,
|
|
28
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
29
|
+
scope: config.scope,
|
|
30
|
+
clientId: config.clientId,
|
|
31
|
+
clientSecret: config.clientSecret,
|
|
32
|
+
authorizationParams: config.authorizationParams,
|
|
33
|
+
callbackUrl: config.callbackUrl,
|
|
34
|
+
accessTokenExpireMs: config.accessTokenExpireMs
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function oauthNameToEnvKey(identifier) {
|
|
39
|
+
const encoded = Buffer.from(identifier).toString("hex").toUpperCase();
|
|
40
|
+
return `OAUTH_${encoded}_ACCESS_TOKEN`;
|
|
41
|
+
}
|
|
42
|
+
function readRequiredEnvVar(key, context) {
|
|
43
|
+
const value = process.env[key];
|
|
44
|
+
if (value) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Missing OAuth access token env var "${key}" (name: "${context.name}"). Make sure you've completed OAuth for this capability and are running inside the worker runtime.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
oauth
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.test.d.ts","sourceRoot":"","sources":["../../src/capabilities/oauth.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { PropertyConfiguration, PropertySchema, Schema } from "../schema.js";
|
|
2
|
-
import type { Icon, PeopleValue, Schedule, SyncSchedule, TextValue } from "../types.js";
|
|
2
|
+
import type { Icon, PeopleValue, PlaceValue, Schedule, SyncSchedule, TextValue } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Maps a property configuration to its corresponding value type.
|
|
5
5
|
*/
|
|
6
6
|
type PropertyValueType<T extends PropertyConfiguration> = T extends {
|
|
7
7
|
type: "people";
|
|
8
|
-
} ? PeopleValue :
|
|
8
|
+
} ? PeopleValue : T extends {
|
|
9
|
+
type: "place";
|
|
10
|
+
} ? PlaceValue : TextValue;
|
|
9
11
|
/**
|
|
10
12
|
* An object representing a third-party record to be synced.
|
|
11
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/capabilities/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACX,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAS,EAET,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,KAAK,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,IAAI,CAAC,SAAS;IACnE,IAAI,EAAE,QAAQ,CAAC;CACf,GACE,WAAW,GACX,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/capabilities/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACX,IAAI,EACJ,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,EAET,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,KAAK,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,IAAI,CAAC,SAAS;IACnE,IAAI,EAAE,QAAQ,CAAC;CACf,GACE,WAAW,GACX,CAAC,SAAS;IAAE,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,MAAM,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,OAAO,GAAG,OAAO,IAAI;IACrE,kBAAkB,EAAE,EAAE,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAChD,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,IAAI,CACnB,EAAE,SAAS,MAAM,EACjB,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,EACpB,OAAO,GAAG,OAAO,EAChB,iBAAiB,EAAE,iBAAiB,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC;;;;;;;;sBAS5B,OAAO;;;;;EAkBhC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export { emojiIcon, imageIcon, notionIcon } from "./builder.js";
|
|
1
|
+
export { emojiIcon, imageIcon, notionIcon, place } from "./builder.js";
|
|
2
2
|
export type { AutomationConfiguration, AutomationContext, PageObjectResponse, } from "./capabilities/automation.js";
|
|
3
3
|
export { automation } from "./capabilities/automation.js";
|
|
4
|
+
export type { NotionManagedOAuthConfiguration, OAuthConfiguration, UserManagedOAuthConfiguration, } from "./capabilities/oauth.js";
|
|
5
|
+
export { oauth } from "./capabilities/oauth.js";
|
|
4
6
|
export type { SyncConfiguration, SyncExecutionResult, SyncedObject, } from "./capabilities/sync.js";
|
|
5
7
|
export { sync } from "./capabilities/sync.js";
|
|
6
8
|
export { tool } from "./capabilities/tool.js";
|
|
7
|
-
export type { Icon, ImageIcon, NoticonColor, NoticonName, Schedule, } from "./types.js";
|
|
9
|
+
export type { Icon, ImageIcon, NoticonColor, NoticonName, PlaceValue, Schedule, } from "./types.js";
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EACX,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,YAAY,EACX,+BAA+B,EAC/B,kBAAkB,EAClB,6BAA6B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,YAAY,EACX,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,YAAY,EACX,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,UAAU,EACV,QAAQ,GACR,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { emojiIcon, imageIcon, notionIcon } from "./builder.js";
|
|
1
|
+
import { emojiIcon, imageIcon, notionIcon, place } from "./builder.js";
|
|
2
2
|
import { automation } from "./capabilities/automation.js";
|
|
3
|
+
import { oauth } from "./capabilities/oauth.js";
|
|
3
4
|
import { sync } from "./capabilities/sync.js";
|
|
4
5
|
import { tool } from "./capabilities/tool.js";
|
|
5
6
|
export {
|
|
@@ -7,6 +8,8 @@ export {
|
|
|
7
8
|
emojiIcon,
|
|
8
9
|
imageIcon,
|
|
9
10
|
notionIcon,
|
|
11
|
+
oauth,
|
|
12
|
+
place,
|
|
10
13
|
sync,
|
|
11
14
|
tool
|
|
12
15
|
};
|
package/dist/schema.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { DateFormat, Icon, NumberFormat, SelectOption, StatusGroup } from "
|
|
|
2
2
|
/**
|
|
3
3
|
* Supported property types for sync schemas.
|
|
4
4
|
*/
|
|
5
|
-
export type PropertyType = "title" | "rich_text" | "url" | "email" | "phone_number" | "checkbox" | "file" | "number" | "date" | "select" | "multi_select" | "status" | "people";
|
|
5
|
+
export type PropertyType = "title" | "rich_text" | "url" | "email" | "phone_number" | "checkbox" | "file" | "number" | "date" | "select" | "multi_select" | "status" | "people" | "place";
|
|
6
6
|
/**
|
|
7
7
|
* Definition of a single property in a sync schema.
|
|
8
8
|
*/
|
|
@@ -43,9 +43,17 @@ export type PropertyConfiguration = {
|
|
|
43
43
|
groups: StatusGroup[];
|
|
44
44
|
} | {
|
|
45
45
|
type: "people";
|
|
46
|
+
} | {
|
|
47
|
+
type: "place";
|
|
46
48
|
};
|
|
47
49
|
export type Schema<PK extends string> = {
|
|
48
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The default name for the database when it is first created.
|
|
52
|
+
*
|
|
53
|
+
* Updating this after the database has been created will not change the
|
|
54
|
+
* name of the database.
|
|
55
|
+
*/
|
|
56
|
+
defaultName: string;
|
|
49
57
|
/**
|
|
50
58
|
* Optional icon to use as the icon for the database page.
|
|
51
59
|
* If not provided, defaults to 📋.
|
|
@@ -116,4 +124,8 @@ export declare function status(config: {
|
|
|
116
124
|
* Creates a people property definition.
|
|
117
125
|
*/
|
|
118
126
|
export declare function people(): PropertyConfiguration;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a place property definition for storing geographic locations.
|
|
129
|
+
*/
|
|
130
|
+
export declare function place(): PropertyConfiguration;
|
|
119
131
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB,OAAO,GACP,WAAW,GACX,KAAK,GACL,OAAO,GACP,cAAc,GACd,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB,OAAO,GACP,WAAW,GACX,KAAK,GACL,OAAO,GACP,cAAc,GACd,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,QAAQ,GACR,OAAO,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,MAA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M,CAAC,EAAE,YAAY,GAAG,qBAAqB,CAEnE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU,GAAG,qBAAqB,CAEpE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAErE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAE1E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB,GAAG,qBAAqB,CAExB;AAED;;GAEG;AACH,wBAAgB,MAAM,IAAI,qBAAqB,CAE9C;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,qBAAqB,CAE7C"}
|
package/dist/schema.js
CHANGED
|
@@ -37,6 +37,9 @@ function status(config) {
|
|
|
37
37
|
function people() {
|
|
38
38
|
return { type: "people" };
|
|
39
39
|
}
|
|
40
|
+
function place() {
|
|
41
|
+
return { type: "place" };
|
|
42
|
+
}
|
|
40
43
|
export {
|
|
41
44
|
checkbox,
|
|
42
45
|
date,
|
|
@@ -46,6 +49,7 @@ export {
|
|
|
46
49
|
number,
|
|
47
50
|
people,
|
|
48
51
|
phoneNumber,
|
|
52
|
+
place,
|
|
49
53
|
richText,
|
|
50
54
|
select,
|
|
51
55
|
status,
|
package/dist/types.d.ts
CHANGED
|
@@ -130,6 +130,32 @@ export interface PersonReference {
|
|
|
130
130
|
*/
|
|
131
131
|
export type PeopleValue = PersonReference[];
|
|
132
132
|
export type { NoticonName } from "./icon-names.js";
|
|
133
|
+
/**
|
|
134
|
+
* Place value representing a geographic location.
|
|
135
|
+
* Used for place properties in databases.
|
|
136
|
+
*/
|
|
137
|
+
export interface PlaceValue {
|
|
138
|
+
/**
|
|
139
|
+
* Latitude coordinate (required)
|
|
140
|
+
*/
|
|
141
|
+
lat: number;
|
|
142
|
+
/**
|
|
143
|
+
* Longitude coordinate (required)
|
|
144
|
+
*/
|
|
145
|
+
lon: number;
|
|
146
|
+
/**
|
|
147
|
+
* Optional display name for the location
|
|
148
|
+
*/
|
|
149
|
+
name?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Optional street address
|
|
152
|
+
*/
|
|
153
|
+
address?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Optional Google Place ID for the location
|
|
156
|
+
*/
|
|
157
|
+
googlePlaceId?: string;
|
|
158
|
+
}
|
|
133
159
|
/**
|
|
134
160
|
* Time units for schedule intervals.
|
|
135
161
|
* - "m": minutes
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,SAAS,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,KAAK,CAAC;AAET;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,YAAY,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC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,MAAM,QAAQ,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
package/src/builder.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
Icon,
|
|
5
5
|
NoticonColor,
|
|
6
6
|
PeopleValue,
|
|
7
|
+
PlaceValue,
|
|
7
8
|
TextValue,
|
|
8
9
|
} from "./types.js";
|
|
9
10
|
|
|
@@ -187,6 +188,17 @@ export function people(...emails: string[]): PeopleValue {
|
|
|
187
188
|
return emails.map((email) => ({ email }));
|
|
188
189
|
}
|
|
189
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Creates a place value for a geographic location.
|
|
193
|
+
* @param value - The place value with lat/lon coordinates and optional name/address
|
|
194
|
+
*/
|
|
195
|
+
export function place(value: PlaceValue): PlaceValue {
|
|
196
|
+
if (typeof value.lat !== "number" || typeof value.lon !== "number") {
|
|
197
|
+
throw new Error("Place value must have numeric lat and lon coordinates");
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
|
|
190
202
|
/**
|
|
191
203
|
* Validates a date string is in YYYY-MM-DD format and represents a valid date.
|
|
192
204
|
*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { oauth } from "./oauth.js";
|
|
3
|
+
|
|
4
|
+
describe("oauth", () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
// Clean up env changes between tests
|
|
7
|
+
delete process.env.OAUTH_676F6F676C6541757468_ACCESS_TOKEN;
|
|
8
|
+
delete process.env.OAUTH_676F6F676C652D63616C656E646172_ACCESS_TOKEN;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("creates notion-managed oauth capability with accessToken helper", async () => {
|
|
12
|
+
const myOauth = oauth({
|
|
13
|
+
name: "googleAuth",
|
|
14
|
+
provider: "google",
|
|
15
|
+
accessTokenExpireMs: 60_000,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
expect(myOauth._tag).toBe("oauth");
|
|
19
|
+
expect(myOauth.config.type).toBe("notion_managed");
|
|
20
|
+
expect(myOauth.config.accessTokenExpireMs).toBe(60_000);
|
|
21
|
+
expect(myOauth.envKey).toBe("OAUTH_676F6F676C6541757468_ACCESS_TOKEN");
|
|
22
|
+
expect(typeof myOauth.accessToken).toBe("function");
|
|
23
|
+
|
|
24
|
+
process.env.OAUTH_676F6F676C6541757468_ACCESS_TOKEN = "token-123";
|
|
25
|
+
await expect(myOauth.accessToken()).resolves.toBe("token-123");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("normalizes non-alphanumeric characters in the identifier", () => {
|
|
29
|
+
const myOauth = oauth({
|
|
30
|
+
name: "google-calendar",
|
|
31
|
+
provider: "google",
|
|
32
|
+
accessTokenExpireMs: 3600_000,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(myOauth.envKey).toBe(
|
|
36
|
+
"OAUTH_676F6F676C652D63616C656E646172_ACCESS_TOKEN",
|
|
37
|
+
);
|
|
38
|
+
expect(myOauth.config.accessTokenExpireMs).toBe(3600_000);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("throws a helpful error when the token env var is missing", async () => {
|
|
42
|
+
const myOauth = oauth({
|
|
43
|
+
name: "googleAuth",
|
|
44
|
+
provider: "google",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
await expect(myOauth.accessToken()).rejects.toThrow(
|
|
48
|
+
/Missing OAuth access token env var "OAUTH_676F6F676C6541757468_ACCESS_TOKEN"/,
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a Notion-managed OAuth provider.
|
|
3
|
+
*
|
|
4
|
+
* Notion owns the OAuth app credentials (client ID/secret) and the backend has
|
|
5
|
+
* pre-configured provider settings.
|
|
6
|
+
*/
|
|
7
|
+
export interface NotionManagedOAuthConfiguration {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier for this OAuth provider instance.
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The pre-configured provider to use (e.g., "google", "github", "salesforce").
|
|
15
|
+
* The backend will use this to look up the OAuth configuration.
|
|
16
|
+
*/
|
|
17
|
+
provider: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Optional default access token expiry (in milliseconds) to use when the OAuth provider
|
|
21
|
+
* does not return `expires_in` in token responses.
|
|
22
|
+
*
|
|
23
|
+
* Some providers (e.g. Salesforce in certain configurations) may omit expiry information.
|
|
24
|
+
*/
|
|
25
|
+
accessTokenExpireMs?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for a user-managed OAuth provider.
|
|
30
|
+
*
|
|
31
|
+
* You own the OAuth app credentials and must explicitly provide endpoints and
|
|
32
|
+
* other OAuth parameters.
|
|
33
|
+
*/
|
|
34
|
+
export interface UserManagedOAuthConfiguration {
|
|
35
|
+
/**
|
|
36
|
+
* The unique identifier for this OAuth provider instance.
|
|
37
|
+
*/
|
|
38
|
+
name: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The client ID for the OAuth app.
|
|
42
|
+
*/
|
|
43
|
+
clientId: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The client secret for the OAuth app.
|
|
47
|
+
*/
|
|
48
|
+
clientSecret: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The OAuth 2.0 authorization endpoint URL.
|
|
52
|
+
*/
|
|
53
|
+
authorizationEndpoint: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The OAuth 2.0 token endpoint URL.
|
|
57
|
+
*/
|
|
58
|
+
tokenEndpoint: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The OAuth scope(s) to request.
|
|
62
|
+
*/
|
|
63
|
+
scope: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Optional additional authorization parameters to include in the authorization request.
|
|
67
|
+
*/
|
|
68
|
+
authorizationParams?: Record<string, string>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Optional callback URL for OAuth redirect.
|
|
72
|
+
*/
|
|
73
|
+
callbackUrl?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Optional default access token expiry (in milliseconds) to use when the OAuth provider
|
|
77
|
+
* does not return `expires_in` in token responses.
|
|
78
|
+
*
|
|
79
|
+
* Some providers (e.g. Salesforce in certain configurations) may omit expiry information.
|
|
80
|
+
*/
|
|
81
|
+
accessTokenExpireMs?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Union type representing either Notion-managed or user-managed OAuth configuration.
|
|
86
|
+
*/
|
|
87
|
+
export type OAuthConfiguration =
|
|
88
|
+
| NotionManagedOAuthConfiguration
|
|
89
|
+
| UserManagedOAuthConfiguration;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates an OAuth provider configuration for authenticating with third-party services.
|
|
93
|
+
*
|
|
94
|
+
* There are two ways to configure OAuth:
|
|
95
|
+
*
|
|
96
|
+
* 1. Notion-managed providers:
|
|
97
|
+
* ```ts
|
|
98
|
+
* oauth({
|
|
99
|
+
* type: "notion_managed",
|
|
100
|
+
* name: "my-google-auth",
|
|
101
|
+
* provider: "google"
|
|
102
|
+
* })
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* 2. User-managed OAuth configuration:
|
|
106
|
+
* ```ts
|
|
107
|
+
* oauth({
|
|
108
|
+
* type: "user_managed",
|
|
109
|
+
* name: "my-custom-oauth",
|
|
110
|
+
* authorizationEndpoint: "https://provider.com/oauth/authorize",
|
|
111
|
+
* tokenEndpoint: "https://provider.com/oauth/token",
|
|
112
|
+
* scope: "read write",
|
|
113
|
+
* clientId: process.env.CLIENT_ID,
|
|
114
|
+
* clientSecret: process.env.CLIENT_SECRET,
|
|
115
|
+
* authorizationParams: {
|
|
116
|
+
* access_type: "offline",
|
|
117
|
+
* prompt: "consent"
|
|
118
|
+
* }
|
|
119
|
+
* })
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @param config - The OAuth configuration (Notion-managed or user-managed).
|
|
123
|
+
* @returns An OAuth provider definition.
|
|
124
|
+
*/
|
|
125
|
+
export function oauth(config: OAuthConfiguration) {
|
|
126
|
+
const envKey = oauthNameToEnvKey(config.name);
|
|
127
|
+
|
|
128
|
+
if ("provider" in config) {
|
|
129
|
+
return {
|
|
130
|
+
_tag: "oauth",
|
|
131
|
+
envKey,
|
|
132
|
+
async accessToken(): Promise<string> {
|
|
133
|
+
return readRequiredEnvVar(envKey, { name: config.name });
|
|
134
|
+
},
|
|
135
|
+
config: {
|
|
136
|
+
type: "notion_managed" as const,
|
|
137
|
+
name: config.name,
|
|
138
|
+
provider: config.provider,
|
|
139
|
+
accessTokenExpireMs: config.accessTokenExpireMs,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
_tag: "oauth",
|
|
146
|
+
envKey,
|
|
147
|
+
async accessToken(): Promise<string> {
|
|
148
|
+
return readRequiredEnvVar(envKey, { name: config.name });
|
|
149
|
+
},
|
|
150
|
+
config: {
|
|
151
|
+
type: "user_managed" as const,
|
|
152
|
+
name: config.name,
|
|
153
|
+
authorizationEndpoint: config.authorizationEndpoint,
|
|
154
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
155
|
+
scope: config.scope,
|
|
156
|
+
clientId: config.clientId,
|
|
157
|
+
clientSecret: config.clientSecret,
|
|
158
|
+
authorizationParams: config.authorizationParams,
|
|
159
|
+
callbackUrl: config.callbackUrl,
|
|
160
|
+
accessTokenExpireMs: config.accessTokenExpireMs,
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function oauthNameToEnvKey(identifier: string): string {
|
|
166
|
+
const encoded = Buffer.from(identifier).toString("hex").toUpperCase();
|
|
167
|
+
|
|
168
|
+
return `OAUTH_${encoded}_ACCESS_TOKEN`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function readRequiredEnvVar(key: string, context: { name: string }): string {
|
|
172
|
+
const value = process.env[key];
|
|
173
|
+
if (value) {
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
throw new Error(
|
|
178
|
+
`Missing OAuth access token env var "${key}" (name: "${context.name}"). ` +
|
|
179
|
+
`Make sure you've completed OAuth for this capability and are running inside the worker runtime.`,
|
|
180
|
+
);
|
|
181
|
+
}
|
package/src/capabilities/sync.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
import type {
|
|
8
8
|
Icon,
|
|
9
9
|
PeopleValue,
|
|
10
|
+
PlaceValue,
|
|
10
11
|
Schedule,
|
|
11
12
|
SyncSchedule,
|
|
12
13
|
TextValue,
|
|
@@ -20,7 +21,9 @@ type PropertyValueType<T extends PropertyConfiguration> = T extends {
|
|
|
20
21
|
type: "people";
|
|
21
22
|
}
|
|
22
23
|
? PeopleValue
|
|
23
|
-
:
|
|
24
|
+
: T extends { type: "place" }
|
|
25
|
+
? PlaceValue
|
|
26
|
+
: TextValue;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* An object representing a third-party record to be synced.
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export { emojiIcon, imageIcon, notionIcon } from "./builder.js";
|
|
1
|
+
export { emojiIcon, imageIcon, notionIcon, place } from "./builder.js";
|
|
2
2
|
export type {
|
|
3
3
|
AutomationConfiguration,
|
|
4
4
|
AutomationContext,
|
|
5
5
|
PageObjectResponse,
|
|
6
6
|
} from "./capabilities/automation.js";
|
|
7
7
|
export { automation } from "./capabilities/automation.js";
|
|
8
|
+
export type {
|
|
9
|
+
NotionManagedOAuthConfiguration,
|
|
10
|
+
OAuthConfiguration,
|
|
11
|
+
UserManagedOAuthConfiguration,
|
|
12
|
+
} from "./capabilities/oauth.js";
|
|
13
|
+
export { oauth } from "./capabilities/oauth.js";
|
|
8
14
|
export type {
|
|
9
15
|
SyncConfiguration,
|
|
10
16
|
SyncExecutionResult,
|
|
@@ -17,5 +23,6 @@ export type {
|
|
|
17
23
|
ImageIcon,
|
|
18
24
|
NoticonColor,
|
|
19
25
|
NoticonName,
|
|
26
|
+
PlaceValue,
|
|
20
27
|
Schedule,
|
|
21
28
|
} from "./types.js";
|
package/src/schema.ts
CHANGED
|
@@ -22,7 +22,8 @@ export type PropertyType =
|
|
|
22
22
|
| "select"
|
|
23
23
|
| "multi_select"
|
|
24
24
|
| "status"
|
|
25
|
-
| "people"
|
|
25
|
+
| "people"
|
|
26
|
+
| "place";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Definition of a single property in a sync schema.
|
|
@@ -62,10 +63,17 @@ export type PropertyConfiguration =
|
|
|
62
63
|
type: "status";
|
|
63
64
|
groups: StatusGroup[];
|
|
64
65
|
}
|
|
65
|
-
| { type: "people" }
|
|
66
|
+
| { type: "people" }
|
|
67
|
+
| { type: "place" };
|
|
66
68
|
|
|
67
69
|
export type Schema<PK extends string> = {
|
|
68
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The default name for the database when it is first created.
|
|
72
|
+
*
|
|
73
|
+
* Updating this after the database has been created will not change the
|
|
74
|
+
* name of the database.
|
|
75
|
+
*/
|
|
76
|
+
defaultName: string;
|
|
69
77
|
/**
|
|
70
78
|
* Optional icon to use as the icon for the database page.
|
|
71
79
|
* If not provided, defaults to 📋.
|
|
@@ -176,3 +184,10 @@ export function status(config: {
|
|
|
176
184
|
export function people(): PropertyConfiguration {
|
|
177
185
|
return { type: "people" };
|
|
178
186
|
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Creates a place property definition for storing geographic locations.
|
|
190
|
+
*/
|
|
191
|
+
export function place(): PropertyConfiguration {
|
|
192
|
+
return { type: "place" };
|
|
193
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -188,6 +188,33 @@ export type PeopleValue = PersonReference[];
|
|
|
188
188
|
|
|
189
189
|
export type { NoticonName } from "./icon-names.js";
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Place value representing a geographic location.
|
|
193
|
+
* Used for place properties in databases.
|
|
194
|
+
*/
|
|
195
|
+
export interface PlaceValue {
|
|
196
|
+
/**
|
|
197
|
+
* Latitude coordinate (required)
|
|
198
|
+
*/
|
|
199
|
+
lat: number;
|
|
200
|
+
/**
|
|
201
|
+
* Longitude coordinate (required)
|
|
202
|
+
*/
|
|
203
|
+
lon: number;
|
|
204
|
+
/**
|
|
205
|
+
* Optional display name for the location
|
|
206
|
+
*/
|
|
207
|
+
name?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Optional street address
|
|
210
|
+
*/
|
|
211
|
+
address?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Optional Google Place ID for the location
|
|
214
|
+
*/
|
|
215
|
+
googlePlaceId?: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
191
218
|
/**
|
|
192
219
|
* Time units for schedule intervals.
|
|
193
220
|
* - "m": minutes
|