@usesocial/cli 0.19.0 → 0.19.2
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/CHANGELOG.md +13 -0
- package/README.md +3 -0
- package/dist/index.mjs +46 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @usesocial/cli
|
|
2
2
|
|
|
3
|
+
## 0.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#118](https://github.com/usesocial/monorepo/pull/118) [`e6fbb0e`](https://github.com/usesocial/monorepo/commit/e6fbb0e5f3c9d94231a2835de0b39b2880cd4197) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Return X profile, tweet, and list resources directly under `.data`, and preserve partial provider
|
|
8
|
+
errors and expansions in response metadata.
|
|
9
|
+
|
|
10
|
+
## 0.19.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#116](https://github.com/usesocial/monorepo/pull/116) [`b24c2e4`](https://github.com/usesocial/monorepo/commit/b24c2e4e0199d9dbbb532702145d889f7773182a) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Report provider-specific comped LinkedIn and X seat capacity in billing status and skip checkout while that capacity remains.
|
|
15
|
+
|
|
3
16
|
## 0.19.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -235,6 +235,9 @@ profile lookup is needed.
|
|
|
235
235
|
`.data`, metadata lives under `.meta`. Sync commands use `{ data, meta }`.
|
|
236
236
|
`social account` service commands return bare JSON; `account logs` returns
|
|
237
237
|
`{ items, meta: { cursor } }`.
|
|
238
|
+
- X single-resource reads keep partial expansion failures under `.meta.errors`
|
|
239
|
+
and returned expansion objects under `.meta.includes`, so the primary
|
|
240
|
+
resource remains directly usable at `.data`.
|
|
238
241
|
- Schema-backed planning: `social schema --list` is the compact runnable index.
|
|
239
242
|
- Local SQL is the free surface for your own synced data.
|
|
240
243
|
|
package/dist/index.mjs
CHANGED
|
@@ -11425,7 +11425,8 @@ pgTable("webhook_operations", {
|
|
|
11425
11425
|
pgTable("billing_overrides", {
|
|
11426
11426
|
email: text$1("email").primaryKey(),
|
|
11427
11427
|
userId: text$1("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
11428
|
-
|
|
11428
|
+
seatAllowanceLinkedin: integer("seat_allowance_linkedin").notNull().default(2),
|
|
11429
|
+
seatAllowanceX: integer("seat_allowance_x").notNull().default(2),
|
|
11429
11430
|
monthlyUsageCredits: integer("monthly_usage_credits").notNull().default(6e4),
|
|
11430
11431
|
reason: text$1("reason").notNull(),
|
|
11431
11432
|
expiresAt: timestamptz("expires_at"),
|
|
@@ -11435,7 +11436,8 @@ pgTable("billing_overrides", {
|
|
|
11435
11436
|
uniqueIndex("billing_overrides_user_id_key").on(table.userId).where(sql`${table.userId} is not null`),
|
|
11436
11437
|
check("billing_overrides_email_lower_check", sql`lower(${table.email}) = ${table.email}`),
|
|
11437
11438
|
check("billing_overrides_email_nonempty_check", sql`length(${table.email}) > 0`),
|
|
11438
|
-
check("
|
|
11439
|
+
check("billing_overrides_seat_allowance_linkedin_check", sql`${table.seatAllowanceLinkedin} >= 0`),
|
|
11440
|
+
check("billing_overrides_seat_allowance_x_check", sql`${table.seatAllowanceX} >= 0`),
|
|
11439
11441
|
check("billing_overrides_monthly_usage_credits_check", sql`${table.monthlyUsageCredits} >= 0`)
|
|
11440
11442
|
]);
|
|
11441
11443
|
pgTable("proxy_call_logs", {
|
|
@@ -19697,15 +19699,23 @@ const hazardFor = (method) => {
|
|
|
19697
19699
|
confirm: "advisory"
|
|
19698
19700
|
};
|
|
19699
19701
|
};
|
|
19700
|
-
const responseShapingFor = (
|
|
19701
|
-
const names =
|
|
19702
|
+
const responseShapingFor = (op) => {
|
|
19703
|
+
const names = op.parameters.map((p) => p.name);
|
|
19702
19704
|
const fields = names.filter((n) => n.endsWith(".fields"));
|
|
19703
19705
|
const expansions = names.includes("expansions");
|
|
19704
|
-
|
|
19706
|
+
const singleResource = op.endpoint.method === "GET" && op.endpoint.pagination.style === "none";
|
|
19707
|
+
if (fields.length === 0 && !expansions && !singleResource) return { supported: false };
|
|
19705
19708
|
return {
|
|
19706
19709
|
supported: true,
|
|
19707
19710
|
fields,
|
|
19708
|
-
expansions
|
|
19711
|
+
expansions,
|
|
19712
|
+
...singleResource ? {
|
|
19713
|
+
resourcePath: "data",
|
|
19714
|
+
metadataPaths: {
|
|
19715
|
+
errors: "errors",
|
|
19716
|
+
includes: "includes"
|
|
19717
|
+
}
|
|
19718
|
+
} : {}
|
|
19709
19719
|
};
|
|
19710
19720
|
};
|
|
19711
19721
|
const hazardsFor = (op) => {
|
|
@@ -19869,7 +19879,7 @@ const xRuntimeAdapter = {
|
|
|
19869
19879
|
}),
|
|
19870
19880
|
idempotencyFor: (op) => idempotencyFor(op.endpoint.method),
|
|
19871
19881
|
hazardFor: (op) => hazardFor(op.endpoint.method),
|
|
19872
|
-
responseShapingFor
|
|
19882
|
+
responseShapingFor,
|
|
19873
19883
|
hazardsFor,
|
|
19874
19884
|
exampleCommandFor: (op, context) => exampleCommandFor(op, context.commandName, context.group ?? ""),
|
|
19875
19885
|
resolveOwnAccount: (deps, args) => deps.resolveOwnXAccount(args),
|
|
@@ -21789,7 +21799,14 @@ const listReadContract = (inputSchema, pagination) => manualSchemaContract({
|
|
|
21789
21799
|
responseShaping: {
|
|
21790
21800
|
supported: true,
|
|
21791
21801
|
fields: ["list.fields", "user.fields"],
|
|
21792
|
-
expansions: true
|
|
21802
|
+
expansions: true,
|
|
21803
|
+
...pagination.style === "none" ? {
|
|
21804
|
+
resourcePath: "data",
|
|
21805
|
+
metadataPaths: {
|
|
21806
|
+
errors: "errors",
|
|
21807
|
+
includes: "includes"
|
|
21808
|
+
}
|
|
21809
|
+
} : {}
|
|
21793
21810
|
},
|
|
21794
21811
|
itemUrlTemplate: "https://x.com/i/lists/{id}",
|
|
21795
21812
|
examples: [],
|
|
@@ -24470,7 +24487,7 @@ function createEnv(opts) {
|
|
|
24470
24487
|
}
|
|
24471
24488
|
//#endregion
|
|
24472
24489
|
//#region package.json
|
|
24473
|
-
var version$1 = "0.19.
|
|
24490
|
+
var version$1 = "0.19.2";
|
|
24474
24491
|
//#endregion
|
|
24475
24492
|
//#region src/lib/env.ts
|
|
24476
24493
|
const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
|
|
@@ -25039,6 +25056,20 @@ const shapedRecord = (value, itemURLTemplate, idField) => {
|
|
|
25039
25056
|
};
|
|
25040
25057
|
const itemURLTemplateFrom = (contract) => isRecord$7(contract) && typeof contract.itemUrlTemplate === "string" ? contract.itemUrlTemplate : void 0;
|
|
25041
25058
|
const idFieldFrom = (contract) => isRecord$7(contract) && typeof contract.idField === "string" && contract.idField.length > 0 ? contract.idField : void 0;
|
|
25059
|
+
const responseShapingFrom = (contract) => isRecord$7(contract) && isRecord$7(contract.responseShaping) ? contract.responseShaping : void 0;
|
|
25060
|
+
const resourcePathFrom = (contract) => {
|
|
25061
|
+
const resourcePath = responseShapingFrom(contract)?.resourcePath;
|
|
25062
|
+
return typeof resourcePath === "string" && resourcePath.length > 0 ? resourcePath : void 0;
|
|
25063
|
+
};
|
|
25064
|
+
const providerMetadataFrom = (contract, data) => {
|
|
25065
|
+
const metadataPaths = responseShapingFrom(contract)?.metadataPaths;
|
|
25066
|
+
if (!isRecord$7(metadataPaths)) return {};
|
|
25067
|
+
return Object.fromEntries(Object.entries(metadataPaths).flatMap(([name, path]) => {
|
|
25068
|
+
if (typeof path !== "string") return [];
|
|
25069
|
+
const value = valueAtPath(data, path);
|
|
25070
|
+
return value === void 0 ? [] : [[name, value]];
|
|
25071
|
+
}));
|
|
25072
|
+
};
|
|
25042
25073
|
const usersByIdFromIncludes = (data) => {
|
|
25043
25074
|
if (!(isRecord$7(data) && isRecord$7(data.includes) && Array.isArray(data.includes.users))) return /* @__PURE__ */ new Map();
|
|
25044
25075
|
return new Map(data.includes.users.flatMap((user) => {
|
|
@@ -25055,11 +25086,13 @@ const withAuthorFromIncludes = (value, usersById) => {
|
|
|
25055
25086
|
};
|
|
25056
25087
|
};
|
|
25057
25088
|
const shapedItem = (value, itemURLTemplate, idField, usersById) => withAuthorFromIncludes(shapedRecord(value, itemURLTemplate, idField), usersById);
|
|
25058
|
-
const outputPayloadFor = (data, itemURLTemplate, idField) => {
|
|
25089
|
+
const outputPayloadFor = (data, itemURLTemplate, idField, resourcePath) => {
|
|
25059
25090
|
const usersById = usersByIdFromIncludes(data);
|
|
25060
25091
|
if (Array.isArray(data)) return { items: data.map((item) => shapedItem(item, itemURLTemplate, idField, usersById)) };
|
|
25061
25092
|
if (isRecord$7(data) && Array.isArray(data.items)) return { items: data.items.map((item) => shapedItem(item, itemURLTemplate, idField, usersById)) };
|
|
25062
25093
|
if (isRecord$7(data) && Array.isArray(data.data)) return { items: data.data.map((item) => shapedItem(item, itemURLTemplate, idField, usersById)) };
|
|
25094
|
+
const resource = valueAtPath(data, resourcePath);
|
|
25095
|
+
if (resourcePath !== void 0 && resource !== void 0) return { data: shapedRecord(resource, itemURLTemplate, idField) };
|
|
25063
25096
|
return { data: shapedRecord(data, itemURLTemplate, idField) };
|
|
25064
25097
|
};
|
|
25065
25098
|
const numberFromHeader = (headers, name) => {
|
|
@@ -25137,7 +25170,8 @@ const totalCountFrom = (contract, data) => {
|
|
|
25137
25170
|
const resultEnvelope = ({ account, contract, data, local, now = Date.now, resolved = [], responseHeaders, usage }) => {
|
|
25138
25171
|
const itemURLTemplate = itemURLTemplateFrom(contract);
|
|
25139
25172
|
const idField = idFieldFrom(contract);
|
|
25140
|
-
const payload = outputPayloadFor(data, itemURLTemplate, idField);
|
|
25173
|
+
const payload = outputPayloadFor(data, itemURLTemplate, idField, resourcePathFrom(contract));
|
|
25174
|
+
const providerMetadata = providerMetadataFrom(contract, data);
|
|
25141
25175
|
const cache = local === void 0 ? cacheFromHeaders(responseHeaders) : cacheFromLocal(local, now);
|
|
25142
25176
|
const itemCount = "items" in payload && Array.isArray(payload.items) ? payload.items.length : 1;
|
|
25143
25177
|
const cursor = nextCursorFrom(contract, data);
|
|
@@ -25156,6 +25190,7 @@ const resultEnvelope = ({ account, contract, data, local, now = Date.now, resolv
|
|
|
25156
25190
|
cache,
|
|
25157
25191
|
...cursor === void 0 ? {} : { cursor },
|
|
25158
25192
|
...totalCount === void 0 ? {} : { totalCount },
|
|
25193
|
+
...providerMetadata,
|
|
25159
25194
|
...usage === void 0 ? {} : { usage: usageSummaryForOutput(usage) }
|
|
25160
25195
|
}
|
|
25161
25196
|
};
|