Skip to content

Commit

Permalink
chore!: remove isInitialProject project setting
Browse files Browse the repository at this point in the history
Required after a change to the schema. See
<digidem/comapeo-schema#253>.
  • Loading branch information
EvanHahn committed Sep 16, 2024
1 parent 745604a commit bc419c8
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CREATE TABLE `projectSettings` (
`name` text,
`defaultPresets` text,
`configMetadata` text,
`isInitialProject` integer NOT NULL,
`forks` text NOT NULL
);
--> statement-breakpoint
Expand Down
9 changes: 1 addition & 8 deletions drizzle/client/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "41e23fc3-463e-432a-9a5f-7c20366d6294",
"id": "70f3b09a-a450-43f6-800a-1693b37c2ecb",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"localDeviceInfo": {
Expand Down Expand Up @@ -176,13 +176,6 @@
"notNull": false,
"autoincrement": false
},
"isInitialProject": {
"name": "isInitialProject",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"forks": {
"name": "forks",
"type": "text",
Expand Down
4 changes: 2 additions & 2 deletions drizzle/client/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1725381616476,
"tag": "0000_chemical_star_brand",
"when": 1726451496091,
"tag": "0000_furry_sebastian_shaw",
"breakpoints": true
}
]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion drizzle/project/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "b06de2c5-6a4c-4578-a8f0-d15f9f20e902",
"id": "9979bd60-29d8-4bb5-a843-62a88650755d",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"coreOwnership_backlink": {
Expand Down
4 changes: 2 additions & 2 deletions drizzle/project/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1725381611574,
"tag": "0000_tan_glorian",
"when": 1726451493242,
"tag": "0000_confused_lady_bullseye",
"breakpoints": true
}
]
Expand Down
10 changes: 3 additions & 7 deletions src/mapeo-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,13 @@ export class MapeoManager extends TypedEmitter {
* Create a new project.
* @param {(
* import('type-fest').Simplify<(
* Partial<Pick<ProjectValue, 'name' | 'isInitialProject'>> &
* Partial<Pick<ProjectValue, 'name'>> &
* { configPath?: string }
* )>
* )} [options]
* @returns {Promise<string>} Project public id
*/
async createProject({
name,
configPath = this.#defaultConfigPath,
isInitialProject = false,
} = {}) {
async createProject({ name, configPath = this.#defaultConfigPath } = {}) {
// 1. Create project keypair
const projectKeypair = KeyManager.generateProjectKeypair()

Expand Down Expand Up @@ -406,7 +402,7 @@ export class MapeoManager extends TypedEmitter {
})

// 5. Write project settings to project instance
await project.$setProjectSettings({ name, isInitialProject })
await project.$setProjectSettings({ name })

// 6. Write device info into project
const deviceInfo = this.getDeviceInfo()
Expand Down
1 change: 0 additions & 1 deletion src/mapeo-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ export class MapeoProject extends TypedEmitter {
await projectSettings[kCreateWithDocId](this.#projectId, {

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.

Check failure on line 540 in src/mapeo-project.js

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20.x)

Argument of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject?: boolean | undefined; }' is not assignable to parameter of type '{ schemaName: "projectSettings"; name?: string | undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } | undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } | undefined; isInitialProject: boolean; } | CoreOwnershipWithSignaturesValue'.
...settings,
schemaName: 'projectSettings',
isInitialProject: Boolean(settings.isInitialProject),
})
)
}
Expand Down
7 changes: 1 addition & 6 deletions test-e2e/manager-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ test('Managing created projects', async (t) => {
})

const project1Id = await manager.createProject()
const project2Id = await manager.createProject({
name: 'project 2',
isInitialProject: true,
})
const project2Id = await manager.createProject({ name: 'project 2' })

await t.test('initial information from listed projects', async () => {
const listedProjects = await manager.listProjects()
Expand Down Expand Up @@ -70,7 +67,6 @@ test('Managing created projects', async (t) => {
name: undefined,
defaultPresets: undefined,
configMetadata: undefined,
isInitialProject: false,
},
'undefined name and default presets for project1'
)
Expand All @@ -80,7 +76,6 @@ test('Managing created projects', async (t) => {
name: 'project 2',
defaultPresets: undefined,
configMetadata: undefined,
isInitialProject: true,
},
'matched name for project2 with undefined default presets'
)
Expand Down
4 changes: 2 additions & 2 deletions test-e2e/project-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ test('Project settings create, read, and update operations', async () => {

assert.deepEqual(
removeUndefinedFields(initialSettings),
{ isInitialProject: false },
'project has no settings, other than "is initial project?", after creation'
{},
'project has no settings after creation'
)

const expectedSettings = {
Expand Down

0 comments on commit bc419c8

Please sign in to comment.