attio 0.0.1-experimental.20240708.0 → 0.0.1-experimental.20240710
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/lib/api/complete-bundle-upload.d.ts +8 -0
- package/lib/api/complete-bundle-upload.d.ts.map +1 -0
- package/lib/api/complete-bundle-upload.js +22 -0
- package/lib/api/complete-bundle-upload.js.map +1 -0
- package/lib/api/create-dev-version.d.ts +27 -0
- package/lib/api/create-dev-version.d.ts.map +1 -0
- package/lib/api/create-dev-version.js +18 -0
- package/lib/api/create-dev-version.js.map +1 -0
- package/lib/api/create-developer-account.d.ts +12 -0
- package/lib/api/create-developer-account.d.ts.map +1 -0
- package/lib/api/create-developer-account.js +37 -0
- package/lib/api/create-developer-account.js.map +1 -0
- package/lib/api/create-integration.d.ts +14 -0
- package/lib/api/create-integration.d.ts.map +1 -0
- package/lib/api/create-integration.js +41 -0
- package/lib/api/create-integration.js.map +1 -0
- package/lib/api/handle-error.d.ts +3 -0
- package/lib/api/handle-error.d.ts.map +1 -0
- package/lib/api/handle-error.js +12 -0
- package/lib/api/handle-error.js.map +1 -0
- package/lib/api/is-integration-slug-valid.d.ts +6 -0
- package/lib/api/is-integration-slug-valid.d.ts.map +1 -0
- package/lib/api/is-integration-slug-valid.js +18 -0
- package/lib/api/is-integration-slug-valid.js.map +1 -0
- package/lib/api/make-headers.d.ts +6 -0
- package/lib/api/make-headers.d.ts.map +1 -0
- package/lib/api/make-headers.js +8 -0
- package/lib/api/make-headers.js.map +1 -0
- package/lib/api/ping.d.ts +7 -0
- package/lib/api/ping.d.ts.map +1 -0
- package/lib/api/ping.js +16 -0
- package/lib/api/ping.js.map +1 -0
- package/lib/api/start-upload.d.ts +12 -0
- package/lib/api/start-upload.d.ts.map +1 -0
- package/lib/api/start-upload.js +19 -0
- package/lib/api/start-upload.js.map +1 -0
- package/lib/build/proxy-server-modules-plugin.d.ts.map +1 -1
- package/lib/build/proxy-server-modules-plugin.js +13 -6
- package/lib/build/proxy-server-modules-plugin.js.map +1 -1
- package/lib/build/server/generate-server-entry.d.ts.map +1 -1
- package/lib/build/server/generate-server-entry.js +21 -14
- package/lib/build/server/generate-server-entry.js.map +1 -1
- package/lib/build.d.ts +0 -1
- package/lib/build.d.ts.map +1 -1
- package/lib/build.js +0 -13
- package/lib/build.js.map +1 -1
- package/lib/commands/create.d.ts.map +1 -1
- package/lib/commands/create.js +3 -3
- package/lib/commands/create.js.map +1 -1
- package/lib/components/InitialInstructions.js +1 -1
- package/lib/components/InitialInstructions.js.map +1 -1
- package/lib/machines/create-machine.d.ts +15 -15
- package/lib/machines/create-machine.d.ts.map +1 -1
- package/lib/machines/create-machine.js +21 -14
- package/lib/machines/create-machine.js.map +1 -1
- package/lib/machines/dev-machine.d.ts +2 -1
- package/lib/machines/dev-machine.d.ts.map +1 -1
- package/lib/machines/dev-machine.js +25 -11
- package/lib/machines/dev-machine.js.map +1 -1
- package/lib/machines/js-machine.d.ts.map +1 -1
- package/lib/machines/js-machine.js +2 -2
- package/lib/machines/js-machine.js.map +1 -1
- package/lib/schema.d.ts +39 -0
- package/lib/schema.d.ts.map +1 -0
- package/lib/schema.js +24 -0
- package/lib/schema.js.map +1 -0
- package/lib/schema.json +53 -0
- package/lib/templates/common/README.md +6 -4
- package/lib/templates/common/attio.json +4 -0
- package/lib/templates/javascript/.env +12 -0
- package/lib/templates/javascript/package.json +1 -9
- package/lib/templates/typescript/.env +12 -0
- package/lib/templates/typescript/package.json +1 -9
- package/lib/util/load-config.d.ts +41 -0
- package/lib/util/load-config.d.ts.map +1 -0
- package/lib/util/load-config.js +62 -0
- package/lib/util/load-config.js.map +1 -0
- package/lib/util/load-extension-config.d.ts +3 -0
- package/lib/util/load-extension-config.d.ts.map +1 -0
- package/lib/util/load-extension-config.js +21 -0
- package/lib/util/load-extension-config.js.map +1 -0
- package/package.json +5 -3
- package/lib/util/upload-bundle.d.ts +0 -162
- package/lib/util/upload-bundle.d.ts.map +0 -1
- package/lib/util/upload-bundle.js +0 -235
- package/lib/util/upload-bundle.js.map +0 -1
package/lib/schema.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"slug": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"description": "A unique slug for the integration"
|
|
7
|
+
},
|
|
8
|
+
"id": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"format": "uuid",
|
|
11
|
+
"description": "A unique ID for the integration"
|
|
12
|
+
},
|
|
13
|
+
"connections": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"connection_type": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": [
|
|
21
|
+
"secret"
|
|
22
|
+
],
|
|
23
|
+
"description": "The type of connection"
|
|
24
|
+
},
|
|
25
|
+
"audience": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": [
|
|
28
|
+
"workspace",
|
|
29
|
+
"workspace-member"
|
|
30
|
+
],
|
|
31
|
+
"description": "The connection's audience"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"connection_type",
|
|
36
|
+
"audience"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"propertyNames": {
|
|
41
|
+
"pattern": "^[a-z]+(_[a-z]+)*$"
|
|
42
|
+
},
|
|
43
|
+
"default": {},
|
|
44
|
+
"description": "Connections to other services"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"slug",
|
|
49
|
+
"id"
|
|
50
|
+
],
|
|
51
|
+
"additionalProperties": false,
|
|
52
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
53
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# title-to-be-replaced
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## `slug-to-be-replaced` Attio Extension
|
|
4
|
+
|
|
5
|
+
### Build
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
npm install
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
### Dev Mode
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
14
|
npm run dev
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
### Linting
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
npm run lint
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Add secrets that you want available in your .server.js files
|
|
2
|
+
# IN DEV MODE ONLY here. In production, secrets should be managed
|
|
3
|
+
# using the `attio secret` command.
|
|
4
|
+
#
|
|
5
|
+
# Example: SECRET_KEY=super-secret-value
|
|
6
|
+
#
|
|
7
|
+
# You will then be able to reference them in your code like so:
|
|
8
|
+
# ```
|
|
9
|
+
# import { env } from '@attio/extension-sdk';
|
|
10
|
+
#
|
|
11
|
+
# const secretValue = env('SECRET_KEY');
|
|
12
|
+
# ```
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "slug-to-be-replaced",
|
|
3
3
|
"description": "title-to-be-replaced",
|
|
4
4
|
"private": true,
|
|
5
5
|
"version": "0.0.1",
|
|
6
|
-
"attio": {
|
|
7
|
-
"app": "src/app",
|
|
8
|
-
"integration": {
|
|
9
|
-
"slug": "slug-to-be-replaced",
|
|
10
|
-
"id": "id-to-be-replaced",
|
|
11
|
-
"connections": []
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
6
|
"scripts": {
|
|
15
7
|
"dev": "attio dev",
|
|
16
8
|
"build": "attio build",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Add secrets that you want available in your .server.ts files
|
|
2
|
+
# IN DEV MODE ONLY here. In production, secrets should be managed
|
|
3
|
+
# using the `attio secret` command.
|
|
4
|
+
#
|
|
5
|
+
# Example: SECRET_KEY=super-secret-value
|
|
6
|
+
#
|
|
7
|
+
# You will then be able to reference them in your code like so:
|
|
8
|
+
# ```
|
|
9
|
+
# import { env } from '@attio/extension-sdk';
|
|
10
|
+
#
|
|
11
|
+
# const secretValue = env('SECRET_KEY');
|
|
12
|
+
# ```
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "slug-to-be-replaced",
|
|
3
3
|
"description": "title-to-be-replaced",
|
|
4
4
|
"private": true,
|
|
5
5
|
"version": "0.0.1",
|
|
6
|
-
"attio": {
|
|
7
|
-
"app": "src/app",
|
|
8
|
-
"integration": {
|
|
9
|
-
"slug": "slug-to-be-replaced",
|
|
10
|
-
"id": "id-to-be-replaced",
|
|
11
|
-
"connections": []
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
6
|
"scripts": {
|
|
15
7
|
"dev": "attio dev",
|
|
16
8
|
"build": "attio build",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const initialConfigSchema: z.ZodObject<{
|
|
3
|
+
token: z.ZodString;
|
|
4
|
+
developer_slug: z.ZodString;
|
|
5
|
+
target_workspace_id: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
token: string;
|
|
8
|
+
developer_slug: string;
|
|
9
|
+
target_workspace_id: string;
|
|
10
|
+
}, {
|
|
11
|
+
token: string;
|
|
12
|
+
developer_slug: string;
|
|
13
|
+
target_workspace_id: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type InitialConfig = z.infer<typeof initialConfigSchema>;
|
|
16
|
+
declare const configSchema: z.ZodObject<{
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
developer_slug: z.ZodString;
|
|
19
|
+
target_workspace_id: z.ZodString;
|
|
20
|
+
developer_account_id: z.ZodString;
|
|
21
|
+
developer_account_member_id: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
token: string;
|
|
24
|
+
developer_account_id: string;
|
|
25
|
+
developer_account_member_id: string;
|
|
26
|
+
developer_slug: string;
|
|
27
|
+
target_workspace_id: string;
|
|
28
|
+
}, {
|
|
29
|
+
token: string;
|
|
30
|
+
developer_account_id: string;
|
|
31
|
+
developer_account_member_id: string;
|
|
32
|
+
developer_slug: string;
|
|
33
|
+
target_workspace_id: string;
|
|
34
|
+
}>;
|
|
35
|
+
type Config = z.infer<typeof configSchema>;
|
|
36
|
+
export declare const configFileName = ".attio.json";
|
|
37
|
+
export type InitialConfigError = "No config file" | "Invalid config file" | "Invalid developer_slug: must be lower kebab case and contain only letters and hyphens. e.g. my-slug";
|
|
38
|
+
export declare function loadInitialConfig(): InitialConfig | InitialConfigError;
|
|
39
|
+
export declare function loadConfig(): Promise<Config | InitialConfigError>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=load-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/util/load-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAKrB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;EAGhB,CAAA;AACF,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,eAAO,MAAM,cAAc,gBAAgB,CAAA;AAG3C,MAAM,MAAM,kBAAkB,GACxB,gBAAgB,GAChB,qBAAqB,GACrB,qGAAqG,CAAA;AAE3G,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,kBAAkB,CAOtE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAuCvE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { createDeveloperAccount } from "../api/create-developer-account.js";
|
|
5
|
+
import { isValidSlug } from "./validate-slug.js";
|
|
6
|
+
export const initialConfigSchema = z.object({
|
|
7
|
+
token: z.string(),
|
|
8
|
+
developer_slug: z.string(),
|
|
9
|
+
target_workspace_id: z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
const configSchema = initialConfigSchema.extend({
|
|
12
|
+
developer_account_id: z.string(),
|
|
13
|
+
developer_account_member_id: z.string(),
|
|
14
|
+
});
|
|
15
|
+
export const configFileName = ".attio.json";
|
|
16
|
+
const configPath = `${homedir()}/${configFileName}`;
|
|
17
|
+
export function loadInitialConfig() {
|
|
18
|
+
if (!existsSync(configPath))
|
|
19
|
+
return "No config file";
|
|
20
|
+
const configFile = JSON.parse(readFileSync(configPath, { encoding: "utf8" }));
|
|
21
|
+
const parsed = initialConfigSchema.safeParse(configFile);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
return "Invalid config file";
|
|
24
|
+
return parsed.data;
|
|
25
|
+
}
|
|
26
|
+
export async function loadConfig() {
|
|
27
|
+
if (!existsSync(configPath))
|
|
28
|
+
return "No config file";
|
|
29
|
+
const configFileContents = readFileSync(configPath, { encoding: "utf8" });
|
|
30
|
+
let configFile;
|
|
31
|
+
try {
|
|
32
|
+
configFile = JSON.parse(configFileContents);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return "Invalid config file";
|
|
36
|
+
}
|
|
37
|
+
const parsed = configSchema.safeParse(configFile);
|
|
38
|
+
if (parsed.success) {
|
|
39
|
+
if (!isValidSlug(parsed.data.developer_slug)) {
|
|
40
|
+
return "Invalid developer_slug: must be lower kebab case and contain only letters and hyphens. e.g. my-slug";
|
|
41
|
+
}
|
|
42
|
+
return parsed.data;
|
|
43
|
+
}
|
|
44
|
+
const initialConfig = loadInitialConfig();
|
|
45
|
+
if (typeof initialConfig === "string")
|
|
46
|
+
return initialConfig;
|
|
47
|
+
const { token, developer_slug: developerSlug } = initialConfig;
|
|
48
|
+
if (!isValidSlug(developerSlug)) {
|
|
49
|
+
return "Invalid developer_slug: must be lower kebab case and contain only letters and hyphens. e.g. my-slug";
|
|
50
|
+
}
|
|
51
|
+
const devAccount = await createDeveloperAccount({ token, developerSlug });
|
|
52
|
+
const config = configSchema.parse({
|
|
53
|
+
token,
|
|
54
|
+
developer_slug: developerSlug,
|
|
55
|
+
developer_account_id: devAccount.developer_account.developer_account_id,
|
|
56
|
+
developer_account_member_id: devAccount.developer_account_member.developer_account_member_id,
|
|
57
|
+
target_workspace_id: initialConfig.target_workspace_id,
|
|
58
|
+
});
|
|
59
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=load-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/util/load-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAC,OAAO,EAAC,MAAM,IAAI,CAAA;AAC1B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAA;AACzE,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAA;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;CACzC,CAA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E,CAAC;YAC3C,OAAO,qGAAqG,CAAA;QAChH,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAA;IACtB,CAAC;IAED,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAA;IACzC,IAAI,OAAO,aAAa,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAA;IAE3D,MAAM,EAAC,KAAK,EAAE,cAAc,EAAE,aAAa,EAAC,GAAG,aAAa,CAAA;IAC5D,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,OAAO,qGAAqG,CAAA;IAChH,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,EAAC,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAEvE,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC;QAC9B,KAAK;QACL,cAAc,EAAE,aAAa;QAC7B,oBAAoB,EAAE,UAAU,CAAC,iBAAiB,CAAC,oBAAoB;QACvE,2BAA2B,EACvB,UAAU,CAAC,wBAAwB,CAAC,2BAA2B;QACnE,mBAAmB,EAAE,aAAa,CAAC,mBAAmB;KACzD,CAAC,CAAA;IACF,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAE1D,OAAO,MAAM,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-extension-config.d.ts","sourceRoot":"","sources":["../../src/util/load-extension-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAc,MAAM,cAAc,CAAA;AAIhD,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,MAAM,CAerD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { parseConfig } from "../schema.js";
|
|
3
|
+
const configPath = "./attio.json";
|
|
4
|
+
export function loadExtensionConfig() {
|
|
5
|
+
if (!existsSync(configPath))
|
|
6
|
+
return "No attio.json";
|
|
7
|
+
let doc;
|
|
8
|
+
try {
|
|
9
|
+
doc = JSON.parse(readFileSync(configPath, "utf8"));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return "Invalid attio.json";
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
return parseConfig(doc);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return e.message;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=load-extension-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-extension-config.js","sourceRoot":"","sources":["../../src/util/load-extension-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,IAAI,CAAA;AAE3C,OAAO,EAAS,WAAW,EAAC,MAAM,cAAc,CAAA;AAEhD,MAAM,UAAU,GAAG,cAAc,CAAA;AAEjC,MAAM,UAAU,mBAAmB;IAC/B,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,eAAe,CAAA;IAEnD,IAAI,GAAY,CAAA;IAEhB,IAAI,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAA;IACtD,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,oBAAoB,CAAA;IAC/B,CAAC;IACD,IAAI,CAAC;QACD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAQ,CAAW,CAAC,OAAO,CAAA;IAC/B,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attio",
|
|
3
|
-
"version": "0.0.1-experimental.
|
|
3
|
+
"version": "0.0.1-experimental.20240710",
|
|
4
4
|
"bin": "lib/attio.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"lib"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "NODE_ENV=production tsc --build && node ./scripts/copy-templates.js",
|
|
10
|
+
"build": "NODE_ENV=production tsc --build && node ./scripts/copy-templates.js && node ./scripts/generate-schema.js",
|
|
11
11
|
"build-watch": "tsc --build --watch",
|
|
12
12
|
"pretest": "./scripts/install-bun.sh && PATH=$HOME/.bun/bin:$PATH concurrently --timings -n build,bun,yarn,pnpm,config \"yarn build\" \"bun --version\" \"npm install --global yarn\" \"npm install --global pnpm\" \"echo '{\\\"token\\\":\\\"CI\\\",\\\"developer_slug\\\":\\\"ci\\\",\\\"target_workspace_id\\\":\\\"a3b71ecf-85da-4f12-a901-2f188c63b39e\\\"}' > ~/.attio.json\"",
|
|
13
13
|
"test": "yarn run test-typescript && PATH=$HOME/.bun/bin:$PATH yarn run test-jest",
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
"uuid": "^9.0.1",
|
|
57
57
|
"xstate": "^5.12.0",
|
|
58
58
|
"yargs": "^17.7.2",
|
|
59
|
-
"zod": "^3.22.3"
|
|
59
|
+
"zod": "^3.22.3",
|
|
60
|
+
"zod-to-json-schema": "3.23.1",
|
|
61
|
+
"zod-validation-error": "3.3.0"
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const createIntegration: (token: string, devSlug: string, slug: string, title: string) => Promise<{
|
|
3
|
-
title: string;
|
|
4
|
-
description: string;
|
|
5
|
-
developer_account_id: string;
|
|
6
|
-
integration_id: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
avatar_url: string | null;
|
|
9
|
-
}>;
|
|
10
|
-
declare const createDevVersionSchema: z.ZodObject<{
|
|
11
|
-
integration_id: z.ZodString;
|
|
12
|
-
integration_dev_version_id: z.ZodString;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
integration_id: string;
|
|
15
|
-
integration_dev_version_id: string;
|
|
16
|
-
}, {
|
|
17
|
-
integration_id: string;
|
|
18
|
-
integration_dev_version_id: string;
|
|
19
|
-
}>;
|
|
20
|
-
export type DevVersion = z.infer<typeof createDevVersionSchema>;
|
|
21
|
-
export declare const createDevVersion: ({ token, devSlug, integrationId, targetWorkspaceId, connections, }: {
|
|
22
|
-
token: string;
|
|
23
|
-
devSlug: string;
|
|
24
|
-
integrationId: string;
|
|
25
|
-
targetWorkspaceId: string;
|
|
26
|
-
connections: Array<{
|
|
27
|
-
connection_type: "secret";
|
|
28
|
-
audience: "workspace" | "workspace-member";
|
|
29
|
-
}>;
|
|
30
|
-
}) => Promise<{
|
|
31
|
-
integration_id: string;
|
|
32
|
-
integration_dev_version_id: string;
|
|
33
|
-
}>;
|
|
34
|
-
export declare const startUpload: (token: string, devSlug: string, integrationId: string, devVersionId: string) => Promise<{
|
|
35
|
-
integration_dev_version_id: string;
|
|
36
|
-
integration_dev_version_bundle_id: string;
|
|
37
|
-
client_bundle_upload_url: string;
|
|
38
|
-
server_bundle_upload_url: string;
|
|
39
|
-
}>;
|
|
40
|
-
declare const packageJsonSchema: z.ZodObject<{
|
|
41
|
-
attio: z.ZodObject<{
|
|
42
|
-
app: z.ZodString;
|
|
43
|
-
integration: z.ZodObject<{
|
|
44
|
-
id: z.ZodString;
|
|
45
|
-
slug: z.ZodString;
|
|
46
|
-
connections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
47
|
-
connection_type: z.ZodEnum<["secret"]>;
|
|
48
|
-
audience: z.ZodEnum<["workspace", "workspace-member"]>;
|
|
49
|
-
}, "strip", z.ZodTypeAny, {
|
|
50
|
-
connection_type: "secret";
|
|
51
|
-
audience: "workspace" | "workspace-member";
|
|
52
|
-
}, {
|
|
53
|
-
connection_type: "secret";
|
|
54
|
-
audience: "workspace" | "workspace-member";
|
|
55
|
-
}>, "many">>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
id: string;
|
|
58
|
-
slug: string;
|
|
59
|
-
connections: {
|
|
60
|
-
connection_type: "secret";
|
|
61
|
-
audience: "workspace" | "workspace-member";
|
|
62
|
-
}[];
|
|
63
|
-
}, {
|
|
64
|
-
id: string;
|
|
65
|
-
slug: string;
|
|
66
|
-
connections?: {
|
|
67
|
-
connection_type: "secret";
|
|
68
|
-
audience: "workspace" | "workspace-member";
|
|
69
|
-
}[] | undefined;
|
|
70
|
-
}>;
|
|
71
|
-
}, "strip", z.ZodTypeAny, {
|
|
72
|
-
app: string;
|
|
73
|
-
integration: {
|
|
74
|
-
id: string;
|
|
75
|
-
slug: string;
|
|
76
|
-
connections: {
|
|
77
|
-
connection_type: "secret";
|
|
78
|
-
audience: "workspace" | "workspace-member";
|
|
79
|
-
}[];
|
|
80
|
-
};
|
|
81
|
-
}, {
|
|
82
|
-
app: string;
|
|
83
|
-
integration: {
|
|
84
|
-
id: string;
|
|
85
|
-
slug: string;
|
|
86
|
-
connections?: {
|
|
87
|
-
connection_type: "secret";
|
|
88
|
-
audience: "workspace" | "workspace-member";
|
|
89
|
-
}[] | undefined;
|
|
90
|
-
};
|
|
91
|
-
}>;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
attio: {
|
|
94
|
-
app: string;
|
|
95
|
-
integration: {
|
|
96
|
-
id: string;
|
|
97
|
-
slug: string;
|
|
98
|
-
connections: {
|
|
99
|
-
connection_type: "secret";
|
|
100
|
-
audience: "workspace" | "workspace-member";
|
|
101
|
-
}[];
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
}, {
|
|
105
|
-
attio: {
|
|
106
|
-
app: string;
|
|
107
|
-
integration: {
|
|
108
|
-
id: string;
|
|
109
|
-
slug: string;
|
|
110
|
-
connections?: {
|
|
111
|
-
connection_type: "secret";
|
|
112
|
-
audience: "workspace" | "workspace-member";
|
|
113
|
-
}[] | undefined;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
}>;
|
|
117
|
-
type IntegrationConfig = z.infer<typeof packageJsonSchema>["attio"]["integration"];
|
|
118
|
-
type IntegrationConfigError = "No package.json" | "Invalid package.json";
|
|
119
|
-
export declare const loadIntegrationConfig: () => IntegrationConfig | IntegrationConfigError;
|
|
120
|
-
export declare const initialConfigSchema: z.ZodObject<{
|
|
121
|
-
token: z.ZodString;
|
|
122
|
-
developer_slug: z.ZodString;
|
|
123
|
-
target_workspace_id: z.ZodString;
|
|
124
|
-
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
token: string;
|
|
126
|
-
developer_slug: string;
|
|
127
|
-
target_workspace_id: string;
|
|
128
|
-
}, {
|
|
129
|
-
token: string;
|
|
130
|
-
developer_slug: string;
|
|
131
|
-
target_workspace_id: string;
|
|
132
|
-
}>;
|
|
133
|
-
export type InitialConfig = z.infer<typeof initialConfigSchema>;
|
|
134
|
-
declare const configSchema: z.ZodObject<{
|
|
135
|
-
token: z.ZodString;
|
|
136
|
-
developer_slug: z.ZodString;
|
|
137
|
-
target_workspace_id: z.ZodString;
|
|
138
|
-
developer_account_id: z.ZodString;
|
|
139
|
-
developer_account_member_id: z.ZodString;
|
|
140
|
-
}, "strip", z.ZodTypeAny, {
|
|
141
|
-
developer_account_id: string;
|
|
142
|
-
developer_account_member_id: string;
|
|
143
|
-
token: string;
|
|
144
|
-
developer_slug: string;
|
|
145
|
-
target_workspace_id: string;
|
|
146
|
-
}, {
|
|
147
|
-
developer_account_id: string;
|
|
148
|
-
developer_account_member_id: string;
|
|
149
|
-
token: string;
|
|
150
|
-
developer_slug: string;
|
|
151
|
-
target_workspace_id: string;
|
|
152
|
-
}>;
|
|
153
|
-
type Config = z.infer<typeof configSchema>;
|
|
154
|
-
export declare const configFileName = ".attio.json";
|
|
155
|
-
export type InitialConfigError = "No config file" | "Invalid config file" | "Invalid developer_slug: must be lower kebab case and contain only letters and hyphens. e.g. my-slug";
|
|
156
|
-
export declare const loadInitialConfig: () => InitialConfig | InitialConfigError;
|
|
157
|
-
export declare const loadConfig: () => Promise<Config | InitialConfigError>;
|
|
158
|
-
export declare const completeBundleUpload: (token: string, devSlug: string, integrationId: string, devVersionId: string, bundleId: string) => Promise<true>;
|
|
159
|
-
export declare const isIntegrationSlugValid: (token: string, devSlug: string, integrationSlug: string) => Promise<boolean>;
|
|
160
|
-
export declare const ping: (token: string, devSlug: string, integrationId: string, devVersionId: string) => Promise<boolean>;
|
|
161
|
-
export {};
|
|
162
|
-
//# sourceMappingURL=upload-bundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-bundle.d.ts","sourceRoot":"","sources":["../../src/util/upload-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAiErB,eAAO,MAAM,iBAAiB,UACnB,MAAM,WACJ,MAAM,QACT,MAAM,SACL,MAAM;;;;;;;EA6BhB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;;EAG1B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB,uEAM1B;IACC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM;QACf,eAAe,EAAE,QAAQ,CAAA;QACzB,QAAQ,EAAE,WAAW,GAAG,kBAAkB,CAAA;KAC7C,CAAC,CAAA;CACL;;;EAYA,CAAA;AAQD,eAAO,MAAM,WAAW,UACb,MAAM,WACJ,MAAM,iBACA,MAAM,gBACP,MAAM;;;;;EAYvB,CAAA;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBrB,CAAA;AAEF,KAAK,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