@marcoappio/marco-config 4.0.16 → 4.0.18
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/appwrite/appwrite.d.ts +557 -561
- package/dist/appwrite/appwrite.d.ts.map +1 -1
- package/dist/appwrite/appwrite.js +4 -7
- package/dist/appwrite/appwrite.test.js +2 -1
- package/dist/appwrite/commands.d.ts +20 -20
- package/dist/appwrite/commands.js +5 -5
- package/dist/appwrite/commands.test.js +3 -3
- package/dist/appwrite/decodedSchemas.js +2 -2
- package/dist/appwrite/functions.d.ts +10 -10
- package/dist/appwrite/functions.js +6 -6
- package/dist/appwrite/functions.test.js +1 -1
- package/dist/appwrite/index.d.ts +5 -3
- package/dist/appwrite/index.d.ts.map +1 -1
- package/dist/appwrite/index.js +4 -3
- package/dist/appwrite/tableContract/identity.d.ts +62 -297
- package/dist/appwrite/tableContract/identity.d.ts.map +1 -1
- package/dist/appwrite/tableContract/identity.js +122 -146
- package/dist/appwrite/tableContract/index.d.ts +726 -818
- package/dist/appwrite/tableContract/index.d.ts.map +1 -1
- package/dist/appwrite/tableContract/index.js +23 -10
- package/dist/appwrite/tableContract/index.test.js +40 -4
- package/dist/appwrite/tableContract/mailbox.d.ts +88 -411
- package/dist/appwrite/tableContract/mailbox.d.ts.map +1 -1
- package/dist/appwrite/tableContract/mailbox.js +159 -180
- package/dist/appwrite/tableContract/operational.d.ts +76 -351
- package/dist/appwrite/tableContract/operational.d.ts.map +1 -1
- package/dist/appwrite/tableContract/operational.js +154 -178
- package/dist/appwrite/tableContract/shared.d.ts +14 -7
- package/dist/appwrite/tableContract/shared.d.ts.map +1 -1
- package/dist/appwrite/tableContract/shared.js +2 -2
- package/dist/constants/emailProvider.js +1 -1
- package/dist/constants/index.js +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.test.js +67 -6
- package/dist/schemas/app.js +1 -1
- package/dist/schemas/auth.js +1 -1
- package/dist/schemas/emailAccount.d.ts +1 -1
- package/dist/schemas/emailAccount.js +5 -5
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.js +9 -9
- package/dist/schemas/models/account.js +4 -4
- package/dist/schemas/models/contact.js +2 -2
- package/dist/schemas/models/draft.js +4 -4
- package/dist/schemas/models/index.d.ts +5 -5
- package/dist/schemas/models/index.js +5 -5
- package/dist/schemas/models/mailboxAddress.test.js +3 -3
- package/dist/schemas/models/numericSemantics.test.js +2 -2
- package/dist/schemas/models/thread.js +5 -5
- package/dist/schemas/models/user.d.ts +1 -1
- package/dist/schemas/models/user.js +3 -3
- package/dist/schemas/models/user.test.js +2 -2
- package/dist/schemas/number.js +1 -1
- package/dist/schemas/oauth.js +1 -1
- package/dist/schemas/pushNotifications.js +1 -1
- package/dist/schemas/scalars.test.js +2 -2
- package/dist/schemas/schemaValues.test.js +1 -1
- package/dist/schemas/string.js +1 -1
- package/dist/types/IMAPSourceLocation.d.ts +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.js +11 -11
- package/dist/utils/accounts/index.d.ts +1 -1
- package/dist/utils/accounts/index.js +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/labels/index.d.ts +1 -1
- package/dist/utils/threads/index.d.ts +2 -2
- package/dist/utils/threads/index.js +2 -2
- package/dist/utils/threads/parseLabelIdList/parseLabelIdList.test.js +1 -1
- package/dist/utils/threads/processSearchTerm/processSearchTerm.test.js +1 -1
- package/package.json +15 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/appwrite/tableContract/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAK5B,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAItB,MAAM,UAAU,CAAA;AA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BAAgB,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE7G,YAAY,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import { identityTableInputs } from './identity';
|
|
3
|
-
import { mailboxTableInputs } from './mailbox';
|
|
4
|
-
import { operationalTableInputs } from './operational';
|
|
5
|
-
import { appwriteIds, appwriteRowIdSchema, identifierSchema, isoTimestampSchema, } from './shared';
|
|
6
|
-
export * from './shared';
|
|
2
|
+
import { identityTableInputs } from './identity.js';
|
|
3
|
+
import { mailboxTableInputs } from './mailbox.js';
|
|
4
|
+
import { operationalTableInputs } from './operational.js';
|
|
5
|
+
import { appwriteIds, appwriteRowIdSchema, identifierSchema, isoTimestampSchema, } from './shared.js';
|
|
6
|
+
export * from './shared.js';
|
|
7
7
|
const appwriteTableInputs = {
|
|
8
8
|
...identityTableInputs,
|
|
9
9
|
...mailboxTableInputs,
|
|
10
10
|
...operationalTableInputs,
|
|
11
11
|
};
|
|
12
|
-
const materialiseTable = (table) => {
|
|
12
|
+
const materialiseTable = (key, id, table) => {
|
|
13
13
|
const columns = Object.entries(table.fields).flatMap(([key, field]) => {
|
|
14
14
|
if ('relatedTable' in field.definition) {
|
|
15
15
|
return [];
|
|
@@ -31,9 +31,9 @@ const materialiseTable = (table) => {
|
|
|
31
31
|
});
|
|
32
32
|
return {
|
|
33
33
|
columns,
|
|
34
|
-
id
|
|
34
|
+
id,
|
|
35
35
|
indexes: table.indexes,
|
|
36
|
-
key
|
|
36
|
+
key,
|
|
37
37
|
name: table.name,
|
|
38
38
|
relationships,
|
|
39
39
|
};
|
|
@@ -55,6 +55,13 @@ function createDataSchema(fields, dataCheck) {
|
|
|
55
55
|
return schema;
|
|
56
56
|
}
|
|
57
57
|
const createRowSchema = (fields, tableId, wirePermissions) => v.strictObject({ ...wireMetadata(tableId, wirePermissions), ...fields });
|
|
58
|
+
const isAppwriteTableKey = (tableKey) => Object.hasOwn(appwriteIds.tables, tableKey);
|
|
59
|
+
const appwriteTableIdentity = (tableKey) => {
|
|
60
|
+
if (isAppwriteTableKey(tableKey)) {
|
|
61
|
+
return { id: appwriteIds.tables[tableKey], key: tableKey };
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`Unknown Appwrite table key: ${tableKey}`);
|
|
64
|
+
};
|
|
58
65
|
export function defineAppwriteTables(tables) {
|
|
59
66
|
const createDataSchemaForTable = (fields, dataCheck) => {
|
|
60
67
|
if (dataCheck) {
|
|
@@ -63,8 +70,14 @@ export function defineAppwriteTables(tables) {
|
|
|
63
70
|
return createDataSchema(fields);
|
|
64
71
|
};
|
|
65
72
|
const dataSchemas = Object.fromEntries(Object.entries(tables).map(([tableKey, table]) => [tableKey, createDataSchemaForTable(table.fields, table.dataCheck)]));
|
|
66
|
-
const rowSchemas = Object.fromEntries(Object.entries(tables).map(([tableKey, table]) =>
|
|
67
|
-
|
|
73
|
+
const rowSchemas = Object.fromEntries(Object.entries(tables).map(([tableKey, table]) => {
|
|
74
|
+
const { id } = appwriteTableIdentity(tableKey);
|
|
75
|
+
return [tableKey, createRowSchema(table.fields, id, table.wirePermissions)];
|
|
76
|
+
}));
|
|
77
|
+
const tableDefinitions = Object.fromEntries(Object.entries(tables).map(([tableKey, table]) => {
|
|
78
|
+
const { id, key } = appwriteTableIdentity(tableKey);
|
|
79
|
+
return [tableKey, materialiseTable(key, id, table)];
|
|
80
|
+
}));
|
|
68
81
|
return {
|
|
69
82
|
dataSchemas,
|
|
70
83
|
rowSchemas,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
-
import { identityTableInputs } from './identity';
|
|
4
|
-
import { defineAppwriteTables } from './index';
|
|
5
|
-
import { mailboxTableInputs } from './mailbox';
|
|
6
|
-
import { operationalTableInputs } from './operational';
|
|
3
|
+
import { identityTableInputs } from './identity.js';
|
|
4
|
+
import { defineAppwriteTables } from './index.js';
|
|
5
|
+
import { mailboxTableInputs } from './mailbox.js';
|
|
6
|
+
import { operationalTableInputs } from './operational.js';
|
|
7
|
+
import { appwriteColumnDefinitions, appwriteIds, appwriteRelationship, appwriteRelationshipIdSchema, defineAppwriteTableGroup, identifierSchema } from './shared.js';
|
|
7
8
|
const tableInputs = {
|
|
8
9
|
...identityTableInputs,
|
|
9
10
|
...mailboxTableInputs,
|
|
@@ -29,6 +30,33 @@ const validAccount = {
|
|
|
29
30
|
state: 'CONNECTED',
|
|
30
31
|
};
|
|
31
32
|
describe('defineAppwriteTables', () => {
|
|
33
|
+
it('constrains table group keys and index attributes at compile time', () => {
|
|
34
|
+
const fields = {
|
|
35
|
+
email: appwriteColumnDefinitions.string(identifierSchema),
|
|
36
|
+
profile: appwriteRelationship(appwriteRelationshipIdSchema, 'profiles'),
|
|
37
|
+
};
|
|
38
|
+
defineAppwriteTableGroup({
|
|
39
|
+
// @ts-expect-error unknown table keys are rejected
|
|
40
|
+
profile: { fields, indexes: [], name: 'Profile' },
|
|
41
|
+
});
|
|
42
|
+
defineAppwriteTableGroup({
|
|
43
|
+
profiles: {
|
|
44
|
+
fields,
|
|
45
|
+
// @ts-expect-error unknown fields are rejected
|
|
46
|
+
indexes: [{ attributes: ['missing'], name: 'missing', type: 'key' }],
|
|
47
|
+
name: 'Profiles',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
defineAppwriteTableGroup({
|
|
51
|
+
profiles: {
|
|
52
|
+
fields,
|
|
53
|
+
// @ts-expect-error relationship fields are rejected
|
|
54
|
+
indexes: [{ attributes: ['profile'], name: 'profile', type: 'key' }],
|
|
55
|
+
name: 'Profiles',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
expect(true).toBe(true);
|
|
59
|
+
});
|
|
32
60
|
it('applies each supplied table data check to its generated data schema', () => {
|
|
33
61
|
const contract = defineAppwriteTables({
|
|
34
62
|
...tableInputs,
|
|
@@ -44,5 +72,13 @@ describe('defineAppwriteTables', () => {
|
|
|
44
72
|
expect(Object.keys(contract.dataSchemas).sort()).toEqual(Object.keys(tableInputs).sort());
|
|
45
73
|
expect(Object.keys(contract.rowSchemas).sort()).toEqual(Object.keys(tableInputs).sort());
|
|
46
74
|
expect(Object.keys(contract.tables).sort()).toEqual(Object.keys(tableInputs).sort());
|
|
75
|
+
expect(Object.fromEntries(Object.entries(contract.tables).map(([key, table]) => [key, table.id]))).toEqual(appwriteIds.tables);
|
|
76
|
+
expect(Object.entries(contract.tables).every(([key, table]) => table.key === key)).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
it('rejects inherited object property names as table keys', () => {
|
|
79
|
+
expect(() => defineAppwriteTables({
|
|
80
|
+
...tableInputs,
|
|
81
|
+
toString: tableInputs.accounts,
|
|
82
|
+
})).toThrow('Unknown Appwrite table key: toString');
|
|
47
83
|
});
|
|
48
84
|
});
|