@tapstack/db 1.0.6 → 3.0.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 +655 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.js +22 -0
- package/dist/adapters/nodejs.adapter.d.ts +63 -0
- package/dist/adapters/nodejs.adapter.js +204 -0
- package/dist/adapters/types.d.ts +77 -0
- package/dist/adapters/types.js +19 -0
- package/dist/index.d.ts +101 -21
- package/dist/index.js +114 -41
- package/dist/modules/automations.d.ts +109 -0
- package/dist/modules/automations.js +59 -0
- package/dist/modules/conversations.d.ts +82 -0
- package/dist/modules/conversations.js +54 -0
- package/dist/modules/fields.d.ts +30 -9
- package/dist/modules/fields.js +31 -13
- package/dist/modules/files.d.ts +68 -0
- package/dist/modules/files.js +115 -0
- package/dist/modules/index.d.ts +12 -0
- package/dist/modules/index.js +28 -0
- package/dist/modules/objects.d.ts +30 -9
- package/dist/modules/objects.js +35 -13
- package/dist/modules/organizations.d.ts +69 -0
- package/dist/modules/organizations.js +83 -0
- package/dist/modules/records.d.ts +47 -5
- package/dist/modules/records.js +70 -5
- package/dist/modules/workspaces.d.ts +44 -0
- package/dist/modules/workspaces.js +57 -0
- package/dist/types.d.ts +159 -10
- package/dist/types.js +19 -0
- package/package.json +16 -7
- package/src/__tests__/client.test.ts +305 -49
- package/src/adapters/index.ts +13 -0
- package/src/adapters/nodejs.adapter.ts +298 -0
- package/src/adapters/types.ts +108 -0
- package/src/index.ts +132 -44
- package/src/modules/automations.ts +157 -0
- package/src/modules/conversations.ts +134 -0
- package/src/modules/fields.ts +64 -14
- package/src/modules/files.ts +144 -0
- package/src/modules/index.ts +19 -0
- package/src/modules/objects.ts +46 -14
- package/src/modules/organizations.ts +137 -0
- package/src/modules/records.ts +119 -6
- package/src/modules/workspaces.ts +95 -0
- package/src/types.ts +229 -9
- package/dist/request.d.ts +0 -2
- package/dist/request.js +0 -20
- package/src/request.ts +0 -14
package/dist/modules/objects.js
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Objects Module
|
|
4
|
+
* CRUD operations for Tapstack objects (data models)
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.ObjectModule = void 0;
|
|
4
|
-
const request_1 = require("../request");
|
|
5
8
|
class ObjectModule {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
9
|
+
constructor(adapter) {
|
|
10
|
+
this.adapter = adapter;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* List all objects in the workspace
|
|
14
|
+
*/
|
|
15
|
+
async list() {
|
|
16
|
+
return this.adapter.request('GET', 'schema/objects');
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Get a single object by slug
|
|
20
|
+
*/
|
|
21
|
+
async get(slug) {
|
|
22
|
+
return this.adapter.request('GET', `schema/objects/${slug}`);
|
|
14
23
|
}
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Create a new object
|
|
26
|
+
*/
|
|
27
|
+
async create(data) {
|
|
28
|
+
return this.adapter.request('POST', 'schema/objects', {
|
|
29
|
+
body: data,
|
|
30
|
+
});
|
|
17
31
|
}
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Update an existing object
|
|
34
|
+
*/
|
|
35
|
+
async update(slug, data) {
|
|
36
|
+
return this.adapter.request('PATCH', `schema/objects/${slug}`, {
|
|
37
|
+
body: data,
|
|
38
|
+
});
|
|
20
39
|
}
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Delete an object (soft delete by default)
|
|
42
|
+
*/
|
|
43
|
+
async delete(slug, soft = true) {
|
|
44
|
+
return this.adapter.request('DELETE', `schema/objects/${slug}`, { params: { soft: String(soft) } });
|
|
23
45
|
}
|
|
24
46
|
}
|
|
25
47
|
exports.ObjectModule = ObjectModule;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organizations Module
|
|
3
|
+
* CRUD operations for Tapstack organizations
|
|
4
|
+
*/
|
|
5
|
+
import { IInstanceAdapter } from '../adapters/types';
|
|
6
|
+
import { TapstackOrganization, CreateOrganizationPayload, UpdateOrganizationPayload, OrganizationListResponse, OrganizationMember, TapstackWorkspace, WorkspaceListResponse } from '../types';
|
|
7
|
+
export declare class OrganizationModule {
|
|
8
|
+
private adapter;
|
|
9
|
+
constructor(adapter: IInstanceAdapter);
|
|
10
|
+
/**
|
|
11
|
+
* List all organizations the user belongs to
|
|
12
|
+
*/
|
|
13
|
+
list(): Promise<OrganizationListResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a single organization by ID
|
|
16
|
+
*/
|
|
17
|
+
get(orgId: string): Promise<TapstackOrganization>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new organization
|
|
20
|
+
*/
|
|
21
|
+
create(data: CreateOrganizationPayload): Promise<TapstackOrganization>;
|
|
22
|
+
/**
|
|
23
|
+
* Update an existing organization
|
|
24
|
+
*/
|
|
25
|
+
update(orgId: string, data: UpdateOrganizationPayload): Promise<TapstackOrganization>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete an organization
|
|
28
|
+
*/
|
|
29
|
+
delete(orgId: string): Promise<{
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* List workspaces in an organization
|
|
34
|
+
*/
|
|
35
|
+
listWorkspaces(orgId: string): Promise<WorkspaceListResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a workspace in an organization
|
|
38
|
+
*/
|
|
39
|
+
createWorkspace(orgId: string, data: {
|
|
40
|
+
name: string;
|
|
41
|
+
slug?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
}): Promise<TapstackWorkspace>;
|
|
44
|
+
/**
|
|
45
|
+
* List members of an organization
|
|
46
|
+
*/
|
|
47
|
+
listMembers(orgId: string): Promise<{
|
|
48
|
+
members: OrganizationMember[];
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Add a member to an organization
|
|
52
|
+
*/
|
|
53
|
+
addMember(orgId: string, data: {
|
|
54
|
+
email: string;
|
|
55
|
+
role?: string;
|
|
56
|
+
}): Promise<OrganizationMember>;
|
|
57
|
+
/**
|
|
58
|
+
* Update a member's role
|
|
59
|
+
*/
|
|
60
|
+
updateMember(orgId: string, memberId: string, data: {
|
|
61
|
+
role: string;
|
|
62
|
+
}): Promise<OrganizationMember>;
|
|
63
|
+
/**
|
|
64
|
+
* Remove a member from an organization
|
|
65
|
+
*/
|
|
66
|
+
removeMember(orgId: string, memberId: string): Promise<{
|
|
67
|
+
removed: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Organizations Module
|
|
4
|
+
* CRUD operations for Tapstack organizations
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.OrganizationModule = void 0;
|
|
8
|
+
class OrganizationModule {
|
|
9
|
+
constructor(adapter) {
|
|
10
|
+
this.adapter = adapter;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List all organizations the user belongs to
|
|
14
|
+
*/
|
|
15
|
+
async list() {
|
|
16
|
+
return this.adapter.request('GET', 'organizations');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get a single organization by ID
|
|
20
|
+
*/
|
|
21
|
+
async get(orgId) {
|
|
22
|
+
return this.adapter.request('GET', `organizations/${orgId}`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a new organization
|
|
26
|
+
*/
|
|
27
|
+
async create(data) {
|
|
28
|
+
return this.adapter.request('POST', 'organizations', {
|
|
29
|
+
body: data,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Update an existing organization
|
|
34
|
+
*/
|
|
35
|
+
async update(orgId, data) {
|
|
36
|
+
return this.adapter.request('PATCH', `organizations/${orgId}`, {
|
|
37
|
+
body: data,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Delete an organization
|
|
42
|
+
*/
|
|
43
|
+
async delete(orgId) {
|
|
44
|
+
return this.adapter.request('DELETE', `organizations/${orgId}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List workspaces in an organization
|
|
48
|
+
*/
|
|
49
|
+
async listWorkspaces(orgId) {
|
|
50
|
+
return this.adapter.request('GET', `organizations/${orgId}/workspaces`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a workspace in an organization
|
|
54
|
+
*/
|
|
55
|
+
async createWorkspace(orgId, data) {
|
|
56
|
+
return this.adapter.request('POST', `organizations/${orgId}/workspaces`, { body: data });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* List members of an organization
|
|
60
|
+
*/
|
|
61
|
+
async listMembers(orgId) {
|
|
62
|
+
return this.adapter.request('GET', `organizations/${orgId}/members`);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Add a member to an organization
|
|
66
|
+
*/
|
|
67
|
+
async addMember(orgId, data) {
|
|
68
|
+
return this.adapter.request('POST', `organizations/${orgId}/members`, { body: data });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Update a member's role
|
|
72
|
+
*/
|
|
73
|
+
async updateMember(orgId, memberId, data) {
|
|
74
|
+
return this.adapter.request('PATCH', `organizations/${orgId}/members/${memberId}`, { body: data });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Remove a member from an organization
|
|
78
|
+
*/
|
|
79
|
+
async removeMember(orgId, memberId) {
|
|
80
|
+
return this.adapter.request('DELETE', `organizations/${orgId}/members/${memberId}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.OrganizationModule = OrganizationModule;
|
|
@@ -1,7 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Records Module
|
|
3
|
+
* CRUD operations for Tapstack records (data entries)
|
|
4
|
+
*/
|
|
5
|
+
import { IInstanceAdapter } from '../adapters/types';
|
|
6
|
+
import { TapstackRecord, CreateRecordPayload, UpdateRecordPayload, RecordQueryOptions, RecordListResponse } from '../types';
|
|
3
7
|
export declare class RecordModule {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
8
|
+
private adapter;
|
|
9
|
+
constructor(adapter: IInstanceAdapter);
|
|
10
|
+
/**
|
|
11
|
+
* List records for an object with pagination and filtering
|
|
12
|
+
*/
|
|
13
|
+
list(objectSlug: string, options?: RecordQueryOptions): Promise<RecordListResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a single record by ID
|
|
16
|
+
*/
|
|
17
|
+
get(objectSlug: string, recordId: string): Promise<TapstackRecord>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new record
|
|
20
|
+
*/
|
|
21
|
+
create(objectSlug: string, data: CreateRecordPayload): Promise<TapstackRecord>;
|
|
22
|
+
/**
|
|
23
|
+
* Update an existing record
|
|
24
|
+
*/
|
|
25
|
+
update(objectSlug: string, recordId: string, data: UpdateRecordPayload): Promise<TapstackRecord>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a record (soft delete by default)
|
|
28
|
+
*/
|
|
29
|
+
delete(objectSlug: string, recordId: string, soft?: boolean): Promise<{
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Bulk create records
|
|
34
|
+
*/
|
|
35
|
+
bulkCreate(objectSlug: string, records: CreateRecordPayload[]): Promise<{
|
|
36
|
+
records: TapstackRecord[];
|
|
37
|
+
count: number;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Bulk delete records (soft delete by default)
|
|
41
|
+
*/
|
|
42
|
+
bulkDelete(objectSlug: string, recordIds: string[], soft?: boolean): Promise<{
|
|
43
|
+
deleted: number;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Query records with advanced filtering (legacy method for backwards compatibility)
|
|
47
|
+
*/
|
|
48
|
+
query<T = TapstackRecord[]>(objectSlug: string, variables: Record<string, unknown>): Promise<T>;
|
|
7
49
|
}
|
package/dist/modules/records.js
CHANGED
|
@@ -1,13 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Records Module
|
|
4
|
+
* CRUD operations for Tapstack records (data entries)
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
7
|
exports.RecordModule = void 0;
|
|
4
|
-
const request_1 = require("../request");
|
|
5
8
|
class RecordModule {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
9
|
+
constructor(adapter) {
|
|
10
|
+
this.adapter = adapter;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* List records for an object with pagination and filtering
|
|
14
|
+
*/
|
|
15
|
+
async list(objectSlug, options) {
|
|
16
|
+
const params = {};
|
|
17
|
+
if (options?.page)
|
|
18
|
+
params.page = String(options.page);
|
|
19
|
+
if (options?.pageSize)
|
|
20
|
+
params.pageSize = String(options.pageSize);
|
|
21
|
+
if (options?.sortBy)
|
|
22
|
+
params.sortBy = options.sortBy;
|
|
23
|
+
if (options?.sortOrder)
|
|
24
|
+
params.sortOrder = options.sortOrder;
|
|
25
|
+
if (options?.filters)
|
|
26
|
+
params.filters = JSON.stringify(options.filters);
|
|
27
|
+
return this.adapter.request('GET', `records/${objectSlug}`, {
|
|
28
|
+
params,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get a single record by ID
|
|
33
|
+
*/
|
|
34
|
+
async get(objectSlug, recordId) {
|
|
35
|
+
return this.adapter.request('GET', `records/${objectSlug}/${recordId}`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a new record
|
|
39
|
+
*/
|
|
40
|
+
async create(objectSlug, data) {
|
|
41
|
+
return this.adapter.request('POST', `records/${objectSlug}`, {
|
|
42
|
+
body: data,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Update an existing record
|
|
47
|
+
*/
|
|
48
|
+
async update(objectSlug, recordId, data) {
|
|
49
|
+
return this.adapter.request('PATCH', `records/${objectSlug}/${recordId}`, { body: data });
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Delete a record (soft delete by default)
|
|
53
|
+
*/
|
|
54
|
+
async delete(objectSlug, recordId, soft = true) {
|
|
55
|
+
return this.adapter.request('DELETE', `records/${objectSlug}/${recordId}`, { params: { soft: String(soft) } });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Bulk create records
|
|
59
|
+
*/
|
|
60
|
+
async bulkCreate(objectSlug, records) {
|
|
61
|
+
return this.adapter.request('POST', `records/${objectSlug}/bulk`, { body: { records } });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Bulk delete records (soft delete by default)
|
|
65
|
+
*/
|
|
66
|
+
async bulkDelete(objectSlug, recordIds, soft = true) {
|
|
67
|
+
return this.adapter.request('POST', `records/${objectSlug}/bulk/delete`, { body: { recordIds, soft } });
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Query records with advanced filtering (legacy method for backwards compatibility)
|
|
71
|
+
*/
|
|
72
|
+
async query(objectSlug, variables) {
|
|
73
|
+
return this.adapter.request('POST', `records/${objectSlug}/query`, {
|
|
74
|
+
body: variables,
|
|
75
|
+
});
|
|
11
76
|
}
|
|
12
77
|
}
|
|
13
78
|
exports.RecordModule = RecordModule;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspaces Module
|
|
3
|
+
* CRUD operations for Tapstack workspaces
|
|
4
|
+
*/
|
|
5
|
+
import { IInstanceAdapter } from '../adapters/types';
|
|
6
|
+
import { TapstackWorkspace, CreateWorkspacePayload, UpdateWorkspacePayload, WorkspaceListResponse } from '../types';
|
|
7
|
+
export declare class WorkspaceModule {
|
|
8
|
+
private adapter;
|
|
9
|
+
constructor(adapter: IInstanceAdapter);
|
|
10
|
+
/**
|
|
11
|
+
* List all workspaces the user has access to
|
|
12
|
+
*/
|
|
13
|
+
list(): Promise<WorkspaceListResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a single workspace by ID
|
|
16
|
+
*/
|
|
17
|
+
get(workspaceId: string): Promise<TapstackWorkspace>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new workspace (within an organization)
|
|
20
|
+
*/
|
|
21
|
+
create(orgId: string, data: CreateWorkspacePayload): Promise<TapstackWorkspace>;
|
|
22
|
+
/**
|
|
23
|
+
* Update an existing workspace
|
|
24
|
+
*/
|
|
25
|
+
update(orgId: string, workspaceId: string, data: UpdateWorkspacePayload): Promise<TapstackWorkspace>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a workspace
|
|
28
|
+
*/
|
|
29
|
+
delete(orgId: string, workspaceId: string): Promise<{
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Get workspace statistics
|
|
34
|
+
*/
|
|
35
|
+
getStats(workspaceId: string): Promise<{
|
|
36
|
+
objectCount: number;
|
|
37
|
+
recordCount: number;
|
|
38
|
+
storageUsed: number;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a workspace by slug (for routing)
|
|
42
|
+
*/
|
|
43
|
+
resolveBySlug(orgSlug: string, workspaceSlug: string): Promise<TapstackWorkspace>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Workspaces Module
|
|
4
|
+
* CRUD operations for Tapstack workspaces
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WorkspaceModule = void 0;
|
|
8
|
+
class WorkspaceModule {
|
|
9
|
+
constructor(adapter) {
|
|
10
|
+
this.adapter = adapter;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List all workspaces the user has access to
|
|
14
|
+
*/
|
|
15
|
+
async list() {
|
|
16
|
+
return this.adapter.request('GET', 'workspaces');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get a single workspace by ID
|
|
20
|
+
*/
|
|
21
|
+
async get(workspaceId) {
|
|
22
|
+
return this.adapter.request('GET', `workspaces/${workspaceId}`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a new workspace (within an organization)
|
|
26
|
+
*/
|
|
27
|
+
async create(orgId, data) {
|
|
28
|
+
return this.adapter.request('POST', `workspaces/org/${orgId}`, {
|
|
29
|
+
body: data,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Update an existing workspace
|
|
34
|
+
*/
|
|
35
|
+
async update(orgId, workspaceId, data) {
|
|
36
|
+
return this.adapter.request('PATCH', `workspaces/org/${orgId}/${workspaceId}`, { body: data });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Delete a workspace
|
|
40
|
+
*/
|
|
41
|
+
async delete(orgId, workspaceId) {
|
|
42
|
+
return this.adapter.request('DELETE', `workspaces/org/${orgId}/${workspaceId}`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get workspace statistics
|
|
46
|
+
*/
|
|
47
|
+
async getStats(workspaceId) {
|
|
48
|
+
return this.adapter.request('GET', `workspaces/${workspaceId}/stats`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a workspace by slug (for routing)
|
|
52
|
+
*/
|
|
53
|
+
async resolveBySlug(orgSlug, workspaceSlug) {
|
|
54
|
+
return this.adapter.request('GET', `resolve-workspace/${orgSlug}/${workspaceSlug}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.WorkspaceModule = WorkspaceModule;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Types for @tapstack/db
|
|
3
|
+
*/
|
|
4
|
+
export * from './adapters/types';
|
|
1
5
|
export interface TapstackObject {
|
|
6
|
+
id: string;
|
|
7
|
+
singleName: string;
|
|
8
|
+
pluralName: string;
|
|
2
9
|
slug: string;
|
|
3
|
-
|
|
4
|
-
|
|
10
|
+
icon: string;
|
|
11
|
+
isSystemObject: boolean;
|
|
12
|
+
use?: string | null;
|
|
13
|
+
parentId?: string | null;
|
|
14
|
+
workspaceId?: string | null;
|
|
15
|
+
createdAt: number;
|
|
16
|
+
updatedAt: number;
|
|
17
|
+
deletedAt?: number | null;
|
|
18
|
+
fields?: TapstackField[];
|
|
5
19
|
}
|
|
20
|
+
export type CreateObjectPayload = {
|
|
21
|
+
singleName: string;
|
|
22
|
+
pluralName: string;
|
|
23
|
+
slug?: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
use?: string;
|
|
26
|
+
parentId?: string;
|
|
27
|
+
};
|
|
28
|
+
export type UpdateObjectPayload = Partial<CreateObjectPayload>;
|
|
29
|
+
export type FieldType = 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'json' | 'select' | 'single_select' | 'multi_select' | 'checkbox' | 'radio' | 'relation' | 'input' | 'textarea' | 'autoincrement' | 'htmlBox' | 'email' | 'phone' | 'url' | 'currency' | 'rating' | 'fullName' | 'address' | 'array' | 'ai' | 'person' | 'files';
|
|
6
30
|
export interface TapstackField {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
value: string;
|
|
34
|
+
type: FieldType;
|
|
35
|
+
data?: Record<string, unknown>;
|
|
36
|
+
systemData?: Record<string, unknown>;
|
|
37
|
+
objectId: string;
|
|
38
|
+
createdAt: number;
|
|
39
|
+
updatedAt: number;
|
|
40
|
+
deletedAt?: number | null;
|
|
41
|
+
}
|
|
42
|
+
export type CreateFieldPayload = {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
type: FieldType;
|
|
46
|
+
data?: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
export type UpdateFieldPayload = Partial<Omit<CreateFieldPayload, 'value'>>;
|
|
49
|
+
export type RecordStatus = 'draft' | 'published' | 'deleted';
|
|
50
|
+
export interface TapstackRecord {
|
|
51
|
+
id: string;
|
|
52
|
+
objectId: string;
|
|
53
|
+
workspaceId?: string;
|
|
54
|
+
data: Record<string, unknown>;
|
|
55
|
+
status: RecordStatus;
|
|
56
|
+
version: number;
|
|
57
|
+
createdAt: number;
|
|
58
|
+
updatedAt: number;
|
|
59
|
+
deletedAt?: number | null;
|
|
60
|
+
}
|
|
61
|
+
export type CreateRecordPayload = {
|
|
62
|
+
data: Record<string, unknown>;
|
|
63
|
+
status?: RecordStatus;
|
|
64
|
+
};
|
|
65
|
+
export type UpdateRecordPayload = {
|
|
66
|
+
data?: Record<string, unknown>;
|
|
67
|
+
status?: RecordStatus;
|
|
68
|
+
};
|
|
69
|
+
export interface RecordQueryOptions {
|
|
70
|
+
page?: number;
|
|
71
|
+
pageSize?: number;
|
|
72
|
+
sortBy?: string;
|
|
73
|
+
sortOrder?: 'asc' | 'desc';
|
|
74
|
+
filters?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export interface RecordListResponse {
|
|
77
|
+
items: TapstackRecord[];
|
|
78
|
+
total: number;
|
|
79
|
+
page: number;
|
|
80
|
+
pageSize: number;
|
|
81
|
+
totalPages: number;
|
|
82
|
+
}
|
|
83
|
+
export interface TapstackOrganization {
|
|
7
84
|
id: string;
|
|
8
85
|
name: string;
|
|
9
|
-
|
|
10
|
-
|
|
86
|
+
slug: string;
|
|
87
|
+
ownerId: string;
|
|
88
|
+
stripeCustomerId?: string | null;
|
|
89
|
+
createdAt: number;
|
|
90
|
+
updatedAt: number;
|
|
91
|
+
deletedAt?: number | null;
|
|
11
92
|
}
|
|
12
|
-
export type
|
|
13
|
-
|
|
93
|
+
export type CreateOrganizationPayload = {
|
|
94
|
+
name: string;
|
|
95
|
+
slug?: string;
|
|
14
96
|
};
|
|
15
|
-
export
|
|
16
|
-
|
|
97
|
+
export type UpdateOrganizationPayload = Partial<CreateOrganizationPayload>;
|
|
98
|
+
export interface OrganizationMember {
|
|
99
|
+
id: string;
|
|
100
|
+
organizationId: string;
|
|
101
|
+
userId: string;
|
|
102
|
+
role: string;
|
|
103
|
+
createdAt: number;
|
|
104
|
+
updatedAt: number;
|
|
17
105
|
}
|
|
18
|
-
export
|
|
19
|
-
|
|
106
|
+
export interface TapstackWorkspace {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
slug: string;
|
|
110
|
+
description?: string | null;
|
|
111
|
+
organizationId: string;
|
|
112
|
+
createdAt: number;
|
|
113
|
+
updatedAt: number;
|
|
114
|
+
deletedAt?: number | null;
|
|
115
|
+
}
|
|
116
|
+
export type CreateWorkspacePayload = {
|
|
117
|
+
name: string;
|
|
118
|
+
slug?: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
};
|
|
121
|
+
export type UpdateWorkspacePayload = Partial<CreateWorkspacePayload>;
|
|
122
|
+
export interface TapstackFile {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
path: string;
|
|
126
|
+
mimeType: string;
|
|
127
|
+
size: number;
|
|
128
|
+
url?: string;
|
|
129
|
+
folderId?: string | null;
|
|
130
|
+
workspaceId: string;
|
|
131
|
+
createdAt: number;
|
|
132
|
+
updatedAt: number;
|
|
133
|
+
}
|
|
134
|
+
export interface TapstackFolder {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
parentId?: string | null;
|
|
138
|
+
workspaceId: string;
|
|
139
|
+
createdAt: number;
|
|
140
|
+
updatedAt: number;
|
|
141
|
+
}
|
|
142
|
+
export interface FileUploadOptions {
|
|
143
|
+
folderId?: string;
|
|
144
|
+
folder?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface FileListResponse {
|
|
147
|
+
files: TapstackFile[];
|
|
148
|
+
total: number;
|
|
149
|
+
}
|
|
150
|
+
export interface FolderListResponse {
|
|
151
|
+
folders: TapstackFolder[];
|
|
152
|
+
}
|
|
153
|
+
export interface ObjectListResponse {
|
|
154
|
+
objects: TapstackObject[];
|
|
155
|
+
}
|
|
156
|
+
export interface FieldListResponse {
|
|
157
|
+
fields: TapstackField[];
|
|
158
|
+
}
|
|
159
|
+
export interface OrganizationListResponse {
|
|
160
|
+
organizations: TapstackOrganization[];
|
|
161
|
+
}
|
|
162
|
+
export interface WorkspaceListResponse {
|
|
163
|
+
workspaces: TapstackWorkspace[];
|
|
164
|
+
}
|
|
165
|
+
/** @deprecated Use TapstackObject instead */
|
|
166
|
+
export type TapstackResponse<T> = {
|
|
167
|
+
data: T;
|
|
168
|
+
};
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core Types for @tapstack/db
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
// Re-export adapter types
|
|
21
|
+
__exportStar(require("./adapters/types"), exports);
|
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapstack/db",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Tapstack Database Client - Official SDK for the Tapstack API",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
8
|
-
"prepublishOnly": "npm run build"
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"test": "jest"
|
|
9
11
|
},
|
|
10
12
|
"publishConfig": {
|
|
11
13
|
"access": "public"
|
|
12
14
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"typescript": ">=4.7"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"tapstack",
|
|
20
|
+
"database",
|
|
21
|
+
"client",
|
|
22
|
+
"api",
|
|
23
|
+
"sdk"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT"
|
|
26
|
+
}
|