@comapeo/core 4.3.0 → 5.0.0-next.3
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/dist/blob-store/downloader.d.ts +5 -2
- package/dist/blob-store/downloader.d.ts.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/core-ownership.d.ts +2 -6
- package/dist/core-ownership.d.ts.map +1 -1
- package/dist/datatype/index.d.ts +30 -30
- package/dist/datatype/index.d.ts.map +1 -1
- package/dist/discovery/local-discovery.d.ts.map +1 -1
- package/dist/import-categories.d.ts +19 -0
- package/dist/import-categories.d.ts.map +1 -0
- package/dist/intl/iso639.d.ts +4 -0
- package/dist/intl/iso639.d.ts.map +1 -0
- package/dist/intl/parse-bcp-47.d.ts +22 -0
- package/dist/intl/parse-bcp-47.d.ts.map +1 -0
- package/dist/invite/invite-api.d.ts.map +1 -1
- package/dist/lib/drizzle-helpers.d.ts +19 -1
- package/dist/lib/drizzle-helpers.d.ts.map +1 -1
- package/dist/mapeo-manager.d.ts +15 -9
- package/dist/mapeo-manager.d.ts.map +1 -1
- package/dist/mapeo-project.d.ts +4969 -3017
- package/dist/mapeo-project.d.ts.map +1 -1
- package/dist/schema/client.d.ts +246 -232
- package/dist/schema/client.d.ts.map +1 -1
- package/dist/schema/comapeo-to-drizzle.d.ts +65 -0
- package/dist/schema/comapeo-to-drizzle.d.ts.map +1 -0
- package/dist/schema/json-schema-to-drizzle.d.ts +18 -0
- package/dist/schema/json-schema-to-drizzle.d.ts.map +1 -0
- package/dist/schema/project.d.ts +2711 -1835
- package/dist/schema/project.d.ts.map +1 -1
- package/dist/schema/types.d.ts +73 -66
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/translation-api.d.ts +112 -192
- package/dist/translation-api.d.ts.map +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +25 -3
- package/dist/utils.d.ts.map +1 -1
- package/drizzle/client/0004_glorious_shape.sql +1 -0
- package/drizzle/client/meta/0000_snapshot.json +13 -9
- package/drizzle/client/meta/0001_snapshot.json +13 -9
- package/drizzle/client/meta/0002_snapshot.json +13 -9
- package/drizzle/client/meta/0003_snapshot.json +13 -9
- package/drizzle/client/meta/0004_snapshot.json +239 -0
- package/drizzle/client/meta/_journal.json +7 -0
- package/drizzle/project/meta/0000_snapshot.json +43 -24
- package/drizzle/project/meta/0001_snapshot.json +47 -26
- package/drizzle/project/meta/0002_snapshot.json +47 -26
- package/package.json +17 -9
- package/src/constants.js +0 -3
- package/src/datatype/index.js +92 -39
- package/src/discovery/local-discovery.js +3 -2
- package/src/import-categories.js +368 -0
- package/src/index-writer/index.js +1 -1
- package/src/intl/iso639.js +8118 -0
- package/src/intl/parse-bcp-47.js +91 -0
- package/src/invite/invite-api.js +2 -0
- package/src/lib/drizzle-helpers.js +70 -18
- package/src/mapeo-manager.js +138 -88
- package/src/mapeo-project.js +72 -229
- package/src/roles.js +1 -1
- package/src/schema/client.js +22 -28
- package/src/schema/comapeo-to-drizzle.js +57 -0
- package/src/schema/{schema-to-drizzle.js → json-schema-to-drizzle.js} +25 -25
- package/src/schema/project.js +24 -37
- package/src/schema/types.ts +138 -99
- package/src/translation-api.js +65 -13
- package/src/types.ts +11 -20
- package/src/utils.js +37 -3
- package/dist/config-import.d.ts +0 -74
- package/dist/config-import.d.ts.map +0 -1
- package/dist/schema/schema-to-drizzle.d.ts +0 -20
- package/dist/schema/schema-to-drizzle.d.ts.map +0 -1
- package/dist/schema/utils.d.ts +0 -55
- package/dist/schema/utils.d.ts.map +0 -1
- package/src/config-import.js +0 -603
- package/src/schema/utils.js +0 -51
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/schema/project.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/schema/project.js"],"names":[],"mappings":"AAUA;;;;;;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;;;;;;;;;;;;;;;;;;;;;;GAAkE;AAClE;;;;;;;;;;;;;;;;;;;;;;GAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGE"}
|
package/dist/schema/types.d.ts
CHANGED
|
@@ -1,83 +1,67 @@
|
|
|
1
1
|
import { Includes, ReadonlyDeep } from 'type-fest';
|
|
2
2
|
import { JSONSchema7 as JSONSchema7Writable, JSONSchema7Type } from 'json-schema';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[K in keyof T]-?: undefined extends T[K] ? T[K] | null : T[K];
|
|
6
|
-
};
|
|
3
|
+
import type { SQLiteBooleanBuilder, SQLiteIntegerBuilder, SQLiteRealBuilder, SQLiteTableWithColumns, SQLiteTextBuilder, SQLiteTextJsonBuilder } from 'drizzle-orm/sqlite-core';
|
|
4
|
+
import type { $Type, BuildColumns, ColumnBuilderBase, HasDefault, IsPrimaryKey, NotNull } from 'drizzle-orm';
|
|
7
5
|
/** Convert a readonly array/object to writeable */
|
|
8
6
|
type Writable<T> = {
|
|
9
7
|
-readonly [P in keyof T]: T[P];
|
|
10
8
|
};
|
|
11
|
-
/** Type returned by text(columnName, { enum: [] }) */
|
|
12
|
-
type TextBuilder<TName extends string, TEnum extends readonly [string, ...string[]], TNotNull extends boolean, THasDefault extends boolean> = import('drizzle-orm/sqlite-core').SQLiteTextBuilder<{
|
|
13
|
-
name: TName;
|
|
14
|
-
data: Writable<TEnum>[number];
|
|
15
|
-
driverParam: string;
|
|
16
|
-
columnType: 'SQLiteText';
|
|
17
|
-
dataType: 'string';
|
|
18
|
-
enumValues: Writable<TEnum>;
|
|
19
|
-
notNull: TNotNull;
|
|
20
|
-
hasDefault: THasDefault;
|
|
21
|
-
}>;
|
|
22
|
-
/** Type returned by integer(columnName, { mode: 'boolean' }) */
|
|
23
|
-
type BooleanBuilder<TName extends string, TNotNull extends boolean, THasDefault extends boolean> = import('drizzle-orm/sqlite-core').SQLiteBooleanBuilder<{
|
|
24
|
-
name: TName;
|
|
25
|
-
data: boolean;
|
|
26
|
-
driverParam: number;
|
|
27
|
-
columnType: 'SQLiteBoolean';
|
|
28
|
-
dataType: 'boolean';
|
|
29
|
-
notNull: TNotNull;
|
|
30
|
-
hasDefault: THasDefault;
|
|
31
|
-
enumValues: undefined;
|
|
32
|
-
}>;
|
|
33
|
-
/** Type returned by real(columnName) */
|
|
34
|
-
type RealBuilder<TName extends string, TNotNull extends boolean, THasDefault extends boolean> = import('drizzle-orm/sqlite-core').SQLiteRealBuilder<{
|
|
35
|
-
name: TName;
|
|
36
|
-
data: number;
|
|
37
|
-
driverParam: number;
|
|
38
|
-
columnType: 'SQLiteReal';
|
|
39
|
-
dataType: 'number';
|
|
40
|
-
notNull: TNotNull;
|
|
41
|
-
hasDefault: THasDefault;
|
|
42
|
-
enumValues: undefined;
|
|
43
|
-
}>;
|
|
44
|
-
/** Type returned by integer(columnName) */
|
|
45
|
-
type IntegerBuilder<TName extends string, TNotNull extends boolean, THasDefault extends boolean> = import('drizzle-orm/sqlite-core').SQLiteIntegerBuilder<{
|
|
46
|
-
name: TName;
|
|
47
|
-
data: number;
|
|
48
|
-
driverParam: number;
|
|
49
|
-
columnType: 'SQLiteInteger';
|
|
50
|
-
dataType: 'number';
|
|
51
|
-
notNull: TNotNull;
|
|
52
|
-
hasDefault: THasDefault;
|
|
53
|
-
enumValues: undefined;
|
|
54
|
-
}>;
|
|
55
|
-
/** Type returned by the `customJson` custom type */
|
|
56
|
-
type JsonBuilder<TName extends string, TData extends unknown, TNotNull extends boolean, THasDefault extends boolean> = import('drizzle-orm/sqlite-core').SQLiteCustomColumnBuilder<{
|
|
57
|
-
name: TName;
|
|
58
|
-
data: TData;
|
|
59
|
-
dataType: 'custom';
|
|
60
|
-
driverParam: string;
|
|
61
|
-
columnType: 'SQLiteCustomColumn';
|
|
62
|
-
notNull: TNotNull;
|
|
63
|
-
hasDefault: THasDefault;
|
|
64
|
-
enumValues: undefined;
|
|
65
|
-
}>;
|
|
66
9
|
export type JSONSchema7 = ReadonlyDeep<JSONSchema7Writable>;
|
|
67
10
|
type JsonSchema7Properties = {
|
|
68
11
|
readonly [K: string]: JSONSchema7;
|
|
69
12
|
};
|
|
70
|
-
export type
|
|
13
|
+
export type JSONSchema7Object = Omit<JSONSchema7, 'properties' | 'type'> & {
|
|
14
|
+
readonly type: 'object';
|
|
71
15
|
readonly properties: JsonSchema7Properties;
|
|
72
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Create a Drizzle SQLite table definition from a JSONSchema object. All
|
|
19
|
+
* top-level properties map to SQLite columns, with `required` properties marked
|
|
20
|
+
* as `NOT NULL`, and JSONSchema `default` will map to SQLite defaults.
|
|
21
|
+
*
|
|
22
|
+
* Any properties that are of type `object` or `array` in the JSONSchema will be
|
|
23
|
+
* mapped to a text field, which drizzle will parse and stringify. Types for
|
|
24
|
+
* `object` and `array` properties will be derived from `TObjectType`.
|
|
25
|
+
*/
|
|
26
|
+
export type JsonSchemaToDrizzleSqliteTable<
|
|
27
|
+
/** Typescript type for the object defined in the JSONSchema */
|
|
28
|
+
TObjectType extends {
|
|
29
|
+
[K in keyof TSchema['properties']]?: any;
|
|
30
|
+
},
|
|
31
|
+
/** The JSONSchema object schema */
|
|
32
|
+
TSchema extends JSONSchema7Object,
|
|
33
|
+
/** Name of the table to create */
|
|
34
|
+
TTableName extends string,
|
|
35
|
+
/** Additional columns to add to the table definition (e.g. not defined in JSONSchema ) */
|
|
36
|
+
TColumnsMap extends Record<string, ColumnBuilderBase> = {},
|
|
37
|
+
/** Name of the property to use as primary key */
|
|
38
|
+
TPrimaryKey extends keyof TSchema['properties'] | undefined = undefined> = SQLiteTableWithColumns<{
|
|
39
|
+
name: TTableName;
|
|
40
|
+
schema: undefined;
|
|
41
|
+
columns: BuildColumns<TTableName, JsonSchemaToDrizzleColumns<TObjectType, TSchema, TPrimaryKey> & TColumnsMap, 'sqlite'>;
|
|
42
|
+
dialect: 'sqlite';
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Convert a JSONSchema Object Schema to a Drizzle Columns map (e.g. parameter
|
|
46
|
+
* for `sqliteTable()`). All top-level properties map to SQLite columns, with
|
|
47
|
+
* `required` properties marked as `NOT NULL`, and JSONSchema `default` will map
|
|
48
|
+
* to SQLite defaults.
|
|
49
|
+
*
|
|
50
|
+
* Any properties that are of type `object` or `array` in the JSONSchema will be
|
|
51
|
+
* mapped to a text field, which drizzle will parse and stringify. Types for
|
|
52
|
+
* `object` and `array` properties will be derived from `TObjectType`.
|
|
53
|
+
*/
|
|
54
|
+
type JsonSchemaToDrizzleColumns<TObjectType extends {
|
|
55
|
+
[K in keyof TSchema['properties']]?: any;
|
|
56
|
+
}, TSchema extends JSONSchema7Object, TPrimaryKey extends keyof TSchema['properties'] | undefined = undefined> = AddJSONSchemaDefaults<TSchema, AddJSONSchemaRequired<TSchema, SchemaToDrizzleColumnsBase<TSchema, TObjectType>>>;
|
|
73
57
|
/** Get the type of a JSONSchema string: array of constants for an enum,
|
|
74
58
|
otherwise string[]. Strangeness is to convert it into the format expected by
|
|
75
59
|
drizzle, which results in the correct type for the field from SQLite */
|
|
76
60
|
type Enum<T extends JSONSchema7, TEnum extends T['enum'] = T['enum']> = TEnum extends readonly [string, ...string[]] ? Writable<TEnum> : T['const'] extends string ? [T['const']] : [string, ...string[]];
|
|
77
61
|
/** True if JSONSchema object has a default */
|
|
78
|
-
type
|
|
62
|
+
type HasJSONSchemaDefault<T extends JSONSchema7> = T['default'] extends JSONSchema7Type ? true : false;
|
|
79
63
|
/** True if JSONSchema value is required */
|
|
80
|
-
type
|
|
64
|
+
type IsJSONSchemaRequired<T extends JSONSchema7Object, U extends string, V extends JSONSchema7['required'] = T['required']> = V extends readonly any[] ? Includes<V, U> : false;
|
|
81
65
|
/**
|
|
82
66
|
* Convert a JSONSchema to a Drizzle Columns map (e.g. parameter for
|
|
83
67
|
* `sqliteTable()`). All top-level properties map to SQLite columns, with
|
|
@@ -86,12 +70,35 @@ type IsRequired<T extends JSONSchema7WithProps, U extends string, V extends JSON
|
|
|
86
70
|
* the JSONSchema will be mapped to a text field, which drizzle will parse and
|
|
87
71
|
* stringify. Types for parsed JSON will be derived from MapeoDoc types.
|
|
88
72
|
*/
|
|
89
|
-
export type SchemaToDrizzleColumns<
|
|
73
|
+
export type SchemaToDrizzleColumns<TSchema extends JSONSchema7Object,
|
|
74
|
+
/** This is the type matching the JSONSchema */
|
|
75
|
+
TObjectType extends {
|
|
76
|
+
[K in keyof TSchema['properties']]?: any;
|
|
77
|
+
}, TPrimaryKey extends keyof TSchema['properties'] | undefined = undefined> = AddPrimaryKey<AddJSONSchemaDefaults<TSchema, AddJSONSchemaRequired<TSchema, SchemaToDrizzleColumnsBase<TSchema, TObjectType>>>, TPrimaryKey>;
|
|
78
|
+
/**
|
|
79
|
+
* Add `HasDefault` to columns if the JSONSchema has a default for that property
|
|
80
|
+
*/
|
|
81
|
+
type AddJSONSchemaDefaults<TJSONSchema extends JSONSchema7Object, TColumns extends Record<string, ColumnBuilderBase>, U extends JsonSchema7Properties = TJSONSchema['properties']> = {
|
|
82
|
+
[K in keyof TColumns]: K extends keyof U ? HasJSONSchemaDefault<U[K]> extends true ? HasDefault<TColumns[K]> : TColumns[K] : TColumns[K];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Mark columns as NotNull if they are required in the JSONSchema
|
|
86
|
+
*/
|
|
87
|
+
type AddJSONSchemaRequired<TJSONSchema extends JSONSchema7Object, TColumns extends Record<string, ColumnBuilderBase>> = {
|
|
88
|
+
[K in keyof TColumns]: K extends string ? IsJSONSchemaRequired<TJSONSchema, K> extends true ? NotNull<TColumns[K]> : TColumns[K] : TColumns[K];
|
|
89
|
+
};
|
|
90
|
+
type AddPrimaryKey<TColumns extends Record<string, ColumnBuilderBase>, TKey extends keyof TColumns | undefined> = TKey extends string ? Omit<TColumns, TKey> & {
|
|
91
|
+
[K in TKey]: IsPrimaryKey<TColumns[TKey]>;
|
|
92
|
+
} : TColumns;
|
|
93
|
+
/**
|
|
94
|
+
* Map JSONSchema object properties to Drizzle column types.
|
|
95
|
+
*/
|
|
96
|
+
type SchemaToDrizzleColumnsBase<TSchema extends JSONSchema7Object, TObjectType extends {
|
|
90
97
|
[K in keyof U]?: any;
|
|
91
|
-
}, U extends JsonSchema7Properties =
|
|
92
|
-
[K in keyof U]: K extends string ? U[K]['type'] extends 'string' ?
|
|
98
|
+
}, U extends JsonSchema7Properties = TSchema['properties']> = {
|
|
99
|
+
[K in keyof U]: K extends string ? U[K]['type'] extends 'string' ? SQLiteTextBuilder<Enum<U[K]>> : U[K]['type'] extends 'boolean' ? SQLiteBooleanBuilder : U[K]['type'] extends 'number' ? SQLiteRealBuilder : U[K]['type'] extends 'integer' ? SQLiteIntegerBuilder : U[K]['type'] extends 'array' | 'object' ? $Type<SQLiteTextJsonBuilder, TObjectType[K]> : never : never;
|
|
93
100
|
} & {
|
|
94
|
-
forks:
|
|
101
|
+
forks: $Type<SQLiteTextJsonBuilder, string[]>;
|
|
95
102
|
};
|
|
96
103
|
export type NonEmptyArray<T> = [T, ...T[]];
|
|
97
104
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EACL,WAAW,IAAI,mBAAmB,EAClC,eAAe,EAChB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EACL,WAAW,IAAI,mBAAmB,EAClC,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,i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** @import { MapeoDoc, Translation, TranslationValue } from '@comapeo/schema' */
|
|
2
2
|
/** @import { SetOptional } from 'type-fest' */
|
|
3
3
|
export const ktranslatedLanguageCodeToSchemaNames: unique symbol;
|
|
4
4
|
export default class TranslationApi {
|
|
@@ -38,9 +38,7 @@ export default class TranslationApi {
|
|
|
38
38
|
updatedAt: string;
|
|
39
39
|
links: string[];
|
|
40
40
|
deleted: boolean;
|
|
41
|
-
} &
|
|
42
|
-
forks: string[];
|
|
43
|
-
}>;
|
|
41
|
+
} & import("./datatype/index.js").DerivedDocFields>;
|
|
44
42
|
/** @typedef {SetOptional<TranslationValue['docRef'], 'versionId'>} DocRefWithOptionalVersionId */
|
|
45
43
|
/**
|
|
46
44
|
* @param {SetOptional<
|
|
@@ -58,196 +56,118 @@ export default class TranslationApi {
|
|
|
58
56
|
* @param {TranslationValue} doc
|
|
59
57
|
*/
|
|
60
58
|
index(doc: TranslationValue): void;
|
|
61
|
-
get dataType(): import("./datatype/index.js").DataType<import("./datastore/index.js").DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, import("
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
readonly schemaName:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
dataType: "custom";
|
|
141
|
-
columnType: "SQLiteCustomColumn";
|
|
142
|
-
data: string[];
|
|
143
|
-
driverParam: string;
|
|
144
|
-
notNull: true;
|
|
145
|
-
hasDefault: false;
|
|
146
|
-
enumValues: undefined;
|
|
147
|
-
baseColumn: never;
|
|
148
|
-
}, object>;
|
|
149
|
-
readonly deleted: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
150
|
-
name: "deleted";
|
|
151
|
-
tableName: "translation";
|
|
152
|
-
dataType: "boolean";
|
|
153
|
-
columnType: "SQLiteBoolean";
|
|
154
|
-
data: boolean;
|
|
155
|
-
driverParam: number;
|
|
156
|
-
notNull: true;
|
|
157
|
-
hasDefault: false;
|
|
158
|
-
enumValues: undefined;
|
|
159
|
-
baseColumn: never;
|
|
160
|
-
}, object>;
|
|
161
|
-
readonly docRef: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
162
|
-
name: "docRef";
|
|
163
|
-
tableName: "translation";
|
|
164
|
-
dataType: "custom";
|
|
165
|
-
columnType: "SQLiteCustomColumn";
|
|
166
|
-
data: {
|
|
167
|
-
docId: string;
|
|
168
|
-
versionId: string;
|
|
59
|
+
get dataType(): import("./datatype/index.js").DataType<import("./datastore/index.js").DataStore<"config", "translation" | "preset" | "field" | "projectSettings" | "deviceInfo" | "icon">, import("./schema/types.js").JsonSchemaToDrizzleSqliteTable<{
|
|
60
|
+
schemaName: "translation";
|
|
61
|
+
docRef: {
|
|
62
|
+
docId: string;
|
|
63
|
+
versionId: string;
|
|
64
|
+
};
|
|
65
|
+
docRefType: "type_unspecified" | "deviceInfo" | "preset" | "field" | "observation" | "projectSettings" | "role" | "track" | "UNRECOGNIZED";
|
|
66
|
+
propertyRef: string;
|
|
67
|
+
languageCode: string;
|
|
68
|
+
regionCode?: string | undefined;
|
|
69
|
+
message: string;
|
|
70
|
+
docId: string;
|
|
71
|
+
versionId: string;
|
|
72
|
+
originalVersionId: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
links: string[];
|
|
76
|
+
deleted: boolean;
|
|
77
|
+
}, {
|
|
78
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
79
|
+
readonly $id: "http://mapeo.world/schemas/translation/v1.json";
|
|
80
|
+
readonly description: "A translation is a translated message in a single language for a string property/field of any Mapeo record type";
|
|
81
|
+
readonly title: "translation";
|
|
82
|
+
readonly type: "object";
|
|
83
|
+
readonly properties: {
|
|
84
|
+
readonly docId: {
|
|
85
|
+
readonly description: "Hex-encoded 32-byte buffer";
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly minLength: 1;
|
|
88
|
+
};
|
|
89
|
+
readonly versionId: {
|
|
90
|
+
readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'";
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly minLength: 1;
|
|
93
|
+
};
|
|
94
|
+
readonly originalVersionId: {
|
|
95
|
+
readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`.";
|
|
96
|
+
readonly type: "string";
|
|
97
|
+
readonly minLength: 1;
|
|
98
|
+
};
|
|
99
|
+
readonly schemaName: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
readonly const: "translation";
|
|
102
|
+
};
|
|
103
|
+
readonly createdAt: {
|
|
104
|
+
readonly description: "RFC3339-formatted datetime of when the first version of the element was created";
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly format: "date-time";
|
|
107
|
+
};
|
|
108
|
+
readonly updatedAt: {
|
|
109
|
+
readonly description: "RFC3339-formatted datetime of when this version of the element was created";
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
readonly format: "date-time";
|
|
112
|
+
};
|
|
113
|
+
readonly links: {
|
|
114
|
+
readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'";
|
|
115
|
+
readonly type: "array";
|
|
116
|
+
readonly uniqueItems: true;
|
|
117
|
+
readonly items: {
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
readonly deleted: {
|
|
122
|
+
readonly description: "Indicates whether the document has been deleted";
|
|
123
|
+
readonly type: "boolean";
|
|
124
|
+
};
|
|
125
|
+
readonly docRef: {
|
|
126
|
+
readonly type: "object";
|
|
127
|
+
readonly properties: {
|
|
128
|
+
readonly docId: {
|
|
129
|
+
readonly description: "hex-encoded id of the element that this observation references";
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
readonly minLength: 1;
|
|
132
|
+
};
|
|
133
|
+
readonly versionId: {
|
|
134
|
+
readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'";
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
readonly minLength: 1;
|
|
137
|
+
};
|
|
169
138
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
readonly
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
baseColumn: never;
|
|
199
|
-
}, object>;
|
|
200
|
-
readonly languageCode: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
201
|
-
name: "languageCode";
|
|
202
|
-
tableName: "translation";
|
|
203
|
-
dataType: "string";
|
|
204
|
-
columnType: "SQLiteText";
|
|
205
|
-
data: string;
|
|
206
|
-
driverParam: string;
|
|
207
|
-
notNull: true;
|
|
208
|
-
hasDefault: false;
|
|
209
|
-
enumValues: [string, ...string[]];
|
|
210
|
-
baseColumn: never;
|
|
211
|
-
}, object>;
|
|
212
|
-
readonly regionCode: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
213
|
-
name: "regionCode";
|
|
214
|
-
tableName: "translation";
|
|
215
|
-
dataType: "string";
|
|
216
|
-
columnType: "SQLiteText";
|
|
217
|
-
data: string;
|
|
218
|
-
driverParam: string;
|
|
219
|
-
notNull: false;
|
|
220
|
-
hasDefault: false;
|
|
221
|
-
enumValues: [string, ...string[]];
|
|
222
|
-
baseColumn: never;
|
|
223
|
-
}, object>;
|
|
224
|
-
readonly message: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
225
|
-
name: "message";
|
|
226
|
-
tableName: "translation";
|
|
227
|
-
dataType: "string";
|
|
228
|
-
columnType: "SQLiteText";
|
|
229
|
-
data: string;
|
|
230
|
-
driverParam: string;
|
|
231
|
-
notNull: true;
|
|
232
|
-
hasDefault: false;
|
|
233
|
-
enumValues: [string, ...string[]];
|
|
234
|
-
baseColumn: never;
|
|
235
|
-
}, object>;
|
|
236
|
-
forks: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
237
|
-
name: "forks";
|
|
238
|
-
tableName: "translation";
|
|
239
|
-
dataType: "custom";
|
|
240
|
-
columnType: "SQLiteCustomColumn";
|
|
241
|
-
data: string[];
|
|
242
|
-
driverParam: string;
|
|
243
|
-
notNull: true;
|
|
244
|
-
hasDefault: false;
|
|
245
|
-
enumValues: undefined;
|
|
246
|
-
baseColumn: never;
|
|
247
|
-
}, object>;
|
|
139
|
+
readonly required: readonly ["docId", "versionId"];
|
|
140
|
+
};
|
|
141
|
+
readonly docRefType: {
|
|
142
|
+
readonly description: "type of the element that this translation references";
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
readonly enum: readonly ["type_unspecified", "deviceInfo", "preset", "field", "observation", "projectSettings", "role", "track", "UNRECOGNIZED"];
|
|
145
|
+
};
|
|
146
|
+
readonly propertyRef: {
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
readonly description: "identifier for translated field/property in dot-prop notation";
|
|
149
|
+
readonly minLength: 1;
|
|
150
|
+
};
|
|
151
|
+
readonly languageCode: {
|
|
152
|
+
readonly type: "string";
|
|
153
|
+
readonly description: "three-letter ISO 169-3 language code";
|
|
154
|
+
readonly minLength: 1;
|
|
155
|
+
readonly maxLength: 3;
|
|
156
|
+
};
|
|
157
|
+
readonly regionCode: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly description: "two-letter country code from ISO 3166-1 alpha-2 or a three-digit code from UN M.49 for geographical regions";
|
|
160
|
+
readonly minLength: 2;
|
|
161
|
+
readonly maxLength: 3;
|
|
162
|
+
};
|
|
163
|
+
readonly message: {
|
|
164
|
+
readonly type: "string";
|
|
165
|
+
readonly description: "the translated string";
|
|
166
|
+
};
|
|
248
167
|
};
|
|
249
|
-
|
|
250
|
-
|
|
168
|
+
readonly required: readonly ["schemaName", "docRef", "docRefType", "propertyRef", "languageCode", "message", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"];
|
|
169
|
+
readonly additionalProperties: false;
|
|
170
|
+
}, "translation", import("./schema/comapeo-to-drizzle.js").AdditionalColumns, "docId">, "translation", {
|
|
251
171
|
schemaName: "translation";
|
|
252
172
|
docRef: {
|
|
253
173
|
docId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-api.d.ts","sourceRoot":"","sources":["../src/translation-api.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translation-api.d.ts","sourceRoot":"","sources":["../src/translation-api.js"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,+CAA+C;AAE/C,iEAEC;AACD;IAWE;;;;;;;;;OASG;IACH,0BARG;QAMS,QAAQ,EANT,OAAO,qBAAqB,EAAE,QAAQ,CAChD,OAAW,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,EACtD,cAAkB,qBAAqB,EAAE,gBAAgB,EACzD,aAAiB,EACjB,WAAe,EACf,gBAAoB,CACjB;KACH,EAWA;IAED,+BAA+B;IAC/B,SADc,OAAO,CAAC,IAAI,CAAC,CAG1B;IAED;;OAEG;IACH,WAFW,gBAAgB;;;;;;;;;;;;;;;;;;wDAW1B;IAED,kGAAkG;IAElG;;;;;OAKG;IACH,WALW,YACR,IAAI,CAAC,gBAAgB,EAAC,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC,EAC5D,aAAe,GAAG,YAAY,CAAC,GAAG;QAAC,MAAM;;;UAA6B;KAAC,GAC3D,OAAO,CAAC,OAAO,iBAAiB,EAAE,WAAW,EAAE,CAAC,CAqE5D;IAED;;OAEG;IACH,WAFW,gBAAgB,QAqB1B;IAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAEC;IALD,mHAEC;;CAIF;sCAnL4D,iBAAiB;iCAC7C,WAAW;iCADiB,iBAAiB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Simplify, TupleToUnion, ValueOf, RequireAtLeastOne
|
|
1
|
+
import type { Simplify, TupleToUnion, ValueOf, RequireAtLeastOne } from 'type-fest';
|
|
2
2
|
import { SUPPORTED_BLOB_VARIANTS } from './blob-store/index.js';
|
|
3
3
|
import { MapeoCommon, MapeoDoc, MapeoValue, Observation, decode } from '@comapeo/schema';
|
|
4
4
|
import type BigSparseArray from 'big-sparse-array';
|
|
@@ -46,13 +46,6 @@ export type CoreOwnershipWithSignatures = Extract<ReturnType<typeof decode>, {
|
|
|
46
46
|
schemaName: 'coreOwnership';
|
|
47
47
|
}>;
|
|
48
48
|
export type CoreOwnershipWithSignaturesValue = Omit<CoreOwnershipWithSignatures, Exclude<keyof MapeoCommon, 'schemaName'>>;
|
|
49
|
-
type NullToOptional<T> = SetOptional<T, NullKeys<T>>;
|
|
50
|
-
type RemoveNull<T> = {
|
|
51
|
-
[K in keyof T]: Exclude<T[K], null>;
|
|
52
|
-
};
|
|
53
|
-
type NullKeys<Base> = NonNullable<{
|
|
54
|
-
[Key in keyof Base]: null extends Base[Key] ? Key : never;
|
|
55
|
-
}[keyof Base]>;
|
|
56
49
|
/**
|
|
57
50
|
* Replace an object's `Buffer` values with `string`s. Useful for serialization.
|
|
58
51
|
*/
|
|
@@ -65,7 +58,14 @@ export type MapBuffers<T> = {
|
|
|
65
58
|
* top-level optional props set to `null`) to the original types in
|
|
66
59
|
* @comapeo/schema
|
|
67
60
|
*/
|
|
68
|
-
export type NullableToOptional<T> = Simplify<
|
|
61
|
+
export type NullableToOptional<T> = Simplify<{
|
|
62
|
+
[K in keyof T as null extends T[K] ? K : never]?: Exclude<T[K], null>;
|
|
63
|
+
} & {
|
|
64
|
+
[K in keyof T as null extends T[K] ? never : K]: T[K];
|
|
65
|
+
}>;
|
|
66
|
+
export type OptionalToNullable<T> = Simplify<{
|
|
67
|
+
[K in keyof T]-?: T[K] | (undefined extends T[K] ? null : never);
|
|
68
|
+
}>;
|
|
69
69
|
export type KeyPair = {
|
|
70
70
|
publicKey: PublicKey;
|
|
71
71
|
secretKey: SecretKey;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAA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