From b0a1be902db09e65a45a78170aa8d92222541676 Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Thu, 17 Sep 2020 17:22:40 -0300 Subject: [PATCH 001/189] fixes and changes --- packages/spec/specs/components/activity.yaml | 27 ++- packages/spec/specs/components/user.yaml | 49 +++-- packages/spec/specs/openapi.yaml | 197 +++++++++--------- .../spec/specs/paths/activity/activities.yaml | 30 +++ .../paths/activity/activity-comment.yaml | 33 +-- .../paths/activity/activity-comments.yaml | 18 +- .../spec/specs/paths/activity/activity.yaml | 23 +- .../spec/specs/paths/activity/activitys.yaml | 30 --- packages/spec/specs/paths/assets/assets.yaml | 8 +- packages/spec/specs/paths/auth/login.yaml | 14 +- .../specs/paths/auth/password-request.yaml | 6 +- .../spec/specs/paths/auth/password-reset.yaml | 6 +- packages/spec/specs/paths/auth/refresh.yaml | 16 +- .../spec/specs/paths/auth/sso-provider.yaml | 8 +- packages/spec/specs/paths/auth/sso.yaml | 6 +- .../specs/paths/collections/collection.yaml | 46 ++-- .../specs/paths/collections/collections.yaml | 38 ++-- .../specs/paths/extensions/interfaces.yaml | 12 +- .../spec/specs/paths/extensions/layouts.yaml | 12 +- .../spec/specs/paths/extensions/modules.yaml | 12 +- .../specs/paths/fields/collection-field.yaml | 44 ++-- .../specs/paths/fields/collection-fields.yaml | 36 ++-- packages/spec/specs/paths/fields/fields.yaml | 18 +- packages/spec/specs/paths/files/file.yaml | 24 +-- packages/spec/specs/paths/files/files.yaml | 16 +- packages/spec/specs/paths/files/revision.yaml | 10 +- .../spec/specs/paths/files/revisions.yaml | 10 +- packages/spec/specs/paths/folders/folder.yaml | 50 ++--- .../spec/specs/paths/folders/folders.yaml | 48 ++--- packages/spec/specs/paths/items/item.yaml | 42 ++-- packages/spec/specs/paths/items/items.yaml | 34 +-- packages/spec/specs/paths/mail/mail.yaml | 12 +- .../specs/paths/permissions/permission.yaml | 48 ++--- .../permissions-me-collection.yaml | 16 +- .../paths/permissions/permissions-me.yaml | 14 +- .../specs/paths/permissions/permissions.yaml | 50 ++--- packages/spec/specs/paths/presets/preset.yaml | 38 ++-- .../spec/specs/paths/presets/presets.yaml | 44 ++-- .../spec/specs/paths/relations/relation.yaml | 56 ++--- .../spec/specs/paths/relations/relations.yaml | 50 ++--- .../spec/specs/paths/revisions/revision.yaml | 20 +- .../spec/specs/paths/revisions/revisions.yaml | 32 +-- packages/spec/specs/paths/roles/role.yaml | 53 ++--- packages/spec/specs/paths/roles/roles.yaml | 53 ++--- packages/spec/specs/paths/scim/group.yaml | 38 ++-- packages/spec/specs/paths/scim/groups.yaml | 65 +++--- packages/spec/specs/paths/scim/user.yaml | 69 +++--- packages/spec/specs/paths/scim/users.yaml | 29 +-- packages/spec/specs/paths/server/info.yaml | 24 +-- .../spec/specs/paths/settings/setting.yaml | 46 ++-- .../spec/specs/paths/settings/settings.yaml | 48 ++--- packages/spec/specs/paths/users/me.yaml | 18 +- .../specs/paths/users/user-invite-token.yaml | 14 +- .../spec/specs/paths/users/user-invite.yaml | 17 +- .../spec/specs/paths/users/user-tracking.yaml | 17 +- packages/spec/specs/paths/users/user.yaml | 50 ++--- packages/spec/specs/paths/users/users.yaml | 48 ++--- .../spec/specs/paths/webhooks/webhooks.yaml | 14 +- 58 files changed, 970 insertions(+), 936 deletions(-) create mode 100644 packages/spec/specs/paths/activity/activities.yaml delete mode 100644 packages/spec/specs/paths/activity/activitys.yaml diff --git a/packages/spec/specs/components/activity.yaml b/packages/spec/specs/components/activity.yaml index b42843f34f..0b61752148 100644 --- a/packages/spec/specs/components/activity.yaml +++ b/packages/spec/specs/components/activity.yaml @@ -8,15 +8,25 @@ properties: description: Action that was performed. example: update type: string - enum: [authenticate, comment, upload, create, update, delete, soft-delete, revert, invalid-credentials] + enum: + [ + authenticate, + comment, + upload, + create, + update, + delete, + soft-delete, + revert, + invalid-credentials, + ] action_by: - description: Unique identifier of the user account who caused this action. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - type: string + $ref: "./user.yaml" + description: The user who caused this action. nullable: true # States the SQL structure action_on: description: When the action happened. - example: '2019-12-05 22:52:09' + example: "2019-12-05 22:52:09" type: string format: date-time ip: @@ -37,11 +47,12 @@ properties: type: string item: description: Unique identifier for the item the action applied to. This is always a string, even for integer primary keys. - example: '328' + example: "328" type: string comment: - description: User comment. This will store the comments that show up in the right + description: + User comment. This will store the comments that show up in the right sidebar of the item edit page in the admin app. example: null type: string - nullable: true \ No newline at end of file + nullable: true diff --git a/packages/spec/specs/components/user.yaml b/packages/spec/specs/components/user.yaml index aee4d712c2..d1eb942c50 100644 --- a/packages/spec/specs/components/user.yaml +++ b/packages/spec/specs/components/user.yaml @@ -1,5 +1,31 @@ type: object properties: + id: + description: Unique identifier for the user. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + type: string + first_name: + description: First name of the user. + example: Admin + type: string + last_name: + description: First name of the user. + example: User + type: string + email: + description: Unique email address for the user. + example: admin@example.com + type: string + format: email + password: + description: Password of the user. + example: "*********" + type: string + location: + description: Location of the user. + example: null + type: string + nullable: true tfa_secret: description: The 2FA secret string that's used to generate one time passwords. example: null @@ -12,36 +38,19 @@ properties: - type: integer nullable: true - type: string - - $ref: '../openapi.yaml#/components/schemas/File' + - $ref: "../openapi.yaml#/components/schemas/File" nullable: true - email: - description: Unique email address for the user. - example: admin@example.com - type: string - format: email external_id: description: ID used for SCIM. example: null type: string nullable: true - first_name: - description: First name of the user. - example: Admin - type: string - id: - description: Unique identifier for the user. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - type: string last_login: description: When this user logged in last. - example: '2020-05-31 14:32:37' + example: "2020-05-31 14:32:37" type: string nullable: true format: date-time - last_name: - description: First name of the user. - example: User - type: string last_page: description: Last page that the user was on. example: /my-project/settings/collections/a @@ -73,4 +82,4 @@ properties: description: The user's title. example: null type: string - nullable: true \ No newline at end of file + nullable: true diff --git a/packages/spec/specs/openapi.yaml b/packages/spec/specs/openapi.yaml index 0df514aa82..5c0597253b 100644 --- a/packages/spec/specs/openapi.yaml +++ b/packages/spec/specs/openapi.yaml @@ -6,14 +6,14 @@ info: email: contact@directus.io license: name: GPL-3.0 - url: 'https://www.gnu.org/licenses/gpl-3.0.de.html' + url: "https://www.gnu.org/licenses/gpl-3.0.de.html" version: 1.0.0 externalDocs: description: Directus Docs - url: 'https://docs.directus.io' + url: "https://docs.directus.io" servers: - - url: 'https://demo.directus.io/' - - url: '/' + - url: "https://demo.directus.io/" + - url: "/" tags: - name: Activity description: All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens. @@ -60,233 +60,232 @@ tags: - name: Webhooks description: Webhooks. paths: - # Activity /activity: - $ref: './paths/activity/activitys.yaml' + $ref: "./paths/activity/activities.yaml" /activity/comment: - $ref: './paths/activity/activity-comments.yaml' + $ref: "./paths/activity/activity-comments.yaml" /activity/{id}: - $ref: './paths/activity/activity.yaml' + $ref: "./paths/activity/activity.yaml" /activity/comment/{id}: - $ref: './paths/activity/activity-comment.yaml' + $ref: "./paths/activity/activity-comment.yaml" # Assets /assets/{key}: - $ref: './paths/assets/assets.yaml' + $ref: "./paths/assets/assets.yaml" # Authentication /auth/login: - $ref: './paths/auth/login.yaml' + $ref: "./paths/auth/login.yaml" /auth/refresh: - $ref: './paths/auth/refresh.yaml' + $ref: "./paths/auth/refresh.yaml" /auth/logout: - $ref: './paths/auth/logout.yaml' + $ref: "./paths/auth/logout.yaml" /auth/password/request: - $ref: './paths/auth/password-request.yaml' + $ref: "./paths/auth/password-request.yaml" /auth/password/reset: - $ref: './paths/auth/password-reset.yaml' + $ref: "./paths/auth/password-reset.yaml" /auth/sso: - $ref: './paths/auth/sso.yaml' + $ref: "./paths/auth/sso.yaml" /auth/sso/{provider}: - $ref: './paths/auth/sso-provider.yaml' + $ref: "./paths/auth/sso-provider.yaml" # Items /items/{collection}: - $ref: './paths/items/items.yaml' + $ref: "./paths/items/items.yaml" /items/{collection}/{id}: - $ref: './paths/items/item.yaml' + $ref: "./paths/items/item.yaml" # Presets /presets: - $ref: './paths/presets/presets.yaml' + $ref: "./paths/presets/presets.yaml" /presets/{id}: - $ref: './paths/presets/preset.yaml' + $ref: "./paths/presets/preset.yaml" # Collections /collections: - $ref: './paths/collections/collections.yaml' + $ref: "./paths/collections/collections.yaml" /collections/{collection}: - $ref: './paths/collections/collection.yaml' - + $ref: "./paths/collections/collection.yaml" + # Extensions /interfaces: - $ref: './paths/extensions/interfaces.yaml' + $ref: "./paths/extensions/interfaces.yaml" /layouts: - $ref: './paths/extensions/layouts.yaml' + $ref: "./paths/extensions/layouts.yaml" /modules: - $ref: './paths/extensions/modules.yaml' + $ref: "./paths/extensions/modules.yaml" # Fields /fields: - $ref: './paths/fields/fields.yaml' + $ref: "./paths/fields/fields.yaml" /fields/{collection}: - $ref: './paths/fields/collection-fields.yaml' + $ref: "./paths/fields/collection-fields.yaml" /fields/{collection}/{field}: - $ref: './paths/fields/collection-field.yaml' + $ref: "./paths/fields/collection-field.yaml" # Files /files: - $ref: './paths/files/files.yaml' + $ref: "./paths/files/files.yaml" /files/{id}: - $ref: './paths/files/file.yaml' + $ref: "./paths/files/file.yaml" /files/{id}/revisions: - $ref: './paths/files/revisions.yaml' + $ref: "./paths/files/revisions.yaml" /files/{id}/revisions/{offset}: - $ref: './paths/files/revision.yaml' + $ref: "./paths/files/revision.yaml" # Folders /folders: - $ref: './paths/folders/folders.yaml' + $ref: "./paths/folders/folders.yaml" /folders/{id}: - $ref: './paths/folders/folder.yaml' + $ref: "./paths/folders/folder.yaml" # Mail /mail: - $ref: './paths/mail/mail.yaml' + $ref: "./paths/mail/mail.yaml" # Permissions /permissions: - $ref: './paths/permissions/permissions.yaml' + $ref: "./paths/permissions/permissions.yaml" /permissions/me: - $ref: './paths/permissions/permissions-me.yaml' + $ref: "./paths/permissions/permissions-me.yaml" /permissions/{id}: - $ref: './paths/permissions/permission.yaml' + $ref: "./paths/permissions/permission.yaml" /permissions/me/{collection}: - $ref: './paths/permissions/permissions-me-collection.yaml' + $ref: "./paths/permissions/permissions-me-collection.yaml" # Relations /relations: - $ref: './paths/relations/relations.yaml' + $ref: "./paths/relations/relations.yaml" /relations/{id}: - $ref: './paths/relations/relation.yaml' + $ref: "./paths/relations/relation.yaml" # Revisions /revisions: - $ref: './paths/revisions/revisions.yaml' + $ref: "./paths/revisions/revisions.yaml" /revisions/{id}: - $ref: './paths/revisions/revision.yaml' + $ref: "./paths/revisions/revision.yaml" # Revisions /roles: - $ref: './paths/roles/roles.yaml' + $ref: "./paths/roles/roles.yaml" /roles/{id}: - $ref: './paths/roles/role.yaml' + $ref: "./paths/roles/role.yaml" # SCIM /scim/v2/Users: - $ref: './paths/scim/users.yaml' + $ref: "./paths/scim/users.yaml" /scim/v2/Users/{id}: - $ref: './paths/scim/user.yaml' + $ref: "./paths/scim/user.yaml" /scim/v2/Groups: - $ref: './paths/scim/groups.yaml' + $ref: "./paths/scim/groups.yaml" /scim/v2/Groups/{id}: - $ref: './paths/scim/group.yaml' - + $ref: "./paths/scim/group.yaml" + # Server /server/info: - $ref: './paths/server/info.yaml' + $ref: "./paths/server/info.yaml" servers: - - url: 'https://demo.directus.io/' + - url: "https://demo.directus.io/" /server/ping: - $ref: './paths/server/ping.yaml' + $ref: "./paths/server/ping.yaml" servers: - - url: 'https://demo.directus.io/' + - url: "https://demo.directus.io/" # Settings /settings: - $ref: './paths/settings/settings.yaml' + $ref: "./paths/settings/settings.yaml" # Users /users: - $ref: './paths/users/users.yaml' + $ref: "./paths/users/users.yaml" /users/me: - $ref: './paths/users/me.yaml' + $ref: "./paths/users/me.yaml" /users/invite: - $ref: './paths/users/user-invite.yaml' + $ref: "./paths/users/user-invite.yaml" /users/{id}: - $ref: './paths/users/user.yaml' + $ref: "./paths/users/user.yaml" /users/invite/{token}: - $ref: './paths/users/user-invite-token.yaml' + $ref: "./paths/users/user-invite-token.yaml" /users/{id}/track/page: - $ref: './paths/users/user-tracking.yaml' + $ref: "./paths/users/user-tracking.yaml" # Utilities /utils/hash: - $ref: './paths/utils/hash.yaml' + $ref: "./paths/utils/hash.yaml" /utils/hash/verify: - $ref: './paths/utils/hash-match.yaml' + $ref: "./paths/utils/hash-match.yaml" /utils/random/string: - $ref: './paths/utils/random.yaml' + $ref: "./paths/utils/random.yaml" # Webhooks /webhooks: - $ref: './paths/webhooks/webhooks.yaml' + $ref: "./paths/webhooks/webhooks.yaml" components: schemas: Activity: - $ref: './components/activity.yaml' + $ref: "./components/activity.yaml" Preset: - $ref: './components/preset.yaml' + $ref: "./components/preset.yaml" Collection: - $ref: './components/collection.yaml' + $ref: "./components/collection.yaml" Field: - $ref: './components/field.yaml' + $ref: "./components/field.yaml" File: - $ref: './components/file.yaml' + $ref: "./components/file.yaml" Folder: - $ref: './components/folder.yaml' + $ref: "./components/folder.yaml" Item: - $ref: './components/item.yaml' + $ref: "./components/item.yaml" Permissions: - $ref: './components/permissions.yaml' + $ref: "./components/permissions.yaml" Relation: - $ref: './components/relation.yaml' + $ref: "./components/relation.yaml" Revision: - $ref: './components/revision.yaml' + $ref: "./components/revision.yaml" Role: - $ref: './components/role.yaml' + $ref: "./components/role.yaml" Setting: - $ref: './components/setting.yaml' + $ref: "./components/setting.yaml" User: - $ref: './components/user.yaml' + $ref: "./components/user.yaml" Webhook: - $ref: './components/webhook.yaml' + $ref: "./components/webhook.yaml" parameters: - # All path parameters + # All path parameters Id: - $ref: './parameters/id.yaml' + $ref: "./parameters/id.yaml" UUId: - $ref: './parameters/uuid.yaml' + $ref: "./parameters/uuid.yaml" Collection: - $ref: './parameters/collection.yaml' + $ref: "./parameters/collection.yaml" # All query parameters q: - $ref: './parameters/q.yaml' + $ref: "./parameters/q.yaml" Page: - $ref: './parameters/page.yaml' + $ref: "./parameters/page.yaml" Offset: - $ref: './parameters/offset.yaml' + $ref: "./parameters/offset.yaml" Single: - $ref: './parameters/single.yaml' + $ref: "./parameters/single.yaml" Sort: - $ref: './parameters/sort.yaml' + $ref: "./parameters/sort.yaml" Meta: - $ref: './parameters/meta.yaml' + $ref: "./parameters/meta.yaml" Limit: - $ref: './parameters/limit.yaml' + $ref: "./parameters/limit.yaml" Filter: - $ref: './parameters/filter.yaml' + $ref: "./parameters/filter.yaml" Fields: - $ref: './parameters/fields.yaml' + $ref: "./parameters/fields.yaml" Mode: - $ref: './parameters/mode.yaml' + $ref: "./parameters/mode.yaml" responses: NotFoundError: - $ref: './responses/notFoundError.yaml' + $ref: "./responses/notFoundError.yaml" UnauthorizedError: - $ref: './responses/unauthorizedError.yaml' + $ref: "./responses/unauthorizedError.yaml" securitySchemes: KeyAuth: type: apiKey @@ -296,8 +295,8 @@ components: Auth: type: apiKey in: header - name: 'Authorization' + name: "Authorization" description: To authenticate, use the "/auth/authenticate" endpoint with the credentials "admin@example.com" | "password". Use the api key here like so "Bearer \". -security: +security: - Auth: [] - KeyAuth: [] diff --git a/packages/spec/specs/paths/activity/activities.yaml b/packages/spec/specs/paths/activity/activities.yaml new file mode 100644 index 0000000000..0a191d164b --- /dev/null +++ b/packages/spec/specs/paths/activity/activities.yaml @@ -0,0 +1,30 @@ +get: + operationId: getActivities + description: Returns a list of activity actions. + parameters: + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + responses: + "200": + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/Activity" + description: Successful request + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" + tags: + - Activity diff --git a/packages/spec/specs/paths/activity/activity-comment.yaml b/packages/spec/specs/paths/activity/activity-comment.yaml index d79f1da118..d32eb485ed 100644 --- a/packages/spec/specs/paths/activity/activity-comment.yaml +++ b/packages/spec/specs/paths/activity/activity-comment.yaml @@ -2,7 +2,8 @@ patch: description: Update the content of an existing comment. operationId: updateComment parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Id" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -13,32 +14,32 @@ patch: type: string example: My updated comment responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Activity' + $ref: "#/components/schemas/Activity" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Activity + - Activity delete: description: Delete an existing comment. Deleted comments can not be retrieved. operationId: deleteComment + parameters: + - $ref: "#/components/parameters/Id" responses: - '203': + "203": description: Deleted succsessfully - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Activity -parameters: -- $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - Activity diff --git a/packages/spec/specs/paths/activity/activity-comments.yaml b/packages/spec/specs/paths/activity/activity-comments.yaml index e9046aaf8b..a625519f55 100644 --- a/packages/spec/specs/paths/activity/activity-comments.yaml +++ b/packages/spec/specs/paths/activity/activity-comments.yaml @@ -2,13 +2,13 @@ post: description: Creates a new comment. operationId: createComment parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object - required: [ "collection", "item", "comment" ] + required: ["collection", "item", "comment"] properties: collection: type: string @@ -20,18 +20,18 @@ post: type: string example: A new comment responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Activity' + $ref: "#/components/schemas/Activity" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Activity \ No newline at end of file + - Activity diff --git a/packages/spec/specs/paths/activity/activity.yaml b/packages/spec/specs/paths/activity/activity.yaml index 95d9bf57aa..2633c05813 100644 --- a/packages/spec/specs/paths/activity/activity.yaml +++ b/packages/spec/specs/paths/activity/activity.yaml @@ -1,13 +1,14 @@ get: - description: Retrieves the details of an existing activity action. Provide the primary + description: + Retrieves the details of an existing activity action. Provide the primary key of the activity action and Directus will return the corresponding information. operationId: getActivity parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Id" + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -15,10 +16,10 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Activity' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Activity" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Activity \ No newline at end of file + - Activity diff --git a/packages/spec/specs/paths/activity/activitys.yaml b/packages/spec/specs/paths/activity/activitys.yaml deleted file mode 100644 index de6759b239..0000000000 --- a/packages/spec/specs/paths/activity/activitys.yaml +++ /dev/null @@ -1,30 +0,0 @@ -get: - operationId: getActivitys - description: Returns a list of activity actions. - parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - responses: - '200': - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: '../../openapi.yaml#/components/schemas/Activity' - description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' - tags: - - Activity \ No newline at end of file diff --git a/packages/spec/specs/paths/assets/assets.yaml b/packages/spec/specs/paths/assets/assets.yaml index 48aa4886a3..b344658c15 100644 --- a/packages/spec/specs/paths/assets/assets.yaml +++ b/packages/spec/specs/paths/assets/assets.yaml @@ -3,7 +3,7 @@ get: - Assets operationId: getAsset description: Image typed files can be dynamically resized and transformed to fit any need. - security: + security: - Auth: [] parameters: - name: key @@ -41,11 +41,11 @@ get: minimum: 1 maximum: 100 responses: - '200': + "200": description: Successful request content: text/plain: schema: type: string - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' \ No newline at end of file + "404": + $ref: "#/components/responses/NotFoundError" diff --git a/packages/spec/specs/paths/auth/login.yaml b/packages/spec/specs/paths/auth/login.yaml index 4630356887..7cdd4c4002 100644 --- a/packages/spec/specs/paths/auth/login.yaml +++ b/packages/spec/specs/paths/auth/login.yaml @@ -8,7 +8,7 @@ post: application/json: schema: type: object - required: [ email, password ] + required: [email, password] properties: email: type: string @@ -28,19 +28,19 @@ post: type: string description: If 2FA is enabled, you need to pass the one time password. responses: - '200': + "200": description: Successful authentification content: application/json: schema: type: object properties: - public: - type: boolean data: type: object properties: - token: + access_token: type: string - user: - $ref: '../../openapi.yaml#/components/schemas/User' \ No newline at end of file + example: eyJhbGciOiJI... + expires: + type: integer + example: 900 diff --git a/packages/spec/specs/paths/auth/password-request.yaml b/packages/spec/specs/paths/auth/password-request.yaml index e9a839f851..71637a4278 100644 --- a/packages/spec/specs/paths/auth/password-request.yaml +++ b/packages/spec/specs/paths/auth/password-request.yaml @@ -8,7 +8,7 @@ post: application/json: schema: type: object - required: [ email ] + required: [email] properties: email: type: string @@ -19,5 +19,5 @@ post: example: https://mydomain.com/passwordreset description: Provide a custom reset url which the link in the Email will lead to. The reset token will be passed as a parameter. responses: - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/password-reset.yaml b/packages/spec/specs/paths/auth/password-reset.yaml index 2f5530d739..750844c193 100644 --- a/packages/spec/specs/paths/auth/password-reset.yaml +++ b/packages/spec/specs/paths/auth/password-reset.yaml @@ -8,7 +8,7 @@ post: application/json: schema: type: object - required: [ token, password ] + required: [token, password] properties: token: type: string @@ -20,5 +20,5 @@ post: format: password description: New password for the user. responses: - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/refresh.yaml b/packages/spec/specs/paths/auth/refresh.yaml index c2074d85ef..3dcc7becf3 100644 --- a/packages/spec/specs/paths/auth/refresh.yaml +++ b/packages/spec/specs/paths/auth/refresh.yaml @@ -8,26 +8,28 @@ post: application/json: schema: type: object - required: [ token ] + required: [token] properties: refresh_token: type: string example: eyJ0eXAiOiJKV... description: JWT access token you want to refresh. This token can't be expired. responses: - '200': + "200": description: Successful request content: application/json: schema: type: object properties: - public: - type: boolean data: type: object properties: - token: + access_token: type: string - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + example: eyJhbGciOiJI... + expires: + type: integer + example: 900 + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/sso-provider.yaml b/packages/spec/specs/paths/auth/sso-provider.yaml index 6d5d0f48a1..acaedbed64 100644 --- a/packages/spec/specs/paths/auth/sso-provider.yaml +++ b/packages/spec/specs/paths/auth/sso-provider.yaml @@ -10,7 +10,7 @@ get: required: true schema: type: string - - $ref: '../../openapi.yaml#/components/parameters/Mode' + - $ref: "#/components/parameters/Mode" - name: redirect_url in: query required: true @@ -18,7 +18,7 @@ get: schema: type: string responses: - '200': + "200": description: Successful request content: application/json: @@ -32,5 +32,5 @@ get: properties: token: type: string - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/sso.yaml b/packages/spec/specs/paths/auth/sso.yaml index 14d0283fc4..21cd78770f 100644 --- a/packages/spec/specs/paths/auth/sso.yaml +++ b/packages/spec/specs/paths/auth/sso.yaml @@ -4,7 +4,7 @@ get: operationId: sso description: List the SSO providers. responses: - '200': + "200": description: Successful request content: application/json: @@ -18,5 +18,5 @@ get: example: ["github", "facebook"] items: type: string - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/collections/collection.yaml b/packages/spec/specs/paths/collections/collection.yaml index 43ab3eee50..c03d5fba1e 100644 --- a/packages/spec/specs/paths/collections/collection.yaml +++ b/packages/spec/specs/paths/collections/collection.yaml @@ -2,28 +2,28 @@ get: description: Retrieves the details of a single collection. operationId: getCollection parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Collection' + $ref: "#/components/schemas/Collection" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Collections + - Collections patch: description: Update an existing collection. operationId: updateCollection parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -49,37 +49,37 @@ patch: type: object description: Key value pairs of how to show this collection's name in different languages in the admin app. responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Collection' + $ref: "#/components/schemas/Collection" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Collections + - Collections delete: description: "Delete an existing collection. Warning: This will delete the whole collection, including the items within. Proceed with caution." operationId: deleteCollection responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Collections + - Collections parameters: - name: collection in: path required: true description: The unique name of the collection. schema: - type: string \ No newline at end of file + type: string diff --git a/packages/spec/specs/paths/collections/collections.yaml b/packages/spec/specs/paths/collections/collections.yaml index 0412d50783..abad097537 100644 --- a/packages/spec/specs/paths/collections/collections.yaml +++ b/packages/spec/specs/paths/collections/collections.yaml @@ -2,11 +2,11 @@ get: description: Returns a list of the collections available in the project. operationId: getCollections parameters: - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -16,24 +16,24 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Collection' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Collection" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Collections + - Collections post: description: Create a new collection in Directus. operationId: createCollection parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object - required: [ collection, fields ] + required: [collection, fields] properties: collection: type: string @@ -61,18 +61,18 @@ post: type: string description: Key value pairs of how to show this collection's name in different languages in the admin app. responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Collection' + $ref: "#/components/schemas/Collection" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Collections \ No newline at end of file + - Collections diff --git a/packages/spec/specs/paths/extensions/interfaces.yaml b/packages/spec/specs/paths/extensions/interfaces.yaml index 199e5bcfd7..9bc69c119f 100644 --- a/packages/spec/specs/paths/extensions/interfaces.yaml +++ b/packages/spec/specs/paths/extensions/interfaces.yaml @@ -2,7 +2,7 @@ get: description: List all installed custom interfaces. operationId: getInterfaces responses: - '200': + "200": description: Successful request content: application/json: @@ -13,9 +13,9 @@ get: type: array items: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Extensions \ No newline at end of file + - Extensions diff --git a/packages/spec/specs/paths/extensions/layouts.yaml b/packages/spec/specs/paths/extensions/layouts.yaml index e3c336dea6..2192650948 100644 --- a/packages/spec/specs/paths/extensions/layouts.yaml +++ b/packages/spec/specs/paths/extensions/layouts.yaml @@ -2,7 +2,7 @@ get: description: List all installed custom layouts. operationId: getLayouts responses: - '200': + "200": content: application/json: schema: @@ -13,9 +13,9 @@ get: items: type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Extensions \ No newline at end of file + - Extensions diff --git a/packages/spec/specs/paths/extensions/modules.yaml b/packages/spec/specs/paths/extensions/modules.yaml index b84aa75ea6..8c9254a932 100644 --- a/packages/spec/specs/paths/extensions/modules.yaml +++ b/packages/spec/specs/paths/extensions/modules.yaml @@ -2,7 +2,7 @@ get: description: List all installed custom modules. operationId: getModules responses: - '200': + "200": content: application/json: schema: @@ -13,9 +13,9 @@ get: items: type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Extensions \ No newline at end of file + - Extensions diff --git a/packages/spec/specs/paths/fields/collection-field.yaml b/packages/spec/specs/paths/fields/collection-field.yaml index bf1ba19a98..a275fcafb8 100644 --- a/packages/spec/specs/paths/fields/collection-field.yaml +++ b/packages/spec/specs/paths/fields/collection-field.yaml @@ -2,7 +2,7 @@ get: description: Retrieves the details of a single field in a given collection. operationId: getCollectionField responses: - '200': + "200": description: Successful request content: application/json: @@ -10,13 +10,13 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Field' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Field" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields + - Fields patch: description: Update an existing field. operationId: updateField @@ -68,7 +68,7 @@ patch: description: Sort order of this field on the edit page of the admin app. type: integer translation: - description: 'Key value pair of `: ` that allows the user to change the displayed name of the field in the admin app.' + description: "Key value pair of `: ` that allows the user to change the displayed name of the field in the admin app." type: object unique: description: If the value of this field should be unique within the collection. @@ -85,7 +85,7 @@ patch: type: integer type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -93,26 +93,26 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Field' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Field" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields + - Fields delete: description: Delete an existing field. operationId: deleteField responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields + - Fields parameters: - name: collection in: path @@ -125,4 +125,4 @@ parameters: description: The unique name of the field. schema: type: string - required: true \ No newline at end of file + required: true diff --git a/packages/spec/specs/paths/fields/collection-fields.yaml b/packages/spec/specs/paths/fields/collection-fields.yaml index b619042720..283966d2cb 100644 --- a/packages/spec/specs/paths/fields/collection-fields.yaml +++ b/packages/spec/specs/paths/fields/collection-fields.yaml @@ -2,9 +2,9 @@ get: description: Returns a list of the fields available in the given collection. operationId: getCollectionFields parameters: - - $ref: '../../openapi.yaml#/components/parameters/Sort' + - $ref: "#/components/parameters/Sort" responses: - '200': + "200": description: Successful request content: application/json: @@ -14,13 +14,13 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Field' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Field" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields + - Fields post: description: Create a new field in a given collection. operationId: createField @@ -28,7 +28,7 @@ post: content: application/json: schema: - required: [ field, datatype, type, length ] + required: [field, datatype, type, length] properties: field: description: Unique name of the field. Field name is unique within the collection. @@ -79,7 +79,7 @@ post: description: Sort order of this field on the edit page of the admin app. type: integer translation: - description: 'Key value pair of `: ` that allows the user to change the displayed name of the field in the admin app.' + description: "Key value pair of `: ` that allows the user to change the displayed name of the field in the admin app." type: object unique: description: If the value of this field should be unique within the collection. @@ -96,25 +96,25 @@ post: type: integer type: object responses: - '200': + "200": content: application/json: schema: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Field' + $ref: "#/components/schemas/Field" description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields + - Fields parameters: - description: Unique identifier of the collection the item resides in. in: path name: collection required: true schema: - type: string \ No newline at end of file + type: string diff --git a/packages/spec/specs/paths/fields/fields.yaml b/packages/spec/specs/paths/fields/fields.yaml index 1b893014ac..41783cdded 100644 --- a/packages/spec/specs/paths/fields/fields.yaml +++ b/packages/spec/specs/paths/fields/fields.yaml @@ -2,10 +2,10 @@ get: description: Returns a list of the fields available in the project. operationId: getFields parameters: - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Sort' + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Sort" responses: - '200': + "200": description: Successful request content: application/json: @@ -15,10 +15,10 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Field' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Field" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Fields \ No newline at end of file + - Fields diff --git a/packages/spec/specs/paths/files/file.yaml b/packages/spec/specs/paths/files/file.yaml index 415848c69a..a29d2fd707 100644 --- a/packages/spec/specs/paths/files/file.yaml +++ b/packages/spec/specs/paths/files/file.yaml @@ -4,7 +4,7 @@ get: - Files operationId: getFile responses: - '200': + "200": description: Successful request content: application/json: @@ -12,9 +12,9 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/File' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/File" + "401": + $ref: "#/components/responses/UnauthorizedError" patch: description: Update an existing file. tags: @@ -26,7 +26,7 @@ patch: schema: type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -34,18 +34,18 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/File' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/File" + "401": + $ref: "#/components/responses/UnauthorizedError" delete: description: Delete an existing file. tags: - Files operationId: deleteFile responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + "401": + $ref: "#/components/responses/UnauthorizedError" parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/files/files.yaml b/packages/spec/specs/paths/files/files.yaml index 83512ee80c..9bac99e8d6 100644 --- a/packages/spec/specs/paths/files/files.yaml +++ b/packages/spec/specs/paths/files/files.yaml @@ -4,7 +4,7 @@ get: - Files operationId: getFiles responses: - '200': + "200": description: Successful request content: application/json: @@ -14,9 +14,9 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/File' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/File" + "401": + $ref: "#/components/responses/UnauthorizedError" post: description: Create a new file. tags: @@ -31,7 +31,7 @@ post: data: type: string responses: - '200': + "200": description: Successful request content: application/json: @@ -39,6 +39,6 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/File' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + $ref: "#/components/schemas/File" + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/files/revision.yaml b/packages/spec/specs/paths/files/revision.yaml index 962a3177b5..6e425fbbf9 100644 --- a/packages/spec/specs/paths/files/revision.yaml +++ b/packages/spec/specs/paths/files/revision.yaml @@ -4,7 +4,7 @@ get: - Files operationId: getFileRevision parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' + - $ref: "#/components/parameters/UUId" - name: offset in: path description: offset or revision @@ -12,7 +12,7 @@ get: schema: type: integer responses: - '200': + "200": description: Successful request content: application/json: @@ -20,6 +20,6 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Revision' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + $ref: "#/components/schemas/Revision" + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/files/revisions.yaml b/packages/spec/specs/paths/files/revisions.yaml index eb6e56a072..fe5b119eed 100644 --- a/packages/spec/specs/paths/files/revisions.yaml +++ b/packages/spec/specs/paths/files/revisions.yaml @@ -4,9 +4,9 @@ get: - Files operationId: getFileRevisions parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' + - $ref: "#/components/parameters/UUId" responses: - '200': + "200": description: Successful request content: application/json: @@ -16,6 +16,6 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Revision' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + $ref: "#/components/schemas/Revision" + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/folders/folder.yaml b/packages/spec/specs/paths/folders/folder.yaml index e6ea23539a..09f884797e 100644 --- a/packages/spec/specs/paths/folders/folder.yaml +++ b/packages/spec/specs/paths/folders/folder.yaml @@ -2,10 +2,10 @@ get: description: Retrieve a single folder by unique identifier. operationId: getFolder parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,19 +13,19 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Folder' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Folder" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Folders + - Folders patch: description: Update an existing folder operationId: updateFolder parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -40,7 +40,7 @@ patch: example: 3 description: Unique identifier of the parent folder. This allows for nested folders. responses: - '200': + "200": description: Successful request content: application/json: @@ -48,25 +48,25 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Folder' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Folder" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Folders + - Folders delete: description: Delete an existing folder operationId: deleteFolder responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Folders + - Folders parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' \ No newline at end of file + - $ref: "#/components/parameters/UUId" diff --git a/packages/spec/specs/paths/folders/folders.yaml b/packages/spec/specs/paths/folders/folders.yaml index 5b38caca4e..44f8f83eb4 100644 --- a/packages/spec/specs/paths/folders/folders.yaml +++ b/packages/spec/specs/paths/folders/folders.yaml @@ -2,16 +2,16 @@ get: description: List the folders. operationId: getFolders parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -21,19 +21,19 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Folder' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Folder" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Folders + - Folders post: description: Create a new folder. operationId: createFolder parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -49,7 +49,7 @@ post: type: integer required: [name] responses: - '200': + "200": description: Successful request content: application/json: @@ -57,10 +57,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Folder' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Folder" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Folders \ No newline at end of file + - Folders diff --git a/packages/spec/specs/paths/items/item.yaml b/packages/spec/specs/paths/items/item.yaml index 8f4147382f..66731f370d 100644 --- a/packages/spec/specs/paths/items/item.yaml +++ b/packages/spec/specs/paths/items/item.yaml @@ -4,10 +4,10 @@ get: - Items operationId: getItem parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -16,25 +16,25 @@ get: properties: data: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" patch: description: Update an existing item. tags: - Items operationId: updateItem parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -43,24 +43,24 @@ patch: properties: data: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" delete: description: Delete an existing item. tags: - Items operationId: deleteItem responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" parameters: - - $ref: '../../openapi.yaml#/components/parameters/Collection' + - $ref: "#/components/parameters/Collection" - name: id description: Index of the item. in: path @@ -72,4 +72,4 @@ parameters: example: 1 - type: string description: Unique identifier of the item. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 \ No newline at end of file + example: 8cbb43fe-4cdf-4991-8352-c461779cec02 diff --git a/packages/spec/specs/paths/items/items.yaml b/packages/spec/specs/paths/items/items.yaml index 7f08c07e17..5188c6c356 100644 --- a/packages/spec/specs/paths/items/items.yaml +++ b/packages/spec/specs/paths/items/items.yaml @@ -3,17 +3,17 @@ get: tags: - Items operationId: getItems - security: + security: - Auth: [] parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" - name: status in: query description: Filter items by the given status @@ -23,7 +23,7 @@ get: items: type: string responses: - '200': + "200": description: Successful request content: application/json: @@ -34,28 +34,28 @@ get: type: array items: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + "401": + $ref: "#/components/responses/UnauthorizedError" post: description: Create a new item. tags: - Items operationId: createItem parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + "401": + $ref: "#/components/responses/UnauthorizedError" parameters: - - $ref: '../../openapi.yaml#/components/parameters/Collection' \ No newline at end of file + - $ref: "#/components/parameters/Collection" diff --git a/packages/spec/specs/paths/mail/mail.yaml b/packages/spec/specs/paths/mail/mail.yaml index 7b4a4db6da..45f71a0371 100644 --- a/packages/spec/specs/paths/mail/mail.yaml +++ b/packages/spec/specs/paths/mail/mail.yaml @@ -38,15 +38,15 @@ post: type: string enum: [html, text] responses: - '200': + "200": content: application/json: schema: type: string description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Mail \ No newline at end of file + - Mail diff --git a/packages/spec/specs/paths/permissions/permission.yaml b/packages/spec/specs/paths/permissions/permission.yaml index 1238a461b3..de675ee843 100644 --- a/packages/spec/specs/paths/permissions/permission.yaml +++ b/packages/spec/specs/paths/permissions/permission.yaml @@ -2,10 +2,10 @@ get: description: Retrieve a single permissions object by unique identifier. operationId: getPermission parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,18 +13,18 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions + - Permissions patch: description: Update an existing permission operationId: updatePermission parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -75,7 +75,7 @@ patch: type: object type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -83,24 +83,24 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions + - Permissions delete: description: Delete an existing permission operationId: deletePermission responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions + - Permissions parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/permissions/permissions-me-collection.yaml b/packages/spec/specs/paths/permissions/permissions-me-collection.yaml index 724ab3de77..4e9b85d903 100644 --- a/packages/spec/specs/paths/permissions/permissions-me-collection.yaml +++ b/packages/spec/specs/paths/permissions/permissions-me-collection.yaml @@ -2,9 +2,9 @@ get: description: List the permissions that apply to the current user for the given collection operationId: Enter text here parameters: - - $ref: '../../openapi.yaml#/components/parameters/Collection' + - $ref: "#/components/parameters/Collection" responses: - '200': + "200": description: Successful request content: application/json: @@ -14,10 +14,10 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions \ No newline at end of file + - Permissions diff --git a/packages/spec/specs/paths/permissions/permissions-me.yaml b/packages/spec/specs/paths/permissions/permissions-me.yaml index efb11ed592..affa2f9216 100644 --- a/packages/spec/specs/paths/permissions/permissions-me.yaml +++ b/packages/spec/specs/paths/permissions/permissions-me.yaml @@ -2,7 +2,7 @@ get: description: List the permissions that apply to the current user. operationId: getMyPermissions responses: - '200': + "200": description: Successful request content: application/json: @@ -12,10 +12,10 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions \ No newline at end of file + - Permissions diff --git a/packages/spec/specs/paths/permissions/permissions.yaml b/packages/spec/specs/paths/permissions/permissions.yaml index 3d93dc9f30..cb369ffbc0 100644 --- a/packages/spec/specs/paths/permissions/permissions.yaml +++ b/packages/spec/specs/paths/permissions/permissions.yaml @@ -2,17 +2,17 @@ get: description: List all permissions. operationId: getPermissions parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Page' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Page" responses: - '200': + "200": description: Successful request content: application/json: @@ -22,18 +22,18 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions + - Permissions post: description: Create a new permission. operationId: createPermission parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -72,7 +72,7 @@ post: type: array items: type: string - example: ['featured_image'] + example: ["featured_image"] status: description: What status this permission applies to. type: string @@ -92,7 +92,7 @@ post: type: string type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -100,10 +100,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Permissions' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Permissions" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Permissions \ No newline at end of file + - Permissions diff --git a/packages/spec/specs/paths/presets/preset.yaml b/packages/spec/specs/paths/presets/preset.yaml index 3382bb5d53..cfe3d531b4 100644 --- a/packages/spec/specs/paths/presets/preset.yaml +++ b/packages/spec/specs/paths/presets/preset.yaml @@ -3,13 +3,13 @@ get: - Presets operationId: getPreset description: Retrieve a single preset by unique identifier. - security: + security: - Auth: [] parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -17,23 +17,23 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Preset' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/Preset" + "401": + $ref: "#/components/responses/UnauthorizedError" patch: tags: - Presets operationId: updatePreset description: Update an existing preset. parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object - required: [ collection ] + required: [collection] properties: collection: type: string @@ -60,7 +60,7 @@ patch: operator: type: string example: gte - value: + value: type: integer example: 4.5 view_type: @@ -76,7 +76,7 @@ patch: type: object description: Key value pair of language-translation. Can be used to translate the bookmark title in multiple languages. responses: - '200': + "200": description: Successful request content: application/json: @@ -84,9 +84,9 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Preset' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/Preset" + "401": + $ref: "#/components/responses/UnauthorizedError" delete: tags: - Presets @@ -95,9 +95,9 @@ delete: security: - Auth: [] responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + "401": + $ref: "#/components/responses/UnauthorizedError" parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/presets/presets.yaml b/packages/spec/specs/paths/presets/presets.yaml index c02ee8c185..fdb8923b98 100644 --- a/packages/spec/specs/paths/presets/presets.yaml +++ b/packages/spec/specs/paths/presets/presets.yaml @@ -3,20 +3,20 @@ get: - Presets operationId: getPresets description: List the presets. - security: + security: - Auth: [] parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Page' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Page" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -26,23 +26,23 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Preset' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' + $ref: "#/components/schemas/Preset" + "401": + $ref: "#/components/responses/UnauthorizedError" post: tags: - Presets operationId: createPreset description: Create a new preset. parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: type: object - required: [ collection ] + required: [collection] properties: collection: type: string @@ -69,7 +69,7 @@ post: operator: type: string example: gte - value: + value: type: integer example: 4.5 view_type: @@ -85,7 +85,7 @@ post: type: object description: Key value pair of language-translation. Can be used to translate the bookmark title in multiple languages. responses: - '200': + "200": description: Successful request content: application/json: @@ -93,6 +93,6 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Preset' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' \ No newline at end of file + $ref: "#/components/schemas/Preset" + "401": + $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/relations/relation.yaml b/packages/spec/specs/paths/relations/relation.yaml index dd7f0ed240..257c25186c 100644 --- a/packages/spec/specs/paths/relations/relation.yaml +++ b/packages/spec/specs/paths/relations/relation.yaml @@ -2,10 +2,10 @@ get: description: Retrieve a single relation by unique identifier. operationId: getRelation parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,19 +13,19 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Relation' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Relation" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Relations + - Relations patch: description: Update an existing relation operationId: updateRelation parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -38,7 +38,8 @@ patch: description: Collection on the _one_ side of the relationship. type: string field_many: - description: Foreign key. Field that holds the primary key of the related + description: + Foreign key. Field that holds the primary key of the related collection. type: string field_one: @@ -46,12 +47,13 @@ patch: type: string example: books junction_field: - description: Field on the junction table that holds the primary key of + description: + Field on the junction table that holds the primary key of the related collection. type: string type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -59,24 +61,24 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Relation' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Relation" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Relations + - Relations delete: description: Delete an existing relation. operationId: deleteRelation responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Relations + - Relations parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/relations/relations.yaml b/packages/spec/specs/paths/relations/relations.yaml index 07c49fc2c0..f0f51bfe13 100644 --- a/packages/spec/specs/paths/relations/relations.yaml +++ b/packages/spec/specs/paths/relations/relations.yaml @@ -2,17 +2,17 @@ get: description: List the relations. operationId: getRelations parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Page' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Page" responses: - '200': + "200": description: Successful request content: application/json: @@ -22,19 +22,19 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Relation' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Relation" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Relations + - Relations post: description: Create a new relation. operationId: createRelation parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -61,7 +61,7 @@ post: type: string type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -69,10 +69,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Relation' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Relation" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Relations \ No newline at end of file + - Relations diff --git a/packages/spec/specs/paths/revisions/revision.yaml b/packages/spec/specs/paths/revisions/revision.yaml index d93acacc6f..1af3ed3006 100644 --- a/packages/spec/specs/paths/revisions/revision.yaml +++ b/packages/spec/specs/paths/revisions/revision.yaml @@ -2,11 +2,11 @@ get: description: Retrieve a single revision by unique identifier. operationId: getRevision parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Id" + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -14,10 +14,10 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Revision' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Revision" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Revisions \ No newline at end of file + - Revisions diff --git a/packages/spec/specs/paths/revisions/revisions.yaml b/packages/spec/specs/paths/revisions/revisions.yaml index c8b28e308b..f612f869d8 100644 --- a/packages/spec/specs/paths/revisions/revisions.yaml +++ b/packages/spec/specs/paths/revisions/revisions.yaml @@ -2,17 +2,17 @@ get: description: List the revisions. operationId: getRevisions parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Page' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Page" responses: - '200': + "200": description: Successful request content: application/json: @@ -22,10 +22,10 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Revision' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Revision" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Revisions \ No newline at end of file + - Revisions diff --git a/packages/spec/specs/paths/roles/role.yaml b/packages/spec/specs/paths/roles/role.yaml index f50a2f2c57..3e4c57521d 100644 --- a/packages/spec/specs/paths/roles/role.yaml +++ b/packages/spec/specs/paths/roles/role.yaml @@ -2,10 +2,10 @@ get: description: Retrieve a single role by unique identifier. operationId: getRole parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,19 +13,19 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Role' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Role" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Roles + - Roles patch: description: Update an existing role operationId: updateRole parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -44,7 +44,8 @@ patch: description: ID used with external services in SCIM. type: string ip_whitelist: - description: Array of IP addresses that are allowed to connect to the + description: + Array of IP addresses that are allowed to connect to the API as a user of this role. type: array items: @@ -57,7 +58,7 @@ patch: type: string type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -65,24 +66,24 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Role' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Role" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Roles + - Roles delete: description: Delete an existing role operationId: deleteRole responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Roles + - Roles parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' \ No newline at end of file + - $ref: "#/components/parameters/UUId" diff --git a/packages/spec/specs/paths/roles/roles.yaml b/packages/spec/specs/paths/roles/roles.yaml index aca6b7b071..4f7b4afb22 100644 --- a/packages/spec/specs/paths/roles/roles.yaml +++ b/packages/spec/specs/paths/roles/roles.yaml @@ -2,17 +2,17 @@ get: description: List the roles. operationId: getRoles parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' - - $ref: '../../openapi.yaml#/components/parameters/Page' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" + - $ref: "#/components/parameters/Page" responses: - '200': + "200": description: Successful request content: application/json: @@ -22,19 +22,19 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/Role' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Role" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Roles + - Roles post: description: Create a new role. operationId: createRole parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -53,7 +53,8 @@ post: description: ID used with external services in SCIM. type: string ip_whitelist: - description: Array of IP addresses that are allowed to connect to the + description: + Array of IP addresses that are allowed to connect to the API as a user of this role. type: array items: @@ -67,7 +68,7 @@ post: example: Interns type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -75,10 +76,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Role' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Role" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Roles \ No newline at end of file + - Roles diff --git a/packages/spec/specs/paths/scim/group.yaml b/packages/spec/specs/paths/scim/group.yaml index 379454e940..238a8cafbc 100644 --- a/packages/spec/specs/paths/scim/group.yaml +++ b/packages/spec/specs/paths/scim/group.yaml @@ -2,18 +2,18 @@ get: description: Retrieve a single SCIM Group by unique identifier. operationId: getSCIMGroup responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM patch: description: Update an existing SCIM Group operationId: updateSCIMGroup @@ -23,29 +23,29 @@ patch: schema: type: object responses: - '200': + "200": content: application/json: schema: type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM delete: description: Delete an existing SCIM Group operationId: deleteSCIMGroup responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/scim/groups.yaml b/packages/spec/specs/paths/scim/groups.yaml index 412c33e0f0..721a8f76d8 100644 --- a/packages/spec/specs/paths/scim/groups.yaml +++ b/packages/spec/specs/paths/scim/groups.yaml @@ -2,39 +2,40 @@ get: description: List the SCIM Groups. operationId: getSCIMGroups parameters: - - description: The 1-based index of the first result in the current set of list results. - in: query - name: startIndex - required: false - schema: - type: integer - - description: Specifies the desired maximum number of query results per page. - in: query - name: count - required: false - schema: - type: integer - - description: Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq - 15` - in: query - name: filter - required: false - schema: - type: integer + - description: The 1-based index of the first result in the current set of list results. + in: query + name: startIndex + required: false + schema: + type: integer + - description: Specifies the desired maximum number of query results per page. + in: query + name: count + required: false + schema: + type: integer + - description: + Filter by `id`, `userName`, `emails.value` and `externalId` attributes + are supported. Only the `eq` operator is supported. Uses format `?filter=id eq + 15` + in: query + name: filter + required: false + schema: + type: integer responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM post: description: Create a new SCIM Group. operationId: createSCIMGroup @@ -44,15 +45,15 @@ post: schema: type: object responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM \ No newline at end of file + - SCIM diff --git a/packages/spec/specs/paths/scim/user.yaml b/packages/spec/specs/paths/scim/user.yaml index 3934a31219..c3d526d168 100644 --- a/packages/spec/specs/paths/scim/user.yaml +++ b/packages/spec/specs/paths/scim/user.yaml @@ -2,7 +2,8 @@ get: description: Retrieve a single SCIM user by unique identifier. operationId: getSCIMUser parameters: - - description: The `external_id` saved in `directus_users`. Corresponds to the `id` + - description: + The `external_id` saved in `directus_users`. Corresponds to the `id` in the SCIM Users endpoint result. in: path name: id @@ -10,64 +11,66 @@ get: schema: type: integer responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM patch: description: Update an existing SCIM User operationId: updateSCIMUser parameters: - - description: The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer + - description: + The `external_id` saved in `directus_users`. Corresponds to the `id` + in the SCIM Users endpoint result. + in: path + name: id + required: true + schema: + type: integer requestBody: content: application/json: schema: type: object responses: - '200': + "200": content: application/json: schema: type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM delete: description: Delete an existing SCIM User operationId: deleteSCIMUser parameters: - - description: The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer + - description: + The `external_id` saved in `directus_users`. Corresponds to the `id` + in the SCIM Users endpoint result. + in: path + name: id + required: true + schema: + type: integer responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM \ No newline at end of file + - SCIM diff --git a/packages/spec/specs/paths/scim/users.yaml b/packages/spec/specs/paths/scim/users.yaml index b6e2a8c07e..9fb6b42afc 100644 --- a/packages/spec/specs/paths/scim/users.yaml +++ b/packages/spec/specs/paths/scim/users.yaml @@ -14,8 +14,9 @@ get: required: false schema: type: integer - - description: Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq + - description: + Filter by `id`, `userName`, `emails.value` and `externalId` attributes + are supported. Only the `eq` operator is supported. Uses format `?filter=id eq 15` in: query name: filter @@ -23,18 +24,18 @@ get: schema: type: integer responses: - '200': + "200": description: Successful request content: application/json: schema: type: object - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM + - SCIM post: description: Create a new SCIM User. operationId: createSCIMUser @@ -44,15 +45,15 @@ post: schema: type: object responses: - '200': + "200": content: application/json: schema: type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - SCIM \ No newline at end of file + - SCIM diff --git a/packages/spec/specs/paths/server/info.yaml b/packages/spec/specs/paths/server/info.yaml index 42e7ecc755..8d7ddbe295 100644 --- a/packages/spec/specs/paths/server/info.yaml +++ b/packages/spec/specs/paths/server/info.yaml @@ -2,14 +2,14 @@ get: description: Perform a system status check and return the options. operationId: serverInfo parameters: - - description: The first time you create a project, the provided token will be saved and required for subsequent project installs. It can also be found and configured in `/config/__api.json` on your server. - in: query - name: super_admin_token - required: true - schema: - type: integer + - description: The first time you create a project, the provided token will be saved and required for subsequent project installs. It can also be found and configured in `/config/__api.json` on your server. + in: query + name: super_admin_token + required: true + schema: + type: integer responses: - '200': + "200": content: application/json: schema: @@ -18,9 +18,9 @@ get: type: object type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Server \ No newline at end of file + - Server diff --git a/packages/spec/specs/paths/settings/setting.yaml b/packages/spec/specs/paths/settings/setting.yaml index 869c5f8231..32a4a477a1 100644 --- a/packages/spec/specs/paths/settings/setting.yaml +++ b/packages/spec/specs/paths/settings/setting.yaml @@ -2,9 +2,9 @@ get: description: Retrieve a single setting by unique identifier. operationId: getSetting parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -12,18 +12,18 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Setting' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Setting" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Settings + - Settings patch: description: Update an existing setting operationId: updateSetting parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: @@ -37,7 +37,7 @@ patch: type: string type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -45,24 +45,24 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Setting' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Setting" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Settings + - Settings delete: description: Delete an existing setting operationId: deleteSetting responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Settings + - Settings parameters: - - $ref: '../../openapi.yaml#/components/parameters/Id' \ No newline at end of file + - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/settings/settings.yaml b/packages/spec/specs/paths/settings/settings.yaml index cca6921656..2a7a9a06f7 100644 --- a/packages/spec/specs/paths/settings/settings.yaml +++ b/packages/spec/specs/paths/settings/settings.yaml @@ -2,13 +2,13 @@ get: description: List the settings. operationId: getSettings parameters: - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Page' + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Page" responses: - '200': + "200": description: Successful request content: application/json: @@ -16,13 +16,13 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Setting' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Setting" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Settings + - Settings patch: description: Update an existing setting operationId: updateSetting @@ -32,7 +32,7 @@ patch: schema: type: object responses: - '200': + "200": description: Successful request content: application/json: @@ -40,18 +40,18 @@ patch: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Setting' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Setting" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Settings + - Settings # post: # description: Create a new setting. # operationId: createSettings # parameters: -# - $ref: '../../openapi.yaml#/components/parameters/Meta' +# - $ref: '#/components/parameters/Meta' # requestBody: # content: # application/json: @@ -66,10 +66,10 @@ patch: # type: object # properties: # data: -# $ref: '../../openapi.yaml#/components/schemas/Setting' +# $ref: '#/components/schemas/Setting' # '401': -# $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' +# $ref: '#/components/responses/UnauthorizedError' # '404': -# $ref: '../../openapi.yaml#/components/responses/NotFoundError' +# $ref: '#/components/responses/NotFoundError' # tags: -# - Settings \ No newline at end of file +# - Settings diff --git a/packages/spec/specs/paths/users/me.yaml b/packages/spec/specs/paths/users/me.yaml index 140cfb1d83..d6fd337468 100644 --- a/packages/spec/specs/paths/users/me.yaml +++ b/packages/spec/specs/paths/users/me.yaml @@ -2,10 +2,10 @@ get: description: Retrieve the currently authenticated user. operationId: me parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,10 +13,10 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users \ No newline at end of file + - Users diff --git a/packages/spec/specs/paths/users/user-invite-token.yaml b/packages/spec/specs/paths/users/user-invite-token.yaml index 29bbb675de..1ddde96d3c 100644 --- a/packages/spec/specs/paths/users/user-invite-token.yaml +++ b/packages/spec/specs/paths/users/user-invite-token.yaml @@ -9,7 +9,7 @@ post: schema: type: integer responses: - '200': + "200": description: Successful request content: application/json: @@ -17,10 +17,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users \ No newline at end of file + - Users diff --git a/packages/spec/specs/paths/users/user-invite.yaml b/packages/spec/specs/paths/users/user-invite.yaml index 3d93f7e5f8..a395a60db6 100644 --- a/packages/spec/specs/paths/users/user-invite.yaml +++ b/packages/spec/specs/paths/users/user-invite.yaml @@ -1,5 +1,6 @@ post: - description: Invites one or more users to this project. It creates a user with an + description: + Invites one or more users to this project. It creates a user with an invited status, and then sends an email to the user with instructions on how to activate their account. operationId: invite @@ -13,7 +14,7 @@ post: description: Email address or array of email addresses of the to-be-invited user(s). type: string responses: - '200': + "200": description: Successful request content: application/json: @@ -21,10 +22,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users \ No newline at end of file + - Users diff --git a/packages/spec/specs/paths/users/user-tracking.yaml b/packages/spec/specs/paths/users/user-tracking.yaml index b96fb51fae..9bcdfc343f 100644 --- a/packages/spec/specs/paths/users/user-tracking.yaml +++ b/packages/spec/specs/paths/users/user-tracking.yaml @@ -1,9 +1,10 @@ patch: - description: Updates the last used page field of the user. This is used internally + description: + Updates the last used page field of the user. This is used internally to be able to open the Directus admin app from the last page you used. operationId: updateLastUsedPage parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' + - $ref: "#/components/parameters/UUId" requestBody: content: application/json: @@ -14,11 +15,11 @@ patch: type: string type: object responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users \ No newline at end of file + - Users diff --git a/packages/spec/specs/paths/users/user.yaml b/packages/spec/specs/paths/users/user.yaml index d6d4a85c82..62e2aabd06 100644 --- a/packages/spec/specs/paths/users/user.yaml +++ b/packages/spec/specs/paths/users/user.yaml @@ -2,10 +2,10 @@ get: description: Retrieve a single user by unique identifier. operationId: getUser parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" responses: - '200': + "200": description: Successful request content: application/json: @@ -13,26 +13,26 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users + - Users patch: description: Update an existing user operationId: updateUser parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: - $ref: '../../openapi.yaml#/components/schemas/User' + $ref: "#/components/schemas/User" responses: - '200': + "200": content: application/json: schema: @@ -41,23 +41,23 @@ patch: type: object type: object description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users + - Users delete: description: Delete an existing user operationId: deleteUser responses: - '200': + "200": description: Successful request - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users + - Users parameters: - - $ref: '../../openapi.yaml#/components/parameters/UUId' \ No newline at end of file + - $ref: "#/components/parameters/UUId" diff --git a/packages/spec/specs/paths/users/users.yaml b/packages/spec/specs/paths/users/users.yaml index 5a3a1ce0be..67ba2f0b45 100644 --- a/packages/spec/specs/paths/users/users.yaml +++ b/packages/spec/specs/paths/users/users.yaml @@ -2,16 +2,16 @@ get: description: List the users. operationId: getUsers parameters: - - $ref: '../../openapi.yaml#/components/parameters/Fields' - - $ref: '../../openapi.yaml#/components/parameters/Limit' - - $ref: '../../openapi.yaml#/components/parameters/Offset' - - $ref: '../../openapi.yaml#/components/parameters/Single' - - $ref: '../../openapi.yaml#/components/parameters/Meta' - - $ref: '../../openapi.yaml#/components/parameters/Sort' - - $ref: '../../openapi.yaml#/components/parameters/Filter' - - $ref: '../../openapi.yaml#/components/parameters/q' + - $ref: "#/components/parameters/Fields" + - $ref: "#/components/parameters/Limit" + - $ref: "#/components/parameters/Offset" + - $ref: "#/components/parameters/Single" + - $ref: "#/components/parameters/Meta" + - $ref: "#/components/parameters/Sort" + - $ref: "#/components/parameters/Filter" + - $ref: "#/components/parameters/q" responses: - '200': + "200": description: Successful request content: application/json: @@ -21,25 +21,25 @@ get: data: type: array items: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users + - Users post: description: Create a new user. operationId: createUser parameters: - - $ref: '../../openapi.yaml#/components/parameters/Meta' + - $ref: "#/components/parameters/Meta" requestBody: content: application/json: schema: - $ref: '../../openapi.yaml#/components/schemas/User' + $ref: "#/components/schemas/User" responses: - '200': + "200": description: Successful request content: application/json: @@ -47,10 +47,10 @@ post: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/User' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/User" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Users \ No newline at end of file + - Users diff --git a/packages/spec/specs/paths/webhooks/webhooks.yaml b/packages/spec/specs/paths/webhooks/webhooks.yaml index 8a73d71f19..f91be68256 100644 --- a/packages/spec/specs/paths/webhooks/webhooks.yaml +++ b/packages/spec/specs/paths/webhooks/webhooks.yaml @@ -2,7 +2,7 @@ get: description: Get all webhooks. operationId: getWebhooks responses: - '200': + "200": description: Successful request content: application/json: @@ -10,10 +10,10 @@ get: type: object properties: data: - $ref: '../../openapi.yaml#/components/schemas/Webhook' - '401': - $ref: '../../openapi.yaml#/components/responses/UnauthorizedError' - '404': - $ref: '../../openapi.yaml#/components/responses/NotFoundError' + $ref: "#/components/schemas/Webhook" + "401": + $ref: "#/components/responses/UnauthorizedError" + "404": + $ref: "#/components/responses/NotFoundError" tags: - - Webhooks \ No newline at end of file + - Webhooks From 882406df31216bbe4a669652b1ac832b726e82a8 Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Mon, 21 Sep 2020 19:34:48 -0300 Subject: [PATCH 002/189] user and role --- packages/spec/specs/components/role.yaml | 58 ++++++++++--------- packages/spec/specs/components/user.yaml | 71 +++++++++++++----------- 2 files changed, 72 insertions(+), 57 deletions(-) diff --git a/packages/spec/specs/components/role.yaml b/packages/spec/specs/components/role.yaml index 2fa154c67e..035618125a 100644 --- a/packages/spec/specs/components/role.yaml +++ b/packages/spec/specs/components/role.yaml @@ -1,43 +1,51 @@ type: object properties: - collection_listing: - description: Custom override for the admin app collection navigation. - example: null - type: object - nullable: true + id: + description: Unique identifier for the role. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + type: string + name: + description: Name of the role. + example: Administrator + type: string + icon: + description: The role's icon. + example: verified_user + type: string description: description: Description of the role. example: Admins have access to all managed data within the system by default type: string nullable: true - enforce_tfa: - description: Whether or not this role enforces the use of 2FA. - example: false - type: boolean - external_id: - description: ID used with external services in SCIM. - example: null - type: string - nullable: true - id: - description: Unique identifier for the role. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - type: string - ip_whitelist: - description: Array of IP addresses that are allowed to connect to the API as a + ip_access: + description: + Array of IP addresses that are allowed to connect to the API as a user of this role. example: [] type: array items: type: string - module_listing: + enforce_tfa: + description: Whether or not this role enforces the use of 2FA. + example: false + type: boolean + module_list: description: Custom override for the admin app module bar navigation. example: null type: array items: type: object nullable: true - name: - description: Name of the role. - example: Administrator - type: string \ No newline at end of file + collection_list: + description: Custom override for the admin app collection navigation. + example: null + type: object + nullable: true + admin_access: + description: Admin role. If true, skips all permission checks. + example: false + type: boolean + app_access: + description: The users in the role are allowed to use the app. + example: true + type: boolean diff --git a/packages/spec/specs/components/user.yaml b/packages/spec/specs/components/user.yaml index d1eb942c50..ba66a6ed51 100644 --- a/packages/spec/specs/components/user.yaml +++ b/packages/spec/specs/components/user.yaml @@ -22,15 +22,25 @@ properties: example: "*********" type: string location: - description: Location of the user. + description: The user's location. example: null type: string nullable: true - tfa_secret: - description: The 2FA secret string that's used to generate one time passwords. + title: + description: The user's title. example: null type: string nullable: true + description: + description: The user's description. + example: null + type: string + nullable: + tags: + description: The user's tags. + example: null + type: array + nullable: true avatar: description: The user's avatar. example: null @@ -40,11 +50,35 @@ properties: - type: string - $ref: "../openapi.yaml#/components/schemas/File" nullable: true - external_id: - description: ID used for SCIM. + timezone: + description: The user's timezone. + example: America/New_York + type: string + language: + description: The user's language used in Directus. + example: en-US + type: string + theme: + description: What theme the user is using. + example: auto + type: string + enum: [light, dark, auto] + tfa_secret: + description: The 2FA secret string that's used to generate one time passwords. example: null type: string nullable: true + status: + description: Status of the user. + example: active + type: string + enum: [active, invited, draft, suspended, deleted] + role: + description: Unique identifier of the role of this user. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/Role" last_login: description: When this user logged in last. example: "2020-05-31 14:32:37" @@ -56,30 +90,3 @@ properties: example: /my-project/settings/collections/a type: string nullable: true - language: - description: The user's language used in Directus. - example: en-US - type: string - role: - description: Unique identifier of the role of this user. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - type: string - status: - description: Status of the user. - example: active - type: string - enum: [active, invited, draft, suspended, deleted] - theme: - description: What theme the user is using. - example: auto - type: string - enum: [light, dark, auto] - timezone: - description: The user's timezone. - example: America/New_York - type: string - title: - description: The user's title. - example: null - type: string - nullable: true From cef7975d582e9ce8c21ad660899e6f2d885939aa Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Mon, 28 Sep 2020 19:31:46 -0300 Subject: [PATCH 003/189] field, file, folder, permissions, relation and revision --- packages/spec/specs/components/field.yaml | 252 +++++++++++------- packages/spec/specs/components/file.yaml | 192 ++++++------- packages/spec/specs/components/folder.yaml | 6 +- .../spec/specs/components/permissions.yaml | 20 +- packages/spec/specs/components/relation.yaml | 13 +- packages/spec/specs/components/revision.yaml | 38 ++- 6 files changed, 264 insertions(+), 257 deletions(-) diff --git a/packages/spec/specs/components/field.yaml b/packages/spec/specs/components/field.yaml index 5e93ece2ea..045b860898 100644 --- a/packages/spec/specs/components/field.yaml +++ b/packages/spec/specs/components/field.yaml @@ -1,10 +1,5 @@ type: object properties: - id: - description: Unique identifier for the field in the `directus_fields` collection. - example: 167 - type: integer - nullable: true collection: description: Unique name of the collection this field is in. example: about_us @@ -13,102 +8,161 @@ properties: description: Unique name of the field. Field name is unique within the collection. example: id type: string - auto_increment: - description: If the value in this field is auto incremented. Only applies to integer - type fields. - example: true - type: boolean - datatype: - description: SQL datatype of the column that corresponds to this field. - example: INT - type: string - nullable: true - group: - description: What field group this field is part of. - example: null - type: integer - nullable: true - hidden_browse: - description: If this field should be hidden from the item browse (listing) page. - example: true - type: boolean - hidden_detail: - description: If this field should be hidden from the item detail (edit) page. - example: true - type: boolean - interface: - description: What interface is used in the admin app to edit the value for this - field. - example: primary-key - type: string - nullable: true - length: - description: Length of the field. Will be used in SQL to set the `length` property - of the colummn. - example: '10' - type: string - nullable: true - locked: - description: If the field can be altered by the end user. Directus system fields - have this value set to `true`. - example: true - type: boolean - note: - description: A user provided note for the field. Will be rendered alongside the - interface on the edit page. - example: '' - type: string - nullable: true - options: - description: Options for the interface that's used. This format is based on the - individual interface. - example: null - type: object - nullable: true - primary_key: - description: If this field is the primary key of the collection. - example: true - type: boolean - readonly: - description: Prevents the user from editing the value in the field. - example: false - type: boolean - required: - description: If this field requires a value. - example: true - type: boolean - signed: - description: If the value is signed or not. Only applies to integer type fields. - example: false - type: boolean - sort: - description: Sort order of this field on the edit page of the admin app. - example: 1 - type: integer - nullable: true - translation: - description: 'Key value pair of `: ` that allows the user - to change the displayed name of the field in the admin app.' - example: null - type: object - nullable: true type: description: Directus specific data type. Used to cast values in the API. example: integer type: string - unique: - description: If the value of this field should be unique within the collection. - example: false - type: boolean - validation: - description: User provided regex that will be used in the API to validate incoming - values. It uses the PHP flavor of RegEX. - example: null - type: string + schema: + description: The schema info. + type: object + properties: + name: + description: The name of the field. + example: title + type: string + table: + description: The collection of the field. + example: posts + type: string + type: + description: The type of the field. + example: string + type: string + default_value: + description: The default value of the field. + example: null + type: string + nullable: true + max_length: + description: The max length of the field. + example: null + type: integer + nullable: true + is_nullable: + description: If the field is nullable. + example: false + type: boolean + is_primary_key: + description: If the field is primary key. + example: false + type: boolean + has_auto_increment: + description: If the field has auto increment. + example: false + type: boolean + foreign_key_column: + description: Related column from the foreign key constraint. + example: null + type: string + nullable: true + foreign_key_table: + description: Related table from the foreign key constraint. + example: null + type: string + nullable: true + comment: + description: Comment as saved in the database. + example: null + type: string + nullable: true + schema: + description: Database schema (pg only). + example: public + type: string + foreign_key_schema: + description: Related schema from the foreign key constraint (pg only). + example: null + type: string + nullable: true + meta: + description: The meta info. + type: object nullable: true - width: - description: Width of the field on the edit form. - example: null - type: string - nullable: true - enum: [half, half-left, half-right, full, fill, null] \ No newline at end of file + properties: + id: + description: Unique identifier for the field in the `directus_fields` collection. + example: 3 + type: integer + collection: + description: Unique name of the collection this field is in. + example: posts + type: string + field: + description: Unique name of the field. Field name is unique within the collection. + example: title + type: string + special: + description: Transformation flag for field + example: null + type: array + items: + type: string + nullable: true + interface: + description: + What interface is used in the admin app to edit the value for this + field. + example: primary-key + type: string + nullable: true + options: + description: + Options for the interface that's used. This format is based on the + individual interface. + example: null + type: object + nullable: true + display: + description: What display is used in the admin app to display the value for this field. + example: null + type: string + nullable: true + display_options: + description: Options for the display that's used. This format is based on the individual display. + example: null + type: object + nullable: true + locked: + description: + If the field can be altered by the end user. Directus system fields + have this value set to `true`. + example: true + type: boolean + readonly: + description: Prevents the user from editing the value in the field. + example: false + type: boolean + hidden: + description: If this field should be hidden. + example: true + type: boolean + sort: + description: Sort order of this field on the edit page of the admin app. + example: 1 + type: integer + nullable: true + width: + description: Width of the field on the edit form. + example: null + type: string + nullable: true + enum: [half, half-left, half-right, full, fill, null] + group: + description: What field group this field is part of. + example: null + type: integer + nullable: true + translation: + description: + "Key value pair of `: ` that allows the user + to change the displayed name of the field in the admin app." + example: null + type: object + nullable: true + note: + description: + A user provided note for the field. Will be rendered alongside the + interface on the edit page. + example: "" + type: string + nullable: true diff --git a/packages/spec/specs/components/file.yaml b/packages/spec/specs/components/file.yaml index 7a89306a30..d72b48e7c7 100644 --- a/packages/spec/specs/components/file.yaml +++ b/packages/spec/specs/components/file.yaml @@ -1,60 +1,71 @@ type: object properties: + id: + description: Unique identifier for the file. + example: 8cbb43fe-4cdf-4991-8352-c461779cec02 + type: string + storage: + description: + Where the file is stored. Either `local` for the local filesystem + or the name of the storage adapter (for example `s3`). + example: local + type: string + filename_disk: + description: + Name of the file on disk. By default, Directus uses a random hash + for the filename. + example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg + type: string + filename_download: + description: How you want to the file to be named when it's being downloaded. + example: avatar.jpg + type: string + title: + description: + Title for the file. Is extracted from the filename on upload, but + can be edited by the user. + example: User Avatar + type: string + type: + description: MIME type of the file. + example: image/jpeg + type: string + folder: + description: Virtual folder where this file resides in. + example: null + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/Folder" + nullable: true + uploaded_by: + description: Who uploaded the file. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/User" + uploaded_on: + description: When the file was uploaded. + example: "2019-12-03T00:10:15+00:00" + type: string + format: date-time charset: description: Character set of the file. example: binary type: string nullable: true # Should not be null? - checksum: - description: Represents the sum of the correct digits of the file, can be used - to detect errors in and duplicates of the file later. - example: d41d8cd98f00b204e9800998ecf8427e - type: string - data: - example: - embed: null - full_url: 'https://demo.directus.io/uploads/thumper/originals/a88c3b72-ac58-5436-a4ec-b2858531333a.jpg' - thumbnails: - dimension: 64x64 - height: 64 - relative_url: '/thumper/assets/pnw7s9lqy68048g0?key=directus-small-crop' - url: 'https://demo.directus.io/thumper/assets/pnw7s9lqy68048g0?key=directus-small-crop' - width: 64 - url: '/uploads/thumper/originals/a88c3b72-ac58-5436-a4ec-b2858531333a.jpg' - properties: - full_url: - description: Full URL to the original file. - type: string - thumbnails: - description: List of all available asset sizes with links. - type: array - nullable: true - items: - type: object - properties: - dimension: - description: Width x height of the thumbnail. - type: string - height: - description: Height of the thumbnail in pixels. - type: integer - relative_url: - description: Relative URL to the thumbnail. - type: string - url: - description: Full URL to the thumbnail. - type: string - width: - description: Width of the thumbnail in pixels. - type: integer - url: - description: Relative URL to the original file. - type: string - type: object - description: - description: Description for the file. - example: '' - type: string + filesize: + description: Size of the file in bytes. + example: 137862 + type: integer + width: + description: Width of the file in pixels. Only applies to images. + example: 800 + type: integer + nullable: true + height: + description: Height of the file in pixels. Only applies to images. + example: 838 + type: integer nullable: true duration: description: Duration of the file in seconds. Only applies to audio and video. @@ -66,82 +77,29 @@ properties: example: null type: string nullable: true - filename_disk: - description: Name of the file on disk. By default, Directus uses a random hash - for the filename. - example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg + description: + description: Description for the file. + example: "" type: string - filename_download: - description: How you want to the file to be named when it's being downloaded. - example: avatar.jpg - type: string - filesize: - description: Size of the file in bytes. - example: 137862 - type: integer - folder: - description: Virtual folder where this file resides in. - example: null - $ref: '../openapi.yaml#/components/schemas/Folder' nullable: true - height: - description: Height of the file in pixels. Only applies to images. - example: 838 - type: integer - nullable: true - id: - description: Unique identifier for the file. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - type: string location: - description: Where the file was created. Is automatically populated based on EXIF + description: + Where the file was created. Is automatically populated based on EXIF data for images. type: string nullable: true - metadata: - description: User provided miscellaneous key value pairs that serve as additional - metadata for the file. - example: null - type: object - nullable: true - private_hash: - description: Random hash used to access the file privately. This can be rotated - to prevent unauthorized access to the file. - example: pnw7s9lqy68048g0 - type: string - storage: - description: Where the file is stored. Either `local` for the local filesystem - or the name of the storage adapter (for example `s3`). - example: local - type: string tags: - description: Tags for the file. Is automatically populated based on EXIF data + description: + Tags for the file. Is automatically populated based on EXIF data for images. type: array nullable: true items: type: string - title: - description: Title for the file. Is extracted from the filename on upload, but - can be edited by the user. - example: User Avatar - type: string - type: - description: MIME type of the file. - example: image/jpeg - type: string - uploaded_by: - description: Who uploaded the file. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - type: string - # $ref: '../openapi.yaml#/components/schemas/User' - uploaded_on: - description: When the file was uploaded. - example: '2019-12-03T00:10:15+00:00' - type: string - format: date-time - width: - description: Width of the file in pixels. Only applies to images. - example: 800 - type: integer - nullable: true \ No newline at end of file + metadata: + description: + User provided miscellaneous key value pairs that serve as additional + metadata for the file. + example: null + type: object + nullable: true diff --git a/packages/spec/specs/components/folder.yaml b/packages/spec/specs/components/folder.yaml index d91471c03f..8151938c8a 100644 --- a/packages/spec/specs/components/folder.yaml +++ b/packages/spec/specs/components/folder.yaml @@ -11,5 +11,7 @@ properties: parent_folder: description: Unique identifier of the parent folder. This allows for nested folders. example: null - type: string - nullable: true \ No newline at end of file + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/Folder" + nullable: true diff --git a/packages/spec/specs/components/permissions.yaml b/packages/spec/specs/components/permissions.yaml index 1f07a39c0e..18a00fd3ca 100644 --- a/packages/spec/specs/components/permissions.yaml +++ b/packages/spec/specs/components/permissions.yaml @@ -1,5 +1,14 @@ type: object properties: + id: + description: Unique identifier for the permission. + example: 1 + type: integer + role: + description: Unique identifier of the role this permission applies to. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + type: string + nullable: true # Should this be nullable? collection: description: What collection this permission applies to. example: customers @@ -24,10 +33,6 @@ properties: example: none type: string enum: [none, create, update, always] - id: - description: Unique identifier for the permission. - example: 1 - type: integer read: description: If the user can read items. example: mine @@ -39,11 +44,6 @@ properties: type: array items: type: string - role: - description: Unique identifier of the role this permission applies to. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - type: string - nullable: true # Should this be nullable? status: description: What status this permission applies to. example: null @@ -67,4 +67,4 @@ properties: example: [] type: array items: - type: string \ No newline at end of file + type: string diff --git a/packages/spec/specs/components/relation.yaml b/packages/spec/specs/components/relation.yaml index f3bab48044..270828fe89 100644 --- a/packages/spec/specs/components/relation.yaml +++ b/packages/spec/specs/components/relation.yaml @@ -1,5 +1,9 @@ type: object properties: + id: + description: Unique identifier for the relation. + example: 1 + type: integer many_collection: description: Collection that has the field that holds the foreign key. example: directus_activity @@ -25,13 +29,10 @@ properties: description: The primary field. example: id type: string - id: - description: Unique identifier for the relation. - example: 1 - type: integer junction_field: - description: Field on the junction table that holds the primary key of the related + description: + Field on the junction table that holds the primary key of the related collection. example: null type: string - nullable: true \ No newline at end of file + nullable: true diff --git a/packages/spec/specs/components/revision.yaml b/packages/spec/specs/components/revision.yaml index 33acaef79b..921d8b388a 100644 --- a/packages/spec/specs/components/revision.yaml +++ b/packages/spec/specs/components/revision.yaml @@ -1,20 +1,30 @@ type: object properties: + id: + description: Unique identifier for the revision. + example: 1 + type: integer activity: description: Unique identifier for the [activity](/api/activity) record. example: 2 - type: integer + oneOf: + - type: integer + - $ref: "../openapi.yaml#/components/schemas/Activity" collection: description: Collection of the updated item. example: articles type: string + item: + description: Primary key of updated item. + example: "168" + type: string data: description: Copy of item state at time of update. example: author: 1 body: This is my first post featured_image: 15 - id: '168' + id: "168" title: Hello, World! type: object nullable: true # Should this be nullable? @@ -24,28 +34,10 @@ properties: title: Hello, World! oneOf: - type: object - id: - description: Unique identifier for the revision. - example: 1 - type: integer - item: - description: Primary key of updated item. - example: '168' - type: string - parent_changed: - description: If the current item was updated relationally, this shows if the parent - item was updated as well. - example: false - type: boolean - parent_collection: - description: If the current item was updated relationally, this is the collection + parent: + description: + If the current item was updated relationally, this is the collection of the parent item. example: null type: string nullable: true - parent_item: - description: If the current item was updated relationally, this is the unique - identifier of the parent item. - example: null - type: string - nullable: true \ No newline at end of file From 1a817c1a93dbfefa63a7f2f074366c364a47b18b Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Tue, 29 Sep 2020 18:29:14 -0300 Subject: [PATCH 004/189] collections, presets, settings, webhooks --- .../spec/specs/components/collection.yaml | 63 +++++++++-- packages/spec/specs/components/item.yaml | 2 +- packages/spec/specs/components/preset.yaml | 103 +++++++++--------- packages/spec/specs/components/setting.yaml | 61 ++++++++++- packages/spec/specs/components/webhook.yaml | 31 +++++- 5 files changed, 194 insertions(+), 66 deletions(-) diff --git a/packages/spec/specs/components/collection.yaml b/packages/spec/specs/components/collection.yaml index f5e486dbfc..505615688b 100644 --- a/packages/spec/specs/components/collection.yaml +++ b/packages/spec/specs/components/collection.yaml @@ -11,33 +11,74 @@ properties: properties: collection: description: The collection name again! + example: customers type: string - hidden: - type: boolean - singleton: - type: boolean icon: + description: Name of a Google Material Design Icon that's assigned to this collection. type: string + example: people nullable: true note: + description: A note describing the collection. type: string - nullable: true - translation: - type: string + example: null nullable: true display_template: + description: type: string + example: null + nullable: true + hidden: + description: Whether or not the collection is hidden from the navigation in the admin app. + type: boolean + example: false + singleton: + description: Whether or not the collection is treated as a single object. + type: boolean + example: false + translation: + description: Key value pairs of how to show this collection's name in different languages in the admin app. + type: string + example: null + nullable: true + archive_field: + description: What field holds the archive value. + type: string + example: null + nullable: true + archive_app_filter: + description: What value to use for "archived" items. + type: string + example: null + nullable: true + archive_value: + description: What value to use to "unarchive" items. + type: string + example: null + nullable: true + unarchive_value: + description: Whether or not to show the "archived" filter. + type: string + example: null + nullable: true + sort_field: + description: The sort field in the collection. + type: string + example: null nullable: true schema: type: object properties: name: + description: The collection name again! type: string + example: customers schema: + description: Database schema (pg only). + example: public type: string comment: + description: Comment as saved in the database. type: string - collation: - type: string - engine: - type: string + example: null + nullable: true diff --git a/packages/spec/specs/components/item.yaml b/packages/spec/specs/components/item.yaml index 4ee2fb1f9d..03b0d8bfea 100644 --- a/packages/spec/specs/components/item.yaml +++ b/packages/spec/specs/components/item.yaml @@ -1,2 +1,2 @@ type: object -properties: {} \ No newline at end of file +properties: {} diff --git a/packages/spec/specs/components/preset.yaml b/packages/spec/specs/components/preset.yaml index 5c59944b48..af722a18cb 100644 --- a/packages/spec/specs/components/preset.yaml +++ b/packages/spec/specs/components/preset.yaml @@ -1,12 +1,46 @@ type: object properties: + id: + description: Unique identifier for this single collection preset. + example: 155 + type: integer + bookmark: + description: + Name for the bookmark. If this is set, the collection preset will + be considered to be a bookmark. + example: null + nullable: true + type: string + user: + description: + The unique identifier of the user to whom this collection preset + applies. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + nullable: true + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/User" + role: + description: + The unique identifier of a role in the platform. If `user` is null, + this will be used to apply the collection preset or bookmark for all users in + the role. + example: 50419801-0f30-8644-2b3c-9bc2d980d0a0 + nullable: true + type: string collection: description: What collection this collection preset is used for. example: articles type: string + search: + description: What the user searched for in search/filter in the header bar. + example: null + type: string + nullable: true filters: description: The filters that the user applied. example: + key: 7RwVrquB5dPmfbrI1rcWy field: title operator: contains value: Hello @@ -14,60 +48,27 @@ properties: nullable: true items: type: object - id: - description: Unique identifier for this single collection preset. - example: '155' - type: integer - role: - description: The unique identifier of a role in the platform. If `user` is null, - this will be used to apply the collection preset or bookmark for all users in - the role. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - nullable: true + layout: + description: Name of the layout type that is used. type: string - search_query: - description: What the user searched for in search/filter in the header bar. example: null - type: string - nullable: true - title: - description: Name for the bookmark. If this is set, the collection preset will - be considered to be a bookmark. - example: null - type: string - nullable: true - translation: - description: Key value pair of language-translation. Can be used to translate - the bookmark title in multiple languages. - example: null - type: object - nullable: true - user: - description: The unique identifier of the user to whom this collection preset - applies. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - nullable: true - type: string - view_options: - description: Options of the views. The properties in here are controlled by the - layout. - example: - timeline: - color: action - content: excerpt - date: published_on - title: '{{ title }} ({{ author.first_name }} {{ author.last_name }})' - type: object - nullable: true - view_query: - description: View query that's saved per view type. Controls what data is fetched + layout_query: + description: + Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. example: - timeline: + cards: sort: -published_on - type: object + filters: [published_on, published_by] + nullable: true + layout_options: + description: + Options of the views. The properties in here are controlled by the + layout. + example: + cards: + icon: account_circle + title: "{{ first_name }} {{ last_name }}" + subtitle: "{{ title }}" + size: 3 nullable: true - view_type: - description: Name of the view type that is used. - example: timeline - type: string \ No newline at end of file diff --git a/packages/spec/specs/components/setting.yaml b/packages/spec/specs/components/setting.yaml index 4171ab656f..f4ab6e0f6c 100644 --- a/packages/spec/specs/components/setting.yaml +++ b/packages/spec/specs/components/setting.yaml @@ -2,6 +2,63 @@ type: object properties: id: description: Unique identifier for the setting. - example: 1 type: integer -additionalProperties: true \ No newline at end of file + example: 1 + project_name: + description: The name of the project. + type: string + example: Directus + project_url: + description: The url of the project. + type: string + example: null + nullable: true + project_color: + description: The color of the project. + type: string + example: null + nullable: true + project_logo: + description: The logo of the project. + type: string + example: null + nullable: true + public_foreground: + description: The foreground of the project. + type: string + example: null + nullable: true + public_background: + description: The background of the project. + type: string + example: null + nullable: true + public_note: + description: The notes of the project. + type: string + example: null + nullable: true + auth_idle_timeout: + description: Idle authentication timeout. + type: integer + example: 10080 + auth_login_attempts: + description: Authentication login attempts. + type: integer + example: 25, + auth_password_policy: + description: Authentication password policy. + type: string + example: null + nullable: true + storage_asset_transform: + description: + type: string + example: "all" + nullable: true + storage_asset_presets: + description: + type: string + example: null + nullable: true +additionalProperties: true diff --git a/packages/spec/specs/components/webhook.yaml b/packages/spec/specs/components/webhook.yaml index c2d3f4ea36..f616d5bfbc 100644 --- a/packages/spec/specs/components/webhook.yaml +++ b/packages/spec/specs/components/webhook.yaml @@ -3,4 +3,33 @@ properties: id: description: The index of the webhook. type: integer - example: 1 \ No newline at end of file + example: 1 + name: + description: The name of the webhook. + type: string + example: create articles + method: + description: Method used in the webhook. + type: string + example: POST + url: + description: The url of the webhook. + type: string + example: null + nullable: true + status: + description: The status of the webhook. + type: boolean + example: inactive + data: + description: If yes, send the content of what was done + type: boolean + example: true + actions: + description: The actions that triggers this webhook. + example: null + nullable: true + collections: + description: The collections that triggers this webhook. + example: null + nullable: true From 1cf8bde981b19eda4d91304085fe55a1ffa7bdcc Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Tue, 29 Sep 2020 19:00:51 -0300 Subject: [PATCH 005/189] changes --- packages/spec/specs/components/collection.yaml | 1 + packages/spec/specs/components/permissions.yaml | 9 ++++----- packages/spec/specs/components/revision.yaml | 3 +-- packages/spec/specs/components/user.yaml | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/spec/specs/components/collection.yaml b/packages/spec/specs/components/collection.yaml index 505615688b..e6a9322f03 100644 --- a/packages/spec/specs/components/collection.yaml +++ b/packages/spec/specs/components/collection.yaml @@ -7,6 +7,7 @@ properties: meta: description: Metadata of the collection. type: object + example: null nullable: true properties: collection: diff --git a/packages/spec/specs/components/permissions.yaml b/packages/spec/specs/components/permissions.yaml index 18a00fd3ca..4d7463a4aa 100644 --- a/packages/spec/specs/components/permissions.yaml +++ b/packages/spec/specs/components/permissions.yaml @@ -52,11 +52,10 @@ properties: status_blacklist: description: Explicitly denies specific statuses to be used. example: [] - oneOf: - - type: array - nullable: true - items: - type: string + type: array + nullable: true + items: + type: string update: description: If the user can update items. example: none diff --git a/packages/spec/specs/components/revision.yaml b/packages/spec/specs/components/revision.yaml index 921d8b388a..5e1cbd2074 100644 --- a/packages/spec/specs/components/revision.yaml +++ b/packages/spec/specs/components/revision.yaml @@ -32,8 +32,7 @@ properties: description: Changes between the previous and the current revision. example: title: Hello, World! - oneOf: - - type: object + type: object parent: description: If the current item was updated relationally, this is the collection diff --git a/packages/spec/specs/components/user.yaml b/packages/spec/specs/components/user.yaml index ba66a6ed51..e99d1f25ca 100644 --- a/packages/spec/specs/components/user.yaml +++ b/packages/spec/specs/components/user.yaml @@ -46,7 +46,6 @@ properties: example: null oneOf: - type: integer - nullable: true - type: string - $ref: "../openapi.yaml#/components/schemas/File" nullable: true From 8c60dc41dd57f591cdcf9a01908cc697ad54119f Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Tue, 29 Sep 2020 19:39:41 -0300 Subject: [PATCH 006/189] some fixes and changes --- packages/spec/specs/components/activity.yaml | 4 +++- packages/spec/specs/components/collection.yaml | 2 +- packages/spec/specs/components/setting.yaml | 4 ++-- packages/spec/specs/components/user.yaml | 4 +++- packages/spec/specs/paths/assets/assets.yaml | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/spec/specs/components/activity.yaml b/packages/spec/specs/components/activity.yaml index 0b61752148..43f6c659e2 100644 --- a/packages/spec/specs/components/activity.yaml +++ b/packages/spec/specs/components/activity.yaml @@ -21,8 +21,10 @@ properties: invalid-credentials, ] action_by: - $ref: "./user.yaml" description: The user who caused this action. + oneOf: + - type: string + - $ref: "../openapi.yaml#/components/schemas/User" nullable: true # States the SQL structure action_on: description: When the action happened. diff --git a/packages/spec/specs/components/collection.yaml b/packages/spec/specs/components/collection.yaml index e6a9322f03..23f04f168a 100644 --- a/packages/spec/specs/components/collection.yaml +++ b/packages/spec/specs/components/collection.yaml @@ -25,7 +25,7 @@ properties: example: null nullable: true display_template: - description: + description: Text representation of how items from this collection are shown across the system. type: string example: null nullable: true diff --git a/packages/spec/specs/components/setting.yaml b/packages/spec/specs/components/setting.yaml index f4ab6e0f6c..595e3a018d 100644 --- a/packages/spec/specs/components/setting.yaml +++ b/packages/spec/specs/components/setting.yaml @@ -52,12 +52,12 @@ properties: example: null nullable: true storage_asset_transform: - description: + description: "" type: string example: "all" nullable: true storage_asset_presets: - description: + description: "" type: string example: null nullable: true diff --git a/packages/spec/specs/components/user.yaml b/packages/spec/specs/components/user.yaml index e99d1f25ca..fdb2ca4876 100644 --- a/packages/spec/specs/components/user.yaml +++ b/packages/spec/specs/components/user.yaml @@ -35,12 +35,14 @@ properties: description: The user's description. example: null type: string - nullable: + nullable: true tags: description: The user's tags. example: null type: array nullable: true + items: + type: string avatar: description: The user's avatar. example: null diff --git a/packages/spec/specs/paths/assets/assets.yaml b/packages/spec/specs/paths/assets/assets.yaml index b344658c15..e3eae083c1 100644 --- a/packages/spec/specs/paths/assets/assets.yaml +++ b/packages/spec/specs/paths/assets/assets.yaml @@ -6,9 +6,9 @@ get: security: - Auth: [] parameters: - - name: key + - name: id in: path - description: private_hash of the file + description: The id of the file. required: true schema: type: string From 96fa38f12c42cf417b9fb77dffc28e21486bb366 Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Wed, 30 Sep 2020 18:45:40 -0300 Subject: [PATCH 007/189] updates api specs --- packages/spec/specs/openapi.yaml | 21 ++--- packages/spec/specs/parameters/id.yaml | 4 +- packages/spec/specs/paths/auth/login.yaml | 7 +- packages/spec/specs/paths/auth/logout.yaml | 15 +++- .../specs/paths/auth/password-request.yaml | 4 - packages/spec/specs/paths/auth/refresh.yaml | 3 + .../spec/specs/paths/presets/presets.yaml | 21 ++--- packages/spec/specs/paths/scim/group.yaml | 51 ------------- packages/spec/specs/paths/scim/groups.yaml | 59 -------------- packages/spec/specs/paths/scim/user.yaml | 76 ------------------- packages/spec/specs/paths/scim/users.yaml | 59 -------------- 11 files changed, 40 insertions(+), 280 deletions(-) delete mode 100644 packages/spec/specs/paths/scim/group.yaml delete mode 100644 packages/spec/specs/paths/scim/groups.yaml delete mode 100644 packages/spec/specs/paths/scim/user.yaml delete mode 100644 packages/spec/specs/paths/scim/users.yaml diff --git a/packages/spec/specs/openapi.yaml b/packages/spec/specs/openapi.yaml index 5c0597253b..f56f5f7f03 100644 --- a/packages/spec/specs/openapi.yaml +++ b/packages/spec/specs/openapi.yaml @@ -1,17 +1,18 @@ openapi: 3.0.1 info: - title: Directus SDK + title: Directus API description: Template for generating any kind of SDK. contact: email: contact@directus.io license: name: GPL-3.0 url: "https://www.gnu.org/licenses/gpl-3.0.de.html" - version: 1.0.0 + version: 9.0.0 externalDocs: description: Directus Docs url: "https://docs.directus.io" servers: + - url: "http://localhost:41201/" - url: "https://demo.directus.io/" - url: "/" tags: @@ -21,8 +22,8 @@ tags: description: Image typed files can be dynamically resized and transformed to fit any need. - name: Authentication description: All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens. - - name: Collection presets - description: Collection presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom item listings for users of the app. + - name: Presets + description: Presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom item listings for users of the app. - name: Collections description: Collections are the individual collections of items, similar to tables in a database. Changes to collections will alter the schema of the database. - name: Extensions @@ -71,7 +72,7 @@ paths: $ref: "./paths/activity/activity-comment.yaml" # Assets - /assets/{key}: + /assets/{id}: $ref: "./paths/assets/assets.yaml" # Authentication @@ -172,16 +173,6 @@ paths: /roles/{id}: $ref: "./paths/roles/role.yaml" - # SCIM - /scim/v2/Users: - $ref: "./paths/scim/users.yaml" - /scim/v2/Users/{id}: - $ref: "./paths/scim/user.yaml" - /scim/v2/Groups: - $ref: "./paths/scim/groups.yaml" - /scim/v2/Groups/{id}: - $ref: "./paths/scim/group.yaml" - # Server /server/info: $ref: "./paths/server/info.yaml" diff --git a/packages/spec/specs/parameters/id.yaml b/packages/spec/specs/parameters/id.yaml index ec7af1c934..ab577d31de 100644 --- a/packages/spec/specs/parameters/id.yaml +++ b/packages/spec/specs/parameters/id.yaml @@ -1,6 +1,6 @@ -description: Index of the file. +description: Index name: id in: path required: true schema: - type: integer \ No newline at end of file + type: integer diff --git a/packages/spec/specs/paths/auth/login.yaml b/packages/spec/specs/paths/auth/login.yaml index 7cdd4c4002..fc3aa301f8 100644 --- a/packages/spec/specs/paths/auth/login.yaml +++ b/packages/spec/specs/paths/auth/login.yaml @@ -21,8 +21,8 @@ post: example: password mode: type: string - enum: [jwt, cookie] - default: jwt + enum: ["json", cookie] + default: "json" description: Choose between retrieving the token as a string, or setting it as a cookie. otp: type: string @@ -44,3 +44,6 @@ post: expires: type: integer example: 900 + refresh_token: + type: string + example: yuOJkjdPXMd... diff --git a/packages/spec/specs/paths/auth/logout.yaml b/packages/spec/specs/paths/auth/logout.yaml index 120471a4f0..2beb4b14eb 100644 --- a/packages/spec/specs/paths/auth/logout.yaml +++ b/packages/spec/specs/paths/auth/logout.yaml @@ -3,6 +3,17 @@ post: tags: - Authentication operationId: logout + requestBody: + content: + application/json: + schema: + type: object + required: [token] + properties: + refresh_token: + type: string + example: eyJ0eXAiOiJKV... + description: JWT access token you want to logout. responses: - '200': - description: Request successful \ No newline at end of file + "200": + description: Request successful diff --git a/packages/spec/specs/paths/auth/password-request.yaml b/packages/spec/specs/paths/auth/password-request.yaml index 71637a4278..fbbceb9b0e 100644 --- a/packages/spec/specs/paths/auth/password-request.yaml +++ b/packages/spec/specs/paths/auth/password-request.yaml @@ -14,10 +14,6 @@ post: type: string example: admin@example.com description: Email address of the user you're requesting a reset for. - reset_url: - type: string - example: https://mydomain.com/passwordreset - description: Provide a custom reset url which the link in the Email will lead to. The reset token will be passed as a parameter. responses: "401": $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/refresh.yaml b/packages/spec/specs/paths/auth/refresh.yaml index 3dcc7becf3..0f417f637c 100644 --- a/packages/spec/specs/paths/auth/refresh.yaml +++ b/packages/spec/specs/paths/auth/refresh.yaml @@ -31,5 +31,8 @@ post: expires: type: integer example: 900 + refresh_token: + type: string + example: Gy-caJMpmGTA... "401": $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/presets/presets.yaml b/packages/spec/specs/paths/presets/presets.yaml index fdb8923b98..5b0970a74c 100644 --- a/packages/spec/specs/paths/presets/presets.yaml +++ b/packages/spec/specs/paths/presets/presets.yaml @@ -53,9 +53,10 @@ post: description: Name for the bookmark. If this is set, the collection preset will be considered to be a bookmark. example: Highly rated articles role: - type: integer + type: string description: The unique identifier of a role in the platform. If user is null, this will be used to apply the collection preset or bookmark for all users in the role. - search_query: + example: null + search: type: string description: What the user searched for in search/filter in the header bar. filters: @@ -63,6 +64,9 @@ post: items: type: object properties: + key: + type: string + example: aHKLAakdVghzD field: type: string example: rating @@ -72,18 +76,15 @@ post: value: type: integer example: 4.5 - view_type: + layout: type: string - description: Name of the view type that is used. Defaults to tabular. - view_query: + description: Name of the view type that is used. + layout_query: type: string - description: View query that's saved per view type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. - view_options: + description: Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. + layout_options: type: string description: Options of the views. The properties in here are controlled by the layout. - translation: - type: object - description: Key value pair of language-translation. Can be used to translate the bookmark title in multiple languages. responses: "200": description: Successful request diff --git a/packages/spec/specs/paths/scim/group.yaml b/packages/spec/specs/paths/scim/group.yaml deleted file mode 100644 index 238a8cafbc..0000000000 --- a/packages/spec/specs/paths/scim/group.yaml +++ /dev/null @@ -1,51 +0,0 @@ -get: - description: Retrieve a single SCIM Group by unique identifier. - operationId: getSCIMGroup - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -patch: - description: Update an existing SCIM Group - operationId: updateSCIMGroup - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -delete: - description: Delete an existing SCIM Group - operationId: deleteSCIMGroup - responses: - "200": - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -parameters: - - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/scim/groups.yaml b/packages/spec/specs/paths/scim/groups.yaml deleted file mode 100644 index 721a8f76d8..0000000000 --- a/packages/spec/specs/paths/scim/groups.yaml +++ /dev/null @@ -1,59 +0,0 @@ -get: - description: List the SCIM Groups. - operationId: getSCIMGroups - parameters: - - description: The 1-based index of the first result in the current set of list results. - in: query - name: startIndex - required: false - schema: - type: integer - - description: Specifies the desired maximum number of query results per page. - in: query - name: count - required: false - schema: - type: integer - - description: - Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq - 15` - in: query - name: filter - required: false - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -post: - description: Create a new SCIM Group. - operationId: createSCIMGroup - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM diff --git a/packages/spec/specs/paths/scim/user.yaml b/packages/spec/specs/paths/scim/user.yaml deleted file mode 100644 index c3d526d168..0000000000 --- a/packages/spec/specs/paths/scim/user.yaml +++ /dev/null @@ -1,76 +0,0 @@ -get: - description: Retrieve a single SCIM user by unique identifier. - operationId: getSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -patch: - description: Update an existing SCIM User - operationId: updateSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -delete: - description: Delete an existing SCIM User - operationId: deleteSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - responses: - "200": - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM diff --git a/packages/spec/specs/paths/scim/users.yaml b/packages/spec/specs/paths/scim/users.yaml deleted file mode 100644 index 9fb6b42afc..0000000000 --- a/packages/spec/specs/paths/scim/users.yaml +++ /dev/null @@ -1,59 +0,0 @@ -get: - description: List the SCIM users - operationId: getSCIMUsers - parameters: - - description: The 1-based index of the first result in the current set of list results. - in: query - name: startIndex - required: false - schema: - type: integer - - description: Specifies the desired maximum number of query results per page. - in: query - name: count - required: false - schema: - type: integer - - description: - Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq - 15` - in: query - name: filter - required: false - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -post: - description: Create a new SCIM User. - operationId: createSCIMUser - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM From 508661167e56970ccc297943ea1a1096330b185f Mon Sep 17 00:00:00 2001 From: Nitwel Date: Fri, 2 Oct 2020 20:36:24 +0200 Subject: [PATCH 008/189] add accordion option to v-list-group --- app/src/components/v-list/v-list-group.vue | 16 ++++++++++++---- .../modules/docs/components/navigation-item.vue | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/components/v-list/v-list-group.vue b/app/src/components/v-list/v-list-group.vue index bf9f904e21..aa41ab4830 100644 --- a/app/src/components/v-list/v-list-group.vue +++ b/app/src/components/v-list/v-list-group.vue @@ -1,5 +1,5 @@ diff --git a/app/src/modules/docs/components/navigation-item.vue b/app/src/modules/docs/components/navigation-item.vue index 4a2fc16be6..4708d82fb8 100644 --- a/app/src/modules/docs/components/navigation-item.vue +++ b/app/src/modules/docs/components/navigation-item.vue @@ -14,7 +14,7 @@ dense /> - +
From 325fe78791101bb79e9feacba0c075637d2b22c7 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Sat, 3 Oct 2020 00:56:40 +0200 Subject: [PATCH 010/189] Remove v-model on groups and make docs nav linear --- app/src/components/v-list/v-list-group.vue | 17 +------ app/src/components/v-list/v-list.vue | 2 +- .../docs/components/navigation-item.vue | 36 +------------- .../modules/docs/components/navigation.vue | 49 ++++++++++++------- 4 files changed, 35 insertions(+), 69 deletions(-) diff --git a/app/src/components/v-list/v-list-group.vue b/app/src/components/v-list/v-list-group.vue index 52fe1c17de..7569b4caa7 100644 --- a/app/src/components/v-list/v-list-group.vue +++ b/app/src/components/v-list/v-list-group.vue @@ -19,10 +19,6 @@ import { defineComponent, nextTick, toRefs, watch, PropType, ref } from '@vue/co import { useGroupableParent, useGroupable } from '@/composables/groupable'; export default defineComponent({ - model: { - prop: 'activeItems', - event: 'input' - }, props: { multiple: { type: Boolean, @@ -32,10 +28,6 @@ export default defineComponent({ type: String, default: null, }, - activeItems: { - type: Array as PropType<(number | string)[]>, - default: null - }, active: { type: Boolean, default: false, @@ -62,7 +54,7 @@ export default defineComponent({ } }, setup(props, { listeners, emit }) { - const {activeItems, multiple} = toRefs(props) + const {multiple} = toRefs(props) const { active: groupActive, toggle, activate, deactivate } = useGroupable({ group: props.scope, @@ -71,12 +63,7 @@ export default defineComponent({ if (props.disableGroupableParent !== true) { useGroupableParent( - { - selection: activeItems, - onSelectionChange: (newSelection) => { - emit('input', newSelection) - } - }, + {}, { multiple } diff --git a/app/src/components/v-list/v-list.vue b/app/src/components/v-list/v-list.vue index 5d05a33ee6..8aec96c005 100644 --- a/app/src/components/v-list/v-list.vue +++ b/app/src/components/v-list/v-list.vue @@ -54,7 +54,7 @@ export default defineComponent({ } }, { - mandatory: ref(false), + mandatory: ref(true), multiple } ); diff --git a/app/src/modules/docs/components/navigation-item.vue b/app/src/modules/docs/components/navigation-item.vue index 31bf78d834..e9b99f6679 100644 --- a/app/src/modules/docs/components/navigation-item.vue +++ b/app/src/modules/docs/components/navigation-item.vue @@ -1,5 +1,5 @@ @@ -33,12 +34,12 @@ export default defineComponent({ const collectionsStore = useCollectionsStore(); const component = ref(); - const isSingle = computed(() => { + const isSingleton = computed(() => { const collectionInfo = collectionsStore.getCollection(props.collection); return !!collectionInfo?.meta?.singleton === true; }); - return { component, isSingle }; + return { component, isSingleton }; }, beforeRouteLeave(to, from, next) { if ((this as any).$refs?.component?.navigationGuard) { diff --git a/app/src/modules/collections/routes/item.vue b/app/src/modules/collections/routes/item.vue index 362208ef1d..78dc55f904 100644 --- a/app/src/modules/collections/routes/item.vue +++ b/app/src/modules/collections/routes/item.vue @@ -242,6 +242,10 @@ export default defineComponent({ type: String, default: null, }, + singleton: { + type: Boolean, + default: false, + }, }, setup(props) { const form = ref(); @@ -377,7 +381,7 @@ export default defineComponent({ if (saveAllowed.value === false || hasEdits.value === false) return; await save(); - router.push(`/collections/${props.collection}`); + if (props.singleton === false) router.push(`/collections/${props.collection}`); } async function saveAndStay() { From cc950b551036cea1abb6a2bd0d00ed1494ab6643 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:15:37 -0400 Subject: [PATCH 169/189] Move main server logic out of cli --- api/package.json | 4 +-- api/src/cli/commands/start.ts | 54 +++++++++++------------------------ api/src/server-dev.ts | 4 +++ api/src/server.ts | 46 ++++++++++++++++++++++------- 4 files changed, 58 insertions(+), 50 deletions(-) create mode 100644 api/src/server-dev.ts diff --git a/api/package.json b/api/package.json index 244562cb1e..b87d388dbf 100644 --- a/api/package.json +++ b/api/package.json @@ -51,9 +51,9 @@ "directus": "cli.js" }, "scripts": { - "start": "cross-env NODE_ENV=production node dist/server.js", + "start": "npx directus start", "build": "rm -rf dist && tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist", - "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server.ts --respawn --watch \"src/**/*.ts\" --transpile-only", + "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server-dev.ts --respawn --watch \"src/**/*.ts\" --transpile-only", "cli": "cross-env NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts", "prepublishOnly": "npm run build" }, diff --git a/api/src/cli/commands/start.ts b/api/src/cli/commands/start.ts index 58c7d7dcdf..f8dcf48aed 100644 --- a/api/src/cli/commands/start.ts +++ b/api/src/cli/commands/start.ts @@ -1,45 +1,23 @@ import logger from '../../logger'; -import { Express } from 'express'; -import { createTerminus, TerminusOptions } from '@godaddy/terminus'; -import http from 'http'; -import emitter from '../../emitter'; export default async function start() { - const { default: env } = require('../../env'); - const database = require('../../database'); - - await database.validateDBConnection(); - - const app: Express = require('../../app').default; + const env = require('../../env').default; + const { validateDBConnection } = require('../../database'); + await validateDBConnection(); const port = env.PORT; - const server = http.createServer(app); + const server = require('../../server').default; - const terminusOptions: TerminusOptions = { - timeout: 1000, - signals: ['SIGINT', 'SIGTERM', 'SIGHUP'], - beforeShutdown, - onSignal, - onShutdown, - logger: logger.info, - }; - - createTerminus(server, terminusOptions); - - server.listen(port); - logger.info(`Server started at port ${port}`); - - async function beforeShutdown() { - emitter.emit('destroy'); - logger.info('Shutting down Directus'); - } - - async function onSignal() { - await database.default.destroy(); - logger.info('Database connections destroyed'); - } - - async function onShutdown() { - logger.info('Directus shut down OK. Bye bye!'); - } + server + .listen(port, () => { + logger.info(`Server started at port ${port}`); + }) + .once('error', (err: any) => { + if (err?.code === 'EADDRINUSE') { + logger.fatal(`Port ${port} is already in use`); + process.exit(1); + } else { + throw err; + } + }); } diff --git a/api/src/server-dev.ts b/api/src/server-dev.ts new file mode 100644 index 0000000000..b123077caf --- /dev/null +++ b/api/src/server-dev.ts @@ -0,0 +1,4 @@ +import server from './server'; +import logger from './logger'; + +server.listen(8055, () => logger.info(`Dev server started at port ${8055}`)); diff --git a/api/src/server.ts b/api/src/server.ts index b9a9c748b2..4edb562914 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -1,16 +1,42 @@ -import app from './app'; import logger from './logger'; -import env from './env'; -import { validateDBConnection } from './database'; +import { createTerminus, TerminusOptions } from '@godaddy/terminus'; +import http from 'http'; +import emitter from './emitter'; +import database from './database'; +import app from './app'; -export default async function start() { - await validateDBConnection(); +const server = http.createServer(app); - const port = env.NODE_ENV === 'development' ? 8055 : env.PORT; +const terminusOptions: TerminusOptions = { + timeout: 1000, + signals: ['SIGINT', 'SIGTERM', 'SIGHUP'], + beforeShutdown, + onSignal, + onShutdown, + logger: logger.info, +}; - app.listen(port, () => { - logger.info(`Server started at port ${port}`); - }); +createTerminus(server, terminusOptions); + +export default server; + +async function beforeShutdown() { + await emitter.emitAsync('destroy'); + + if (process.env.NODE_ENV === 'development') { + logger.info('Restarting...'); + } else { + logger.info('Shutting down...'); + } } -start(); +async function onSignal() { + await database.destroy(); + logger.info('Database connections destroyed'); +} + +async function onShutdown() { + if (process.env.NODE_ENV !== 'development') { + logger.info('Directus shut down OK. Bye bye!'); + } +} From a4092a070d967f90d9759c945faa559f07d266bf Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:19:14 -0400 Subject: [PATCH 170/189] Add server.start / server.start.before / server.stop / server.stop.before --- api/src/cli/commands/start.ts | 4 ++++ api/src/server.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/src/cli/commands/start.ts b/api/src/cli/commands/start.ts index f8dcf48aed..458a5527e8 100644 --- a/api/src/cli/commands/start.ts +++ b/api/src/cli/commands/start.ts @@ -1,4 +1,5 @@ import logger from '../../logger'; +import emitter from '../../emitter'; export default async function start() { const env = require('../../env').default; @@ -8,9 +9,12 @@ export default async function start() { const server = require('../../server').default; + await emitter.emitAsync('server.start.before', { server }); + server .listen(port, () => { logger.info(`Server started at port ${port}`); + emitter.emitAsync('server.start').catch((err) => logger.warn(err)); }) .once('error', (err: any) => { if (err?.code === 'EADDRINUSE') { diff --git a/api/src/server.ts b/api/src/server.ts index 4edb562914..c32a6f1fd8 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -21,7 +21,7 @@ createTerminus(server, terminusOptions); export default server; async function beforeShutdown() { - await emitter.emitAsync('destroy'); + await emitter.emitAsync('server.stop.before', { server }); if (process.env.NODE_ENV === 'development') { logger.info('Restarting...'); @@ -36,6 +36,8 @@ async function onSignal() { } async function onShutdown() { + emitter.emitAsync('server.stop').catch((err) => logger.warn(err)); + if (process.env.NODE_ENV !== 'development') { logger.info('Directus shut down OK. Bye bye!'); } From 2c1b031288058a3f1ed4684b892b677578be381c Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:20:34 -0400 Subject: [PATCH 171/189] Update docs to reflect change --- docs/guides/extensions/api-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/extensions/api-hooks.md b/docs/guides/extensions/api-hooks.md index 508927aac7..e0f6f4801c 100644 --- a/docs/guides/extensions/api-hooks.md +++ b/docs/guides/extensions/api-hooks.md @@ -86,7 +86,7 @@ module.exports = function registerHook({ exceptions }) { | `response` | | No† | | `auth` | `success`†, `fail`† and `refresh`† | No | | `init` | | Optional | -| `destroy` | | No | +| `server` | `start` and `stop` | Optional | † TBD From a39b762c81c307c370f26a14d4ecefdef7c3f17e Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:31:57 -0400 Subject: [PATCH 172/189] Move start functionality to server.ts --- api/src/cli/commands/start.ts | 26 ++------------------------ api/src/server-dev.ts | 5 ++--- api/src/server.ts | 24 +++++++++++++++++++++++- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/api/src/cli/commands/start.ts b/api/src/cli/commands/start.ts index 458a5527e8..53457b5906 100644 --- a/api/src/cli/commands/start.ts +++ b/api/src/cli/commands/start.ts @@ -1,27 +1,5 @@ -import logger from '../../logger'; -import emitter from '../../emitter'; - export default async function start() { - const env = require('../../env').default; - const { validateDBConnection } = require('../../database'); - await validateDBConnection(); - const port = env.PORT; + const startServer = require('../../server').start; - const server = require('../../server').default; - - await emitter.emitAsync('server.start.before', { server }); - - server - .listen(port, () => { - logger.info(`Server started at port ${port}`); - emitter.emitAsync('server.start').catch((err) => logger.warn(err)); - }) - .once('error', (err: any) => { - if (err?.code === 'EADDRINUSE') { - logger.fatal(`Port ${port} is already in use`); - process.exit(1); - } else { - throw err; - } - }); + await startServer(); } diff --git a/api/src/server-dev.ts b/api/src/server-dev.ts index b123077caf..3d5cf1e111 100644 --- a/api/src/server-dev.ts +++ b/api/src/server-dev.ts @@ -1,4 +1,3 @@ -import server from './server'; -import logger from './logger'; +import { start } from './server'; -server.listen(8055, () => logger.info(`Dev server started at port ${8055}`)); +start(); diff --git a/api/src/server.ts b/api/src/server.ts index c32a6f1fd8..22544108b3 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -2,8 +2,9 @@ import logger from './logger'; import { createTerminus, TerminusOptions } from '@godaddy/terminus'; import http from 'http'; import emitter from './emitter'; -import database from './database'; +import database, { validateDBConnection } from './database'; import app from './app'; +import env from './env'; const server = http.createServer(app); @@ -20,6 +21,27 @@ createTerminus(server, terminusOptions); export default server; +export async function start() { + await validateDBConnection(); + await emitter.emitAsync('server.start.before', { server }); + + const port = env.PORT; + + server + .listen(port, () => { + logger.info(`Server started at port ${port}`); + emitter.emitAsync('server.start').catch((err) => logger.warn(err)); + }) + .once('error', (err: any) => { + if (err?.code === 'EADDRINUSE') { + logger.fatal(`Port ${port} is already in use`); + process.exit(1); + } else { + throw err; + } + }); +} + async function beforeShutdown() { await emitter.emitAsync('server.stop.before', { server }); From 0e0d5e8213ebe4c9ab27e831c115cea867e4054b Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:34:57 -0400 Subject: [PATCH 173/189] Start server when running file directly with Node --- api/package.json | 2 +- api/src/server-dev.ts | 3 --- api/src/server.ts | 5 +++++ 3 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 api/src/server-dev.ts diff --git a/api/package.json b/api/package.json index b87d388dbf..7d7ea1a067 100644 --- a/api/package.json +++ b/api/package.json @@ -53,7 +53,7 @@ "scripts": { "start": "npx directus start", "build": "rm -rf dist && tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist", - "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server-dev.ts --respawn --watch \"src/**/*.ts\" --transpile-only", + "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server.ts --respawn --watch \"src/**/*.ts\" --transpile-only", "cli": "cross-env NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts", "prepublishOnly": "npm run build" }, diff --git a/api/src/server-dev.ts b/api/src/server-dev.ts deleted file mode 100644 index 3d5cf1e111..0000000000 --- a/api/src/server-dev.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { start } from './server'; - -start(); diff --git a/api/src/server.ts b/api/src/server.ts index 22544108b3..5a25690803 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -19,6 +19,11 @@ const terminusOptions: TerminusOptions = { createTerminus(server, terminusOptions); +// If this file is called directly in the command line +if (require.main === module) { + start(); +} + export default server; export async function start() { From 0b894138b73ede2d602715e4a7e95ef5befcb980 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:44:21 -0400 Subject: [PATCH 174/189] Move start to separate file --- api/package.json | 2 +- api/src/cli/commands/start.ts | 3 +-- api/src/server.ts | 30 +----------------------------- api/src/start.ts | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 api/src/start.ts diff --git a/api/package.json b/api/package.json index 7d7ea1a067..66489d0c37 100644 --- a/api/package.json +++ b/api/package.json @@ -53,7 +53,7 @@ "scripts": { "start": "npx directus start", "build": "rm -rf dist && tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist", - "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server.ts --respawn --watch \"src/**/*.ts\" --transpile-only", + "dev": "cross-env NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/start.ts --respawn --watch \"src/**/*.ts\" --transpile-only", "cli": "cross-env NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts", "prepublishOnly": "npm run build" }, diff --git a/api/src/cli/commands/start.ts b/api/src/cli/commands/start.ts index 53457b5906..be9ca7ba75 100644 --- a/api/src/cli/commands/start.ts +++ b/api/src/cli/commands/start.ts @@ -1,5 +1,4 @@ export default async function start() { - const startServer = require('../../server').start; - + const startServer = require('../../start').default; await startServer(); } diff --git a/api/src/server.ts b/api/src/server.ts index 5a25690803..fc5ee95aa1 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -2,9 +2,8 @@ import logger from './logger'; import { createTerminus, TerminusOptions } from '@godaddy/terminus'; import http from 'http'; import emitter from './emitter'; -import database, { validateDBConnection } from './database'; +import database from './database'; import app from './app'; -import env from './env'; const server = http.createServer(app); @@ -14,39 +13,12 @@ const terminusOptions: TerminusOptions = { beforeShutdown, onSignal, onShutdown, - logger: logger.info, }; createTerminus(server, terminusOptions); -// If this file is called directly in the command line -if (require.main === module) { - start(); -} - export default server; -export async function start() { - await validateDBConnection(); - await emitter.emitAsync('server.start.before', { server }); - - const port = env.PORT; - - server - .listen(port, () => { - logger.info(`Server started at port ${port}`); - emitter.emitAsync('server.start').catch((err) => logger.warn(err)); - }) - .once('error', (err: any) => { - if (err?.code === 'EADDRINUSE') { - logger.fatal(`Port ${port} is already in use`); - process.exit(1); - } else { - throw err; - } - }); -} - async function beforeShutdown() { await emitter.emitAsync('server.stop.before', { server }); diff --git a/api/src/start.ts b/api/src/start.ts new file mode 100644 index 0000000000..4d63b48cae --- /dev/null +++ b/api/src/start.ts @@ -0,0 +1,33 @@ +import emitter from './emitter'; +import env from './env'; +import logger from './logger'; + +// If this file is called directly using node, start the server +if (require.main === module) { + start(); +} + +export default async function start() { + const server = require('./server').default; + const { validateDBConnection } = require('./database'); + + await validateDBConnection(); + + await emitter.emitAsync('server.start.before', { server }); + + const port = env.PORT; + + server + .listen(port, () => { + logger.info(`Server started at port ${port}`); + emitter.emitAsync('server.start').catch((err) => logger.warn(err)); + }) + .once('error', (err: any) => { + if (err?.code === 'EADDRINUSE') { + logger.fatal(`Port ${port} is already in use`); + process.exit(1); + } else { + throw err; + } + }); +} From dff98f316bc2afca77458ea55b9a39c78e3ccca7 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:46:25 -0400 Subject: [PATCH 175/189] Remove unneeded start command file in cli --- api/src/cli/commands/start.ts | 4 ---- api/src/cli/index.ts | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 api/src/cli/commands/start.ts diff --git a/api/src/cli/commands/start.ts b/api/src/cli/commands/start.ts deleted file mode 100644 index be9ca7ba75..0000000000 --- a/api/src/cli/commands/start.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default async function start() { - const startServer = require('../../start').default; - await startServer(); -} diff --git a/api/src/cli/index.ts b/api/src/cli/index.ts index 67c6b38fa1..a501ac1f58 100644 --- a/api/src/cli/index.ts +++ b/api/src/cli/index.ts @@ -4,7 +4,7 @@ import program from 'commander'; const pkg = require('../../package.json'); -import start from './commands/start'; +import start from '../start'; import init from './commands/init'; import dbInstall from './commands/database/install'; import dbMigrate from './commands/database/migrate'; From 8cdf3cb23dc5983658cff32cba0e3daef647f8b7 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 12:53:15 -0400 Subject: [PATCH 176/189] v9.0.0-beta.12 --- api/package-lock.json | 2 +- api/package.json | 2 +- app/package-lock.json | 2 +- app/package.json | 2 +- docs/package-lock.json | 2 +- docs/package.json | 2 +- lerna.json | 2 +- packages/create-directus-project/package-lock.json | 2 +- packages/create-directus-project/package.json | 2 +- packages/format-title/package-lock.json | 2 +- packages/format-title/package.json | 2 +- packages/spec/package-lock.json | 2 +- packages/spec/package.json | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index 9b7698b080..e07a654392 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -1,6 +1,6 @@ { "name": "directus", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/api/package.json b/api/package.json index 66489d0c37..acc9089a1b 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "directus", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "license": "GPL-3.0-only", "homepage": "https://github.com/directus/next#readme", "description": "Directus is a real-time API and App dashboard for managing SQL database content.", diff --git a/app/package-lock.json b/app/package-lock.json index ec5df18302..b541b07968 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "@directus/app", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/app/package.json b/app/package.json index 93cbd95795..2943b7d227 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "@directus/app", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "private": false, "description": "Directus is an Open-Source Headless CMS & API for Managing Custom Databases", "author": "Rijk van Zanten ", diff --git a/docs/package-lock.json b/docs/package-lock.json index c515b3351a..61ee71982d 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -1,6 +1,6 @@ { "name": "@directus/docs", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/docs/package.json b/docs/package.json index e4f77776ca..0d84c2aaf9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,7 +1,7 @@ { "name": "@directus/docs", "private": false, - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "description": "", "main": "index.js", "scripts": { diff --git a/lerna.json b/lerna.json index 951f1721d0..7738e0f732 100644 --- a/lerna.json +++ b/lerna.json @@ -5,7 +5,7 @@ "docs", "packages/*" ], - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "command": { "bootstrap": { "npmClientArgs": [ diff --git a/packages/create-directus-project/package-lock.json b/packages/create-directus-project/package-lock.json index eee0994947..72ad83243f 100644 --- a/packages/create-directus-project/package-lock.json +++ b/packages/create-directus-project/package-lock.json @@ -1,6 +1,6 @@ { "name": "create-directus-project", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/create-directus-project/package.json b/packages/create-directus-project/package.json index c1a4788ad0..b294e8c9aa 100644 --- a/packages/create-directus-project/package.json +++ b/packages/create-directus-project/package.json @@ -1,6 +1,6 @@ { "name": "create-directus-project", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "description": "A small installer util that will create a directory, add boilerplate folders, and install Directus through npm.", "main": "lib/index.js", "bin": "./lib/index.js", diff --git a/packages/format-title/package-lock.json b/packages/format-title/package-lock.json index 17aa4fe24c..bc71d1c03c 100644 --- a/packages/format-title/package-lock.json +++ b/packages/format-title/package-lock.json @@ -1,6 +1,6 @@ { "name": "@directus/format-title", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/format-title/package.json b/packages/format-title/package.json index cfb6c68724..cba15719b0 100644 --- a/packages/format-title/package.json +++ b/packages/format-title/package.json @@ -1,6 +1,6 @@ { "name": "@directus/format-title", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "description": "Custom string formatter that converts any string into [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)", "keywords": [ "title-case", diff --git a/packages/spec/package-lock.json b/packages/spec/package-lock.json index 84354e8fe0..119c39134b 100644 --- a/packages/spec/package-lock.json +++ b/packages/spec/package-lock.json @@ -1,6 +1,6 @@ { "name": "@directus/specs", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/spec/package.json b/packages/spec/package.json index e93c9fb897..041c799157 100644 --- a/packages/spec/package.json +++ b/packages/spec/package.json @@ -1,6 +1,6 @@ { "name": "@directus/specs", - "version": "9.0.0-beta.11", + "version": "9.0.0-beta.12", "description": "OpenAPI Specification of the Directus API", "main": "index.js", "scripts": { From 1f9328d3a86b2b0d7051267f42e84e7c10c8c115 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 15:22:56 -0400 Subject: [PATCH 177/189] Fix default interface for dateTime type Fixes #664 --- .../get-default-interface-for-type.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/utils/get-default-interface-for-type/get-default-interface-for-type.ts b/app/src/utils/get-default-interface-for-type/get-default-interface-for-type.ts index 448e045369..fab195e6c0 100644 --- a/app/src/utils/get-default-interface-for-type/get-default-interface-for-type.ts +++ b/app/src/utils/get-default-interface-for-type/get-default-interface-for-type.ts @@ -6,7 +6,7 @@ const defaultInterfaceMap: Record = { binary: 'text-input', boolean: 'toggle', date: 'datetime', - dateTime: 'dateTime', + dateTime: 'datetime', decimal: 'numeric', float: 'numeric', integer: 'numeric', @@ -17,7 +17,7 @@ const defaultInterfaceMap: Record = { timestamp: 'datetime', uuid: 'text-input', unknown: 'text-input', - csv: 'tags' + csv: 'tags', }; /** From 60ed9be03e8987369955d764a6e997f6a8dc64d6 Mon Sep 17 00:00:00 2001 From: Rijk van Zanten Date: Thu, 15 Oct 2020 17:00:41 -0400 Subject: [PATCH 178/189] Update extensions.ts --- api/src/types/extensions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/types/extensions.ts b/api/src/types/extensions.ts index 1d60d25bfa..030819cb1c 100644 --- a/api/src/types/extensions.ts +++ b/api/src/types/extensions.ts @@ -5,7 +5,7 @@ import env from '../env'; import Knex from 'knex'; import { Router } from 'express'; -type ExtensionContext = { +export type ExtensionContext = { services: typeof services; exceptions: typeof exceptions; database: Knex; From 068b62bb12a8929829d321f4dd724e0265baf6e5 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:21:55 -0400 Subject: [PATCH 179/189] Update schema inspector --- api/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/package.json b/api/package.json index acc9089a1b..4bc8189132 100644 --- a/api/package.json +++ b/api/package.json @@ -102,7 +102,7 @@ "jsonwebtoken": "^8.5.1", "keyv": "^4.0.1", "knex": "^0.21.4", - "knex-schema-inspector": "0.0.20", + "knex-schema-inspector": "^0.0.21", "liquidjs": "^9.14.1", "lodash": "^4.17.19", "macos-release": "^2.4.1", From 2c3992b1f1aa08d4d3b83b956935c5b8720b735a Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:22:39 -0400 Subject: [PATCH 180/189] Add precision / scale support Fixes #560 --- api/src/services/fields.ts | 11 +- api/src/services/payload.ts | 2 +- api/src/utils/get-default-value.ts | 2 +- api/src/utils/get-local-type.ts | 20 ++- app/src/lang/en-US/index.json | 7 +- .../field-detail/components/field.vue | 106 ++++++++++++ .../field-detail/components/schema.vue | 162 +++++++----------- .../data-model/field-detail/field-detail.vue | 14 ++ .../routes/data-model/field-detail/store.ts | 2 + 9 files changed, 209 insertions(+), 117 deletions(-) create mode 100644 app/src/modules/settings/routes/data-model/field-detail/components/field.vue diff --git a/api/src/services/fields.ts b/api/src/services/fields.ts index 2a6ed4190f..f86366f286 100644 --- a/api/src/services/fields.ts +++ b/api/src/services/fields.ts @@ -59,7 +59,7 @@ export class FieldsService { const data = { collection: column.table, field: column.name, - type: column ? getLocalType(column.type, field?.special) : 'alias', + type: column ? getLocalType(column, field) : 'alias', schema: column, meta: field || null, }; @@ -171,7 +171,7 @@ export class FieldsService { const data = { collection, field, - type: column ? getLocalType(column.type, fieldInfo?.special) : 'alias', + type: column ? getLocalType(column, fieldInfo) : 'alias', meta: fieldInfo || null, schema: column || null, }; @@ -248,8 +248,11 @@ export class FieldsService { ); } else if (['float', 'decimal'].includes(field.type)) { const type = field.type as 'float' | 'decimal'; - /** @todo add precision and scale support */ - column = table[type](field.field /* precision, scale */); + column = table[type]( + field.field, + field.schema?.precision || 10, + field.schema?.scale || 5 + ); } else if (field.type === 'csv') { column = table.string(field.field); } else { diff --git a/api/src/services/payload.ts b/api/src/services/payload.ts index 57b5bee145..0927a07b64 100644 --- a/api/src/services/payload.ts +++ b/api/src/services/payload.ts @@ -236,7 +236,7 @@ export class PayloadService { const columnsWithType = columnsInCollection.map((column) => ({ name: column.name, - type: getLocalType(column.type), + type: getLocalType(column), })); const dateColumns = columnsWithType.filter((column) => diff --git a/api/src/utils/get-default-value.ts b/api/src/utils/get-default-value.ts index 338c4aa75b..c070fdb01b 100644 --- a/api/src/utils/get-default-value.ts +++ b/api/src/utils/get-default-value.ts @@ -2,7 +2,7 @@ import { Column } from 'knex-schema-inspector/dist/types/column'; import getLocalType from './get-local-type'; export default function getDefaultValue(column: Column) { - const type = getLocalType(column.type); + const type = getLocalType(column); let defaultValue = column.default_value || null; diff --git a/api/src/utils/get-local-type.ts b/api/src/utils/get-local-type.ts index bb8f7c1ff5..932889009a 100644 --- a/api/src/utils/get-local-type.ts +++ b/api/src/utils/get-local-type.ts @@ -1,4 +1,5 @@ -import { types } from '../types'; +import { Column } from 'knex-schema-inspector/lib/types/column'; +import { FieldMeta, types } from '../types'; /** * Typemap graciously provided by @gpetrov @@ -80,14 +81,19 @@ const localTypeMap: Record +
+

