powersync 0.1.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 +339 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +9 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +8 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.js +49 -0
- package/dist/commands/instance/config.d.ts +6 -0
- package/dist/commands/instance/config.js +23 -0
- package/dist/commands/instance/create.d.ts +16 -0
- package/dist/commands/instance/create.js +163 -0
- package/dist/commands/instance/deploy.d.ts +15 -0
- package/dist/commands/instance/deploy.js +142 -0
- package/dist/commands/instance/destroy.d.ts +9 -0
- package/dist/commands/instance/destroy.js +42 -0
- package/dist/commands/instance/schema.d.ts +6 -0
- package/dist/commands/instance/schema.js +20 -0
- package/dist/commands/instance/set.d.ts +9 -0
- package/dist/commands/instance/set.js +31 -0
- package/dist/commands/instance/status.d.ts +6 -0
- package/dist/commands/instance/status.js +21 -0
- package/dist/commands/instance/stop.d.ts +9 -0
- package/dist/commands/instance/stop.js +42 -0
- package/dist/commands/instance/sync-rules/deploy.d.ts +10 -0
- package/dist/commands/instance/sync-rules/deploy.js +49 -0
- package/dist/commands/instance/sync-rules/generate-schema.d.ts +10 -0
- package/dist/commands/instance/sync-rules/generate-schema.js +55 -0
- package/dist/commands/instance/sync-rules/validate.d.ts +9 -0
- package/dist/commands/instance/sync-rules/validate.js +29 -0
- package/dist/commands/instances.d.ts +6 -0
- package/dist/commands/instances.js +20 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/powersync-sdk/accounts/api.d.ts +717 -0
- package/dist/powersync-sdk/accounts/api.js +182 -0
- package/dist/powersync-sdk/accounts/client.d.ts +1096 -0
- package/dist/powersync-sdk/accounts/client.js +124 -0
- package/dist/powersync-sdk/accounts/codecs.d.ts +32 -0
- package/dist/powersync-sdk/accounts/codecs.js +93 -0
- package/dist/powersync-sdk/accounts/index.d.ts +4 -0
- package/dist/powersync-sdk/accounts/index.js +4 -0
- package/dist/powersync-sdk/accounts/models.d.ts +260 -0
- package/dist/powersync-sdk/accounts/models.js +96 -0
- package/dist/powersync-sdk/accounts/routes.d.ts +44 -0
- package/dist/powersync-sdk/accounts/routes.js +45 -0
- package/dist/powersync-sdk/accounts/source.d.ts +76 -0
- package/dist/powersync-sdk/accounts/source.js +32 -0
- package/dist/powersync-sdk/errors/errors.d.ts +62 -0
- package/dist/powersync-sdk/errors/errors.js +115 -0
- package/dist/powersync-sdk/errors/index.d.ts +2 -0
- package/dist/powersync-sdk/errors/index.js +2 -0
- package/dist/powersync-sdk/errors/utils.d.ts +4 -0
- package/dist/powersync-sdk/errors/utils.js +18 -0
- package/dist/powersync-sdk/fetch-clients/codecs.d.ts +4 -0
- package/dist/powersync-sdk/fetch-clients/codecs.js +34 -0
- package/dist/powersync-sdk/fetch-clients/decoders.d.ts +3 -0
- package/dist/powersync-sdk/fetch-clients/decoders.js +35 -0
- package/dist/powersync-sdk/fetch-clients/definitions.d.ts +97 -0
- package/dist/powersync-sdk/fetch-clients/definitions.js +22 -0
- package/dist/powersync-sdk/fetch-clients/errors.d.ts +7 -0
- package/dist/powersync-sdk/fetch-clients/errors.js +19 -0
- package/dist/powersync-sdk/fetch-clients/index.d.ts +5 -0
- package/dist/powersync-sdk/fetch-clients/index.js +5 -0
- package/dist/powersync-sdk/fetch-clients/node-client.d.ts +9 -0
- package/dist/powersync-sdk/fetch-clients/node-client.js +107 -0
- package/dist/powersync-sdk/fetch-clients/request.d.ts +11 -0
- package/dist/powersync-sdk/fetch-clients/request.js +138 -0
- package/dist/powersync-sdk/fetch-clients/streaming.d.ts +65 -0
- package/dist/powersync-sdk/fetch-clients/streaming.js +99 -0
- package/dist/powersync-sdk/fetch-clients/utils.d.ts +13 -0
- package/dist/powersync-sdk/fetch-clients/utils.js +43 -0
- package/dist/powersync-sdk/fetch-clients/web-client.d.ts +14 -0
- package/dist/powersync-sdk/fetch-clients/web-client.js +56 -0
- package/dist/powersync-sdk/json/index.d.ts +4 -0
- package/dist/powersync-sdk/json/index.js +3 -0
- package/dist/powersync-sdk/json/json.d.ts +5 -0
- package/dist/powersync-sdk/json/json.js +35 -0
- package/dist/powersync-sdk/json/json_container.d.ts +18 -0
- package/dist/powersync-sdk/json/json_container.js +28 -0
- package/dist/powersync-sdk/json/json_stringify.d.ts +36 -0
- package/dist/powersync-sdk/json/json_stringify.js +162 -0
- package/dist/powersync-sdk/powersync/client.d.ts +449 -0
- package/dist/powersync-sdk/powersync/client.js +53 -0
- package/dist/powersync-sdk/powersync/config/HostedConfig.d.ts +327 -0
- package/dist/powersync-sdk/powersync/config/HostedConfig.js +92 -0
- package/dist/powersync-sdk/powersync/config/PowerSyncConfig.d.ts +211 -0
- package/dist/powersync-sdk/powersync/config/PowerSyncConfig.js +97 -0
- package/dist/powersync-sdk/powersync/config/normalize.d.ts +32 -0
- package/dist/powersync-sdk/powersync/config/normalize.js +85 -0
- package/dist/powersync-sdk/powersync/definitions.d.ts +149 -0
- package/dist/powersync-sdk/powersync/definitions.js +97 -0
- package/dist/powersync-sdk/powersync/index.d.ts +8 -0
- package/dist/powersync-sdk/powersync/index.js +8 -0
- package/dist/powersync-sdk/powersync/internal_routes.d.ts +247 -0
- package/dist/powersync-sdk/powersync/internal_routes.js +69 -0
- package/dist/powersync-sdk/powersync/routes.d.ts +779 -0
- package/dist/powersync-sdk/powersync/routes.js +191 -0
- package/dist/powersync-sdk/sdk-clients/endpoints.d.ts +31 -0
- package/dist/powersync-sdk/sdk-clients/endpoints.js +48 -0
- package/dist/powersync-sdk/sdk-clients/index.d.ts +3 -0
- package/dist/powersync-sdk/sdk-clients/index.js +3 -0
- package/dist/powersync-sdk/sdk-clients/pagination.d.ts +14 -0
- package/dist/powersync-sdk/sdk-clients/pagination.js +21 -0
- package/dist/powersync-sdk/sdk-clients/sdk-client.d.ts +17 -0
- package/dist/powersync-sdk/sdk-clients/sdk-client.js +30 -0
- package/dist/powersync-sdk/streaming/bson/buffer-array.d.ts +31 -0
- package/dist/powersync-sdk/streaming/bson/buffer-array.js +79 -0
- package/dist/powersync-sdk/streaming/bson/constants.d.ts +2 -0
- package/dist/powersync-sdk/streaming/bson/constants.js +1 -0
- package/dist/powersync-sdk/streaming/bson/decoder.d.ts +10 -0
- package/dist/powersync-sdk/streaming/bson/decoder.js +62 -0
- package/dist/powersync-sdk/streaming/bson/encoder.d.ts +10 -0
- package/dist/powersync-sdk/streaming/bson/encoder.js +23 -0
- package/dist/powersync-sdk/streaming/bson/header.d.ts +11 -0
- package/dist/powersync-sdk/streaming/bson/header.js +52 -0
- package/dist/powersync-sdk/streaming/bson/index.d.ts +5 -0
- package/dist/powersync-sdk/streaming/bson/index.js +5 -0
- package/dist/powersync-sdk/streaming/core/backpressure.d.ts +15 -0
- package/dist/powersync-sdk/streaming/core/backpressure.js +34 -0
- package/dist/powersync-sdk/streaming/core/cross-stream.d.ts +6 -0
- package/dist/powersync-sdk/streaming/core/cross-stream.js +17 -0
- package/dist/powersync-sdk/streaming/core/index.d.ts +4 -0
- package/dist/powersync-sdk/streaming/core/index.js +4 -0
- package/dist/powersync-sdk/streaming/core/node-utils.d.ts +7 -0
- package/dist/powersync-sdk/streaming/core/node-utils.js +11 -0
- package/dist/powersync-sdk/streaming/core/transformers.d.ts +41 -0
- package/dist/powersync-sdk/streaming/core/transformers.js +70 -0
- package/dist/powersync-sdk/streaming/core/utils.d.ts +36 -0
- package/dist/powersync-sdk/streaming/core/utils.js +66 -0
- package/dist/powersync-sdk/streaming/index.d.ts +3 -0
- package/dist/powersync-sdk/streaming/index.js +3 -0
- package/dist/powersync-sdk/streaming/web.d.ts +4 -0
- package/dist/powersync-sdk/streaming/web.js +4 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.d.ts +2 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.js +36 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.d.ts +2 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.js +58 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.d.ts +18 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.js +348 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.js +118 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.js +131 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.js +134 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.js +122 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.js +158 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.d.ts +14 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.js +165 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.d.ts +11 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.js +207 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.d.ts +30 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.js +29 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.d.ts +2 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.js +111 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.d.ts +9 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.js +9 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.d.ts +5 -0
- package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.js +9 -0
- package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.d.ts +12 -0
- package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.js +35 -0
- package/dist/powersync-sdk/sync-rules/ExpressionType.d.ts +33 -0
- package/dist/powersync-sdk/sync-rules/ExpressionType.js +62 -0
- package/dist/powersync-sdk/sync-rules/IdSequence.d.ts +4 -0
- package/dist/powersync-sdk/sync-rules/IdSequence.js +7 -0
- package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.d.ts +12 -0
- package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.js +38 -0
- package/dist/powersync-sdk/sync-rules/SchemaGenerator.d.ts +14 -0
- package/dist/powersync-sdk/sync-rules/SchemaGenerator.js +24 -0
- package/dist/powersync-sdk/sync-rules/SourceTableInterface.d.ts +5 -0
- package/dist/powersync-sdk/sync-rules/SourceTableInterface.js +1 -0
- package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.d.ts +37 -0
- package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.js +116 -0
- package/dist/powersync-sdk/sync-rules/SqlDataQuery.d.ts +39 -0
- package/dist/powersync-sdk/sync-rules/SqlDataQuery.js +245 -0
- package/dist/powersync-sdk/sync-rules/SqlParameterQuery.d.ts +43 -0
- package/dist/powersync-sdk/sync-rules/SqlParameterQuery.js +254 -0
- package/dist/powersync-sdk/sync-rules/SqlSyncRules.d.ts +52 -0
- package/dist/powersync-sdk/sync-rules/SqlSyncRules.js +252 -0
- package/dist/powersync-sdk/sync-rules/StaticSchema.d.ts +26 -0
- package/dist/powersync-sdk/sync-rules/StaticSchema.js +71 -0
- package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.d.ts +24 -0
- package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.js +71 -0
- package/dist/powersync-sdk/sync-rules/TablePattern.d.ts +17 -0
- package/dist/powersync-sdk/sync-rules/TablePattern.js +56 -0
- package/dist/powersync-sdk/sync-rules/TableQuerySchema.d.ts +9 -0
- package/dist/powersync-sdk/sync-rules/TableQuerySchema.js +41 -0
- package/dist/powersync-sdk/sync-rules/errors.d.ts +22 -0
- package/dist/powersync-sdk/sync-rules/errors.js +60 -0
- package/dist/powersync-sdk/sync-rules/generators.d.ts +6 -0
- package/dist/powersync-sdk/sync-rules/generators.js +6 -0
- package/dist/powersync-sdk/sync-rules/index.d.ts +17 -0
- package/dist/powersync-sdk/sync-rules/index.js +17 -0
- package/dist/powersync-sdk/sync-rules/json_schema.d.ts +3 -0
- package/dist/powersync-sdk/sync-rules/json_schema.js +50 -0
- package/dist/powersync-sdk/sync-rules/sql_filters.d.ts +91 -0
- package/dist/powersync-sdk/sync-rules/sql_filters.js +491 -0
- package/dist/powersync-sdk/sync-rules/sql_functions.d.ts +53 -0
- package/dist/powersync-sdk/sync-rules/sql_functions.js +755 -0
- package/dist/powersync-sdk/sync-rules/sql_support.d.ts +22 -0
- package/dist/powersync-sdk/sync-rules/sql_support.js +208 -0
- package/dist/powersync-sdk/sync-rules/types.d.ts +174 -0
- package/dist/powersync-sdk/sync-rules/types.js +9 -0
- package/dist/powersync-sdk/sync-rules/utils.d.ts +45 -0
- package/dist/powersync-sdk/sync-rules/utils.js +163 -0
- package/dist/service/accounts.client.d.ts +26 -0
- package/dist/service/accounts.client.js +26 -0
- package/dist/service/powersync.client.d.ts +269 -0
- package/dist/service/powersync.client.js +135 -0
- package/dist/service/types.d.ts +69 -0
- package/dist/service/types.js +1 -0
- package/dist/service/utils.d.ts +5 -0
- package/dist/service/utils.js +7 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +52 -0
- package/oclif.manifest.json +514 -0
- package/package.json +81 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { createPaginatedEndpoint } from '../sdk-clients/pagination.js';
|
|
2
|
+
import { SDKClient } from '../sdk-clients/sdk-client.js';
|
|
3
|
+
import { ROUTES } from './routes.js';
|
|
4
|
+
export class AccountsV5Client extends SDKClient {
|
|
5
|
+
acceptInvite = this.createEndpoint({
|
|
6
|
+
path: ROUTES.ACCEPT_INVITE
|
|
7
|
+
});
|
|
8
|
+
completeSignup = this.createEndpoint({
|
|
9
|
+
path: ROUTES.COMPLETE_SIGNUP
|
|
10
|
+
});
|
|
11
|
+
createApp = this.createEndpoint({
|
|
12
|
+
path: ROUTES.CREATE_APP
|
|
13
|
+
});
|
|
14
|
+
createInvite = this.createEndpoint({
|
|
15
|
+
path: ROUTES.CREATE_DEV_INVITE
|
|
16
|
+
});
|
|
17
|
+
createOrg = this.createEndpoint({
|
|
18
|
+
path: ROUTES.CREATE_ORG
|
|
19
|
+
});
|
|
20
|
+
createUser = this.createEndpoint({
|
|
21
|
+
path: ROUTES.CREATE_USER
|
|
22
|
+
});
|
|
23
|
+
declineInvite = this.createEndpoint({
|
|
24
|
+
path: ROUTES.DECLINE_INVITE
|
|
25
|
+
});
|
|
26
|
+
deleteApp = this.createEndpoint({
|
|
27
|
+
path: ROUTES.DELETE_APP
|
|
28
|
+
});
|
|
29
|
+
deleteUser = this.createEndpoint({
|
|
30
|
+
path: ROUTES.DELETE_USER
|
|
31
|
+
});
|
|
32
|
+
destroyInvite = this.createEndpoint({
|
|
33
|
+
path: ROUTES.DESTROY_INVITE
|
|
34
|
+
});
|
|
35
|
+
downgradeOrg = this.createEndpoint({
|
|
36
|
+
path: ROUTES.DOWNGRADE_ORG
|
|
37
|
+
});
|
|
38
|
+
getApp = this.createEndpoint({
|
|
39
|
+
path: ROUTES.GET_APP
|
|
40
|
+
});
|
|
41
|
+
getOrg = this.createEndpoint({
|
|
42
|
+
path: ROUTES.GET_ORG
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Get token for use with SensitiveProfileAccountsV5Client.
|
|
46
|
+
* Currently, this allows for managing MFA configurations.
|
|
47
|
+
*/
|
|
48
|
+
getSensitiveAccessToken = this.createEndpoint({
|
|
49
|
+
path: ROUTES.GET_SENSITIVE_ACCESS_TOKEN
|
|
50
|
+
});
|
|
51
|
+
getTrialUser = this.createEndpoint({
|
|
52
|
+
path: ROUTES.GET_TRIAL_USER
|
|
53
|
+
});
|
|
54
|
+
// === MUTATION ===
|
|
55
|
+
getUser = this.createEndpoint({
|
|
56
|
+
path: ROUTES.GET_USER
|
|
57
|
+
});
|
|
58
|
+
// === DEVELOPER INVITES ===
|
|
59
|
+
getUserInvites = createPaginatedEndpoint(this.createEndpoint({
|
|
60
|
+
path: ROUTES.GET_USER_INVITES
|
|
61
|
+
}));
|
|
62
|
+
getUserPreferredMFAFactor = this.createEndpoint({
|
|
63
|
+
path: ROUTES.GET_PREFERRED_FACTOR
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated
|
|
67
|
+
*/
|
|
68
|
+
giveUserAccess = this.createEndpoint({
|
|
69
|
+
path: ROUTES.GIVE_USER_ACCESS
|
|
70
|
+
});
|
|
71
|
+
listApps = createPaginatedEndpoint(this.createEndpoint({
|
|
72
|
+
path: ROUTES.LIST_APPS
|
|
73
|
+
}));
|
|
74
|
+
listDeveloperInvites = createPaginatedEndpoint(this.createEndpoint({
|
|
75
|
+
path: ROUTES.LIST_DEV_INVITES
|
|
76
|
+
}));
|
|
77
|
+
// === TRIAL ===
|
|
78
|
+
listMFAFactors = this.createEndpoint({
|
|
79
|
+
path: ROUTES.LIST_MFA_FACTORS
|
|
80
|
+
});
|
|
81
|
+
listOrgs = createPaginatedEndpoint(this.createEndpoint({
|
|
82
|
+
path: ROUTES.LIST_ORGS
|
|
83
|
+
}));
|
|
84
|
+
listUsers = createPaginatedEndpoint(this.createEndpoint({
|
|
85
|
+
path: ROUTES.LIST_USERS
|
|
86
|
+
}));
|
|
87
|
+
provisionUserToken = this.createEndpoint({
|
|
88
|
+
path: ROUTES.PROVISION_USER_TOKEN
|
|
89
|
+
});
|
|
90
|
+
searchApps = createPaginatedEndpoint(this.createEndpoint({
|
|
91
|
+
path: ROUTES.SEARCH_APPS
|
|
92
|
+
}));
|
|
93
|
+
searchOrgs = createPaginatedEndpoint(this.createEndpoint({
|
|
94
|
+
path: ROUTES.SEARCH_ORGS
|
|
95
|
+
}));
|
|
96
|
+
searchUsers = createPaginatedEndpoint(this.createEndpoint({
|
|
97
|
+
path: ROUTES.SEARCH_USERS
|
|
98
|
+
}));
|
|
99
|
+
sendMFASMS = this.createEndpoint({
|
|
100
|
+
path: ROUTES.SEND_MFA_SMS
|
|
101
|
+
});
|
|
102
|
+
startTrial = this.createEndpoint({
|
|
103
|
+
path: ROUTES.START_TRIAL
|
|
104
|
+
});
|
|
105
|
+
updateApp = this.createEndpoint({
|
|
106
|
+
path: ROUTES.UPDATE_APP
|
|
107
|
+
});
|
|
108
|
+
updateInvite = this.createEndpoint({
|
|
109
|
+
path: ROUTES.UPDATE_INVITE
|
|
110
|
+
});
|
|
111
|
+
// === Security and MFA ===
|
|
112
|
+
updateOrg = this.createEndpoint({
|
|
113
|
+
path: ROUTES.UPDATE_ORG
|
|
114
|
+
});
|
|
115
|
+
updateOrgBilling = this.createEndpoint({
|
|
116
|
+
path: ROUTES.UPDATE_ORG_BILLING
|
|
117
|
+
});
|
|
118
|
+
updateUser = this.createEndpoint({
|
|
119
|
+
path: ROUTES.UPDATE_USER
|
|
120
|
+
});
|
|
121
|
+
upgradeOrg = this.createEndpoint({
|
|
122
|
+
path: ROUTES.UPGRADE_ORG
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import * as bson from 'bson';
|
|
3
|
+
import * as t from 'ts-codec';
|
|
4
|
+
export declare const buffer: t.Codec<Buffer, string, string, t.CodecProps>;
|
|
5
|
+
export declare const date: t.Codec<Date, string, string, t.CodecProps>;
|
|
6
|
+
export declare const ObjectId: t.Codec<bson.ObjectID, string, string, t.CodecProps>;
|
|
7
|
+
export declare const ResourceId: t.Codec<{
|
|
8
|
+
_id: bson.ObjectId;
|
|
9
|
+
}, {
|
|
10
|
+
id: string;
|
|
11
|
+
}, string, t.CodecProps>;
|
|
12
|
+
export declare const Timestamps: t.ObjectCodec<{
|
|
13
|
+
created_at: t.Codec<Date, string, string, t.CodecProps>;
|
|
14
|
+
updated_at: t.Codec<Date, string, string, t.CodecProps>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const Resource: t.Intersection<t.Codec<{
|
|
17
|
+
_id: bson.ObjectId;
|
|
18
|
+
}, {
|
|
19
|
+
id: string;
|
|
20
|
+
}, string, t.CodecProps>, t.ObjectCodec<{
|
|
21
|
+
created_at: t.Codec<Date, string, string, t.CodecProps>;
|
|
22
|
+
updated_at: t.Codec<Date, string, string, t.CodecProps>;
|
|
23
|
+
}>>;
|
|
24
|
+
export declare const QueryFilter: t.ObjectCodec<{
|
|
25
|
+
exists: t.IdentityCodec<t.CodecType.Boolean>;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const makeQueryFilter: (type: t.AnyCodec) => t.OptionalCodec<t.Codec<any, any, string, t.CodecProps>>;
|
|
28
|
+
export declare const FilterProperties: <T extends t.AnyCodec>(type: T) => t.Codec<{ [K in keyof t.Encoded<T>]?: t.Ix<T>[K] | {
|
|
29
|
+
exists: boolean;
|
|
30
|
+
} | t.Ix<T>[K][] | undefined; }, { [K_1 in keyof t.Encoded<T>]?: {
|
|
31
|
+
exists: boolean;
|
|
32
|
+
} | t.Ox<T>[K_1] | t.Ox<T>[K_1][] | undefined; }, "FilterProperties", t.CodecProps>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
/* eslint-disable unicorn/no-array-reduce */
|
|
3
|
+
/* eslint-disable unicorn/no-array-for-each */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import * as bson from 'bson';
|
|
7
|
+
import * as t from 'ts-codec';
|
|
8
|
+
export const buffer = t.codec('Buffer', (buffer) => {
|
|
9
|
+
if (!Buffer.isBuffer(buffer)) {
|
|
10
|
+
throw new t.TransformError([`Expected buffer but got ${typeof buffer}`]);
|
|
11
|
+
}
|
|
12
|
+
return buffer.toString('base64');
|
|
13
|
+
}, (buffer) => Buffer.from(buffer, 'base64'));
|
|
14
|
+
export const date = t.codec('Date', (date) => {
|
|
15
|
+
if (!(date instanceof Date)) {
|
|
16
|
+
throw new t.TransformError([`Expected Date but got ${typeof date}`]);
|
|
17
|
+
}
|
|
18
|
+
return date.toISOString();
|
|
19
|
+
}, (date) => {
|
|
20
|
+
const parsed = new Date(date);
|
|
21
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
22
|
+
throw new t.TransformError([`Invalid date`]);
|
|
23
|
+
}
|
|
24
|
+
return parsed;
|
|
25
|
+
});
|
|
26
|
+
const assertObjectId = (value) => {
|
|
27
|
+
if (!bson.ObjectId.isValid(value)) {
|
|
28
|
+
throw new t.TransformError([`Expected an ObjectId but got ${typeof value}`]);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const ObjectId = t.codec('ObjectId', (id) => {
|
|
32
|
+
assertObjectId(id);
|
|
33
|
+
return id.toHexString();
|
|
34
|
+
}, (id) => {
|
|
35
|
+
assertObjectId(id);
|
|
36
|
+
return new bson.ObjectId(id);
|
|
37
|
+
});
|
|
38
|
+
const assertObjectWithField = (field, data) => {
|
|
39
|
+
if (typeof data !== 'object') {
|
|
40
|
+
throw new t.TransformError([`Expected an object but got ${typeof data}`]);
|
|
41
|
+
}
|
|
42
|
+
if (!(field in data)) {
|
|
43
|
+
throw new t.TransformError([`Expected ${field} to be a member of object`]);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export const ResourceId = t.codec('ResourceId', (data) => {
|
|
47
|
+
assertObjectWithField('_id', data);
|
|
48
|
+
return {
|
|
49
|
+
id: ObjectId.encode(data._id)
|
|
50
|
+
};
|
|
51
|
+
}, (data) => {
|
|
52
|
+
assertObjectWithField('id', data);
|
|
53
|
+
return {
|
|
54
|
+
_id: ObjectId.decode(data.id)
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
export const Timestamps = t.object({
|
|
58
|
+
created_at: date,
|
|
59
|
+
updated_at: date
|
|
60
|
+
});
|
|
61
|
+
export const Resource = ResourceId.and(Timestamps);
|
|
62
|
+
export const QueryFilter = t.object({
|
|
63
|
+
exists: t.boolean
|
|
64
|
+
});
|
|
65
|
+
export const makeQueryFilter = (type) => {
|
|
66
|
+
return type.or(t.array(type)).or(QueryFilter).optional();
|
|
67
|
+
};
|
|
68
|
+
export const FilterProperties = (type) => {
|
|
69
|
+
const codecs = new Map();
|
|
70
|
+
const addCodecs = (codec) => {
|
|
71
|
+
if (codec.props?.shape) {
|
|
72
|
+
for (const k of Object.keys(codec.props.shape)) {
|
|
73
|
+
codecs.set(k, codec.props.shape[k]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (type._tag === t.CodecType.Object) {
|
|
78
|
+
addCodecs(type);
|
|
79
|
+
}
|
|
80
|
+
else if (type._tag === t.CodecType.Intersection) {
|
|
81
|
+
type.props.codecs.forEach((c) => {
|
|
82
|
+
addCodecs(c);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
t.object({
|
|
86
|
+
test: t.string
|
|
87
|
+
});
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
return t.object([...codecs.keys()].reduce((prev, cur) => {
|
|
90
|
+
prev[cur] = makeQueryFilter(codecs.get(cur));
|
|
91
|
+
return prev;
|
|
92
|
+
}, {}));
|
|
93
|
+
};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import * as t from 'ts-codec';
|
|
2
|
+
export declare enum BUSINESS_REGION {
|
|
3
|
+
US = "us",
|
|
4
|
+
ZA = "za"
|
|
5
|
+
}
|
|
6
|
+
export declare const Organization: t.ObjectCodec<{
|
|
7
|
+
business_customer_code: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
8
|
+
business_customer_region: t.OptionalCodec<t.Codec<BUSINESS_REGION, BUSINESS_REGION, string, t.CodecProps>>;
|
|
9
|
+
label: t.IdentityCodec<t.CodecType.String>;
|
|
10
|
+
locked: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
|
|
11
|
+
pre_signup_trial_expiry: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
12
|
+
trial: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
|
|
13
|
+
trial_expiry: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
14
|
+
}>;
|
|
15
|
+
export type Organization = t.Decoded<typeof Organization>;
|
|
16
|
+
export type SerializedOrganization = t.Encoded<typeof Organization>;
|
|
17
|
+
export declare const OrganizationResource: t.Intersection<t.Codec<{
|
|
18
|
+
label: string;
|
|
19
|
+
locked?: boolean | undefined;
|
|
20
|
+
business_customer_code?: string | undefined;
|
|
21
|
+
business_customer_region?: BUSINESS_REGION | undefined;
|
|
22
|
+
pre_signup_trial_expiry?: string | undefined;
|
|
23
|
+
trial?: boolean | undefined;
|
|
24
|
+
trial_expiry?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
label: string;
|
|
27
|
+
locked?: boolean | undefined;
|
|
28
|
+
business_customer_code?: string | undefined;
|
|
29
|
+
business_customer_region?: BUSINESS_REGION | undefined;
|
|
30
|
+
pre_signup_trial_expiry?: string | undefined;
|
|
31
|
+
trial?: boolean | undefined;
|
|
32
|
+
trial_expiry?: string | undefined;
|
|
33
|
+
}, string, t.CodecProps>, t.Codec<{
|
|
34
|
+
_id: import("bson").ObjectID;
|
|
35
|
+
}, {
|
|
36
|
+
id: string;
|
|
37
|
+
}, string, t.CodecProps>>;
|
|
38
|
+
export type OrganizationResource = t.Decoded<typeof OrganizationResource>;
|
|
39
|
+
export type SerializedOrganizationResource = t.Encoded<typeof OrganizationResource>;
|
|
40
|
+
export declare enum VCS_MODE {
|
|
41
|
+
ADVANCED = "ADVANCED",
|
|
42
|
+
BASIC = "BASIC"
|
|
43
|
+
}
|
|
44
|
+
export declare enum ProjectFeatureFlags {
|
|
45
|
+
APP = "app",
|
|
46
|
+
POWERSYNC = "powersync"
|
|
47
|
+
}
|
|
48
|
+
export declare const App: t.ObjectCodec<{
|
|
49
|
+
auth_scope_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
50
|
+
features: t.ArrayCodec<t.EnumCodec<typeof ProjectFeatureFlags>>;
|
|
51
|
+
name: t.IdentityCodec<t.CodecType.String>;
|
|
52
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
53
|
+
region: t.IdentityCodec<t.CodecType.String>;
|
|
54
|
+
source: t.OptionalCodec<t.Codec<{
|
|
55
|
+
type: import("./source.js").SourceType.GitHub;
|
|
56
|
+
properties: {
|
|
57
|
+
repo: string;
|
|
58
|
+
owner: string;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
type: import("./source.js").SourceType.Internal;
|
|
62
|
+
properties: {
|
|
63
|
+
id: string;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
type: import("./source.js").SourceType.AzureDevops;
|
|
67
|
+
properties: {
|
|
68
|
+
repo: string;
|
|
69
|
+
organization: string;
|
|
70
|
+
project: string;
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
73
|
+
type: import("./source.js").SourceType.GitHub;
|
|
74
|
+
properties: {
|
|
75
|
+
repo: string;
|
|
76
|
+
owner: string;
|
|
77
|
+
};
|
|
78
|
+
} | {
|
|
79
|
+
type: import("./source.js").SourceType.Internal;
|
|
80
|
+
properties: {
|
|
81
|
+
id: string;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
type: import("./source.js").SourceType.AzureDevops;
|
|
85
|
+
properties: {
|
|
86
|
+
repo: string;
|
|
87
|
+
organization: string;
|
|
88
|
+
project: string;
|
|
89
|
+
};
|
|
90
|
+
}, string, t.CodecProps>>;
|
|
91
|
+
vcs_mode: t.OptionalCodec<t.Codec<VCS_MODE, VCS_MODE, string, t.CodecProps>>;
|
|
92
|
+
}>;
|
|
93
|
+
export type App = t.Decoded<typeof App>;
|
|
94
|
+
export type SerializedApp = t.Encoded<typeof App>;
|
|
95
|
+
export declare const AppResource: t.Intersection<t.Codec<{
|
|
96
|
+
name: string;
|
|
97
|
+
region: string;
|
|
98
|
+
org_id: string;
|
|
99
|
+
features: ProjectFeatureFlags[];
|
|
100
|
+
source?: {
|
|
101
|
+
type: import("./source.js").SourceType.GitHub;
|
|
102
|
+
properties: {
|
|
103
|
+
repo: string;
|
|
104
|
+
owner: string;
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
type: import("./source.js").SourceType.Internal;
|
|
108
|
+
properties: {
|
|
109
|
+
id: string;
|
|
110
|
+
};
|
|
111
|
+
} | {
|
|
112
|
+
type: import("./source.js").SourceType.AzureDevops;
|
|
113
|
+
properties: {
|
|
114
|
+
repo: string;
|
|
115
|
+
organization: string;
|
|
116
|
+
project: string;
|
|
117
|
+
};
|
|
118
|
+
} | undefined;
|
|
119
|
+
auth_scope_id?: string | undefined;
|
|
120
|
+
vcs_mode?: VCS_MODE | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
name: string;
|
|
123
|
+
region: string;
|
|
124
|
+
org_id: string;
|
|
125
|
+
features: ProjectFeatureFlags[];
|
|
126
|
+
source?: {
|
|
127
|
+
type: import("./source.js").SourceType.GitHub;
|
|
128
|
+
properties: {
|
|
129
|
+
repo: string;
|
|
130
|
+
owner: string;
|
|
131
|
+
};
|
|
132
|
+
} | {
|
|
133
|
+
type: import("./source.js").SourceType.Internal;
|
|
134
|
+
properties: {
|
|
135
|
+
id: string;
|
|
136
|
+
};
|
|
137
|
+
} | {
|
|
138
|
+
type: import("./source.js").SourceType.AzureDevops;
|
|
139
|
+
properties: {
|
|
140
|
+
repo: string;
|
|
141
|
+
organization: string;
|
|
142
|
+
project: string;
|
|
143
|
+
};
|
|
144
|
+
} | undefined;
|
|
145
|
+
auth_scope_id?: string | undefined;
|
|
146
|
+
vcs_mode?: VCS_MODE | undefined;
|
|
147
|
+
}, string, t.CodecProps>, t.Codec<{
|
|
148
|
+
_id: import("bson").ObjectID;
|
|
149
|
+
}, {
|
|
150
|
+
id: string;
|
|
151
|
+
}, string, t.CodecProps>>;
|
|
152
|
+
export type AppResource = t.Decoded<typeof AppResource>;
|
|
153
|
+
export type SerializedAppResource = t.Encoded<typeof AppResource>;
|
|
154
|
+
export declare enum UserOrgAccess {
|
|
155
|
+
DEVELOPER = "developer",
|
|
156
|
+
OWNER = "owner"
|
|
157
|
+
}
|
|
158
|
+
export declare const User: t.ObjectCodec<{
|
|
159
|
+
email: t.IdentityCodec<t.CodecType.String>;
|
|
160
|
+
name: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
161
|
+
onboarding_token: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
162
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
163
|
+
phone_number: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
164
|
+
signup_complete: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
|
|
165
|
+
}>;
|
|
166
|
+
export type User = t.Decoded<typeof User>;
|
|
167
|
+
export type SerializedUser = t.Encoded<typeof User>;
|
|
168
|
+
export declare const UserResource: t.Intersection<t.Codec<{
|
|
169
|
+
org_id: string;
|
|
170
|
+
email: string;
|
|
171
|
+
name?: string | undefined;
|
|
172
|
+
phone_number?: string | undefined;
|
|
173
|
+
onboarding_token?: string | undefined;
|
|
174
|
+
signup_complete?: boolean | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
org_id: string;
|
|
177
|
+
email: string;
|
|
178
|
+
name?: string | undefined;
|
|
179
|
+
phone_number?: string | undefined;
|
|
180
|
+
onboarding_token?: string | undefined;
|
|
181
|
+
signup_complete?: boolean | undefined;
|
|
182
|
+
}, string, t.CodecProps>, t.Codec<{
|
|
183
|
+
_id: import("bson").ObjectID;
|
|
184
|
+
}, {
|
|
185
|
+
id: string;
|
|
186
|
+
}, string, t.CodecProps>>;
|
|
187
|
+
export type UserResource = t.Decoded<typeof UserResource>;
|
|
188
|
+
export type SerializedUserResource = t.Encoded<typeof UserResource>;
|
|
189
|
+
export declare enum DeveloperInviteStatus {
|
|
190
|
+
ACCEPTED = "accepted",
|
|
191
|
+
DECLINED = "declined",
|
|
192
|
+
PENDING = "pending"
|
|
193
|
+
}
|
|
194
|
+
export declare const DeveloperInvite: t.ObjectCodec<{
|
|
195
|
+
metadata: t.ObjectCodec<{
|
|
196
|
+
email: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
197
|
+
org_name: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
198
|
+
role_names: t.OptionalCodec<t.Codec<string[], string[], string, t.CodecProps>>;
|
|
199
|
+
user_name: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
200
|
+
}>;
|
|
201
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
202
|
+
requested_role_ids: t.ArrayCodec<t.IdentityCodec<t.CodecType.String>>;
|
|
203
|
+
responded_at: t.IdentityCodec<t.CodecType.String>;
|
|
204
|
+
status: t.EnumCodec<typeof DeveloperInviteStatus>;
|
|
205
|
+
user_id: t.IdentityCodec<t.CodecType.String>;
|
|
206
|
+
}>;
|
|
207
|
+
export type DeveloperInvite = t.Decoded<typeof DeveloperInvite>;
|
|
208
|
+
export type SerializedDeveloperInvite = t.Encoded<typeof DeveloperInvite>;
|
|
209
|
+
export declare const DeveloperInviteResource: t.Intersection<t.Codec<{
|
|
210
|
+
metadata: {
|
|
211
|
+
email?: string | undefined;
|
|
212
|
+
role_names?: string[] | undefined;
|
|
213
|
+
org_name?: string | undefined;
|
|
214
|
+
user_name?: string | undefined;
|
|
215
|
+
};
|
|
216
|
+
org_id: string;
|
|
217
|
+
status: DeveloperInviteStatus;
|
|
218
|
+
requested_role_ids: string[];
|
|
219
|
+
responded_at: string;
|
|
220
|
+
user_id: string;
|
|
221
|
+
}, {
|
|
222
|
+
metadata: {
|
|
223
|
+
email?: string | undefined;
|
|
224
|
+
role_names?: string[] | undefined;
|
|
225
|
+
org_name?: string | undefined;
|
|
226
|
+
user_name?: string | undefined;
|
|
227
|
+
};
|
|
228
|
+
org_id: string;
|
|
229
|
+
status: DeveloperInviteStatus;
|
|
230
|
+
requested_role_ids: string[];
|
|
231
|
+
responded_at: string;
|
|
232
|
+
user_id: string;
|
|
233
|
+
}, string, t.CodecProps>, t.Codec<{
|
|
234
|
+
_id: import("bson").ObjectID;
|
|
235
|
+
}, {
|
|
236
|
+
id: string;
|
|
237
|
+
}, string, t.CodecProps>>;
|
|
238
|
+
export type DeveloperInviteResource = t.Decoded<typeof DeveloperInviteResource>;
|
|
239
|
+
export type SerializedDeveloperInviteResource = t.Encoded<typeof DeveloperInviteResource>;
|
|
240
|
+
export declare enum MFAFactorState {
|
|
241
|
+
ACTIVE = "active",
|
|
242
|
+
DISABLED = "disabled",
|
|
243
|
+
PENDING = "pending"
|
|
244
|
+
}
|
|
245
|
+
export declare enum MFAFactor {
|
|
246
|
+
SMS = "sms",
|
|
247
|
+
TOTP = "totp"
|
|
248
|
+
}
|
|
249
|
+
export declare const UserMFAFactorResource: t.ObjectCodec<{
|
|
250
|
+
created_at: t.IdentityCodec<t.CodecType.String>;
|
|
251
|
+
deleted_at: t.IdentityCodec<t.CodecType.String>;
|
|
252
|
+
factor_type: t.EnumCodec<typeof MFAFactor>;
|
|
253
|
+
id: t.IdentityCodec<t.CodecType.String>;
|
|
254
|
+
sms_otp_mobile_number: t.IdentityCodec<t.CodecType.String>;
|
|
255
|
+
state: t.EnumCodec<typeof MFAFactorState>;
|
|
256
|
+
totp_factor_sid: t.IdentityCodec<t.CodecType.String>;
|
|
257
|
+
updated_at: t.IdentityCodec<t.CodecType.String>;
|
|
258
|
+
}>;
|
|
259
|
+
export type UserMFAFactorResource = t.Decoded<typeof UserMFAFactorResource>;
|
|
260
|
+
export type SerializedUserMFAFactorResource = t.Encoded<typeof UserMFAFactorResource>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* eslint-disable new-cap */
|
|
2
|
+
/* eslint-disable camelcase */
|
|
3
|
+
import * as t from 'ts-codec';
|
|
4
|
+
import * as codecs from './codecs.js';
|
|
5
|
+
import { SourceMetadata } from './source.js';
|
|
6
|
+
export var BUSINESS_REGION;
|
|
7
|
+
(function (BUSINESS_REGION) {
|
|
8
|
+
BUSINESS_REGION["US"] = "us";
|
|
9
|
+
BUSINESS_REGION["ZA"] = "za";
|
|
10
|
+
})(BUSINESS_REGION || (BUSINESS_REGION = {}));
|
|
11
|
+
export const Organization = t.object({
|
|
12
|
+
business_customer_code: t.string.optional(),
|
|
13
|
+
business_customer_region: t.Enum(BUSINESS_REGION).optional(),
|
|
14
|
+
label: t.string,
|
|
15
|
+
locked: t.boolean.optional(),
|
|
16
|
+
pre_signup_trial_expiry: t.string.optional(),
|
|
17
|
+
trial: t.boolean.optional(),
|
|
18
|
+
trial_expiry: t.string.optional()
|
|
19
|
+
});
|
|
20
|
+
export const OrganizationResource = Organization.and(codecs.ResourceId);
|
|
21
|
+
export var VCS_MODE;
|
|
22
|
+
(function (VCS_MODE) {
|
|
23
|
+
VCS_MODE["ADVANCED"] = "ADVANCED";
|
|
24
|
+
VCS_MODE["BASIC"] = "BASIC";
|
|
25
|
+
})(VCS_MODE || (VCS_MODE = {}));
|
|
26
|
+
export var ProjectFeatureFlags;
|
|
27
|
+
(function (ProjectFeatureFlags) {
|
|
28
|
+
ProjectFeatureFlags["APP"] = "app";
|
|
29
|
+
ProjectFeatureFlags["POWERSYNC"] = "powersync";
|
|
30
|
+
// maybe later: 'cloudcode', 'backend'
|
|
31
|
+
})(ProjectFeatureFlags || (ProjectFeatureFlags = {}));
|
|
32
|
+
export const App = t.object({
|
|
33
|
+
auth_scope_id: t.string.optional(),
|
|
34
|
+
features: t.array(t.Enum(ProjectFeatureFlags)),
|
|
35
|
+
name: t.string,
|
|
36
|
+
org_id: t.string,
|
|
37
|
+
region: t.string,
|
|
38
|
+
source: SourceMetadata.optional(),
|
|
39
|
+
vcs_mode: t.Enum(VCS_MODE).optional()
|
|
40
|
+
});
|
|
41
|
+
export const AppResource = App.and(codecs.ResourceId);
|
|
42
|
+
export var UserOrgAccess;
|
|
43
|
+
(function (UserOrgAccess) {
|
|
44
|
+
UserOrgAccess["DEVELOPER"] = "developer";
|
|
45
|
+
UserOrgAccess["OWNER"] = "owner";
|
|
46
|
+
})(UserOrgAccess || (UserOrgAccess = {}));
|
|
47
|
+
export const User = t.object({
|
|
48
|
+
email: t.string,
|
|
49
|
+
name: t.string.optional(),
|
|
50
|
+
onboarding_token: t.string.optional(),
|
|
51
|
+
org_id: t.string,
|
|
52
|
+
phone_number: t.string.optional(),
|
|
53
|
+
signup_complete: t.boolean.optional()
|
|
54
|
+
});
|
|
55
|
+
export const UserResource = User.and(codecs.ResourceId);
|
|
56
|
+
export var DeveloperInviteStatus;
|
|
57
|
+
(function (DeveloperInviteStatus) {
|
|
58
|
+
DeveloperInviteStatus["ACCEPTED"] = "accepted";
|
|
59
|
+
DeveloperInviteStatus["DECLINED"] = "declined";
|
|
60
|
+
DeveloperInviteStatus["PENDING"] = "pending";
|
|
61
|
+
})(DeveloperInviteStatus || (DeveloperInviteStatus = {}));
|
|
62
|
+
export const DeveloperInvite = t.object({
|
|
63
|
+
metadata: t.object({
|
|
64
|
+
email: t.string.optional(),
|
|
65
|
+
org_name: t.string.optional(),
|
|
66
|
+
role_names: t.array(t.string).optional(),
|
|
67
|
+
user_name: t.string.optional()
|
|
68
|
+
}),
|
|
69
|
+
org_id: t.string,
|
|
70
|
+
requested_role_ids: t.array(t.string),
|
|
71
|
+
responded_at: t.string,
|
|
72
|
+
status: t.Enum(DeveloperInviteStatus),
|
|
73
|
+
user_id: t.string
|
|
74
|
+
});
|
|
75
|
+
export const DeveloperInviteResource = DeveloperInvite.and(codecs.ResourceId);
|
|
76
|
+
export var MFAFactorState;
|
|
77
|
+
(function (MFAFactorState) {
|
|
78
|
+
MFAFactorState["ACTIVE"] = "active";
|
|
79
|
+
MFAFactorState["DISABLED"] = "disabled";
|
|
80
|
+
MFAFactorState["PENDING"] = "pending";
|
|
81
|
+
})(MFAFactorState || (MFAFactorState = {}));
|
|
82
|
+
export var MFAFactor;
|
|
83
|
+
(function (MFAFactor) {
|
|
84
|
+
MFAFactor["SMS"] = "sms";
|
|
85
|
+
MFAFactor["TOTP"] = "totp";
|
|
86
|
+
})(MFAFactor || (MFAFactor = {}));
|
|
87
|
+
export const UserMFAFactorResource = t.object({
|
|
88
|
+
created_at: t.string,
|
|
89
|
+
deleted_at: t.string,
|
|
90
|
+
factor_type: t.Enum(MFAFactor),
|
|
91
|
+
id: t.string,
|
|
92
|
+
sms_otp_mobile_number: t.string,
|
|
93
|
+
state: t.Enum(MFAFactorState),
|
|
94
|
+
totp_factor_sid: t.string,
|
|
95
|
+
updated_at: t.string
|
|
96
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare enum ROUTES {
|
|
2
|
+
ACCEPT_INVITE = "/api/accounts/v5/invites/accept",
|
|
3
|
+
COMPLETE_SIGNUP = "/api/accounts/v5/trial/complete-signup",
|
|
4
|
+
CREATE_APP = "/api/accounts/v5/apps/create",
|
|
5
|
+
CREATE_DEV_INVITE = "/api/accounts/v5/invites/create",
|
|
6
|
+
CREATE_ORG = "/api/accounts/v5/organizations/create",
|
|
7
|
+
CREATE_USER = "/api/accounts/v5/users/create",
|
|
8
|
+
DECLINE_INVITE = "/api/accounts/v5/invites/decline",
|
|
9
|
+
DELETE_APP = "/api/accounts/v5/apps/delete",
|
|
10
|
+
DELETE_MFA_FACTOR = "/me/profile/delete_factor",
|
|
11
|
+
DELETE_USER = "/api/accounts/v5/users/delete",
|
|
12
|
+
DESTROY_INVITE = "/api/accounts/v5/invites/destroy",
|
|
13
|
+
DOWNGRADE_ORG = "/api/accounts/v5/organizations/downgrade",
|
|
14
|
+
GENERATE_MFA_BACKUP_CODES = "/me/profile/generate_backup_codes",
|
|
15
|
+
GET_APP = "/api/accounts/v5/apps/get",
|
|
16
|
+
GET_ORG = "/api/accounts/v5/organizations/get",
|
|
17
|
+
GET_PREFERRED_FACTOR = "/me/profile/get_preferred_factor",
|
|
18
|
+
GET_SENSITIVE_ACCESS_TOKEN = "/me/profile/auth_for_token",
|
|
19
|
+
GET_TRIAL_USER = "/api/accounts/v5/trial/get-user",
|
|
20
|
+
GET_USER = "/api/accounts/v5/users/get",
|
|
21
|
+
GET_USER_INVITES = "/api/accounts/v5/invites/user-invites",
|
|
22
|
+
GIVE_USER_ACCESS = "/api/accounts/v5/organizations/give-user-access",
|
|
23
|
+
LIST_APPS = "/api/accounts/v5/apps/list",
|
|
24
|
+
LIST_DEV_INVITES = "/api/accounts/v5/invites/list",
|
|
25
|
+
LIST_MFA_FACTORS = "/me/profile/list_mfa_factors",
|
|
26
|
+
LIST_ORGS = "/api/accounts/v5/organizations/list",
|
|
27
|
+
LIST_USERS = "/api/accounts/v5/users/list",
|
|
28
|
+
PROVISION_USER_TOKEN = "/api/accounts/v5/trial/provision-user-token",
|
|
29
|
+
REGISTER_SMS_USER_MFA_FACTOR = "/me/profile/register_sms_factor",
|
|
30
|
+
REGISTER_TOTP_USER_MFA_FACTOR = "/me/profile/register_totp_factor",
|
|
31
|
+
SEARCH_APPS = "/api/accounts/v5/apps/search",
|
|
32
|
+
SEARCH_ORGS = "/api/accounts/v5/organizations/search",
|
|
33
|
+
SEARCH_USERS = "/api/accounts/v5/users/search",
|
|
34
|
+
SEND_MFA_SMS = "/me/profile/request_otp_sms",
|
|
35
|
+
SET_PREFERRED_MFA_METHOD = "/me/profile/set_preferred_factor",
|
|
36
|
+
START_TRIAL = "/api/accounts/v5/trial/start",
|
|
37
|
+
UPDATE_APP = "/api/accounts/v5/apps/update",
|
|
38
|
+
UPDATE_INVITE = "/api/accounts/v5/invites/update",
|
|
39
|
+
UPDATE_ORG = "/api/accounts/v5/organizations/update",
|
|
40
|
+
UPDATE_ORG_BILLING = "/api/accounts/v5/organizations/update-billing",
|
|
41
|
+
UPDATE_USER = "/api/accounts/v5/users/update",
|
|
42
|
+
UPGRADE_ORG = "/api/accounts/v5/organizations/upgrade",
|
|
43
|
+
VERIFY_MFA_FACTOR = "/me/profile/verify_factor"
|
|
44
|
+
}
|