attio 0.0.1-experimental.20240614.1 → 0.0.1-experimental.20240620
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/commands/build.d.ts.map +1 -1
- package/lib/commands/build.js +7 -1
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +8 -2
- package/lib/commands/dev.js.map +1 -1
- package/lib/commands/index.d.ts +9 -3
- package/lib/commands/index.d.ts.map +1 -1
- package/lib/commands/index.js +41 -14
- package/lib/commands/index.js.map +1 -1
- package/lib/components/InitialInstructions.d.ts.map +1 -1
- package/lib/components/InitialInstructions.js +8 -7
- package/lib/components/InitialInstructions.js.map +1 -1
- package/lib/machines/dev-machine.d.ts +38 -22
- package/lib/machines/dev-machine.d.ts.map +1 -1
- package/lib/machines/dev-machine.js +44 -10
- package/lib/machines/dev-machine.js.map +1 -1
- package/lib/machines/scaffold-machine.d.ts +208 -26
- package/lib/machines/scaffold-machine.d.ts.map +1 -1
- package/lib/machines/scaffold-machine.js +304 -158
- package/lib/machines/scaffold-machine.js.map +1 -1
- package/lib/machines/ts-machine.d.ts.map +1 -1
- package/lib/machines/ts-machine.js +1 -0
- package/lib/machines/ts-machine.js.map +1 -1
- package/lib/templates/javascript/package.json +6 -1
- package/lib/templates/typescript/package.json +6 -1
- package/lib/util/make-extension-name.d.ts +1 -0
- package/lib/util/make-extension-name.d.ts.map +1 -1
- package/lib/util/make-extension-name.js +4 -1
- package/lib/util/make-extension-name.js.map +1 -1
- package/lib/util/upload-bundle.d.ts +65 -10
- package/lib/util/upload-bundle.d.ts.map +1 -1
- package/lib/util/upload-bundle.js +86 -16
- package/lib/util/upload-bundle.js.map +1 -1
- package/package.json +11 -3
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"attio": {
|
|
6
|
-
"app": "src/app"
|
|
6
|
+
"app": "src/app",
|
|
7
|
+
"integration": {
|
|
8
|
+
"title": "integration-title-to-be-replaced",
|
|
9
|
+
"slug": "integration-slug-to-be-replaced",
|
|
10
|
+
"id": "integration-id-to-be-replaced"
|
|
11
|
+
}
|
|
7
12
|
},
|
|
8
13
|
"scripts": {
|
|
9
14
|
"dev": "attio dev",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-extension-name.d.ts","sourceRoot":"","sources":["../../src/util/make-extension-name.ts"],"names":[],"mappings":"AASA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
1
|
+
{"version":3,"file":"make-extension-name.d.ts","sourceRoot":"","sources":["../../src/util/make-extension-name.ts"],"names":[],"mappings":"AASA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
const slugify = (string) => string
|
|
2
2
|
.toLowerCase()
|
|
3
3
|
.replace(/\s+/g, "-")
|
|
4
|
-
.replace(/[^\w]+_/g, "")
|
|
4
|
+
.replace(/[^\w]+_'"/g, "")
|
|
5
5
|
.replace(/--+ /g, "-")
|
|
6
6
|
.replace(/^-+/, "")
|
|
7
7
|
.replace(/-+$/, "");
|
|
8
|
+
export function makeIntegrationSlug(string) {
|
|
9
|
+
return slugify(string.toLowerCase().trim());
|
|
10
|
+
}
|
|
8
11
|
export function makeExtensionName(string) {
|
|
9
12
|
return slugify(string.toLowerCase().trim());
|
|
10
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-extension-name.js","sourceRoot":"","sources":["../../src/util/make-extension-name.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE,CAC/B,MAAM;KACD,WAAW,EAAE;KACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;KACpB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"make-extension-name.js","sourceRoot":"","sources":["../../src/util/make-extension-name.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE,CAC/B,MAAM;KACD,WAAW,EAAE;KACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;KACpB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;KACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;KACrB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;KAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AAE3B,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;AAC/C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;AAC/C,CAAC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const EXTENSION_API_URL: string;
|
|
3
|
+
export declare const createIntegration: (token: string, devSlug: string, slug: string, title: string) => Promise<{
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
developer_account_id: string;
|
|
7
|
+
integration_id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
avatar_url: string | null;
|
|
10
|
+
}>;
|
|
2
11
|
declare const createDevVersionSchema: z.ZodObject<{
|
|
3
12
|
integration_id: z.ZodString;
|
|
4
13
|
integration_dev_version_id: z.ZodString;
|
|
@@ -28,21 +37,68 @@ export declare const startUpload: (token: string, devSlug: string, integrationId
|
|
|
28
37
|
server_bundle_upload_url: string;
|
|
29
38
|
integration_dev_version_bundle_id: string;
|
|
30
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
|
+
title: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
title: string;
|
|
49
|
+
id: string;
|
|
50
|
+
slug: string;
|
|
51
|
+
}, {
|
|
52
|
+
title: string;
|
|
53
|
+
id: string;
|
|
54
|
+
slug: string;
|
|
55
|
+
}>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
app: string;
|
|
58
|
+
integration: {
|
|
59
|
+
title: string;
|
|
60
|
+
id: string;
|
|
61
|
+
slug: string;
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
app: string;
|
|
65
|
+
integration: {
|
|
66
|
+
title: string;
|
|
67
|
+
id: string;
|
|
68
|
+
slug: string;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
attio: {
|
|
73
|
+
app: string;
|
|
74
|
+
integration: {
|
|
75
|
+
title: string;
|
|
76
|
+
id: string;
|
|
77
|
+
slug: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
attio: {
|
|
82
|
+
app: string;
|
|
83
|
+
integration: {
|
|
84
|
+
title: string;
|
|
85
|
+
id: string;
|
|
86
|
+
slug: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}>;
|
|
90
|
+
type IntegrationConfig = z.infer<typeof packageJsonSchema>["attio"]["integration"];
|
|
91
|
+
type IntegrationConfigError = "No package.json" | "Invalid package.json";
|
|
92
|
+
export declare const loadIntegrationConfig: () => IntegrationConfig | IntegrationConfigError;
|
|
31
93
|
export declare const initialConfigSchema: z.ZodObject<{
|
|
32
94
|
token: z.ZodString;
|
|
33
95
|
developer_slug: z.ZodString;
|
|
34
|
-
integration_slug: z.ZodString;
|
|
35
|
-
integration_title: z.ZodString;
|
|
36
96
|
}, "strip", z.ZodTypeAny, {
|
|
37
97
|
token: string;
|
|
38
98
|
developer_slug: string;
|
|
39
|
-
integration_slug: string;
|
|
40
|
-
integration_title: string;
|
|
41
99
|
}, {
|
|
42
100
|
token: string;
|
|
43
101
|
developer_slug: string;
|
|
44
|
-
integration_slug: string;
|
|
45
|
-
integration_title: string;
|
|
46
102
|
}>;
|
|
47
103
|
export type InitialConfig = z.infer<typeof initialConfigSchema>;
|
|
48
104
|
export declare const configFileName = ".attio.json";
|
|
@@ -51,12 +107,11 @@ export declare const loadInitialConfig: () => InitialConfig | InitialConfigError
|
|
|
51
107
|
export declare const loadConfig: () => Promise<{
|
|
52
108
|
developer_account_id: string;
|
|
53
109
|
developer_account_member_id: string;
|
|
54
|
-
integration_id: string;
|
|
55
110
|
token: string;
|
|
56
111
|
developer_slug: string;
|
|
57
|
-
|
|
58
|
-
integration_title: string;
|
|
59
|
-
}>;
|
|
112
|
+
} | InitialConfigError>;
|
|
60
113
|
export declare const completeBundleUpload: (token: string, devSlug: string, integrationId: string, devVersionId: string, bundleId: string) => Promise<true>;
|
|
114
|
+
export declare const isIntegrationSlugValid: (token: string, devSlug: string, integrationSlug: string) => Promise<boolean>;
|
|
115
|
+
export declare const ping: (token: string, devSlug: string, integrationId: string, devVersionId: string) => Promise<boolean>;
|
|
61
116
|
export {};
|
|
62
117
|
//# sourceMappingURL=upload-bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAIrB,eAAO,MAAM,iBAAiB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BACE,MAAM,qBAa1B,CAAA;AAMD,eAAO,MAAM,IAAI,UACN,MAAM,WACJ,MAAM,iBACA,MAAM,gBACP,MAAM,qBAYvB,CAAA"}
|
|
@@ -3,14 +3,27 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import { v4 as uuid } from "uuid";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const isTest = process.env.NODE_ENV === "test";
|
|
7
|
+
export const EXTENSION_API_URL = ((_a = process.env.NODE_ENV) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "development" ? "api.attio.me" : "api.attio.com";
|
|
8
|
+
const BASE_URL = `https://${EXTENSION_API_URL}`;
|
|
9
9
|
const getHeaders = (token) => ({
|
|
10
10
|
"x-attio-platform": "web-app",
|
|
11
11
|
"Authorization": `Bearer ${token}`,
|
|
12
12
|
"Content-Type": "application/json",
|
|
13
13
|
});
|
|
14
|
+
const serverErrorSchema = z.object({
|
|
15
|
+
statusCode: z.number(),
|
|
16
|
+
error: z.string(),
|
|
17
|
+
message: z.string(),
|
|
18
|
+
status_code: z.number(),
|
|
19
|
+
});
|
|
20
|
+
const handleError = async (response) => {
|
|
21
|
+
if (response.ok)
|
|
22
|
+
return;
|
|
23
|
+
const json = await response.json();
|
|
24
|
+
const error = serverErrorSchema.parse(json);
|
|
25
|
+
throw new Error(error.message);
|
|
26
|
+
};
|
|
14
27
|
const createDeveloperAccountSchema = z.object({
|
|
15
28
|
developer_account: z.object({
|
|
16
29
|
developer_account_id: z.string(),
|
|
@@ -19,13 +32,20 @@ const createDeveloperAccountSchema = z.object({
|
|
|
19
32
|
developer_account_member_id: z.string(),
|
|
20
33
|
}),
|
|
21
34
|
});
|
|
22
|
-
const createDeveloperAccount = async (token, slug
|
|
35
|
+
const createDeveloperAccount = async (token, slug) => {
|
|
23
36
|
const accountId = uuid();
|
|
37
|
+
if (isTest) {
|
|
38
|
+
return createDeveloperAccountSchema.parse({
|
|
39
|
+
developer_account: { developer_account_id: accountId },
|
|
40
|
+
developer_account_member: { developer_account_member_id: accountId },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
24
43
|
const response = await fetch(`${BASE_URL}/developer-portal/accounts/${accountId}`, {
|
|
25
44
|
method: "PUT",
|
|
26
45
|
headers: getHeaders(token),
|
|
27
|
-
body: JSON.stringify({ slug, title }),
|
|
46
|
+
body: JSON.stringify({ slug, title: slug }),
|
|
28
47
|
});
|
|
48
|
+
await handleError(response);
|
|
29
49
|
const json = await response.json();
|
|
30
50
|
try {
|
|
31
51
|
return createDeveloperAccountSchema.parse(json);
|
|
@@ -42,13 +62,24 @@ const createIntegrationSchema = z.object({
|
|
|
42
62
|
description: z.string(),
|
|
43
63
|
avatar_url: z.string().nullable(),
|
|
44
64
|
});
|
|
45
|
-
const createIntegration = async (token, devSlug, slug, title) => {
|
|
65
|
+
export const createIntegration = async (token, devSlug, slug, title) => {
|
|
46
66
|
const integrationId = uuid();
|
|
67
|
+
if (isTest) {
|
|
68
|
+
return createIntegrationSchema.parse({
|
|
69
|
+
integration_id: integrationId,
|
|
70
|
+
developer_account_id: devSlug,
|
|
71
|
+
slug,
|
|
72
|
+
title,
|
|
73
|
+
description: "Integration created in CI",
|
|
74
|
+
avatar_url: null,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
47
77
|
const response = await fetch(`${BASE_URL}/developer-portal/accounts/${devSlug}/integrations/${integrationId}`, {
|
|
48
78
|
method: "PUT",
|
|
49
79
|
headers: getHeaders(token),
|
|
50
80
|
body: JSON.stringify({ slug, title }),
|
|
51
81
|
});
|
|
82
|
+
await handleError(response);
|
|
52
83
|
const json = await response.json();
|
|
53
84
|
try {
|
|
54
85
|
return createIntegrationSchema.parse(json);
|
|
@@ -68,6 +99,7 @@ export const createDevVersion = async (token, devSlug, integrationId) => {
|
|
|
68
99
|
method: "POST",
|
|
69
100
|
headers: getHeaders(token),
|
|
70
101
|
});
|
|
102
|
+
await handleError(response);
|
|
71
103
|
return createDevVersionSchema.parse(await response.json());
|
|
72
104
|
};
|
|
73
105
|
const startUploadSchema = z.object({
|
|
@@ -81,18 +113,36 @@ export const startUpload = async (token, devSlug, integrationId, devVersionId) =
|
|
|
81
113
|
method: "POST",
|
|
82
114
|
headers: getHeaders(token),
|
|
83
115
|
});
|
|
116
|
+
await handleError(response);
|
|
84
117
|
return startUploadSchema.parse(await response.json());
|
|
85
118
|
};
|
|
119
|
+
const packageJsonSchema = z.object({
|
|
120
|
+
attio: z.object({
|
|
121
|
+
app: z.string(),
|
|
122
|
+
integration: z.object({
|
|
123
|
+
id: z.string(),
|
|
124
|
+
slug: z.string(),
|
|
125
|
+
title: z.string(),
|
|
126
|
+
}),
|
|
127
|
+
}),
|
|
128
|
+
});
|
|
129
|
+
const packageJsonPath = "./package.json";
|
|
130
|
+
export const loadIntegrationConfig = () => {
|
|
131
|
+
if (!existsSync(packageJsonPath))
|
|
132
|
+
return "No package.json";
|
|
133
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, { encoding: "utf8" }));
|
|
134
|
+
const parsed = packageJsonSchema.safeParse(packageJson);
|
|
135
|
+
if (!parsed.success)
|
|
136
|
+
return "Invalid package.json";
|
|
137
|
+
return parsed.data.attio.integration;
|
|
138
|
+
};
|
|
86
139
|
export const initialConfigSchema = z.object({
|
|
87
140
|
token: z.string(),
|
|
88
141
|
developer_slug: z.string(),
|
|
89
|
-
integration_slug: z.string(),
|
|
90
|
-
integration_title: z.string(),
|
|
91
142
|
});
|
|
92
143
|
const configSchema = initialConfigSchema.extend({
|
|
93
144
|
developer_account_id: z.string(),
|
|
94
145
|
developer_account_member_id: z.string(),
|
|
95
|
-
integration_id: z.string(),
|
|
96
146
|
});
|
|
97
147
|
export const configFileName = ".attio.json";
|
|
98
148
|
const configPath = `${homedir()}/${configFileName}`;
|
|
@@ -112,18 +162,14 @@ export const loadConfig = async () => {
|
|
|
112
162
|
return parsed.data;
|
|
113
163
|
const initialConfig = loadInitialConfig();
|
|
114
164
|
if (typeof initialConfig === "string")
|
|
115
|
-
|
|
116
|
-
const { token, developer_slug
|
|
117
|
-
const devAccount = await createDeveloperAccount(token, developer_slug
|
|
118
|
-
const integration = await createIntegration(token, developer_slug, integration_slug, integration_title);
|
|
165
|
+
return initialConfig;
|
|
166
|
+
const { token, developer_slug } = initialConfig;
|
|
167
|
+
const devAccount = await createDeveloperAccount(token, developer_slug);
|
|
119
168
|
const config = configSchema.parse({
|
|
120
169
|
token,
|
|
121
170
|
developer_slug,
|
|
122
171
|
developer_account_id: devAccount.developer_account.developer_account_id,
|
|
123
172
|
developer_account_member_id: devAccount.developer_account_member.developer_account_member_id,
|
|
124
|
-
integration_id: integration.integration_id,
|
|
125
|
-
integration_slug,
|
|
126
|
-
integration_title,
|
|
127
173
|
});
|
|
128
174
|
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
129
175
|
return config;
|
|
@@ -136,6 +182,7 @@ export const completeBundleUpload = async (token, devSlug, integrationId, devVer
|
|
|
136
182
|
method: "POST",
|
|
137
183
|
headers: getHeaders(token),
|
|
138
184
|
});
|
|
185
|
+
await handleError(response);
|
|
139
186
|
const json = await response.json();
|
|
140
187
|
try {
|
|
141
188
|
return completeBundleUploadSchema.parse(json).success;
|
|
@@ -144,4 +191,27 @@ export const completeBundleUpload = async (token, devSlug, integrationId, devVer
|
|
|
144
191
|
throw new Error(JSON.stringify(json));
|
|
145
192
|
}
|
|
146
193
|
};
|
|
194
|
+
const isIntegrationSlugValidSchema = z.object({
|
|
195
|
+
exists: z.boolean(),
|
|
196
|
+
});
|
|
197
|
+
export const isIntegrationSlugValid = async (token, devSlug, integrationSlug) => {
|
|
198
|
+
if (isTest)
|
|
199
|
+
return true;
|
|
200
|
+
const response = await fetch(`${BASE_URL}/developer-portal/accounts/${devSlug}/integrations/${integrationSlug}/exists`, {
|
|
201
|
+
headers: getHeaders(token),
|
|
202
|
+
});
|
|
203
|
+
await handleError(response);
|
|
204
|
+
return !isIntegrationSlugValidSchema.parse(await response.json()).exists;
|
|
205
|
+
};
|
|
206
|
+
const pingSchema = z.object({
|
|
207
|
+
success: z.boolean(),
|
|
208
|
+
});
|
|
209
|
+
export const ping = async (token, devSlug, integrationId, devVersionId) => {
|
|
210
|
+
const response = await fetch(`${BASE_URL}/developer-portal/accounts/${devSlug}/integrations/${integrationId}/dev-versions/${devVersionId}/ping`, {
|
|
211
|
+
method: "POST",
|
|
212
|
+
headers: getHeaders(token),
|
|
213
|
+
});
|
|
214
|
+
await handleError(response);
|
|
215
|
+
return pingSchema.parse(await response.json()).success;
|
|
216
|
+
};
|
|
147
217
|
//# sourceMappingURL=upload-bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-bundle.js","sourceRoot":"","sources":["../../src/util/upload-bundle.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,EAAE,IAAI,IAAI,EAAC,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"upload-bundle.js","sourceRoot":"","sources":["../../src/util/upload-bundle.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,EAAE,IAAI,IAAI,EAAC,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAA;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAC1B,CAAA,MAA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AM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EACrB,KAAa,EACb,OAAe,EACf,aAAqB,EACrB,YAAoB,EACtB,EAAE;IACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,QAAQ,8BAA8B,OAAO,iBAAiB,aAAa,iBAAiB,YAAY,OAAO,EAClH;QACI,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC;KAC7B,CACJ,CAAA;IACD,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAA;IAE3B,OAAO,UAAU,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAA;AAC1D,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attio",
|
|
3
|
-
"version": "0.0.1-experimental.
|
|
3
|
+
"version": "0.0.1-experimental.20240620",
|
|
4
4
|
"bin": "lib/attio.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "NODE_ENV=production tsc --build && node ./scripts/copy-templates.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\\\"}' > ~/.attio.json\"",
|
|
13
|
+
"test": "yarn run test-typescript && PATH=$HOME/.bun/bin:$PATH yarn run test-jest",
|
|
14
|
+
"test-jest": "jest --config ./jest.config.cjs",
|
|
13
15
|
"test-typescript": "tsc --build",
|
|
14
16
|
"clean": "rm -rf lib && rm -rf tsconfig.tsbuildinfo",
|
|
15
17
|
"lint": "eslint 'src/**/*.{js,ts,tsx}'"
|
|
@@ -20,9 +22,15 @@
|
|
|
20
22
|
"@attio/eslint-plugin": "workspace:^",
|
|
21
23
|
"@swc/types": "^0.1.7",
|
|
22
24
|
"@total-typescript/ts-reset": "0.5.1",
|
|
25
|
+
"@types/jest": "^29.5.5",
|
|
23
26
|
"@types/node": "20.12.2",
|
|
24
27
|
"@types/yargs": "^17.0.32",
|
|
25
|
-
"
|
|
28
|
+
"concurrently": "^5.1.0",
|
|
29
|
+
"jest": "^29.7.0",
|
|
30
|
+
"ncp": "2.0.0",
|
|
31
|
+
"tmp-promise": "^3.0.3",
|
|
32
|
+
"ts-jest": "^29.1.0",
|
|
33
|
+
"ts-node": "^10.9.2"
|
|
26
34
|
},
|
|
27
35
|
"dependencies": {
|
|
28
36
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|