ডেটা কানেক্ট কনফিগারেশন ফাইলের রেফারেন্স

Firebase সিএলআই আপনাকে একটি স্থানীয়, সংস্করণ-নিয়ন্ত্রণযোগ্য প্রজেক্ট ডিরেক্টরিতে আপনার ফায়ারবেস প্রজেক্টগুলো পরিচালনা করতে দেয়। এর মধ্যে আপনার প্রজেক্টের Data Connect সার্ভিস, সেই সার্ভিসগুলোর জন্য কানেক্টর এবং প্রতিটি কানেক্টরের জন্য স্কিমা, কোয়েরি ও মিউটেশন সোর্সের মতো রিসোর্স অন্তর্ভুক্ত থাকে। সিএলআই আপনাকে Firebase Data Connect এমুলেটর ইনস্টল এবং পরিচালনা করার সুযোগও দেয়। Firebase কনসোলে কাজ করার একটি কার্যকর বিকল্প হলো সিএলআই।

প্রাইভেট প্রিভিউ প্রোগ্রামের জন্য Firebase সিএলআই এক্সপেরিমেন্ট ইনস্টল করার নির্দেশাবলী এবং Data Connect -সম্পর্কিত সিএলআই কমান্ডগুলোর জন্য, সিএলআই রেফারেন্স দেখুন।

এই নির্দেশিকাটিতে নিম্নলিখিত বিষয়গুলো নথিভুক্ত করা হয়েছে:

  • আপনার firebase.json প্রোজেক্ট কনফিগারেশন ফাইলে Data Connect জন্য নির্দিষ্ট এন্ট্রিগুলো যোগ করুন।
  • dataconnect.yaml এবং connector.yaml ফাইলে Data Connect কনফিগারেশনগুলো থাকে।

ফায়ারবেস প্রজেক্ট কনফিগারেশন ফাইল

firebase.json কনফিগারেশন রেফারেন্স

আপনার প্রোজেক্টে এক বা একাধিক Data Connect সার্ভিস কনফিগার করতে dataconnect কীগুলো ব্যবহার করুন।

dataconnect: {
   source: string // Path to the directory containing the dataconnect.yaml service file.
}

dataconnect.yaml কনফিগারেশন রেফারেন্স

dataconnect.yaml ফাইলটি অ্যাপ্লিকেশন স্কিমা সোর্স, কানেক্টর সোর্স এবং ডেটা সোর্স সংযোগের অবস্থান সম্পর্কিত কনফিগারেশন তথ্য সংরক্ষণ করে। ফাইলটি Firebase CLI-এর জন্য একটি প্রজেক্ট ডিরেক্টরি নির্দেশক হিসেবেও কাজ করে।

ডেপ্লয়মেন্টের সময় স্কিমা মাইগ্রেট করার ক্ষেত্রে কোন স্তরের স্কিমা ভ্যালিডেশন করা হবে, তা schemaValidation কী-টি নিয়ন্ত্রণ করে। কোনো ভ্যালু সেট করা না থাকলে, dataconect:sql:migrate কমান্ডটি সামঞ্জস্যপূর্ণ পরিবর্তনগুলো প্রয়োগ করে এবং কোনো কঠোর পরিবর্তন কার্যকর করার আগে আপনাকে জিজ্ঞাসা করে। এটি সেট করা থাকলে, এর আচরণ নিম্নরূপ:

  • STRICT মোড। অ্যাপ্লিকেশন স্কিমা স্থাপন করার আগে ডাটাবেস স্কিমা অবশ্যই অ্যাপ্লিকেশন স্কিমার সাথে হুবহু মিলতে হবে। আপনার Data Connect স্কিমাতে ব্যবহৃত নয় এমন যেকোনো টেবিল বা কলাম ডাটাবেস থেকে মুছে ফেলা হবে।
  • COMPATIBLE মোড। অ্যাপ্লিকেশন স্কিমা ডেপ্লয় করার আগে ডাটাবেস স্কিমা অবশ্যই অ্যাপ্লিকেশন স্কিমার সাথে সামঞ্জস্যপূর্ণ হতে হবে; যেকোনো অতিরিক্ত পরিবর্তন ঐচ্ছিক বলে বিবেচিত হয়। কম্প্যাটিবল মানে হলো, স্কিমা মাইগ্রেশনগুলো আপনার লেখা অ্যাপ্লিকেশন স্কিমার উপর ভিত্তি করে করা হয়। আপনার ডাটাবেসের যে উপাদানগুলো আপনার অ্যাপ্লিকেশন স্কিমা দ্বারা ব্যবহৃত হয় না, সেগুলো অপরিবর্তিত থাকে। অতএব, ডেপ্লয়মেন্টের পরে, আপনার ব্যাকএন্ডে অব্যবহৃত স্কিমা, টেবিল এবং কলাম থাকতে পারে।

এই ফাইলের অন্যান্য কী-গুলোর মান নিচের কমেন্টগুলোতে ব্যাখ্যা করা হয়েছে।

# The top-level Firebase Data Connect YAML file.

# The Firebase Data Connect API version to target.
# Optional. Defaults to the latest version.
specVersion: string

# The ID of the Firebase Data Connect service resource.
# Required.
serviceId: string

# The location of the Firebase Data Connect service.
# Required.
location: string

# Required.
schema:
  # Relative path to directory for schema definitions.
  # Recursively loads all .gql files in this directory.
  # Optional. If not present, defaults to ./schema.
  source: string
  # Datasource connection information.
  # Required.
  datasource:
    # Required.
    postgresql:
      # The name of the PostgreSQL database.
      # Required.
      database: string
      cloudSql:
        # The ID of the CloudSQL instance resource.
        # Required.
        instanceId: string
        # Schema validation mode for schema migrations.
        # Defaults to unspecified/commented out, meaning you are prompted to
        # review all changes during migration.
        # If desired, uncomment and indicate one of "STRICT" or "COMPATIBLE".
        schemaValidation: string

