@powersync/management-types 0.0.0-dev.84a4b832

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.
Files changed (64) hide show
  1. package/LICENSE +67 -0
  2. package/README.md +88 -0
  3. package/dist/config/HostedConfig.d.ts +1318 -0
  4. package/dist/config/HostedConfig.js +101 -0
  5. package/dist/config/HostedConfig.js.map +1 -0
  6. package/dist/config/HostedSecret.d.ts +18 -0
  7. package/dist/config/HostedSecret.js +12 -0
  8. package/dist/config/HostedSecret.js.map +1 -0
  9. package/dist/config/connections/ConnectionType.d.ts +6 -0
  10. package/dist/config/connections/ConnectionType.js +8 -0
  11. package/dist/config/connections/ConnectionType.js.map +1 -0
  12. package/dist/config/connections/HostedDatabaseSourceConfig.d.ts +23 -0
  13. package/dist/config/connections/HostedDatabaseSourceConfig.js +18 -0
  14. package/dist/config/connections/HostedDatabaseSourceConfig.js.map +1 -0
  15. package/dist/config/connections/HostedMSSQLConnection.d.ts +308 -0
  16. package/dist/config/connections/HostedMSSQLConnection.js +41 -0
  17. package/dist/config/connections/HostedMSSQLConnection.js.map +1 -0
  18. package/dist/config/connections/HostedMongoConnection.d.ts +33 -0
  19. package/dist/config/connections/HostedMongoConnection.js +10 -0
  20. package/dist/config/connections/HostedMongoConnection.js.map +1 -0
  21. package/dist/config/connections/HostedMySQLConnection.d.ts +46 -0
  22. package/dist/config/connections/HostedMySQLConnection.js +16 -0
  23. package/dist/config/connections/HostedMySQLConnection.js.map +1 -0
  24. package/dist/config/connections/HostedPostgresConnection.d.ts +52 -0
  25. package/dist/config/connections/HostedPostgresConnection.js +21 -0
  26. package/dist/config/connections/HostedPostgresConnection.js.map +1 -0
  27. package/dist/errors.d.ts +11 -0
  28. package/dist/errors.js +14 -0
  29. package/dist/errors.js.map +1 -0
  30. package/dist/index.d.ts +13 -0
  31. package/dist/index.js +14 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/routes/dashboard-routes.d.ts +13 -0
  34. package/dist/routes/dashboard-routes.js +16 -0
  35. package/dist/routes/dashboard-routes.js.map +1 -0
  36. package/dist/routes/dev-routes.d.ts +602 -0
  37. package/dist/routes/dev-routes.js +97 -0
  38. package/dist/routes/dev-routes.js.map +1 -0
  39. package/dist/routes/general-routes.d.ts +78 -0
  40. package/dist/routes/general-routes.js +57 -0
  41. package/dist/routes/general-routes.js.map +1 -0
  42. package/dist/routes/index.d.ts +6 -0
  43. package/dist/routes/index.js +7 -0
  44. package/dist/routes/index.js.map +1 -0
  45. package/dist/routes/manage-routes.d.ts +1094 -0
  46. package/dist/routes/manage-routes.js +109 -0
  47. package/dist/routes/manage-routes.js.map +1 -0
  48. package/dist/routes/reporting-routes.d.ts +112 -0
  49. package/dist/routes/reporting-routes.js +61 -0
  50. package/dist/routes/reporting-routes.js.map +1 -0
  51. package/dist/routes/schema.d.ts +131 -0
  52. package/dist/routes/schema.js +71 -0
  53. package/dist/routes/schema.js.map +1 -0
  54. package/dist/scripts/compile-json-schema.d.ts +1 -0
  55. package/dist/scripts/compile-json-schema.js +15 -0
  56. package/dist/scripts/compile-json-schema.js.map +1 -0
  57. package/dist/shared.d.ts +17 -0
  58. package/dist/shared.js +17 -0
  59. package/dist/shared.js.map +1 -0
  60. package/dist/utils/pagination.d.ts +12 -0
  61. package/dist/utils/pagination.js +13 -0
  62. package/dist/utils/pagination.js.map +1 -0
  63. package/json-schema/powersync-config.json +880 -0
  64. package/package.json +43 -0
