@kosha-ai/integration-asana 0.2.0 → 0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-asana.d.ts","sourceRoot":"","sources":["../../src/lib/integration-asana.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integration-asana.d.ts","sourceRoot":"","sources":["../../src/lib/integration-asana.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIlE,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAeD,wBAAgB,KAAK,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB,CA0G7E;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { defineIntegration, oauth2 } from '@kosha-ai/integration-sdk';
|
|
2
|
-
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
const docsDirectory = path.join(currentDir, '../../docs');
|
|
1
|
+
import { defineIntegration, oauth2, packageDirs, } from '@kosha-ai/integration-sdk';
|
|
2
|
+
const { docsPath, migrationsPath } = packageDirs(import.meta.url);
|
|
6
3
|
export function asana(options = {}) {
|
|
7
4
|
const apiBaseUrl = options.baseUrl ?? 'https://app.asana.com/api/1.0';
|
|
8
5
|
const authBaseUrl = options.authBaseUrl ?? 'https://app.asana.com';
|
|
@@ -10,7 +7,8 @@ export function asana(options = {}) {
|
|
|
10
7
|
key: 'asana',
|
|
11
8
|
name: 'Asana',
|
|
12
9
|
docsUrl: 'https://developers.asana.com/reference/rest-api-reference',
|
|
13
|
-
docsPath
|
|
10
|
+
docsPath,
|
|
11
|
+
migrationsPath,
|
|
14
12
|
auth: oauth2({
|
|
15
13
|
authorizationUrl: `${authBaseUrl}/-/oauth_authorize`,
|
|
16
14
|
tokenUrl: `${authBaseUrl}/-/oauth_token`,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
CREATE TABLE "asana_configuration" (
|
|
2
|
+
"id" TEXT NOT NULL,
|
|
3
|
+
"environmentId" TEXT NOT NULL,
|
|
4
|
+
"name" TEXT NOT NULL,
|
|
5
|
+
"slug" TEXT NOT NULL,
|
|
6
|
+
-- Encrypted, so TEXT rather than JSONB.
|
|
7
|
+
"credentials" TEXT,
|
|
8
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
|
|
11
|
+
CONSTRAINT "asana_configuration_pkey" PRIMARY KEY ("id")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
CREATE TABLE "asana_connection" (
|
|
15
|
+
"accountId" TEXT NOT NULL,
|
|
16
|
+
-- Copied from `account` so the unique index below can use it.
|
|
17
|
+
"userId" TEXT NOT NULL,
|
|
18
|
+
"environmentId" TEXT NOT NULL,
|
|
19
|
+
"configurationId" TEXT NOT NULL,
|
|
20
|
+
"metadata" JSONB,
|
|
21
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
22
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
23
|
+
|
|
24
|
+
CONSTRAINT "asana_connection_pkey" PRIMARY KEY ("accountId")
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
CREATE UNIQUE INDEX "asana_configuration_environmentId_slug_key" ON "asana_configuration"("environmentId", "slug");
|
|
28
|
+
|
|
29
|
+
CREATE INDEX "asana_configuration_environmentId_idx" ON "asana_configuration"("environmentId");
|
|
30
|
+
|
|
31
|
+
CREATE UNIQUE INDEX "asana_connection_environmentId_configurationId_userId_key" ON "asana_connection"("environmentId", "configurationId", "userId");
|
|
32
|
+
|
|
33
|
+
CREATE INDEX "asana_connection_environmentId_idx" ON "asana_connection"("environmentId");
|
|
34
|
+
|
|
35
|
+
CREATE INDEX "asana_connection_configurationId_idx" ON "asana_connection"("configurationId");
|
|
36
|
+
|
|
37
|
+
CREATE INDEX "asana_connection_userId_idx" ON "asana_connection"("userId");
|
|
38
|
+
|
|
39
|
+
ALTER TABLE "asana_configuration" ADD CONSTRAINT "asana_configuration_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "environment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
40
|
+
|
|
41
|
+
ALTER TABLE "asana_connection" ADD CONSTRAINT "asana_connection_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
42
|
+
|
|
43
|
+
ALTER TABLE "asana_connection" ADD CONSTRAINT "asana_connection_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
44
|
+
|
|
45
|
+
ALTER TABLE "asana_connection" ADD CONSTRAINT "asana_connection_environmentId_fkey" FOREIGN KEY ("environmentId") REFERENCES "environment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
46
|
+
|
|
47
|
+
-- RESTRICT: a configuration that still has connections cannot be deleted.
|
|
48
|
+
ALTER TABLE "asana_connection" ADD CONSTRAINT "asana_connection_configurationId_fkey" FOREIGN KEY ("configurationId") REFERENCES "asana_configuration"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosha-ai/integration-asana",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Asana integration for Kosha",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kosha",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
39
|
"docs",
|
|
40
|
+
"migrations",
|
|
40
41
|
"!**/*.tsbuildinfo"
|
|
41
42
|
],
|
|
42
43
|
"dependencies": {
|
|
@@ -47,9 +48,9 @@
|
|
|
47
48
|
"key": "asana"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@kosha-ai/integration-sdk": "0.
|
|
51
|
+
"@kosha-ai/integration-sdk": "0.3.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@kosha-ai/integration-sdk": "0.
|
|
54
|
+
"@kosha-ai/integration-sdk": "0.3.0"
|
|
54
55
|
}
|
|
55
56
|
}
|