Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: remove isInitialProject project setting #828

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ -537,10 +537,9 @@
}

return extractEditableProjectSettings(
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
Loading