@@ -0,0 +1,109 @@
1
+ import { internal_routes } from '@powersync/service-types';
2
+ import * as t from 'ts-codec';
3
+ import { BasePowerSyncHostedConfig } from '../config/HostedConfig.js';
4
+ import { InstanceId, ProgramVersionConstraint } from '../shared.js';
5
+ import { ObjectId } from '@journeyapps-labs/micro-codecs';
6
+ export var MANAGE_ROUTES;
7
+ (function (MANAGE_ROUTES) {
8
+ MANAGE_ROUTES["LIST"] = "/api/v1/instances/list";
9
+ MANAGE_ROUTES["CREATE"] = "/api/v1/instances/create";
10
+ MANAGE_ROUTES["DEPLOY"] = "/api/v1/instances/deploy";
11
+ MANAGE_ROUTES["DESTROY"] = "/api/v1/instances/destroy";
12
+ MANAGE_ROUTES["DEACTIVATE"] = "/api/v1/instances/deactivate";
13
+ MANAGE_ROUTES["COMPACT"] = "/api/v1/instances/compact";
14
+ MANAGE_ROUTES["CONFIG"] = "/api/v1/instances/config";
15
+ MANAGE_ROUTES["STATUS"] = "/api/v1/instances/status";
16
+ MANAGE_ROUTES["DIAGNOSTICS"] = "/api/v1/instances/diagnostics";
17
+ })(MANAGE_ROUTES || (MANAGE_ROUTES = {}));
18
+ // POST /api/v1/instances/list
19
+ export const ListInstancesRequest = t.object({
20
+ org_id: ObjectId,
21
+ app_id: ObjectId
22
+ });
23
+ export const ListInstancesResponse = t.object({
24
+ instances: t.array(t.object({
25
+ id: t.string,
26
+ name: t.string,
27
+ has_config: t.boolean,
28
+ deployable: t.boolean
29
+ }))
30
+ });
31
+ // POST /api/v1/instances/create
32
+ export const CreateInstanceRequest = t.object({
33
+ org_id: ObjectId,
34
+ app_id: ObjectId,
35
+ name: t.string,
36
+ region: t.string.optional()
37
+ });
38
+ export const CreateInstanceResponse = t.object({
39
+ id: t.string
40
+ });
41
+ // POST /api/instances/deploy
42
+ export const DeployInstanceRequest = InstanceId.and(t.object({
43
+ name: t.string.optional(),
44
+ config: BasePowerSyncHostedConfig,
45
+ sync_rules: t.string.optional(),
46
+ program_version: ProgramVersionConstraint.optional()
47
+ }));
48
+ export const DeployInstanceResponse = t.object({
49
+ id: t.string,
50
+ operation_id: t.string
51
+ });
52
+ // POST /api/v1/instances/config
53
+ export const InstanceConfigRequest = InstanceId;
54
+ export const InstanceConfigResponse = t.object({
55
+ id: t.string,
56
+ project_id: t.string,
57
+ org_id: t.string,
58
+ name: t.string,
59
+ config: BasePowerSyncHostedConfig.optional(),
60
+ sync_rules: t.string.optional(),
61
+ program_version: ProgramVersionConstraint
62
+ });
63
+ // POST /api/v1/instances/status
64
+ // Get provisioning status. Once provisioned, other requests can be used for additional
65
+ // diagnostics.
66
+ export const InstanceStatusRequest = InstanceId;
67
+ export const InstanceDeployOperation = t.object({
68
+ id: t.string,
69
+ type: t.literal('up').or(t.literal('down')),
70
+ status: t.literal('pending').or(t.literal('running')).or(t.literal('failed')).or(t.literal('completed')),
71
+ created_at: t.string,
72
+ started_at: t.string.optional(),
73
+ finished_at: t.string.optional(),
74
+ system_upgrade: t.boolean.optional(),
75
+ teardown: t.boolean.optional(),
76
+ compact: t.boolean.optional(),
77
+ user_id: t.string.optional(),
78
+ version: t.string
79
+ });
80
+ export const InstanceStatusResponse = t.object({
81
+ id: t.string,
82
+ /** True if provisioned at least once, and should therefore be running. */
83
+ provisioned: t.boolean,
84
+ operations: t.array(InstanceDeployOperation),
85
+ instance_url: t.string.optional()
86
+ });
87
+ // POST /api/v1/instances/destroy
88
+ export const DestroyInstanceRequest = InstanceId;
89
+ export const DestroyInstanceResponse = t.object({
90
+ id: t.string,
91
+ operation_id: t.string.optional()
92
+ });
93
+ // POST /api/v1/instances/deactivate
94
+ export const DeactivateInstanceRequest = InstanceId;
95
+ export const DeactivateInstanceResponse = t.object({
96
+ id: t.string,
97
+ operation_id: t.string.optional()
98
+ });
99
+ // POST /api/v1/instances/compact
100
+ export const CompactInstanceRequest = InstanceId;
101
+ export const CompactInstanceResponse = t.object({
102
+ id: t.string,
103
+ operation_id: t.string.optional()
104
+ });
105
+ // POST /api/v1/instances/diagnostics
106
+ // Get instance diagnostics once provisioned.
107
+ export const InstanceDiagnosticsRequest = InstanceId.and(internal_routes.DiagnosticsRequest);
108
+ export const InstanceDiagnosticsResponse = internal_routes.DiagnosticsResponse;
109
+ //# sourceMappingURL=manage-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manage-routes.js","sourceRoot":"","sources":["../../src/routes/manage-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,CAAC,MAAM,UAAU,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U,CAAC;AAGpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,EAAE,EAAE,CAAC,CAAC,MAAM;IACZ,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,iCAAiC;AACjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAGjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,MAAM;IACZ,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,qCAAqC;AACrC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAG7F,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAe,CAAC,mBAAmB,CAAC"}
@@ -0,0 +1,112 @@
1
+ import * as t from 'ts-codec';
2
+ export declare enum REPORT_ROUTES {
3
+ GET_CLIENT_CONNECTION_DATA = "/api/v1/report/connection/data",
4
+ GET_CURRENT_CONNECTIONS = "/api/v1/report/connection/current",
5
+ GET_GENERAL_CLIENT_ANALYTICS = "/api/v1/report/connection/general/analytics"
6
+ }
7
+ export declare const ClientConnectionsReportRequest: t.Intersection<t.Codec<{
8
+ start: string;
9
+ end: string;
10
+ scrape_ttl?: {
11
+ date: string;
12
+ } | undefined;
13
+ }, {
14
+ start: string;
15
+ end: string;
16
+ scrape_ttl?: {
17
+ date: string;
18
+ } | undefined;
19
+ }, string, t.CodecProps>, t.ObjectCodec<{
20
+ org_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
21
+ app_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
22
+ id: t.IdentityCodec<t.CodecType.String>;
23
+ }>>;
24
+ export type ClientConnectionsReportRequest = t.Encoded<typeof ClientConnectionsReportRequest>;
25
+ export declare const CurrentConnectionsRequest: t.ObjectCodec<{
26
+ org_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
27
+ app_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
28
+ id: t.IdentityCodec<t.CodecType.String>;
29
+ }>;
30
+ export type CurrentConnectionsRequest = t.Encoded<typeof CurrentConnectionsRequest>;
31
+ export type CurrentConnectionsRequestDecoded = t.Decoded<typeof CurrentConnectionsRequest>;
32
+ export declare const ConnectionReport: t.ObjectCodec<{
33
+ sdk: t.IdentityCodec<t.CodecType.String>;
34
+ users: t.IdentityCodec<t.CodecType.Number>;
35
+ clients: t.IdentityCodec<t.CodecType.Number>;
36
+ }>;
37
+ export declare const ClientConnectionsReport: t.ObjectCodec<{
38
+ users: t.IdentityCodec<t.CodecType.Number>;
39
+ sdks: t.ArrayCodec<t.ObjectCodec<{
40
+ sdk: t.IdentityCodec<t.CodecType.String>;
41
+ users: t.IdentityCodec<t.CodecType.Number>;
42
+ clients: t.IdentityCodec<t.CodecType.Number>;
43
+ }>>;
44
+ }>;
45
+ export type ClientConnectionsReportResponse = t.Encoded<typeof ClientConnectionsReport>;
46
+ export type ClientConnectionsReportResponseDecoded = t.Decoded<typeof ClientConnectionsReport>;
47
+ export declare const AnalyticsRequestData: t.ObjectCodec<{
48
+ org_id: t.IdentityCodec<t.CodecType.String>;
49
+ app_id: t.IdentityCodec<t.CodecType.String>;
50
+ id: t.IdentityCodec<t.CodecType.String>;
51
+ client_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
52
+ user_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
53
+ date_range: t.OptionalCodec<t.Codec<{
54
+ start: string;
55
+ end: string;
56
+ }, {
57
+ start: string;
58
+ end: string;
59
+ }, string, t.CodecProps>>;
60
+ }>;
61
+ export declare const ClientConnectionAnalyticsRequest: t.Intersection<t.Codec<{
62
+ id: string;
63
+ org_id: string;
64
+ app_id: string;
65
+ user_id?: string | undefined;
66
+ client_id?: string | undefined;
67
+ date_range?: {
68
+ start: string;
69
+ end: string;
70
+ } | undefined;
71
+ }, {
72
+ id: string;
73
+ org_id: string;
74
+ app_id: string;
75
+ user_id?: string | undefined;
76
+ client_id?: string | undefined;
77
+ date_range?: {
78
+ start: string;
79
+ end: string;
80
+ } | undefined;
81
+ }, string, t.CodecProps>, t.ObjectCodec<{
82
+ cursor: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
83
+ limit: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
84
+ }>>;
85
+ export type ClientConnectionAnalyticsRequest = t.Encoded<typeof ClientConnectionAnalyticsRequest>;
86
+ export type ClientConnectionAnalyticsRequestDecoded = t.Decoded<typeof ClientConnectionAnalyticsRequest>;
87
+ export declare const ClientConnectionAnalyticsEvent: t.ObjectCodec<{
88
+ user_id: t.IdentityCodec<t.CodecType.String>;
89
+ client_id: t.IdentityCodec<t.CodecType.String>;
90
+ connected_at: t.Codec<Date, string, string, t.CodecProps>;
91
+ disconnected_at: t.OptionalCodec<t.Codec<Date, string, string, t.CodecProps>>;
92
+ jwt_exp: t.OptionalCodec<t.Codec<Date, string, string, t.CodecProps>>;
93
+ user_agent: t.IdentityCodec<t.CodecType.String>;
94
+ sdk: t.IdentityCodec<t.CodecType.String>;
95
+ }>;
96
+ export declare const ClientConnectionAnalyticsEventResponse: t.ObjectCodec<{
97
+ total: t.IdentityCodec<t.CodecType.Number>;
98
+ count: t.IdentityCodec<t.CodecType.Number>;
99
+ more: t.IdentityCodec<t.CodecType.Boolean>;
100
+ cursor: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
101
+ items: t.ArrayCodec<t.ObjectCodec<{
102
+ user_id: t.IdentityCodec<t.CodecType.String>;
103
+ client_id: t.IdentityCodec<t.CodecType.String>;
104
+ connected_at: t.Codec<Date, string, string, t.CodecProps>;
105
+ disconnected_at: t.OptionalCodec<t.Codec<Date, string, string, t.CodecProps>>;
106
+ jwt_exp: t.OptionalCodec<t.Codec<Date, string, string, t.CodecProps>>;
107
+ user_agent: t.IdentityCodec<t.CodecType.String>;
108
+ sdk: t.IdentityCodec<t.CodecType.String>;
109
+ }>>;
110
+ }>;
111
+ export type ClientConnectionAnalyticsEventResponse = t.Encoded<typeof ClientConnectionAnalyticsEventResponse>;
112
+ export type ClientConnectionAnalyticsEventResponseDecoded = t.Decoded<typeof ClientConnectionAnalyticsEventResponse>;
@@ -0,0 +1,61 @@
1
+ import { date } from '@journeyapps-labs/micro-codecs';
2
+ import * as t from 'ts-codec';
3
+ import { InstanceId } from '../shared.js';
4
+ import { PaginationRequest, PaginationResponse } from '../utils/pagination.js';
5
+ export var REPORT_ROUTES;
6
+ (function (REPORT_ROUTES) {
7
+ REPORT_ROUTES["GET_CLIENT_CONNECTION_DATA"] = "/api/v1/report/connection/data";
8
+ REPORT_ROUTES["GET_CURRENT_CONNECTIONS"] = "/api/v1/report/connection/current";
9
+ REPORT_ROUTES["GET_GENERAL_CLIENT_ANALYTICS"] = "/api/v1/report/connection/general/analytics";
10
+ })(REPORT_ROUTES || (REPORT_ROUTES = {}));
11
+ // POST /api/v1/report/connection/data
12
+ // Returns list of sdk reports by instance id
13
+ const ConnectionsInfo = t.object({
14
+ start: t.string,
15
+ end: t.string,
16
+ scrape_ttl: t
17
+ .object({
18
+ date: t.string
19
+ })
20
+ .optional()
21
+ });
22
+ export const ClientConnectionsReportRequest = ConnectionsInfo.and(InstanceId);
23
+ // POST /api/v1/report/connection/current
24
+ // Returns list of currently connected sdk reports
25
+ export const CurrentConnectionsRequest = InstanceId;
26
+ export const ConnectionReport = t.object({
27
+ sdk: t.string,
28
+ users: t.number,
29
+ clients: t.number
30
+ });
31
+ export const ClientConnectionsReport = t.object({
32
+ users: t.number,
33
+ sdks: t.array(ConnectionReport)
34
+ });
35
+ // POST /api/v1/report/connection/general/analytics
36
+ // Returns paginated list of client connection events
37
+ export const AnalyticsRequestData = t.object({
38
+ org_id: t.string,
39
+ app_id: t.string,
40
+ id: t.string,
41
+ client_id: t.string.optional(),
42
+ user_id: t.string.optional(),
43
+ date_range: t
44
+ .object({
45
+ start: t.string,
46
+ end: t.string
47
+ })
48
+ .optional()
49
+ });
50
+ export const ClientConnectionAnalyticsRequest = AnalyticsRequestData.and(PaginationRequest);
51
+ export const ClientConnectionAnalyticsEvent = t.object({
52
+ user_id: t.string,
53
+ client_id: t.string,
54
+ connected_at: date,
55
+ disconnected_at: date.optional(),
56
+ jwt_exp: date.optional(),
57
+ user_agent: t.string,
58
+ sdk: t.string
59
+ });
60
+ export const ClientConnectionAnalyticsEventResponse = PaginationResponse(ClientConnectionAnalyticsEvent);
61
+ //# sourceMappingURL=reporting-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporting-routes.js","sourceRoot":"","sources":["../../src/routes/reporting-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,8EAA6D,CAAA;IAC7D,8EAA6D,CAAA;IAC7D,6FAA4E,CAAA;AAC9E,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AACD,sCAAsC;AACtC,6CAA6C;AAC7C,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,GAAG,EAAE,CAAC,CAAC,MAAM;IACb,UAAU,EAAE,CAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM;KACf,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,eAAe,CAAC,GAAG,CA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,EAAE,IAAI,CAAC,QAAQ,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM;IACpB,GAAG,EAAE,CAAC,CAAC,MAAM;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sCAAsC,GAAG,kBAAkB,CAAC,8BAA8B,CAAC,CAAC"}
@@ -0,0 +1,131 @@
1
+ import * as t from 'ts-codec';
2
+ export declare enum SqliteSchemaTypeText {
3
+ null = "null",
4
+ blob = "blob",
5
+ text = "text",
6
+ integer = "integer",
7
+ real = "real",
8
+ numeric = "numeric"
9
+ }
10
+ export declare const TableSchema: t.ObjectCodec<{
11
+ name: t.IdentityCodec<t.CodecType.String>;
12
+ columns: t.ArrayCodec<t.ObjectCodec<{
13
+ name: t.IdentityCodec<t.CodecType.String>;
14
+ /**
15
+ * Option 1: SQLite type flags - see ExpressionType.typeFlags.
16
+ * Option 2: SQLite type name in lowercase - 'text' | 'integer' | 'real' | 'numeric' | 'blob' | 'null'
17
+ *
18
+ * Changed to optional for backwards-compatibility.
19
+ */
20
+ sqlite_type: t.OptionalCodec<t.Codec<number | SqliteSchemaTypeText, number | SqliteSchemaTypeText, string, t.CodecProps>>;
21
+ /**
22
+ * Type name from the source database, e.g. "character varying(255)[]"
23
+ *
24
+ * Changed to optional for backwards-compatibility.
25
+ */
26
+ internal_type: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
27
+ /**
28
+ * Description for the field if available.
29
+ */
30
+ description: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
31
+ /**
32
+ * Full type name, e.g. "character varying(255)[]"
33
+ * @deprecated - use internal_type
34
+ */
35
+ type: t.IdentityCodec<t.CodecType.String>;
36
+ /**
37
+ * Internal postgres type, e.g. "varchar[]".
38
+ * @deprecated - use internal_type instead
39
+ */
40
+ pg_type: t.IdentityCodec<t.CodecType.String>;
41
+ }>>;
42
+ }>;
43
+ export type TableSchema = t.Encoded<typeof TableSchema>;
44
+ export declare const DatabaseSchema: t.ObjectCodec<{
45
+ name: t.IdentityCodec<t.CodecType.String>;
46
+ tables: t.ArrayCodec<t.ObjectCodec<{
47
+ name: t.IdentityCodec<t.CodecType.String>;
48
+ columns: t.ArrayCodec<t.ObjectCodec<{
49
+ name: t.IdentityCodec<t.CodecType.String>;
50
+ /**
51
+ * Option 1: SQLite type flags - see ExpressionType.typeFlags.
52
+ * Option 2: SQLite type name in lowercase - 'text' | 'integer' | 'real' | 'numeric' | 'blob' | 'null'
53
+ *
54
+ * Changed to optional for backwards-compatibility.
55
+ */
56
+ sqlite_type: t.OptionalCodec<t.Codec<number | SqliteSchemaTypeText, number | SqliteSchemaTypeText, string, t.CodecProps>>;
57
+ /**
58
+ * Type name from the source database, e.g. "character varying(255)[]"
59
+ *
60
+ * Changed to optional for backwards-compatibility.
61
+ */
62
+ internal_type: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
63
+ /**
64
+ * Description for the field if available.
65
+ */
66
+ description: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
67
+ /**
68
+ * Full type name, e.g. "character varying(255)[]"
69
+ * @deprecated - use internal_type
70
+ */
71
+ type: t.IdentityCodec<t.CodecType.String>;
72
+ /**
73
+ * Internal postgres type, e.g. "varchar[]".
74
+ * @deprecated - use internal_type instead
75
+ */
76
+ pg_type: t.IdentityCodec<t.CodecType.String>;
77
+ }>>;
78
+ }>>;
79
+ }>;
80
+ export type DatabaseSchema = t.Encoded<typeof DatabaseSchema>;
81
+ export declare const InstanceSchema: t.ObjectCodec<{
82
+ connections: t.ArrayCodec<t.ObjectCodec<{
83
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
84
+ tag: t.IdentityCodec<t.CodecType.String>;
85
+ schemas: t.ArrayCodec<t.ObjectCodec<{
86
+ name: t.IdentityCodec<t.CodecType.String>;
87
+ tables: t.ArrayCodec<t.ObjectCodec<{
88
+ name: t.IdentityCodec<t.CodecType.String>;
89
+ columns: t.ArrayCodec<t.ObjectCodec<{
90
+ name: t.IdentityCodec<t.CodecType.String>;
91
+ /**
92
+ * Option 1: SQLite type flags - see ExpressionType.typeFlags.
93
+ * Option 2: SQLite type name in lowercase - 'text' | 'integer' | 'real' | 'numeric' | 'blob' | 'null'
94
+ *
95
+ * Changed to optional for backwards-compatibility.
96
+ */
97
+ sqlite_type: t.OptionalCodec<t.Codec<number | SqliteSchemaTypeText, number | SqliteSchemaTypeText, string, t.CodecProps>>;
98
+ /**
99
+ * Type name from the source database, e.g. "character varying(255)[]"
100
+ *
101
+ * Changed to optional for backwards-compatibility.
102
+ */
103
+ internal_type: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
104
+ /**
105
+ * Description for the field if available.
106
+ */
107
+ description: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
108
+ /**
109
+ * Full type name, e.g. "character varying(255)[]"
110
+ * @deprecated - use internal_type
111
+ */
112
+ type: t.IdentityCodec<t.CodecType.String>;
113
+ /**
114
+ * Internal postgres type, e.g. "varchar[]".
115
+ * @deprecated - use internal_type instead
116
+ */
117
+ pg_type: t.IdentityCodec<t.CodecType.String>;
118
+ }>>;
119
+ }>>;
120
+ }>>;
121
+ }>>;
122
+ /**
123
+ * Changed to optional for backwards-compatibility.
124
+ */
125
+ defaultConnectionTag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
126
+ /**
127
+ * Changed to optional for backwards-compatibility.
128
+ */
129
+ defaultSchema: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
130
+ }>;
131
+ export type InstanceSchema = t.Encoded<typeof InstanceSchema>;
@@ -0,0 +1,71 @@
1
+ import * as t from 'ts-codec';
2
+ // This is the "new" schema type
3
+ // We support this in additional to the old types.
4
+ // Copied from https://github.com/powersync-ja/powersync-service/blob/bb367f4be5e2389471d99904b29d0b684702049f/packages/types/src/definitions.ts#L94
5
+ export var SqliteSchemaTypeText;
6
+ (function (SqliteSchemaTypeText) {
7
+ SqliteSchemaTypeText["null"] = "null";
8
+ SqliteSchemaTypeText["blob"] = "blob";
9
+ SqliteSchemaTypeText["text"] = "text";
10
+ SqliteSchemaTypeText["integer"] = "integer";
11
+ SqliteSchemaTypeText["real"] = "real";
12
+ SqliteSchemaTypeText["numeric"] = "numeric";
13
+ })(SqliteSchemaTypeText || (SqliteSchemaTypeText = {}));
14
+ export const TableSchema = t.object({
15
+ name: t.string,
16
+ columns: t.array(t.object({
17
+ name: t.string,
18
+ /**
19
+ * Option 1: SQLite type flags - see ExpressionType.typeFlags.
20
+ * Option 2: SQLite type name in lowercase - 'text' | 'integer' | 'real' | 'numeric' | 'blob' | 'null'
21
+ *
22
+ * Changed to optional for backwards-compatibility.
23
+ */
24
+ sqlite_type: t.number.or(t.Enum(SqliteSchemaTypeText)).optional(),
25
+ /**
26
+ * Type name from the source database, e.g. "character varying(255)[]"
27
+ *
28
+ * Changed to optional for backwards-compatibility.
29
+ */
30
+ internal_type: t.string.optional(),
31
+ /**
32
+ * Description for the field if available.
33
+ */
34
+ description: t.string.optional(),
35
+ /**
36
+ * Full type name, e.g. "character varying(255)[]"
37
+ * @deprecated - use internal_type
38
+ */
39
+ type: t.string,
40
+ /**
41
+ * Internal postgres type, e.g. "varchar[]".
42
+ * @deprecated - use internal_type instead
43
+ */
44
+ pg_type: t.string
45
+ }))
46
+ });
47
+ export const DatabaseSchema = t.object({
48
+ name: t.string,
49
+ tables: t.array(TableSchema)
50
+ });
51
+ export const InstanceSchema = t.object({
52
+ connections: t.array(t.object({
53
+ id: t.string.optional(),
54
+ tag: t.string,
55
+ schemas: t.array(DatabaseSchema)
56
+ })),
57
+ /**
58
+ * Changed to optional for backwards-compatibility.
59
+ */
60
+ defaultConnectionTag: t.string.optional(),
61
+ /**
62
+ * Changed to optional for backwards-compatibility.
63
+ */
64
+ defaultSchema: t.string.optional()
65
+ });
66
+ // Test that the older schema is compatible with this one
67
+ function testSchema() {
68
+ const schemaOld = null;
69
+ const schemaConverted = schemaOld;
70
+ }
71
+ //# sourceMappingURL=schema.js.map
@@ -0,0 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CAAC,KAAK,CAClB,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;QACvB,GAAG,EAAE,CAAC,CAAC,MAAM;QACb,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;KACjC,CAAC,CACH;IAED;;OAEG;IACH,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IACzC;;OAEG;IACH,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH,yDAAyD;AAEzD,SAAS,UAAU;IACjB,MAAM,SAAS,GAAG,IAAoD,CAAC;IACvE,MAAM,eAAe,GAAG,SAAkC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { configFile } from '@powersync/service-types';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import * as t from 'ts-codec';
5
+ import { fileURLToPath } from 'url';
6
+ import { BasePowerSyncHostedConfig } from '../config/HostedConfig.js';
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const schemaDir = path.join(__dirname, '../../json-schema');
9
+ fs.mkdirSync(schemaDir, { recursive: true });
10
+ const mergedConfigSchema = t.generateJSONSchema(BasePowerSyncHostedConfig, {
11
+ allowAdditional: true,
12
+ parsers: [configFile.portParser]
13
+ });
14
+ fs.writeFileSync(path.join(schemaDir, 'powersync-config.json'), JSON.stringify(mergedConfigSchema, null, '\t'));
15
+ //# sourceMappingURL=compile-json-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-json-schema.js","sourceRoot":"","sources":["../../src/scripts/compile-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE5D,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAE7C,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,yBAAyB,EAAE;IACzE,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;CACjC,CAAC,CAAC;AAEH,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as t from 'ts-codec';
2
+ export declare const InstanceId: t.ObjectCodec<{
3
+ org_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
4
+ app_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
5
+ id: t.IdentityCodec<t.CodecType.String>;
6
+ }>;
7
+ export type InstanceId = t.Encoded<typeof InstanceId>;
8
+ export declare const AppId: t.ObjectCodec<{
9
+ org_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
10
+ app_id: t.Codec<import("bson").ObjectId, string, string, t.CodecProps>;
11
+ }>;
12
+ export type AppId = t.Encoded<typeof AppId>;
13
+ export declare const ProgramVersionConstraint: t.ObjectCodec<{
14
+ channel: t.IdentityCodec<t.CodecType.String>;
15
+ version_range: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
16
+ }>;
17
+ export type ProgramVersionConstraint = t.Encoded<typeof ProgramVersionConstraint>;
package/dist/shared.js ADDED
@@ -0,0 +1,17 @@
1
+ import * as t from 'ts-codec';
2
+ import { ObjectId } from '@journeyapps-labs/micro-codecs';
3
+ // Manage instances
4
+ export const InstanceId = t.object({
5
+ org_id: ObjectId,
6
+ app_id: ObjectId,
7
+ id: t.string
8
+ });
9
+ export const AppId = t.object({
10
+ org_id: ObjectId,
11
+ app_id: ObjectId
12
+ });
13
+ export const ProgramVersionConstraint = t.object({
14
+ channel: t.string,
15
+ version_range: t.string.optional()
16
+ });
17
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,mBAAmB;AACnB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,CAAC,CAAC,MAAM;CACb,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as t from 'ts-codec';
2
+ export declare const PaginationRequest: t.ObjectCodec<{
3
+ cursor: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
4
+ limit: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
5
+ }>;
6
+ export declare const PaginationResponse: <T extends t.AnyCodec>(item: T) => t.ObjectCodec<{
7
+ total: t.IdentityCodec<t.CodecType.Number>;
8
+ count: t.IdentityCodec<t.CodecType.Number>;
9
+ more: t.IdentityCodec<t.CodecType.Boolean>;
10
+ cursor: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
11
+ items: t.ArrayCodec<T>;
12
+ }>;
@@ -0,0 +1,13 @@
1
+ import * as t from 'ts-codec';
2
+ export const PaginationRequest = t.object({
3
+ cursor: t.string.optional(),
4
+ limit: t.number.optional()
5
+ });
6
+ export const PaginationResponse = (item) => t.object({
7
+ total: t.number,
8
+ count: t.number,
9
+ more: t.boolean,
10
+ cursor: t.string.optional(),
11
+ items: t.array(item)
12
+ });
13
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAuB,IAAO,EAAE,EAAE,CAClE,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,IAAI,EAAE,CAAC,CAAC,OAAO;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;CACrB,CAAC,CAAC"}