@celerity-sdk/datastore 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/chunk-3I3BMI7I.js +21 -0
- package/dist/chunk-3I3BMI7I.js.map +1 -0
- package/dist/chunk-7QVYU63E.js +7 -0
- package/dist/chunk-7QVYU63E.js.map +1 -0
- package/dist/chunk-HHZJK2AK.js +30 -0
- package/dist/chunk-HHZJK2AK.js.map +1 -0
- package/dist/config-IXTAYSFF.js +8 -0
- package/dist/config-IXTAYSFF.js.map +1 -0
- package/dist/dynamodb-datastore-client-LQH3GS6X.js +463 -0
- package/dist/dynamodb-datastore-client-LQH3GS6X.js.map +1 -0
- package/dist/index.cjs +715 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +370 -1
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -1
- package/package.json +18 -7
- package/dist/index.d.cts +0 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/types.ts","../src/factory.ts","../src/decorators.ts","../src/helpers.ts","../src/layer.ts"],"sourcesContent":["import type { Closeable } from \"@celerity-sdk/types\";\n\nexport const DatastoreClient = Symbol.for(\"DatastoreClient\");\n\n/**\n * A data store client abstraction for NoSQL databases. Provides access to named\n * data stores (tables/collections), each representing a logical container for items.\n */\nexport interface DatastoreClient extends Closeable {\n /**\n * Retrieves a datastore instance by its logical name. The returned datastore\n * is a lightweight handle — no network calls are made until an operation is invoked.\n *\n * @param name The name of the datastore (table/collection).\n */\n datastore(name: string): Datastore;\n}\n\n/**\n * A datastore represents a logical container (table/collection) for items in a\n * NoSQL data store. It provides methods for performing CRUD operations, queries,\n * scans, and batch operations within the data store.\n */\nexport interface Datastore {\n /**\n * Retrieve an item from the data store by its primary key. Returns `null` if the\n * item does not exist.\n *\n * @param key The primary key attributes identifying the item.\n * @param options Optional parameters such as consistent read.\n * @returns A promise that resolves to the item, or `null` if not found.\n */\n getItem<T = Record<string, unknown>>(key: ItemKey, options?: GetItemOptions): Promise<T | null>;\n\n /**\n * Store an item in the data store. If an item with the same primary key already\n * exists, it is replaced entirely (upsert semantics).\n *\n * @param item The item to store. Must include all primary key attributes.\n * @param options Optional parameters such as condition expressions.\n */\n putItem(item: Record<string, unknown>, options?: PutItemOptions): Promise<void>;\n\n /**\n * Delete an item from the data store by its primary key. This operation is\n * idempotent — deleting a non-existent key does not throw.\n *\n * @param key The primary key attributes identifying the item to delete.\n * @param options Optional parameters such as condition expressions.\n */\n deleteItem(key: ItemKey, options?: DeleteItemOptions): Promise<void>;\n\n /**\n * Query items by primary key with optional range conditions. Returns an\n * {@link ItemListing} that handles pagination transparently, allowing the caller\n * to iterate over all matching items without managing page tokens.\n *\n * @param options Query parameters including key condition, range conditions,\n * filters, and pagination controls.\n * @returns An item listing that yields items and exposes a cursor for resuming.\n */\n query<T = Record<string, unknown>>(options: QueryOptions): ItemListing<T>;\n\n /**\n * Perform a full scan of the data store. Returns an {@link ItemListing} that\n * handles pagination transparently. Scans read every item in the table and\n * should be used sparingly.\n *\n * @param options Optional scan parameters such as filters and pagination controls.\n * @returns An item listing that yields items and exposes a cursor for resuming.\n */\n scan<T = Record<string, unknown>>(options?: ScanOptions): ItemListing<T>;\n\n /**\n * Retrieve multiple items by their primary keys in a single batch operation.\n * The batch may be split into multiple requests if it exceeds provider limits.\n *\n * @param keys The primary keys of the items to retrieve.\n * @param options Optional parameters such as consistent read.\n * @returns A promise that resolves to the batch get result, including retrieved\n * items and any unprocessed keys.\n */\n batchGetItems<T = Record<string, unknown>>(\n keys: ItemKey[],\n options?: BatchGetItemsOptions,\n ): Promise<BatchGetResult<T>>;\n\n /**\n * Perform multiple put and delete operations in a single batch. The batch may\n * be split into multiple requests if it exceeds provider limits.\n *\n * @param operations The batch of put and delete operations to execute.\n * @returns A promise that resolves to the batch write result, including any\n * unprocessed operations.\n */\n batchWriteItems(operations: BatchWriteOperation[]): Promise<BatchWriteResult>;\n}\n\n/**\n * Primary key attributes for an item. Keys can be string or number values\n * corresponding to primary key and optional range key attributes.\n */\nexport type ItemKey = Record<string, string | number>;\n\n/**\n * A condition on the primary key — always an equality match.\n */\nexport type KeyCondition = {\n /** The attribute name of the primary key. */\n name: string;\n /** The primary key value to match. */\n value: string | number;\n};\n\n/**\n * A condition on the range key. Supports equality, comparison, range,\n * and prefix matching operations.\n */\nexport type RangeCondition = {\n /** The attribute name of the range key. */\n name: string;\n} & (\n | { operator: \"eq\"; value: string | number }\n | { operator: \"lt\"; value: string | number }\n | { operator: \"le\"; value: string | number }\n | { operator: \"gt\"; value: string | number }\n | { operator: \"ge\"; value: string | number }\n | { operator: \"between\"; low: string | number; high: string | number }\n | { operator: \"startsWith\"; value: string }\n);\n\n/**\n * A filter condition on an item attribute. Used for post-read filtering\n * in queries and scans, and for conditional writes.\n *\n * Only includes operators that map cleanly across all target providers\n * (DynamoDB, Firestore, Cosmos DB). The `not_exists` operator is\n * provider-specific and available through the concrete provider classes.\n */\nexport type Condition = {\n /** The attribute name to evaluate. */\n name: string;\n} & (\n | { operator: \"eq\"; value: unknown }\n | { operator: \"ne\"; value: unknown }\n | { operator: \"lt\"; value: string | number }\n | { operator: \"le\"; value: string | number }\n | { operator: \"gt\"; value: string | number }\n | { operator: \"ge\"; value: string | number }\n | { operator: \"between\"; low: string | number; high: string | number }\n | { operator: \"startsWith\"; value: string }\n | { operator: \"contains\"; value: string | number }\n | { operator: \"exists\" }\n);\n\n/**\n * One or more conditions AND'd together. A single {@link Condition} or an array\n * of Conditions — when multiple are provided, all must be true.\n */\nexport type ConditionExpression = Condition | Condition[];\n\n/**\n * Options for the getItem operation.\n */\nexport type GetItemOptions = {\n /** When true, performs a strongly consistent read. Default is eventually consistent. */\n consistentRead?: boolean;\n};\n\n/**\n * Options for the putItem operation.\n */\nexport type PutItemOptions = {\n /**\n * Condition that must be met for the put to succeed. Throws\n * {@link ConditionalCheckFailedError} if the condition is not met.\n */\n condition?: ConditionExpression;\n};\n\n/**\n * Options for the deleteItem operation.\n */\nexport type DeleteItemOptions = {\n /**\n * Condition that must be met for the delete to succeed. Throws\n * {@link ConditionalCheckFailedError} if the condition is not met.\n */\n condition?: ConditionExpression;\n};\n\n/**\n * Options for the query operation.\n */\nexport type QueryOptions = {\n /** The primary key condition (required for queries). */\n key: KeyCondition;\n /** Optional range key condition to narrow the query range. */\n range?: RangeCondition;\n /** Optional filter conditions applied after the query read (does not reduce read capacity). */\n filter?: ConditionExpression;\n /** Query an index instead of the base table. */\n indexName?: string;\n /** When true, results are returned in ascending key order (default). Set to false for descending. */\n sortAscending?: boolean;\n /** Maximum number of items to return per internal page fetch. */\n maxResults?: number;\n /** Opaque cursor token to resume a previous query from where it left off. */\n cursor?: string;\n /** When true, performs a strongly consistent read (not supported on secondary indexes). */\n consistentRead?: boolean;\n};\n\n/**\n * Options for the scan operation.\n */\nexport type ScanOptions = {\n /** Optional filter conditions applied after the scan read. */\n filter?: ConditionExpression;\n /** Scan an index instead of the base table. */\n indexName?: string;\n /** Maximum number of items to return per internal page fetch. */\n maxResults?: number;\n /** Opaque cursor token to resume a previous scan from where it left off. */\n cursor?: string;\n /** When true, performs a strongly consistent read. */\n consistentRead?: boolean;\n};\n\n/**\n * An async iterable of items that also exposes a cursor token for resuming\n * iteration from the current position. The cursor is updated as pages are fetched\n * and encodes enough state to resume from the exact position across all providers.\n */\nexport interface ItemListing<T> extends AsyncIterable<T> {\n /**\n * A cursor token representing the current position in the listing. This token\n * can be passed to a subsequent query or scan call to resume iteration from\n * this position. The value is `undefined` before iteration begins or after all\n * items have been yielded.\n */\n readonly cursor: string | undefined;\n}\n\n/**\n * Options for the batchGetItems operation.\n */\nexport type BatchGetItemsOptions = {\n /** When true, performs strongly consistent reads for all items. */\n consistentRead?: boolean;\n};\n\n/**\n * The result of a batch get operation.\n */\nexport type BatchGetResult<T> = {\n /** The successfully retrieved items. */\n items: T[];\n /** Keys that could not be processed in this batch (caller should retry). */\n unprocessedKeys: ItemKey[];\n};\n\n/**\n * A single operation in a batch write request.\n */\nexport type BatchWriteOperation =\n | { type: \"put\"; item: Record<string, unknown> }\n | { type: \"delete\"; key: ItemKey };\n\n/**\n * The result of a batch write operation.\n */\nexport type BatchWriteResult = {\n /** Operations that could not be processed in this batch (caller should retry). */\n unprocessedOperations: BatchWriteOperation[];\n};\n","import { resolveConfig } from \"@celerity-sdk/config\";\nimport type { CelerityTracer } from \"@celerity-sdk/types\";\nimport type { DatastoreClient } from \"./types\";\nimport type { DynamoDBDatastoreConfig } from \"./providers/dynamodb/types\";\n\nexport type CreateDatastoreClientOptions = {\n /** Override provider selection. If omitted, derived from platform config. */\n provider?: \"aws\" | \"local\" | \"gcp\" | \"azure\";\n /** Cloud deploy target for local environments (e.g. \"aws\", \"gcloud\", \"azure\"). */\n deployTarget?: string;\n /** DynamoDB-specific configuration overrides. */\n aws?: DynamoDBDatastoreConfig;\n /** Optional tracer for Celerity-level span instrumentation. */\n tracer?: CelerityTracer;\n};\n\nexport async function createDatastoreClient(\n options?: CreateDatastoreClientOptions,\n): Promise<DatastoreClient> {\n const resolved = resolveConfig(\"datastore\");\n const provider = options?.provider ?? resolved.provider;\n\n switch (provider) {\n case \"aws\": {\n const { DynamoDBDatastoreClient } =\n await import(\"./providers/dynamodb/dynamodb-datastore-client.js\");\n return new DynamoDBDatastoreClient(options?.aws, options?.tracer);\n }\n case \"local\":\n return createLocalClient(options);\n default:\n throw new Error(`Unsupported datastore provider: \"${provider}\"`);\n }\n}\n\nasync function createLocalClient(options?: CreateDatastoreClientOptions): Promise<DatastoreClient> {\n const deployTarget = options?.deployTarget?.toLowerCase();\n\n switch (deployTarget) {\n case \"aws\":\n case \"aws-serverless\":\n case undefined: {\n // DynamoDB Local (v0 default when no deploy target is specified)\n const { captureDynamoDBConfig } = await import(\"./providers/dynamodb/config.js\");\n const { DynamoDBDatastoreClient } =\n await import(\"./providers/dynamodb/dynamodb-datastore-client.js\");\n const localConfig: DynamoDBDatastoreConfig = {\n ...captureDynamoDBConfig(),\n ...options?.aws,\n };\n return new DynamoDBDatastoreClient(localConfig, options?.tracer);\n }\n // case \"gcloud\":\n // case \"gcloud-serverless\":\n // v1: Firestore emulator\n // case \"azure\":\n // case \"azure-serverless\":\n // v1: Cosmos DB emulator\n default:\n throw new Error(\n `Unsupported local datastore deploy target: \"${deployTarget}\". Only AWS is supported in v0.`,\n );\n }\n}\n","import \"reflect-metadata\";\nimport { INJECT_METADATA, USE_RESOURCE_METADATA } from \"@celerity-sdk/common\";\nimport type { Datastore as DatastoreType } from \"./types\";\n\n// Re-declare as interface so the type merges with the decorator function below.\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface Datastore extends DatastoreType {}\n\nexport function datastoreToken(resourceName: string): symbol {\n return Symbol.for(`celerity:datastore:${resourceName}`);\n}\n\nexport const DEFAULT_DATASTORE_TOKEN = Symbol.for(\"celerity:datastore:default\");\n\n/**\n * Parameter decorator that injects a {@link Datastore} instance for the given\n * blueprint resource. Writes both DI injection metadata and CLI resource-ref\n * metadata using well-known `Symbol.for()` keys (no dependency on core).\n *\n * When `resourceName` is omitted, the default datastore token is used — this\n * auto-resolves when exactly one datastore resource exists.\n *\n * @example\n * ```ts\n * @Controller(\"/users\")\n * class UserController {\n * constructor(@Datastore(\"usersTable\") private users: Datastore) {}\n * }\n * ```\n */\nexport function Datastore(resourceName?: string): ParameterDecorator {\n return (target, _propertyKey, parameterIndex) => {\n const token = resourceName ? datastoreToken(resourceName) : DEFAULT_DATASTORE_TOKEN;\n const existing: Map<number, unknown> =\n Reflect.getOwnMetadata(INJECT_METADATA, target) ?? new Map();\n existing.set(parameterIndex, token);\n Reflect.defineMetadata(INJECT_METADATA, existing, target);\n\n if (resourceName) {\n const resources: string[] = Reflect.getOwnMetadata(USE_RESOURCE_METADATA, target) ?? [];\n if (!resources.includes(resourceName)) {\n Reflect.defineMetadata(USE_RESOURCE_METADATA, [...resources, resourceName], target);\n }\n }\n };\n}\n","import type { ServiceContainer } from \"@celerity-sdk/types\";\nimport type { Datastore } from \"./types\";\nimport { datastoreToken, DEFAULT_DATASTORE_TOKEN } from \"./decorators\";\n\n/**\n * Resolves a {@link Datastore} instance from the DI container.\n * For function-based handlers where parameter decorators aren't available.\n *\n * @param container - The service container (typically `context.container`).\n * @param resourceName - The blueprint resource name. Omit when exactly one\n * datastore resource exists to use the default.\n *\n * @example\n * ```ts\n * const handler = createHttpHandler(async (req, ctx) => {\n * const users = await getDatastore(ctx.container, \"usersTable\");\n * const user = await users.getItem({ pk: req.pathParameters.userId });\n * });\n * ```\n */\nexport function getDatastore(\n container: ServiceContainer,\n resourceName?: string,\n): Promise<Datastore> {\n const token = resourceName ? datastoreToken(resourceName) : DEFAULT_DATASTORE_TOKEN;\n return container.resolve<Datastore>(token);\n}\n","import createDebug from \"debug\";\nimport type { CelerityLayer, BaseHandlerContext, CelerityTracer } from \"@celerity-sdk/types\";\nimport { TRACER_TOKEN, CONFIG_SERVICE_TOKEN } from \"@celerity-sdk/common\";\nimport {\n type ConfigService,\n captureResourceLinks,\n getLinksOfType,\n RESOURCE_CONFIG_NAMESPACE,\n} from \"@celerity-sdk/config\";\nimport { createDatastoreClient } from \"./factory\";\nimport { datastoreToken, DEFAULT_DATASTORE_TOKEN } from \"./decorators\";\n\nconst debug = createDebug(\"celerity:datastore\");\n\n/**\n * System layer that auto-registers {@link DatastoreClient} and per-resource\n * {@link Datastore} handles in the DI container.\n *\n * Reads resource link topology from `CELERITY_RESOURCE_LINKS` and resolves\n * actual table/collection names from the ConfigService \"resources\" namespace.\n * Must run after ConfigLayer in the layer pipeline.\n */\ntype DatastoreLayerConfig = {\n deployTarget: string | undefined;\n};\n\nfunction captureDatastoreLayerConfig(): DatastoreLayerConfig {\n return {\n deployTarget: process.env.CELERITY_DEPLOY_TARGET,\n };\n}\n\nexport class DatastoreLayer implements CelerityLayer<BaseHandlerContext> {\n private initialized = false;\n private config: DatastoreLayerConfig | null = null;\n\n async handle(context: BaseHandlerContext, next: () => Promise<unknown>): Promise<unknown> {\n if (!this.initialized) {\n this.config = captureDatastoreLayerConfig();\n\n const tracer = context.container.has(TRACER_TOKEN)\n ? await context.container.resolve<CelerityTracer>(TRACER_TOKEN)\n : undefined;\n\n const client = await createDatastoreClient({\n tracer,\n deployTarget: this.config.deployTarget,\n });\n debug(\"registering DatastoreClient\");\n context.container.register(\"DatastoreClient\", { useValue: client });\n\n const links = captureResourceLinks();\n const datastoreLinks = getLinksOfType(links, \"datastore\");\n\n if (datastoreLinks.size > 0) {\n const configService = await context.container.resolve<ConfigService>(CONFIG_SERVICE_TOKEN);\n const resourceConfig = configService.namespace(RESOURCE_CONFIG_NAMESPACE);\n\n for (const [resourceName, configKey] of datastoreLinks) {\n const actualName = await resourceConfig.getOrThrow(configKey);\n debug(\"registered datastore resource %s → %s\", resourceName, actualName);\n context.container.register(datastoreToken(resourceName), {\n useValue: client.datastore(actualName),\n });\n }\n\n if (datastoreLinks.size === 1) {\n const [, configKey] = [...datastoreLinks.entries()][0];\n const actualName = await resourceConfig.getOrThrow(configKey);\n debug(\"registered default datastore → %s\", actualName);\n context.container.register(DEFAULT_DATASTORE_TOKEN, {\n useValue: client.datastore(actualName),\n });\n }\n }\n\n this.initialized = true;\n }\n\n return next();\n }\n}\n"],"mappings":";;;;;;;;;AAEO,IAAMA,kBAAkBC,uBAAOC,IAAI,iBAAA;;;ACF1C,SAASC,qBAAqB;AAgB9B,eAAsBC,sBACpBC,SAAsC;AAEtC,QAAMC,WAAWC,cAAc,WAAA;AAC/B,QAAMC,WAAWH,SAASG,YAAYF,SAASE;AAE/C,UAAQA,UAAAA;IACN,KAAK,OAAO;AACV,YAAM,EAAEC,wBAAuB,IAC7B,MAAM,OAAO,yCAAA;AACf,aAAO,IAAIA,wBAAwBJ,SAASK,KAAKL,SAASM,MAAAA;IAC5D;IACA,KAAK;AACH,aAAOC,kBAA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AAeE,SAAS,GAAG;AAC7B,gBAAM,CAAA,EAAGO,SAAAA,IAAa;eAAIT,eAAec,QAAO;YAAI,CAAA;AACpD,gBAAMJ,aAAa,MAAML,eAAeM,WAAWF,SAAAA;AACnDlC,gBAAM,0CAAqCmC,UAAAA;AAC3CxB,kBAAQG,UAAUO,SAASmB,yBAAyB;YAClDlB,UAAUH,OAAOmB,UAAUH,UAAAA;UAC7B,CAAA;QACF;MACF;AAEA,WAAK3B,cAAc;IACrB;AAEA,WAAOI,KAAAA;EACT;AACF;","names":["DatastoreClient","Symbol","for","resolveConfig","createDatastoreClient","options","resolved","resolveConfig","provider","DynamoDBDatastoreClient","aws","tracer","createLocalClient","Error","deployTarget","toLowerCase","undefined","captureDynamoDBConfig","localConfig","INJECT_METADATA","USE_RESOURCE_METADATA","datastoreToken","resourceName","Symbol","for","DEFAULT_DATASTORE_TOKEN","Datastore","target","_propertyKey","parameterIndex","token","existing","Reflect","getOwnMetadata","INJECT_METADATA","Map","set","defineMetadata","resources","USE_RESOURCE_METADATA","includes","getDatastore","container","resourceName","token","datastoreToken","DEFAULT_DATASTORE_TOKEN","resolve","createDebug","TRACER_TOKEN","CONFIG_SERVICE_TOKEN","captureResourceLinks","getLinksOfType","RESOURCE_CONFIG_NAMESPACE","debug","createDebug","captureDatastoreLayerConfig","deployTarget","process","env","CELERITY_DEPLOY_TARGET","DatastoreLayer","initialized","config","handle","context","next","tracer","container","has","TRACER_TOKEN","resolve","undefined","client","createDatastoreClient","register","useValue","links","captureResourceLinks","datastoreLinks","getLinksOfType","size","configService","CONFIG_SERVICE_TOKEN","resourceConfig","namespace","RESOURCE_CONFIG_NAMESPACE","resourceName","configKey","actualName","getOrThrow","datastoreToken","datastore","entries","DEFAULT_DATASTORE_TOKEN"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celerity-sdk/datastore",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "NoSQL data store abstraction for the Celerity Node SDK (DynamoDB / Cloud
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "NoSQL data store abstraction for the Celerity Node SDK (DynamoDB / Cloud Firestore / Cosmos DB)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -31,14 +31,22 @@
|
|
|
31
31
|
"node": ">=22.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"@celerity-sdk/
|
|
34
|
+
"debug": "^4.4.0",
|
|
35
|
+
"@celerity-sdk/types": "^0.5.0",
|
|
36
|
+
"@celerity-sdk/common": "^0.5.0",
|
|
37
|
+
"@celerity-sdk/config": "^0.5.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@aws-sdk/client-dynamodb": "^3.750.0",
|
|
41
|
+
"@aws-sdk/lib-dynamodb": "^3.750.0",
|
|
42
|
+
"reflect-metadata": "^0.2.0"
|
|
36
43
|
},
|
|
37
44
|
"peerDependencies": {
|
|
38
45
|
"@aws-sdk/client-dynamodb": "^3.0.0",
|
|
39
46
|
"@aws-sdk/lib-dynamodb": "^3.0.0",
|
|
40
|
-
"@google-cloud/
|
|
41
|
-
"@azure/cosmos": "^4.0.0"
|
|
47
|
+
"@google-cloud/firestore": "^7.0.0",
|
|
48
|
+
"@azure/cosmos": "^4.0.0",
|
|
49
|
+
"reflect-metadata": "^0.2.0"
|
|
42
50
|
},
|
|
43
51
|
"peerDependenciesMeta": {
|
|
44
52
|
"@aws-sdk/client-dynamodb": {
|
|
@@ -47,11 +55,14 @@
|
|
|
47
55
|
"@aws-sdk/lib-dynamodb": {
|
|
48
56
|
"optional": true
|
|
49
57
|
},
|
|
50
|
-
"@google-cloud/
|
|
58
|
+
"@google-cloud/firestore": {
|
|
51
59
|
"optional": true
|
|
52
60
|
},
|
|
53
61
|
"@azure/cosmos": {
|
|
54
62
|
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"reflect-metadata": {
|
|
65
|
+
"optional": true
|
|
55
66
|
}
|
|
56
67
|
},
|
|
57
68
|
"publishConfig": {
|
package/dist/index.d.cts
DELETED