# Required.
# Relative paths to directories for connector definitions.
# Recursively loads all .gql files in the listed directories.
# All directories specified MUST contain a connector.yaml file.
connectorDirs: [string]

YAML ফাইলটি একটি ডিফল্ট (কিন্তু কনফিগারযোগ্য) ডিরেক্টরি কাঠামো ধরে নেয়, যা নিম্নরূপ:

./(project root)
   /dataconnect
      dataconnect.yaml
      /schema
        *.gql
      /example
        connector.yaml
        *.gql

connector.yaml কনফিগারেশন রেফারেন্স

ডিফল্ট অথেনটিকেশন মোড এবং SDK জেনারেশন অপশনগুলো কনফিগার করতে connector.yaml ব্যবহার করুন।

# The connector-level YAML file.

# Required. The connector name of the Firebase Data Connect connector resource.
connectorId: string

# Optional. If not specified, no generated libraries (i.e. type-safe SDKs) will
# be generated.
generate:
    # Optional.
    javascriptSdk:
        # Path to the directory that will be updated with the latest generated
        # web TypeScript SDK.
        # Required.
        outputDir: string
        # Name of the Javascript package to be created.
        # Required. Example: @dataconnect/generated
        package: string
        # Path to your package.json directory. If specified, the new generated
        # SDK will be installed in this path.
        # Optional. If not provided, the package will not be auto-installed for
        # you.
        packageJsonDir: string
        # Enable React framework bindings.
        # Optional. Default to false.
        react: Boolean
        # Enable Angular framework bindings.
        # Optional. Default to false.
        angular: Boolean
        # Enable and configure client-side caching for the generated SDK.
        # Optional. If the `clientCache` key is not present, caching is disabled.
        clientCache:
            # The maximum age allowed for cached results before fetching fresh
            # values. A value of "0" means that responses are cached, but the
            # client SDK will always fetch fresh values; the cached values are
            # only used when CACHE_ONLY is specified to executeQuery() and as the
            # initial result returned from subscribe().
            # Examples: "0", "30s", "1h30m"
            # Optional. Default: "0"
            maxAge: string
            # Configures how results are to be cached.
            # Optional. Only "memory" is allowed for JavaScript SDKs.
            storage: string
    # Optional.
    dartSdk:
        # Path to the directory that will be updated with the latest generated
        # Flutter Dart SDK.
        # Required.
        outputDir: string
        # Name of the Dart package to be created.
        # Required. Example: "dataconnect_generated"
        package: string
        # Enable and configure client-side caching for the generated SDK.
        # Optional. If the `clientCache` key is not present, caching is disabled.
        clientCache:
            # The maximum age allowed for cached results before fetching fresh
            # values. A value of "0" means that responses are cached, but the
            # client SDK will always fetch fresh values; the cached values are
            # only used when CACHE_ONLY is specified to execute() and as the
            # initial result returned from subscribe().
            # Examples: "0", "30s", "1h30m"
            # Optional. Default: "0"
            maxAge: string
            # Configures whether results are to be cached in persistent storage
            # or in memory ("persistent" or "memory").
            # Optional.
            # Default: "persistent" for Android and iOS targets, "memory" for web.
            storage: string
    # Optional.
    kotlinSdk:
        # Path to the directory that will be updated with the latest generated
        # Android SDK.
        # Required.
        outputDir: string
        # Name of the package to be created.
        # Required. Example: com.google.firebase.dataconnect.generated
        package: string
        # Enable and configure client-side caching for the generated SDK.
        # Optional. If the `clientCache` key is not present, caching is disabled.
        clientCache:
            # The maximum age allowed for cached results before fetching fresh
            # values. A value of "0" means that responses are cached, but the
            # client SDK will always fetch fresh values; the cached values are
            # only used when CACHE_ONLY is specified to execute().
            # Examples: "0", "30s", "1h30m"
            # Optional. Default: "0"
            maxAge: string
            # Configures whether results are to be cached in persistent storage
            # or in memory ("persistent" or "memory").
            # Optional. Default: persistent
            storage: string
    # Optional.
    adminNodeSdk:
        # Path to the directory that will be updated with the latest generated
        # Node Admin SDK.
        # Required.
        outputDir: string
        # Path to your package.json directory. If specified, the new generated
        # SDK will be installed in this path.
        # Optional. If not provided, the package will not be auto-installed for
        # you.
        packageJsonDir: string
        # Name of the package to be created (for example: @dataconnect/admin-generated).
        # Required.
        package: string
    # Optional.
    swiftSdk:
        # Path to the directory that will be updated with the latest generated
        # iOS Swift SDK.
        # Required.
        outputDir: string
        # Name of the Swift package to be created.
        # Required. Example: "FirebaseDataConnectGenerated"
        package: string
        # Enable and configure client-side caching for the generated SDK.
        # Optional. If the `clientCache` key is not present, caching is disabled.
        clientCache:
            # The maximum age allowed for cached results before fetching fresh
            # values. A value of "0" means that responses are cached, but the
            # client SDK will always fetch fresh values; the cached values are
            # only used when CACHE_ONLY is specified to execute().
            # Examples: "0", "30s", "1h30m"
            # Optional. Default: "0"
            maxAge: string
            # Configures whether results are to be cached in persistent storage
            # or in memory ("persistent" or "memory").
            # Optional. Default: persistent
            storage: string