{{ $t('schema_field_title') }}

+ +
+
+
{{ $t('readonly') }}
+ +
+ +
+
{{ $t('hidden') }}
+ +
+ +
+
{{ $t('note') }}
+ +
+ +
+
{{ $t('translations') }}
+ +
+
+
+ + + + + diff --git a/app/src/modules/settings/routes/data-model/field-detail/components/schema.vue b/app/src/modules/settings/routes/data-model/field-detail/components/schema.vue index b06cf5623b..e154ef6bb7 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/components/schema.vue +++ b/app/src/modules/settings/routes/data-model/field-detail/components/schema.vue @@ -18,7 +18,7 @@ />
-
+
{{ $t('type') }} @@ -34,12 +34,54 @@ />
-
-
{{ $t('note') }}
- -
+ -
+ + + + + + +
{{ $t('default_value') }}
- - -
-
{{ $t('length') }}
- -
- -
+
{{ $t('required') }}
- -
-
{{ $t('readonly') }}
- -
- -
-
{{ $t('hidden') }}
- -
- -
-
{{ $t('translations') }}
- -
- -
@@ -422,35 +390,17 @@ export default defineComponent({ diff --git a/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue b/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue index 8ed6df9ee3..cbb8bcb82b 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue +++ b/app/src/modules/settings/routes/data-model/field-detail/field-detail.vue @@ -50,6 +50,13 @@ :type="localType" /> + + Date: Thu, 15 Oct 2020 17:30:09 -0400 Subject: [PATCH 181/189] Add note on config Closes #44 --- api/package-lock.json | 20 ++++++-------------- api/package.json | 2 +- api/src/cli/commands/init/index.ts | 2 ++ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index e07a654392..652a4cd268 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -103,8 +103,7 @@ "version": "file:../docs" }, "@directus/format-title": { - "version": "file:../packages/format-title", - "integrity": "sha512-3D3sfRZbiVXDuWZwY/TVpCxQ9ZDUOX64gbv71i3g2xZpvNbLwsGM0vxHUQD+m9Mv+LGNcza+UG19/gd+wlj0Cw==" + "version": "file:../packages/format-title" }, "@hapi/address": { "version": "4.1.0", @@ -8964,14 +8963,6 @@ } } }, - "knex-schema-inspector": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/knex-schema-inspector/-/knex-schema-inspector-0.0.20.tgz", - "integrity": "sha512-krkGhAc67NcJv2olwfDeRzrQL2fhVB+NqNOXDLqz/HXAFTqTx2s+GhO42YkJrmCs7uoWC6RtHrwr/fEh6Oc4kQ==", - "requires": { - "lodash.flatten": "^4.4.0" - } - }, "liftoff": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz", @@ -9028,7 +9019,8 @@ "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "optional": true }, "lodash.get": { "version": "4.4.2", @@ -10106,9 +10098,9 @@ "optional": true }, "pg": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.4.0.tgz", - "integrity": "sha512-01LcNrAf+mBI46c78mE86I5o5KkOM942lLiSBdiCfgHTR+oUNIjh1fKClWeoPNHJz2oXe/VUSqtk1vwAQYwWEg==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.4.1.tgz", + "integrity": "sha512-NRsH0aGMXmX1z8Dd0iaPCxWUw4ffu+lIAmGm+sTCwuDDWkpEgRCAHZYDwqaNhC5hG5DRMOjSUFasMWhvcmLN1A==", "optional": true, "requires": { "buffer-writer": "2.0.0", diff --git a/api/package.json b/api/package.json index 4bc8189132..a91347a2cf 100644 --- a/api/package.json +++ b/api/package.json @@ -129,7 +129,7 @@ "mssql": "^6.2.0", "mysql": "^2.18.1", "oracledb": "^5.0.0", - "pg": "^8.4.0", + "pg": "^8.4.1", "sqlite3": "^5.0.0" }, "gitHead": "4476da28dbbc2824e680137aa28b2b91b5afabec", diff --git a/api/src/cli/commands/init/index.ts b/api/src/cli/commands/init/index.ts index e5f87c3ed0..1a9d3b3c61 100644 --- a/api/src/cli/commands/init/index.ts +++ b/api/src/cli/commands/init/index.ts @@ -88,6 +88,8 @@ export default async function init(options: Record) { console.log(` Your project has been created at ${chalk.green(rootPath)}. +The configuration can be found in ${chalk.green(rootPath + '/.env')} + Start Directus by running: ${chalk.blue('cd')} ${rootPath} ${chalk.blue('npx directus')} start From 0041f851a74822c8de905edae586a3c9e6ed049e Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:36:57 -0400 Subject: [PATCH 182/189] =?UTF-8?q?Package=20lock=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/package-lock.json | 30 +++++++++++++++++++-- package-lock.json | 61 +++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index 652a4cd268..3f68d3d2e9 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -5755,6 +5755,15 @@ "@directus/specs": { "version": "file:../packages/spec" }, + "@godaddy/terminus": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@godaddy/terminus/-/terminus-4.4.1.tgz", + "integrity": "sha512-ZPwsG7xN+B2bvnEu6+o0rBPAFbXmm6Bk/RAR4b/nhjNOSJtbVFYTd+JSaJYL/jyESqcTcAyzlWO0dmbT4YsckQ==", + "requires": { + "es6-promisify": "^6.0.2", + "stoppable": "^1.1.0" + } + }, "@google-cloud/common": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-3.4.1.tgz", @@ -7322,6 +7331,11 @@ } } }, + "es6-promisify": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-6.1.1.tgz", + "integrity": "sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==" + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -8963,6 +8977,14 @@ } } }, + "knex-schema-inspector": { + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/knex-schema-inspector/-/knex-schema-inspector-0.0.21.tgz", + "integrity": "sha512-hroob7VPZM65ZoYCHrSNBPWFtkJTWa7D1CsqTZiptwenPhYZoNwWxbrUX96W8oZG6bY5xUQ+nyFQv0MdNOjWgA==", + "requires": { + "lodash.flatten": "^4.4.0" + } + }, "liftoff": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz", @@ -9019,8 +9041,7 @@ "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", - "optional": true + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" }, "lodash.get": { "version": "4.4.2", @@ -11307,6 +11328,11 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "stoppable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==" + }, "stream-events": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", diff --git a/package-lock.json b/package-lock.json index d3a581c93a..c2954a8d88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2253,6 +2253,22 @@ } } }, + "@godaddy/terminus": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@godaddy/terminus/-/terminus-4.4.1.tgz", + "integrity": "sha512-ZPwsG7xN+B2bvnEu6+o0rBPAFbXmm6Bk/RAR4b/nhjNOSJtbVFYTd+JSaJYL/jyESqcTcAyzlWO0dmbT4YsckQ==", + "requires": { + "es6-promisify": "^6.0.2", + "stoppable": "^1.1.0" + }, + "dependencies": { + "es6-promisify": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-6.1.1.tgz", + "integrity": "sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==" + } + } + }, "@google-cloud/common": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-3.4.0.tgz", @@ -15949,6 +15965,7 @@ "@directus/app": "file:app", "@directus/format-title": "file:packages/format-title", "@directus/specs": "file:packages/spec", + "@godaddy/terminus": "^4.4.1", "@keyv/redis": "^2.1.2", "@slynova/flydrive": "^1.0.2", "@slynova/flydrive-gcs": "^1.0.2", @@ -15986,7 +16003,7 @@ "keyv": "^4.0.1", "keyv-memcache": "^0.8.0", "knex": "^0.21.4", - "knex-schema-inspector": "0.0.20", + "knex-schema-inspector": "^0.0.21", "liquidjs": "^9.14.1", "lodash": "^4.17.19", "macos-release": "^2.4.1", @@ -16001,14 +16018,13 @@ "ora": "^4.1.1", "oracledb": "^5.0.0", "otplib": "^12.0.1", - "pg": "^8.4.0", + "pg": "^8.4.1", "pino": "^6.4.1", "pino-colada": "^2.1.0", "rate-limiter-flexible": "^2.1.10", "resolve-cwd": "^3.0.0", "sharp": "^0.25.4", "sqlite3": "^5.0.0", - "terminus": "^1.1.0", "uuid": "^8.3.0", "uuid-validate": "0.0.3" }, @@ -35077,6 +35093,11 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, + "stoppable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==" + }, "store2": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/store2/-/store2-2.12.0.tgz", @@ -37098,40 +37119,6 @@ "supports-hyperlinks": "^2.0.0" } }, - "terminus": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/terminus/-/terminus-1.1.0.tgz", - "integrity": "sha1-ZH44xEYE+vYQtiOXT+8nRQIBrIQ=", - "requires": { - "readable-stream": "~2.0.4", - "xtend": "~4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - } - } - } - }, "terser": { "version": "4.8.0", "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", From c116f90d7a0ac191a0b292a45d9edb0dd68b16ac Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:38:06 -0400 Subject: [PATCH 183/189] Remove timezone field from directus_users Fixes #42 --- .../database/seeds/01-tables/03-users.yaml | 4 - .../database/seeds/03-fields/03-users.yaml | 298 ------------------ 2 files changed, 302 deletions(-) diff --git a/api/src/database/seeds/01-tables/03-users.yaml b/api/src/database/seeds/01-tables/03-users.yaml index ee83cef60f..4ba7a0f27d 100644 --- a/api/src/database/seeds/01-tables/03-users.yaml +++ b/api/src/database/seeds/01-tables/03-users.yaml @@ -30,10 +30,6 @@ columns: type: json avatar: type: uuid - timezone: - type: string - length: 255 - default: 'America/New_York' language: type: string length: 8 diff --git a/api/src/database/seeds/03-fields/03-users.yaml b/api/src/database/seeds/03-fields/03-users.yaml index d63c771cf1..d74899c141 100644 --- a/api/src/database/seeds/03-fields/03-users.yaml +++ b/api/src/database/seeds/03-fields/03-users.yaml @@ -78,304 +78,6 @@ fields: special: alias sort: 10 width: full - - collection: directus_users - field: timezone - interface: dropdown - options: - choices: - - value: Pacific/Midway - text: '(UTC-11:00) Midway Island' - - value: Pacific/Samoa - text: '(UTC-11:00) Samoa' - - value: Pacific/Honolulu - text: '(UTC-10:00) Hawaii' - - value: US/Alaska - text: '(UTC-09:00) Alaska' - - value: America/Los_Angeles - text: '(UTC-08:00) Pacific Time (US & Canada)' - - value: America/Tijuana - text: '(UTC-08:00) Tijuana' - - value: US/Arizona - text: '(UTC-07:00) Arizona' - - value: America/Chihuahua - text: '(UTC-07:00) Chihuahua' - - value: America/Mexico/La_Paz - text: '(UTC-07:00) La Paz' - - value: America/Mazatlan - text: '(UTC-07:00) Mazatlan' - - value: US/Mountain - text: '(UTC-07:00) Mountain Time (US & Canada)' - - value: America/Managua - text: '(UTC-06:00) Central America' - - value: US/Central - text: '(UTC-06:00) Central Time (US & Canada)' - - value: America/Guadalajara - text: '(UTC-06:00) Guadalajara' - - value: America/Mexico_City - text: '(UTC-06:00) Mexico City' - - value: America/Monterrey - text: '(UTC-06:00) Monterrey' - - value: Canada/Saskatchewan - text: '(UTC-06:00) Saskatchewan' - - value: America/Bogota - text: '(UTC-05:00) Bogota' - - value: US/Eastern - text: '(UTC-05:00) Eastern Time (US & Canada)' - - value: US/East_Indiana - text: '(UTC-05:00) Indiana (East)' - - value: America/Lima - text: '(UTC-05:00) Lima' - - value: America/Quito - text: '(UTC-05:00) Quito' - - value: Canada/Atlantic - text: '(UTC-04:00) Atlantic Time (Canada)' - - value: America/New_York - text: '(UTC-04:00) New York' - - value: America/Caracas - text: '(UTC-04:30) Caracas' - - value: America/La_Paz - text: '(UTC-04:00) La Paz' - - value: America/Santiago - text: '(UTC-04:00) Santiago' - - value: America/Santo_Domingo - text: '(UTC-04:00) Santo Domingo' - - value: Canada/Newfoundland - text: '(UTC-03:30) Newfoundland' - - value: America/Sao_Paulo - text: '(UTC-03:00) Brasilia' - - value: America/Argentina/Buenos_Aires - text: '(UTC-03:00) Buenos Aires' - - value: America/Argentina/GeorgeTown - text: '(UTC-03:00) Georgetown' - - value: America/Godthab - text: '(UTC-03:00) Greenland' - - value: America/Noronha - text: '(UTC-02:00) Mid-Atlantic' - - value: Atlantic/Azores - text: '(UTC-01:00) Azores' - - value: Atlantic/Cape_Verde - text: '(UTC-01:00) Cape Verde Is.' - - value: Africa/Casablanca - text: '(UTC+00:00) Casablanca' - - value: Europe/Edinburgh - text: '(UTC+00:00) Edinburgh' - - value: Etc/Greenwich - text: '(UTC+00:00) Greenwich Mean Time' - - value: Europe/Lisbon - text: '(UTC+00:00) Lisbon' - - value: Europe/London - text: '(UTC+00:00) London' - - value: Africa/Monrovia - text: '(UTC+00:00) Monrovia' - - value: UTC - text: '(UTC+00:00) UTC' - - value: Europe/Amsterdam - text: '(UTC+01:00) Amsterdam' - - value: Europe/Belgrade - text: '(UTC+01:00) Belgrade' - - value: Europe/Berlin - text: '(UTC+01:00) Berlin' - - value: Europe/Bern - text: '(UTC+01:00) Bern' - - value: Europe/Bratislava - text: '(UTC+01:00) Bratislava' - - value: Europe/Brussels - text: '(UTC+01:00) Brussels' - - value: Europe/Budapest - text: '(UTC+01:00) Budapest' - - value: Europe/Copenhagen - text: '(UTC+01:00) Copenhagen' - - value: Europe/Ljubljana - text: '(UTC+01:00) Ljubljana' - - value: Europe/Madrid - text: '(UTC+01:00) Madrid' - - value: Europe/Paris - text: '(UTC+01:00) Paris' - - value: Europe/Prague - text: '(UTC+01:00) Prague' - - value: Europe/Rome - text: '(UTC+01:00) Rome' - - value: Europe/Sarajevo - text: '(UTC+01:00) Sarajevo' - - value: Europe/Skopje - text: '(UTC+01:00) Skopje' - - value: Europe/Stockholm - text: '(UTC+01:00) Stockholm' - - value: Europe/Vienna - text: '(UTC+01:00) Vienna' - - value: Europe/Warsaw - text: '(UTC+01:00) Warsaw' - - value: Africa/Lagos - text: '(UTC+01:00) West Central Africa' - - value: Europe/Zagreb - text: '(UTC+01:00) Zagreb' - - value: Europe/Athens - text: '(UTC+02:00) Athens' - - value: Europe/Bucharest - text: '(UTC+02:00) Bucharest' - - value: Africa/Cairo - text: '(UTC+02:00) Cairo' - - value: Africa/Harare - text: '(UTC+02:00) Harare' - - value: Europe/Helsinki - text: '(UTC+02:00) Helsinki' - - value: Europe/Istanbul - text: '(UTC+02:00) Istanbul' - - value: Asia/Jerusalem - text: '(UTC+02:00) Jerusalem' - - value: Europe/Kyiv - text: '(UTC+02:00) Kyiv' - - value: Africa/Johannesburg - text: '(UTC+02:00) Pretoria' - - value: Europe/Riga - text: '(UTC+02:00) Riga' - - value: Europe/Sofia - text: '(UTC+02:00) Sofia' - - value: Europe/Tallinn - text: '(UTC+02:00) Tallinn' - - value: Europe/Vilnius - text: '(UTC+02:00) Vilnius' - - value: Asia/Baghdad - text: '(UTC+03:00) Baghdad' - - value: Asia/Kuwait - text: '(UTC+03:00) Kuwait' - - value: Europe/Minsk - text: '(UTC+03:00) Minsk' - - value: Africa/Nairobi - text: '(UTC+03:00) Nairobi' - - value: Asia/Riyadh - text: '(UTC+03:00) Riyadh' - - value: Europe/Volgograd - text: '(UTC+03:00) Volgograd' - - value: Asia/Tehran - text: '(UTC+03:30) Tehran' - - value: Asia/Abu_Dhabi - text: '(UTC+04:00) Abu Dhabi' - - value: Asia/Baku - text: '(UTC+04:00) Baku' - - value: Europe/Moscow - text: '(UTC+04:00) Moscow' - - value: Asia/Muscat - text: '(UTC+04:00) Muscat' - - value: Europe/St_Petersburg - text: '(UTC+04:00) St. Petersburg' - - value: Asia/Tbilisi - text: '(UTC+04:00) Tbilisi' - - value: Asia/Yerevan - text: '(UTC+04:00) Yerevan' - - value: Asia/Kabul - text: '(UTC+04:30) Kabul' - - value: Asia/Islamabad - text: '(UTC+05:00) Islamabad' - - value: Asia/Karachi - text: '(UTC+05:00) Karachi' - - value: Asia/Tashkent - text: '(UTC+05:00) Tashkent' - - value: Asia/Calcutta - text: '(UTC+05:30) Chennai' - - value: Asia/Kolkata - text: '(UTC+05:30) Kolkata' - - value: Asia/Mumbai - text: '(UTC+05:30) Mumbai' - - value: Asia/New_Delhi - text: '(UTC+05:30) New Delhi' - - value: Asia/Sri_Jayawardenepura - text: '(UTC+05:30) Sri Jayawardenepura' - - value: Asia/Katmandu - text: '(UTC+05:45) Kathmandu' - - value: Asia/Almaty - text: '(UTC+06:00) Almaty' - - value: Asia/Astana - text: '(UTC+06:00) Astana' - - value: Asia/Dhaka - text: '(UTC+06:00) Dhaka' - - value: Asia/Yekaterinburg - text: '(UTC+06:00) Ekaterinburg' - - value: Asia/Rangoon - text: '(UTC+06:30) Rangoon' - - value: Asia/Bangkok - text: '(UTC+07:00) Bangkok' - - value: Asia/Hanoi - text: '(UTC+07:00) Hanoi' - - value: Asia/Jakarta - text: '(UTC+07:00) Jakarta' - - value: Asia/Novosibirsk - text: '(UTC+07:00) Novosibirsk' - - value: Asia/Beijing - text: '(UTC+08:00) Beijing' - - value: Asia/Chongqing - text: '(UTC+08:00) Chongqing' - - value: Asia/Hong_Kong - text: '(UTC+08:00) Hong Kong' - - value: Asia/Krasnoyarsk - text: '(UTC+08:00) Krasnoyarsk' - - value: Asia/Kuala_Lumpur - text: '(UTC+08:00) Kuala Lumpur' - - value: Australia/Perth - text: '(UTC+08:00) Perth' - - value: Asia/Singapore - text: '(UTC+08:00) Singapore' - - value: Asia/Taipei - text: '(UTC+08:00) Taipei' - - value: Asia/Ulan_Bator - text: '(UTC+08:00) Ulaan Bataar' - - value: Asia/Urumqi - text: '(UTC+08:00) Urumqi' - - value: Asia/Irkutsk - text: '(UTC+09:00) Irkutsk' - - value: Asia/Osaka - text: '(UTC+09:00) Osaka' - - value: Asia/Sapporo - text: '(UTC+09:00) Sapporo' - - value: Asia/Seoul - text: '(UTC+09:00) Seoul' - - value: Asia/Tokyo - text: '(UTC+09:00) Tokyo' - - value: Australia/Adelaide - text: '(UTC+09:30) Adelaide' - - value: Australia/Darwin - text: '(UTC+09:30) Darwin' - - value: Australia/Brisbane - text: '(UTC+10:00) Brisbane' - - value: Australia/Canberra - text: '(UTC+10:00) Canberra' - - value: Pacific/Guam - text: '(UTC+10:00) Guam' - - value: Australia/Hobart - text: '(UTC+10:00) Hobart' - - value: Australia/Melbourne - text: '(UTC+10:00) Melbourne' - - value: Pacific/Port_Moresby - text: '(UTC+10:00) Port Moresby' - - value: Australia/Sydney - text: '(UTC+10:00) Sydney' - - value: Asia/Yakutsk - text: '(UTC+10:00) Yakutsk' - - value: Asia/Vladivostok - text: '(UTC+11:00) Vladivostok' - - value: Pacific/Auckland - text: '(UTC+12:00) Auckland' - - value: Pacific/Fiji - text: '(UTC+12:00) Fiji' - - value: Pacific/Kwajalein - text: '(UTC+12:00) International Date Line West' - - value: Asia/Kamchatka - text: '(UTC+12:00) Kamchatka' - - value: Asia/Magadan - text: '(UTC+12:00) Magadan' - - value: Pacific/Marshall_Is - text: '(UTC+12:00) Marshall Is.' - - value: Asia/New_Caledonia - text: '(UTC+12:00) New Caledonia' - - value: Asia/Solomon_Is - text: '(UTC+12:00) Solomon Is.' - - value: Pacific/Wellington - text: '(UTC+12:00) Wellington' - - value: Pacific/Tongatapu - text: "(UTC+13:00) Nuku'alofa" - placeholder: Choose a timezone... - sort: 11 - width: half - collection: directus_users field: language interface: dropdown From 7185cd48cb246b93b257fbb530041317c978f42a Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:44:50 -0400 Subject: [PATCH 184/189] Allow searchPath / connection string in PG Fixes #676 --- api/src/database/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/database/index.ts b/api/src/database/index.ts index 463db4c9bb..df77c48711 100644 --- a/api/src/database/index.ts +++ b/api/src/database/index.ts @@ -15,6 +15,8 @@ for (let [key, value] of Object.entries(env)) { key = key.toLowerCase(); if (key.startsWith('db') === false) continue; if (key === 'db_client') continue; + if (key === 'db_search_path') continue; + if (key === 'db_connection_string') continue; key = key.slice(3); // remove `DB_` @@ -23,7 +25,8 @@ for (let [key, value] of Object.entries(env)) { const knexConfig: Config = { client: env.DB_CLIENT, - connection: connectionConfig, + searchPath: env.DB_SEARCH_PATH, + connection: env.DB_CONNECTION_STRING || connectionConfig, log: { warn: (msg) => { /** @note this is wild */ From cac329c7839656a78407ce359b9a9a50536d5dc8 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 17:45:15 -0400 Subject: [PATCH 185/189] Convert env var values that contain , to arrays --- api/src/controllers/auth.ts | 2 +- api/src/env.ts | 5 +++++ api/src/grant.ts | 6 +++--- api/src/storage.ts | 2 +- api/src/utils/track.ts | 8 ++------ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/api/src/controllers/auth.ts b/api/src/controllers/auth.ts index 4c03e9de2a..7fbc62edad 100644 --- a/api/src/controllers/auth.ts +++ b/api/src/controllers/auth.ts @@ -213,7 +213,7 @@ router.post( router.get( '/oauth', asyncHandler(async (req, res, next) => { - const providers = env.OAUTH_PROVIDERS.split(',').filter((p: string) => p); + const providers = env.OAUTH_PROVIDERS as string[]; res.locals.payload = { data: providers.length > 0 ? providers : null }; return next(); }), diff --git a/api/src/env.ts b/api/src/env.ts index d1cf1d1520..520e6c2e7e 100644 --- a/api/src/env.ts +++ b/api/src/env.ts @@ -63,6 +63,11 @@ function processValues(env: Record) { if (value === 'false') env[key] = false; if (value === 'null') env[key] = null; if (isNaN(value) === false && value.length > 0) env[key] = Number(value); + if (typeof value === 'string' && value.includes(',')) + env[key] = value + .split(',') + .map((val) => val.trim()) + .filter((val) => val); } return env; diff --git a/api/src/grant.ts b/api/src/grant.ts index ac65f4a3cc..0e22a549c3 100644 --- a/api/src/grant.ts +++ b/api/src/grant.ts @@ -4,9 +4,9 @@ import env from './env'; -const enabledProviders = (env.OAUTH_PROVIDERS as string) - .split(',') - .map((provider) => provider.trim().toLowerCase()); +const enabledProviders = (env.OAUTH_PROVIDERS as string[]).map((provider) => + provider.toLowerCase() +); const config: any = { defaults: { diff --git a/api/src/storage.ts b/api/src/storage.ts index 1171559efb..bfb14ad532 100644 --- a/api/src/storage.ts +++ b/api/src/storage.ts @@ -25,7 +25,7 @@ function getStorageConfig(): StorageManagerConfig { disks: {}, }; - const locations = env.STORAGE_LOCATIONS.split(','); + const locations = env.STORAGE_LOCATIONS as string[]; locations.forEach((location: string) => { location = location.trim(); diff --git a/api/src/utils/track.ts b/api/src/utils/track.ts index 5a86cf68ae..d4e93a0a41 100644 --- a/api/src/utils/track.ts +++ b/api/src/utils/track.ts @@ -57,9 +57,7 @@ async function getEnvInfo(event: string) { transport: env.EMAIL_TRANSPORT, }, oauth: { - providers: env.OAUTH_PROVIDERS.split(',') - .filter((p?: string) => p) - .map((p: string) => p.trim()), + providers: env.OAUTH_PROVIDERS, }, db_client: env.DB_CLIENT, }; @@ -67,9 +65,7 @@ async function getEnvInfo(event: string) { function getStorageDrivers() { const drivers: string[] = []; - const locations = env.STORAGE_LOCATIONS.split(',') - .filter((l?: string) => l) - .map((l: string) => l.trim()); + const locations = env.STORAGE_LOCATIONS; for (const location of locations) { const driver = env[`STORAGE_${location.toUpperCase()}_DRIVER`]; From 592ab925dbda1e2d9d87fd85a8fbbfa152c5ccaf Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 18:00:27 -0400 Subject: [PATCH 186/189] Add toArray util --- api/src/controllers/auth.ts | 3 ++- api/src/database/run-ast.ts | 9 +++++---- api/src/middleware/error-handler.ts | 3 ++- api/src/services/authorization.ts | 3 ++- api/src/services/collections.ts | 11 ++++++----- api/src/services/files.ts | 5 +++-- api/src/services/items.ts | 17 +++++++++-------- api/src/services/payload.ts | 5 +++-- api/src/services/relations.ts | 3 ++- api/src/services/roles.ts | 3 ++- api/src/services/users.ts | 5 +++-- api/src/storage.ts | 3 ++- api/src/utils/to-array.ts | 3 +++ 13 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 api/src/utils/to-array.ts diff --git a/api/src/controllers/auth.ts b/api/src/controllers/auth.ts index 7fbc62edad..ac02da283c 100644 --- a/api/src/controllers/auth.ts +++ b/api/src/controllers/auth.ts @@ -12,6 +12,7 @@ import { UsersService, AuthenticationService } from '../services'; import grantConfig from '../grant'; import { RouteNotFoundException } from '../exceptions'; import { respond } from '../middleware/respond'; +import { toArray } from '../utils/to-array'; const router = Router(); @@ -213,7 +214,7 @@ router.post( router.get( '/oauth', asyncHandler(async (req, res, next) => { - const providers = env.OAUTH_PROVIDERS as string[]; + const providers = toArray(env.OAUTH_PROVIDERS); res.locals.payload = { data: providers.length > 0 ? providers : null }; return next(); }), diff --git a/api/src/database/run-ast.ts b/api/src/database/run-ast.ts index 02cd54078f..41d300864a 100644 --- a/api/src/database/run-ast.ts +++ b/api/src/database/run-ast.ts @@ -6,6 +6,7 @@ import { Query, Item } from '../types'; import { PayloadService } from '../services/payload'; import applyQuery from '../utils/apply-query'; import Knex, { QueryBuilder } from 'knex'; +import { toArray } from '../utils/to-array'; type RunASTOptions = { query?: AST['query']; @@ -172,7 +173,7 @@ function applyParentFilters( nestedCollectionNodes: NestedCollectionNode[], parentItem: Item | Item[] ) { - const parentItems = Array.isArray(parentItem) ? parentItem : [parentItem]; + const parentItems = toArray(parentItem); for (const nestedNode of nestedCollectionNodes) { if (!nestedNode.relation) continue; @@ -245,8 +246,8 @@ function mergeWithParentItems( nestedNode: NestedCollectionNode, o2mLimit?: number | null ) { - const nestedItems = Array.isArray(nestedItem) ? nestedItem : [nestedItem]; - const parentItems = clone(Array.isArray(parentItem) ? parentItem : [parentItem]); + const nestedItems = toArray(nestedItem); + const parentItems = clone(toArray(parentItem)); if (nestedNode.type === 'm2o') { for (const parentItem of parentItems) { @@ -307,7 +308,7 @@ function removeTemporaryFields( primaryKeyField: string, parentItem?: Item ): null | Item | Item[] { - const rawItems = cloneDeep(Array.isArray(rawItem) ? rawItem : [rawItem]); + const rawItems = cloneDeep(toArray(rawItem)); const items: Item[] = []; if (ast.type === 'm2a') { diff --git a/api/src/middleware/error-handler.ts b/api/src/middleware/error-handler.ts index dbb896f6ee..c2b71b9857 100644 --- a/api/src/middleware/error-handler.ts +++ b/api/src/middleware/error-handler.ts @@ -2,13 +2,14 @@ import { ErrorRequestHandler } from 'express'; import { BaseException } from '../exceptions'; import logger from '../logger'; import env from '../env'; +import { toArray } from '../utils/to-array'; const errorHandler: ErrorRequestHandler = (err, req, res, next) => { let payload: any = { errors: [], }; - const errors = Array.isArray(err) ? err : [err]; + const errors = toArray(err); if (errors.some((err) => err instanceof BaseException === false)) { res.status(500); diff --git a/api/src/services/authorization.ts b/api/src/services/authorization.ts index e6f46ca3a0..0b526b4385 100644 --- a/api/src/services/authorization.ts +++ b/api/src/services/authorization.ts @@ -18,6 +18,7 @@ import { uniq, merge, flatten } from 'lodash'; import generateJoi from '../utils/generate-joi'; import { ItemsService } from './items'; import { parseFilter } from '../utils/parse-filter'; +import { toArray } from '../utils/to-array'; export class AuthorizationService { knex: Knex; @@ -199,7 +200,7 @@ export class AuthorizationService { ): Promise[] | Partial> { const validationErrors: FailedValidationException[] = []; - let payloads = Array.isArray(payload) ? payload : [payload]; + let payloads = toArray(payload); let permission: Permission | undefined; diff --git a/api/src/services/collections.ts b/api/src/services/collections.ts index f06adabe63..cb0718cc2d 100644 --- a/api/src/services/collections.ts +++ b/api/src/services/collections.ts @@ -6,6 +6,7 @@ import SchemaInspector from 'knex-schema-inspector'; import { FieldsService } from '../services/fields'; import { ItemsService } from '../services/items'; import cache from '../cache'; +import { toArray } from '../utils/to-array'; export class CollectionsService { knex: Knex; @@ -23,7 +24,7 @@ export class CollectionsService { throw new ForbiddenException('Only admins can perform this action.'); } - const payloads = (Array.isArray(data) ? data : [data]).map((collection) => { + const payloads = toArray(data).map((collection) => { if (!collection.fields) collection.fields = []; collection.fields = collection.fields.map((field) => { @@ -105,7 +106,7 @@ export class CollectionsService { knex: this.knex, accountability: this.accountability, }); - const collectionKeys = Array.isArray(collection) ? collection : [collection]; + const collectionKeys = toArray(collection); if (this.accountability && this.accountability.admin !== true) { const permissions = await this.knex @@ -212,7 +213,7 @@ export class CollectionsService { throw new InvalidPayloadException(`"meta" key is required`); } - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); for (const key of keys) { const exists = @@ -232,7 +233,7 @@ export class CollectionsService { return key; } - const payloads = Array.isArray(data) ? data : [data]; + const payloads = toArray(data); const collectionUpdates = payloads.map((collection) => { return { @@ -264,7 +265,7 @@ export class CollectionsService { const tablesInDatabase = await schemaInspector.tables(); - const collectionKeys = Array.isArray(collection) ? collection : [collection]; + const collectionKeys = toArray(collection); for (const collectionKey of collectionKeys) { if (tablesInDatabase.includes(collectionKey) === false) { diff --git a/api/src/services/files.ts b/api/src/services/files.ts index 550a09fd5a..829877e379 100644 --- a/api/src/services/files.ts +++ b/api/src/services/files.ts @@ -9,6 +9,7 @@ import { AbstractServiceOptions, File, PrimaryKey } from '../types'; import { clone } from 'lodash'; import cache from '../cache'; import { ForbiddenException } from '../exceptions'; +import { toArray } from '../utils/to-array'; export class FilesService extends ItemsService { constructor(options?: AbstractServiceOptions) { @@ -89,14 +90,14 @@ export class FilesService extends ItemsService { delete(key: PrimaryKey): Promise; delete(keys: PrimaryKey[]): Promise; async delete(key: PrimaryKey | PrimaryKey[]): Promise { - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); let files = await super.readByKey(keys, { fields: ['id', 'storage'] }); if (!files) { throw new ForbiddenException(); } - files = Array.isArray(files) ? files : [files]; + files = toArray(files); for (const file of files) { const disk = storage.disk(file.storage); diff --git a/api/src/services/items.ts b/api/src/services/items.ts index e8ff95a797..515f5a0cda 100644 --- a/api/src/services/items.ts +++ b/api/src/services/items.ts @@ -16,6 +16,7 @@ import Knex from 'knex'; import cache from '../cache'; import emitter from '../emitter'; import logger from '../logger'; +import { toArray } from '../utils/to-array'; import { PayloadService } from './payload'; import { AuthorizationService } from './authorization'; @@ -50,7 +51,7 @@ export class ItemsService implements AbstractService { const primaryKeyField = await this.schemaInspector.primary(this.collection); const columns = await this.schemaInspector.columns(this.collection); - let payloads = clone(Array.isArray(data) ? data : [data]); + let payloads = clone(toArray(data)); const savedPrimaryKeys = await this.knex.transaction(async (trx) => { const payloadService = new PayloadService(this.collection, { @@ -224,7 +225,7 @@ export class ItemsService implements AbstractService { ): Promise { query = clone(query); const primaryKeyField = await this.schemaInspector.primary(this.collection); - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); if (keys.length === 1) { query.single = true; @@ -270,7 +271,7 @@ export class ItemsService implements AbstractService { // Updating one or more items to the same payload if (data && key) { - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); let payload = clone(data); @@ -404,7 +405,7 @@ export class ItemsService implements AbstractService { knex: trx, }); - const payloads = Array.isArray(data) ? data : [data]; + const payloads = toArray(data); for (const single of payloads as Partial[]) { let payload = clone(single); @@ -432,7 +433,7 @@ export class ItemsService implements AbstractService { const itemsService = new ItemsService(this.collection, { knex: this.knex }); let itemsToUpdate = await itemsService.readByQuery(readQuery); - itemsToUpdate = Array.isArray(itemsToUpdate) ? itemsToUpdate : [itemsToUpdate]; + itemsToUpdate = toArray(itemsToUpdate); const keys: PrimaryKey[] = itemsToUpdate.map( (item: Partial) => item[primaryKeyField] @@ -445,7 +446,7 @@ export class ItemsService implements AbstractService { upsert(data: Partial): Promise; async upsert(data: Partial | Partial[]): Promise { const primaryKeyField = await this.schemaInspector.primary(this.collection); - const payloads = Array.isArray(data) ? data : [data]; + const payloads = toArray(data); const primaryKeys: PrimaryKey[] = []; for (const payload of payloads) { @@ -473,7 +474,7 @@ export class ItemsService implements AbstractService { delete(key: PrimaryKey): Promise; delete(keys: PrimaryKey[]): Promise; async delete(key: PrimaryKey | PrimaryKey[]): Promise { - const keys = (Array.isArray(key) ? key : [key]) as PrimaryKey[]; + const keys = toArray(key); const primaryKeyField = await this.schemaInspector.primary(this.collection); if (this.accountability && this.accountability.admin !== true) { @@ -537,7 +538,7 @@ export class ItemsService implements AbstractService { const itemsService = new ItemsService(this.collection); let itemsToDelete = await itemsService.readByQuery(readQuery); - itemsToDelete = Array.isArray(itemsToDelete) ? itemsToDelete : [itemsToDelete]; + itemsToDelete = toArray(itemsToDelete); const keys: PrimaryKey[] = itemsToDelete.map( (item: Partial) => item[primaryKeyField] diff --git a/api/src/services/payload.ts b/api/src/services/payload.ts index 0927a07b64..a97993673b 100644 --- a/api/src/services/payload.ts +++ b/api/src/services/payload.ts @@ -16,6 +16,7 @@ import SchemaInspector from 'knex-schema-inspector'; import getLocalType from '../utils/get-local-type'; import { format, formatISO } from 'date-fns'; import { ForbiddenException } from '../exceptions'; +import { toArray } from '../utils/to-array'; type Action = 'create' | 'read' | 'update'; @@ -141,7 +142,7 @@ export class PayloadService { action: Action, payload: Partial | Partial[] ): Promise | Partial[]> { - let processedPayload = (Array.isArray(payload) ? payload : [payload]) as Partial[]; + let processedPayload = toArray(payload); if (processedPayload.length === 0) return []; @@ -338,7 +339,7 @@ export class PayloadService { .from('directus_relations') .where({ one_collection: this.collection }); - const payloads = clone(Array.isArray(payload) ? payload : [payload]); + const payloads = clone(toArray(payload)); for (let i = 0; i < payloads.length; i++) { let payload = payloads[i]; diff --git a/api/src/services/relations.ts b/api/src/services/relations.ts index 75ff2fb619..c8c17a182f 100644 --- a/api/src/services/relations.ts +++ b/api/src/services/relations.ts @@ -1,6 +1,7 @@ import { ItemsService } from './items'; import { AbstractServiceOptions, Query, PrimaryKey, PermissionsAction, Relation } from '../types'; import { PermissionsService } from './permissions'; +import { toArray } from '../utils/to-array'; /** * @TODO update foreign key constraints when relations are updated @@ -62,7 +63,7 @@ export class RelationsService extends ItemsService { 'read' ); - relations = Array.isArray(relations) ? relations : [relations]; + relations = toArray(relations); return relations.filter((relation) => { let collectionsAllowed = true; diff --git a/api/src/services/roles.ts b/api/src/services/roles.ts index e3556eb3f8..7bf9bd4f54 100644 --- a/api/src/services/roles.ts +++ b/api/src/services/roles.ts @@ -4,6 +4,7 @@ import { PermissionsService } from './permissions'; import { UsersService } from './users'; import { PresetsService } from './presets'; import { UnprocessableEntityException } from '../exceptions'; +import { toArray } from '../utils/to-array'; export class RolesService extends ItemsService { constructor(options?: AbstractServiceOptions) { @@ -13,7 +14,7 @@ export class RolesService extends ItemsService { delete(key: PrimaryKey): Promise; delete(keys: PrimaryKey[]): Promise; async delete(key: PrimaryKey | PrimaryKey[]): Promise { - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); // Make sure there's at least one admin role left after this deletion is done const otherAdminRoles = await this.knex diff --git a/api/src/services/users.ts b/api/src/services/users.ts index d2ccdcd6bb..52022996e8 100644 --- a/api/src/services/users.ts +++ b/api/src/services/users.ts @@ -13,6 +13,7 @@ import { Accountability, PrimaryKey, Item, AbstractServiceOptions } from '../typ import Knex from 'knex'; import env from '../env'; import cache from '../cache'; +import { toArray } from '../utils/to-array'; export class UsersService extends ItemsService { knex: Knex; @@ -39,7 +40,7 @@ export class UsersService extends ItemsService { * This is just an extra bit of hardcoded security. We don't want anybody to be able to disable 2fa through * the regular /users endpoint. Period. You should only be able to manage the 2fa status through the /tfa endpoint. */ - const payloads = Array.isArray(data) ? data : [data]; + const payloads = toArray(data); for (const payload of payloads) { if (payload.hasOwnProperty('tfa_secret')) { @@ -57,7 +58,7 @@ export class UsersService extends ItemsService { delete(key: PrimaryKey): Promise; delete(keys: PrimaryKey[]): Promise; async delete(key: PrimaryKey | PrimaryKey[]): Promise { - const keys = Array.isArray(key) ? key : [key]; + const keys = toArray(key); // Make sure there's at least one admin user left after this deletion is done const otherAdminUsers = await this.knex diff --git a/api/src/storage.ts b/api/src/storage.ts index bfb14ad532..074221e2ba 100644 --- a/api/src/storage.ts +++ b/api/src/storage.ts @@ -7,6 +7,7 @@ import { import env from './env'; import { validateEnv } from './utils/validate-env'; import { getConfigFromEnv } from './utils/get-config-from-env'; +import { toArray } from './utils/to-array'; /** @todo dynamically load these storage adapters */ import { AmazonWebServicesS3Storage } from '@slynova/flydrive-s3'; @@ -25,7 +26,7 @@ function getStorageConfig(): StorageManagerConfig { disks: {}, }; - const locations = env.STORAGE_LOCATIONS as string[]; + const locations = toArray(env.STORAGE_LOCATIONS); locations.forEach((location: string) => { location = location.trim(); diff --git a/api/src/utils/to-array.ts b/api/src/utils/to-array.ts new file mode 100644 index 0000000000..77cf11fae2 --- /dev/null +++ b/api/src/utils/to-array.ts @@ -0,0 +1,3 @@ +export function toArray(val: T | T[]): T[] { + return Array.isArray(val) ? val : [val]; +} From 387571f745ca90f4762f21b2a1d057c15b038141 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 18:00:37 -0400 Subject: [PATCH 187/189] Fix sort values of user detail page --- api/src/database/seeds/03-fields/03-users.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/src/database/seeds/03-fields/03-users.yaml b/api/src/database/seeds/03-fields/03-users.yaml index d74899c141..ae4521b9f5 100644 --- a/api/src/database/seeds/03-fields/03-users.yaml +++ b/api/src/database/seeds/03-fields/03-users.yaml @@ -146,7 +146,7 @@ fields: value: uk-UA - text: Vietnamese (Vietnam) value: vi-VN - sort: 12 + sort: 11 width: half - collection: directus_users field: theme @@ -160,14 +160,14 @@ fields: text: Light Mode - value: dark text: Dark Mode - sort: 13 + sort: 12 width: half - collection: directus_users field: tfa_secret interface: tfa-setup locked: true special: conceal - sort: 14 + sort: 13 width: half - collection: directus_users field: admin_divider @@ -178,7 +178,7 @@ fields: title: Admin Options color: '#F2994A' special: alias - sort: 15 + sort: 14 width: full - collection: directus_users field: status @@ -196,7 +196,7 @@ fields: value: suspended - text: Archived value: archived - sort: 16 + sort: 15 width: half - collection: directus_users field: role @@ -205,7 +205,7 @@ fields: options: template: '{{ name }}' special: m2o - sort: 17 + sort: 16 width: half - collection: directus_users field: token @@ -214,7 +214,7 @@ fields: options: iconRight: vpn_key placeholder: Enter a secure access token... - sort: 18 + sort: 17 width: full - collection: directus_users field: id @@ -223,5 +223,5 @@ fields: locked: true options: iconRight: vpn_key - sort: 19 + sort: 18 width: full From 7b43e06bd0be314be2fa1c095fabd30757517825 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 18:05:30 -0400 Subject: [PATCH 188/189] Fix array mapping issue --- api/src/grant.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/src/grant.ts b/api/src/grant.ts index 0e22a549c3..bb1814f678 100644 --- a/api/src/grant.ts +++ b/api/src/grant.ts @@ -3,10 +3,9 @@ */ import env from './env'; +import { toArray } from './utils/to-array'; -const enabledProviders = (env.OAUTH_PROVIDERS as string[]).map((provider) => - provider.toLowerCase() -); +const enabledProviders = toArray(env.OAUTH_PROVIDERS).map((provider) => provider.toLowerCase()); const config: any = { defaults: { From f99ed1965ec6a46552ad7ffa70971c288a3175c4 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Thu, 15 Oct 2020 18:36:01 -0400 Subject: [PATCH 189/189] Make installer a little friendlier Fixes #322 --- api/src/cli/commands/init/index.ts | 56 ++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/api/src/cli/commands/init/index.ts b/api/src/cli/commands/init/index.ts index 1a9d3b3c61..e82c0a81ce 100644 --- a/api/src/cli/commands/init/index.ts +++ b/api/src/cli/commands/init/index.ts @@ -12,6 +12,7 @@ import argon2 from 'argon2'; import runSeed from '../../../database/seeds/run'; import createDBConnection, { Credentials } from '../../utils/create-db-connection'; +import Knex from 'knex'; export default async function init(options: Record) { const rootPath = process.cwd(); @@ -27,21 +28,54 @@ export default async function init(options: Record) { const dbClient = getDriverForClient(client)!; - const spinnerDriver = ora('Installing Database Driver...').start(); - await execa('npm', ['install', dbClient, '--production']); - spinnerDriver.stop(); + try { + require.resolve(dbClient); + } catch { + const spinnerDriver = ora('Installing Database Driver...').start(); + await execa('npm', ['install', dbClient, '--production']); + spinnerDriver.stop(); + } - const credentials: Credentials = await inquirer.prompt( - (databaseQuestions[dbClient] as any[]).map((question: Function) => - question({ client: dbClient, filepath: rootPath }) - ) - ); + let attemptsRemaining = 5; - const db = createDBConnection(dbClient, credentials); + const { credentials, db } = await trySeed(); - await runSeed(db); + async function trySeed(): Promise<{ credentials: Credentials; db: Knex }> { + const credentials: Credentials = await inquirer.prompt( + (databaseQuestions[dbClient] as any[]).map((question: Function) => + question({ client: dbClient, filepath: rootPath }) + ) + ); - await createEnv(dbClient, credentials, rootPath); + const db = createDBConnection(dbClient, credentials!); + + try { + await runSeed(db); + } catch (err) { + console.log(); + console.log('Something went wrong while seeding the database:'); + console.log(); + console.log(`${err.code && chalk.red(`[${err.code}]`)} ${err.message}`); + console.log(); + console.log('Please try again'); + console.log(); + attemptsRemaining--; + + if (attemptsRemaining > 0) { + return await trySeed(); + } else { + console.log(`Couldn't seed the database. Exiting.`); + process.exit(1); + } + } + + return { credentials, db }; + } + + await createEnv(dbClient, credentials!, rootPath); + + console.log(); + console.log(); console.log(`Create your first admin user:`);