diff --git a/.gitattributes b/.gitattributes index 8d4f9a4..ed2f685 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ +lib/seam/resources/** linguist-generated lib/seam/routes/** linguist-generated diff --git a/codegen/lib/layouts/client.ts b/codegen/lib/layouts/client.ts index f69efca..b35846b 100644 --- a/codegen/lib/layouts/client.ts +++ b/codegen/lib/layouts/client.ts @@ -1,5 +1,5 @@ // Builds the template context for client files -// (lib/seam/routes/clients/{snake_name}.rb). +// (lib/seam/routes/{snake_name}.rb). // Mirrors the output of the nextlove RubyClient#serialize. import { diff --git a/codegen/lib/layouts/imports.ts b/codegen/lib/layouts/imports.ts index 6f05cf0..baaf819 100644 --- a/codegen/lib/layouts/imports.ts +++ b/codegen/lib/layouts/imports.ts @@ -1,5 +1,5 @@ // Builds the template context for the index files -// (lib/seam/routes/{clients,resources}/index.rb). +// (lib/seam/{routes,resources}/index.rb). // Mirrors the output of the nextlove get-entity-imports-template.ts. export interface ImportsLayoutContext { diff --git a/codegen/lib/layouts/resource.ts b/codegen/lib/layouts/resource.ts index bcc1102..823bd1b 100644 --- a/codegen/lib/layouts/resource.ts +++ b/codegen/lib/layouts/resource.ts @@ -1,5 +1,5 @@ // Builds the template context for resource files -// (lib/seam/routes/resources/{snake_name}.rb). +// (lib/seam/resources/{snake_name}.rb). import type { Property } from '@seamapi/blueprint' import { pascalCase } from 'change-case' diff --git a/codegen/lib/routes.ts b/codegen/lib/routes.ts index 80fc2d8..8c5b398 100644 --- a/codegen/lib/routes.ts +++ b/codegen/lib/routes.ts @@ -33,8 +33,7 @@ interface Metadata { } const routesPath = 'lib/seam/routes' -const resourcesPath = `${routesPath}/resources` -const clientsPath = `${routesPath}/clients` +const resourcesPath = 'lib/seam/resources' export const routes = ( files: Metalsmith.Files, @@ -68,7 +67,7 @@ export const routes = ( const clientNames: string[] = [] for (const cls of clients.values()) { - files[`${clientsPath}/${cls.namespace}.rb`] = { + files[`${routesPath}/${cls.namespace}.rb`] = { contents: Buffer.from('\n'), layout: 'client.hbs', ...setClientLayoutContext(cls), @@ -82,7 +81,7 @@ export const routes = ( ...setImportsLayoutContext(resourceNames, ['require "seam/base_resource"']), } - files[`${clientsPath}/index.rb`] = { + files[`${routesPath}/index.rb`] = { contents: Buffer.from('\n'), layout: 'imports.hbs', ...setImportsLayoutContext(clientNames, []), diff --git a/codegen/smith.ts b/codegen/smith.ts index cd19c96..373449c 100644 --- a/codegen/smith.ts +++ b/codegen/smith.ts @@ -11,7 +11,10 @@ import { helpers, routes } from './lib/index.js' const rootDir = dirname(fileURLToPath(import.meta.url)) -await Promise.all([deleteAsync('./lib/seam/routes')]) +await Promise.all([ + deleteAsync('./lib/seam/routes'), + deleteAsync('./lib/seam/resources'), +]) const partials = await getHandlebarsPartials(`${rootDir}/layouts/partials`) diff --git a/lib/seam/http_multi_workspace.rb b/lib/seam/http_multi_workspace.rb index cf9cfd0..e578f63 100644 --- a/lib/seam/http_multi_workspace.rb +++ b/lib/seam/http_multi_workspace.rb @@ -5,8 +5,8 @@ require_relative "lts_version" require_relative "version" require_relative "auth" -require_relative "routes/resources/index" -require_relative "routes/clients/index" +require_relative "resources/index" +require_relative "routes/index" require_relative "routes/routes" module Seam diff --git a/lib/seam/http_single_workspace.rb b/lib/seam/http_single_workspace.rb index 78d4785..e075665 100644 --- a/lib/seam/http_single_workspace.rb +++ b/lib/seam/http_single_workspace.rb @@ -2,8 +2,8 @@ require_relative "request" require_relative "parse_options" -require_relative "routes/resources/index" -require_relative "routes/clients/index" +require_relative "resources/index" +require_relative "routes/index" require_relative "routes/routes" require_relative "version" require_relative "deep_hash_accessor" diff --git a/lib/seam/routes/resources/access_code.rb b/lib/seam/resources/access_code.rb similarity index 100% rename from lib/seam/routes/resources/access_code.rb rename to lib/seam/resources/access_code.rb diff --git a/lib/seam/routes/resources/access_grant.rb b/lib/seam/resources/access_grant.rb similarity index 100% rename from lib/seam/routes/resources/access_grant.rb rename to lib/seam/resources/access_grant.rb diff --git a/lib/seam/routes/resources/access_method.rb b/lib/seam/resources/access_method.rb similarity index 100% rename from lib/seam/routes/resources/access_method.rb rename to lib/seam/resources/access_method.rb diff --git a/lib/seam/routes/resources/acs_access_group.rb b/lib/seam/resources/acs_access_group.rb similarity index 100% rename from lib/seam/routes/resources/acs_access_group.rb rename to lib/seam/resources/acs_access_group.rb diff --git a/lib/seam/routes/resources/acs_credential.rb b/lib/seam/resources/acs_credential.rb similarity index 100% rename from lib/seam/routes/resources/acs_credential.rb rename to lib/seam/resources/acs_credential.rb diff --git a/lib/seam/routes/resources/acs_encoder.rb b/lib/seam/resources/acs_encoder.rb similarity index 100% rename from lib/seam/routes/resources/acs_encoder.rb rename to lib/seam/resources/acs_encoder.rb diff --git a/lib/seam/routes/resources/acs_entrance.rb b/lib/seam/resources/acs_entrance.rb similarity index 100% rename from lib/seam/routes/resources/acs_entrance.rb rename to lib/seam/resources/acs_entrance.rb diff --git a/lib/seam/routes/resources/acs_system.rb b/lib/seam/resources/acs_system.rb similarity index 100% rename from lib/seam/routes/resources/acs_system.rb rename to lib/seam/resources/acs_system.rb diff --git a/lib/seam/routes/resources/acs_user.rb b/lib/seam/resources/acs_user.rb similarity index 100% rename from lib/seam/routes/resources/acs_user.rb rename to lib/seam/resources/acs_user.rb diff --git a/lib/seam/routes/resources/action_attempt.rb b/lib/seam/resources/action_attempt.rb similarity index 100% rename from lib/seam/routes/resources/action_attempt.rb rename to lib/seam/resources/action_attempt.rb diff --git a/lib/seam/routes/resources/batch.rb b/lib/seam/resources/batch.rb similarity index 100% rename from lib/seam/routes/resources/batch.rb rename to lib/seam/resources/batch.rb diff --git a/lib/seam/routes/resources/client_session.rb b/lib/seam/resources/client_session.rb similarity index 100% rename from lib/seam/routes/resources/client_session.rb rename to lib/seam/resources/client_session.rb diff --git a/lib/seam/routes/resources/connect_webview.rb b/lib/seam/resources/connect_webview.rb similarity index 100% rename from lib/seam/routes/resources/connect_webview.rb rename to lib/seam/resources/connect_webview.rb diff --git a/lib/seam/routes/resources/connected_account.rb b/lib/seam/resources/connected_account.rb similarity index 100% rename from lib/seam/routes/resources/connected_account.rb rename to lib/seam/resources/connected_account.rb diff --git a/lib/seam/routes/resources/customer_portal.rb b/lib/seam/resources/customer_portal.rb similarity index 100% rename from lib/seam/routes/resources/customer_portal.rb rename to lib/seam/resources/customer_portal.rb diff --git a/lib/seam/routes/resources/device.rb b/lib/seam/resources/device.rb similarity index 100% rename from lib/seam/routes/resources/device.rb rename to lib/seam/resources/device.rb diff --git a/lib/seam/routes/resources/device_provider.rb b/lib/seam/resources/device_provider.rb similarity index 100% rename from lib/seam/routes/resources/device_provider.rb rename to lib/seam/resources/device_provider.rb diff --git a/lib/seam/routes/resources/event.rb b/lib/seam/resources/event.rb similarity index 100% rename from lib/seam/routes/resources/event.rb rename to lib/seam/resources/event.rb diff --git a/lib/seam/routes/resources/index.rb b/lib/seam/resources/index.rb similarity index 100% rename from lib/seam/routes/resources/index.rb rename to lib/seam/resources/index.rb diff --git a/lib/seam/routes/resources/instant_key.rb b/lib/seam/resources/instant_key.rb similarity index 100% rename from lib/seam/routes/resources/instant_key.rb rename to lib/seam/resources/instant_key.rb diff --git a/lib/seam/routes/resources/noise_threshold.rb b/lib/seam/resources/noise_threshold.rb similarity index 100% rename from lib/seam/routes/resources/noise_threshold.rb rename to lib/seam/resources/noise_threshold.rb diff --git a/lib/seam/routes/resources/pagination.rb b/lib/seam/resources/pagination.rb similarity index 100% rename from lib/seam/routes/resources/pagination.rb rename to lib/seam/resources/pagination.rb diff --git a/lib/seam/routes/resources/phone.rb b/lib/seam/resources/phone.rb similarity index 100% rename from lib/seam/routes/resources/phone.rb rename to lib/seam/resources/phone.rb diff --git a/lib/seam/routes/resources/resource_error.rb b/lib/seam/resources/resource_error.rb similarity index 100% rename from lib/seam/routes/resources/resource_error.rb rename to lib/seam/resources/resource_error.rb diff --git a/lib/seam/routes/resources/resource_errors_support.rb b/lib/seam/resources/resource_errors_support.rb similarity index 100% rename from lib/seam/routes/resources/resource_errors_support.rb rename to lib/seam/resources/resource_errors_support.rb diff --git a/lib/seam/routes/resources/resource_warning.rb b/lib/seam/resources/resource_warning.rb similarity index 100% rename from lib/seam/routes/resources/resource_warning.rb rename to lib/seam/resources/resource_warning.rb diff --git a/lib/seam/routes/resources/resource_warnings_support.rb b/lib/seam/resources/resource_warnings_support.rb similarity index 100% rename from lib/seam/routes/resources/resource_warnings_support.rb rename to lib/seam/resources/resource_warnings_support.rb diff --git a/lib/seam/routes/resources/space.rb b/lib/seam/resources/space.rb similarity index 100% rename from lib/seam/routes/resources/space.rb rename to lib/seam/resources/space.rb diff --git a/lib/seam/routes/resources/thermostat_daily_program.rb b/lib/seam/resources/thermostat_daily_program.rb similarity index 100% rename from lib/seam/routes/resources/thermostat_daily_program.rb rename to lib/seam/resources/thermostat_daily_program.rb diff --git a/lib/seam/routes/resources/thermostat_schedule.rb b/lib/seam/resources/thermostat_schedule.rb similarity index 100% rename from lib/seam/routes/resources/thermostat_schedule.rb rename to lib/seam/resources/thermostat_schedule.rb diff --git a/lib/seam/routes/resources/unmanaged_access_code.rb b/lib/seam/resources/unmanaged_access_code.rb similarity index 100% rename from lib/seam/routes/resources/unmanaged_access_code.rb rename to lib/seam/resources/unmanaged_access_code.rb diff --git a/lib/seam/routes/resources/unmanaged_device.rb b/lib/seam/resources/unmanaged_device.rb similarity index 100% rename from lib/seam/routes/resources/unmanaged_device.rb rename to lib/seam/resources/unmanaged_device.rb diff --git a/lib/seam/routes/resources/user_identity.rb b/lib/seam/resources/user_identity.rb similarity index 100% rename from lib/seam/routes/resources/user_identity.rb rename to lib/seam/resources/user_identity.rb diff --git a/lib/seam/routes/resources/webhook.rb b/lib/seam/resources/webhook.rb similarity index 100% rename from lib/seam/routes/resources/webhook.rb rename to lib/seam/resources/webhook.rb diff --git a/lib/seam/routes/resources/workspace.rb b/lib/seam/resources/workspace.rb similarity index 100% rename from lib/seam/routes/resources/workspace.rb rename to lib/seam/resources/workspace.rb diff --git a/lib/seam/routes/clients/access_codes.rb b/lib/seam/routes/access_codes.rb similarity index 100% rename from lib/seam/routes/clients/access_codes.rb rename to lib/seam/routes/access_codes.rb diff --git a/lib/seam/routes/clients/access_codes_simulate.rb b/lib/seam/routes/access_codes_simulate.rb similarity index 100% rename from lib/seam/routes/clients/access_codes_simulate.rb rename to lib/seam/routes/access_codes_simulate.rb diff --git a/lib/seam/routes/clients/access_codes_unmanaged.rb b/lib/seam/routes/access_codes_unmanaged.rb similarity index 100% rename from lib/seam/routes/clients/access_codes_unmanaged.rb rename to lib/seam/routes/access_codes_unmanaged.rb diff --git a/lib/seam/routes/clients/access_grants.rb b/lib/seam/routes/access_grants.rb similarity index 100% rename from lib/seam/routes/clients/access_grants.rb rename to lib/seam/routes/access_grants.rb diff --git a/lib/seam/routes/clients/access_grants_unmanaged.rb b/lib/seam/routes/access_grants_unmanaged.rb similarity index 100% rename from lib/seam/routes/clients/access_grants_unmanaged.rb rename to lib/seam/routes/access_grants_unmanaged.rb diff --git a/lib/seam/routes/clients/access_methods.rb b/lib/seam/routes/access_methods.rb similarity index 100% rename from lib/seam/routes/clients/access_methods.rb rename to lib/seam/routes/access_methods.rb diff --git a/lib/seam/routes/clients/access_methods_unmanaged.rb b/lib/seam/routes/access_methods_unmanaged.rb similarity index 100% rename from lib/seam/routes/clients/access_methods_unmanaged.rb rename to lib/seam/routes/access_methods_unmanaged.rb diff --git a/lib/seam/routes/clients/acs.rb b/lib/seam/routes/acs.rb similarity index 100% rename from lib/seam/routes/clients/acs.rb rename to lib/seam/routes/acs.rb diff --git a/lib/seam/routes/clients/acs_access_groups.rb b/lib/seam/routes/acs_access_groups.rb similarity index 100% rename from lib/seam/routes/clients/acs_access_groups.rb rename to lib/seam/routes/acs_access_groups.rb diff --git a/lib/seam/routes/clients/acs_credentials.rb b/lib/seam/routes/acs_credentials.rb similarity index 100% rename from lib/seam/routes/clients/acs_credentials.rb rename to lib/seam/routes/acs_credentials.rb diff --git a/lib/seam/routes/clients/acs_encoders.rb b/lib/seam/routes/acs_encoders.rb similarity index 100% rename from lib/seam/routes/clients/acs_encoders.rb rename to lib/seam/routes/acs_encoders.rb diff --git a/lib/seam/routes/clients/acs_encoders_simulate.rb b/lib/seam/routes/acs_encoders_simulate.rb similarity index 100% rename from lib/seam/routes/clients/acs_encoders_simulate.rb rename to lib/seam/routes/acs_encoders_simulate.rb diff --git a/lib/seam/routes/clients/acs_entrances.rb b/lib/seam/routes/acs_entrances.rb similarity index 100% rename from lib/seam/routes/clients/acs_entrances.rb rename to lib/seam/routes/acs_entrances.rb diff --git a/lib/seam/routes/clients/acs_systems.rb b/lib/seam/routes/acs_systems.rb similarity index 100% rename from lib/seam/routes/clients/acs_systems.rb rename to lib/seam/routes/acs_systems.rb diff --git a/lib/seam/routes/clients/acs_users.rb b/lib/seam/routes/acs_users.rb similarity index 100% rename from lib/seam/routes/clients/acs_users.rb rename to lib/seam/routes/acs_users.rb diff --git a/lib/seam/routes/clients/action_attempts.rb b/lib/seam/routes/action_attempts.rb similarity index 100% rename from lib/seam/routes/clients/action_attempts.rb rename to lib/seam/routes/action_attempts.rb diff --git a/lib/seam/routes/clients/client_sessions.rb b/lib/seam/routes/client_sessions.rb similarity index 100% rename from lib/seam/routes/clients/client_sessions.rb rename to lib/seam/routes/client_sessions.rb diff --git a/lib/seam/routes/clients/connect_webviews.rb b/lib/seam/routes/connect_webviews.rb similarity index 100% rename from lib/seam/routes/clients/connect_webviews.rb rename to lib/seam/routes/connect_webviews.rb diff --git a/lib/seam/routes/clients/connected_accounts.rb b/lib/seam/routes/connected_accounts.rb similarity index 100% rename from lib/seam/routes/clients/connected_accounts.rb rename to lib/seam/routes/connected_accounts.rb diff --git a/lib/seam/routes/clients/connected_accounts_simulate.rb b/lib/seam/routes/connected_accounts_simulate.rb similarity index 100% rename from lib/seam/routes/clients/connected_accounts_simulate.rb rename to lib/seam/routes/connected_accounts_simulate.rb diff --git a/lib/seam/routes/clients/customers.rb b/lib/seam/routes/customers.rb similarity index 100% rename from lib/seam/routes/clients/customers.rb rename to lib/seam/routes/customers.rb diff --git a/lib/seam/routes/clients/devices.rb b/lib/seam/routes/devices.rb similarity index 100% rename from lib/seam/routes/clients/devices.rb rename to lib/seam/routes/devices.rb diff --git a/lib/seam/routes/clients/devices_simulate.rb b/lib/seam/routes/devices_simulate.rb similarity index 100% rename from lib/seam/routes/clients/devices_simulate.rb rename to lib/seam/routes/devices_simulate.rb diff --git a/lib/seam/routes/clients/devices_unmanaged.rb b/lib/seam/routes/devices_unmanaged.rb similarity index 100% rename from lib/seam/routes/clients/devices_unmanaged.rb rename to lib/seam/routes/devices_unmanaged.rb diff --git a/lib/seam/routes/clients/events.rb b/lib/seam/routes/events.rb similarity index 100% rename from lib/seam/routes/clients/events.rb rename to lib/seam/routes/events.rb diff --git a/lib/seam/routes/clients/index.rb b/lib/seam/routes/index.rb similarity index 100% rename from lib/seam/routes/clients/index.rb rename to lib/seam/routes/index.rb diff --git a/lib/seam/routes/clients/instant_keys.rb b/lib/seam/routes/instant_keys.rb similarity index 100% rename from lib/seam/routes/clients/instant_keys.rb rename to lib/seam/routes/instant_keys.rb diff --git a/lib/seam/routes/clients/locks.rb b/lib/seam/routes/locks.rb similarity index 100% rename from lib/seam/routes/clients/locks.rb rename to lib/seam/routes/locks.rb diff --git a/lib/seam/routes/clients/locks_simulate.rb b/lib/seam/routes/locks_simulate.rb similarity index 100% rename from lib/seam/routes/clients/locks_simulate.rb rename to lib/seam/routes/locks_simulate.rb diff --git a/lib/seam/routes/clients/noise_sensors.rb b/lib/seam/routes/noise_sensors.rb similarity index 100% rename from lib/seam/routes/clients/noise_sensors.rb rename to lib/seam/routes/noise_sensors.rb diff --git a/lib/seam/routes/clients/noise_sensors_noise_thresholds.rb b/lib/seam/routes/noise_sensors_noise_thresholds.rb similarity index 100% rename from lib/seam/routes/clients/noise_sensors_noise_thresholds.rb rename to lib/seam/routes/noise_sensors_noise_thresholds.rb diff --git a/lib/seam/routes/clients/noise_sensors_simulate.rb b/lib/seam/routes/noise_sensors_simulate.rb similarity index 100% rename from lib/seam/routes/clients/noise_sensors_simulate.rb rename to lib/seam/routes/noise_sensors_simulate.rb diff --git a/lib/seam/routes/clients/phones.rb b/lib/seam/routes/phones.rb similarity index 100% rename from lib/seam/routes/clients/phones.rb rename to lib/seam/routes/phones.rb diff --git a/lib/seam/routes/clients/phones_simulate.rb b/lib/seam/routes/phones_simulate.rb similarity index 100% rename from lib/seam/routes/clients/phones_simulate.rb rename to lib/seam/routes/phones_simulate.rb diff --git a/lib/seam/routes/clients/spaces.rb b/lib/seam/routes/spaces.rb similarity index 100% rename from lib/seam/routes/clients/spaces.rb rename to lib/seam/routes/spaces.rb diff --git a/lib/seam/routes/clients/thermostats.rb b/lib/seam/routes/thermostats.rb similarity index 100% rename from lib/seam/routes/clients/thermostats.rb rename to lib/seam/routes/thermostats.rb diff --git a/lib/seam/routes/clients/thermostats_daily_programs.rb b/lib/seam/routes/thermostats_daily_programs.rb similarity index 100% rename from lib/seam/routes/clients/thermostats_daily_programs.rb rename to lib/seam/routes/thermostats_daily_programs.rb diff --git a/lib/seam/routes/clients/thermostats_schedules.rb b/lib/seam/routes/thermostats_schedules.rb similarity index 100% rename from lib/seam/routes/clients/thermostats_schedules.rb rename to lib/seam/routes/thermostats_schedules.rb diff --git a/lib/seam/routes/clients/thermostats_simulate.rb b/lib/seam/routes/thermostats_simulate.rb similarity index 100% rename from lib/seam/routes/clients/thermostats_simulate.rb rename to lib/seam/routes/thermostats_simulate.rb diff --git a/lib/seam/routes/clients/user_identities.rb b/lib/seam/routes/user_identities.rb similarity index 100% rename from lib/seam/routes/clients/user_identities.rb rename to lib/seam/routes/user_identities.rb diff --git a/lib/seam/routes/clients/user_identities_unmanaged.rb b/lib/seam/routes/user_identities_unmanaged.rb similarity index 100% rename from lib/seam/routes/clients/user_identities_unmanaged.rb rename to lib/seam/routes/user_identities_unmanaged.rb diff --git a/lib/seam/routes/clients/webhooks.rb b/lib/seam/routes/webhooks.rb similarity index 100% rename from lib/seam/routes/clients/webhooks.rb rename to lib/seam/routes/webhooks.rb diff --git a/lib/seam/routes/clients/workspaces.rb b/lib/seam/routes/workspaces.rb similarity index 100% rename from lib/seam/routes/clients/workspaces.rb rename to lib/seam/routes/workspaces.rb diff --git a/lib/seam/webhook.rb b/lib/seam/webhook.rb index 7187122..0906624 100644 --- a/lib/seam/webhook.rb +++ b/lib/seam/webhook.rb @@ -3,7 +3,7 @@ require "svix/webhook" require "svix/errors" require_relative "base_resource" -require_relative "routes/resources/event" +require_relative "resources/event" module Seam WebhookVerificationError = Svix::WebhookVerificationError